正在显示
25 个修改的文件
包含
2026 行增加
和
21 行删除
| 1 | package org.jeecg.modules.erp.depot.controller; | 1 | package org.jeecg.modules.erp.depot.controller; |
| 2 | 2 | ||
| 3 | -import cn.hutool.core.date.DateUtil; | ||
| 4 | -import cn.hutool.json.JSONUtil; | 3 | +import cn.hutool.core.bean.BeanUtil; |
| 5 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 6 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 5 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 7 | import com.baomidou.mybatisplus.core.metadata.IPage; | 6 | import com.baomidou.mybatisplus.core.metadata.IPage; |
| @@ -15,9 +14,10 @@ import org.jeecg.common.aspect.annotation.PermissionData; | @@ -15,9 +14,10 @@ import org.jeecg.common.aspect.annotation.PermissionData; | ||
| 15 | import org.jeecg.common.system.base.controller.JeecgController; | 14 | import org.jeecg.common.system.base.controller.JeecgController; |
| 16 | import org.jeecg.common.system.query.QueryGenerator; | 15 | import org.jeecg.common.system.query.QueryGenerator; |
| 17 | import org.jeecg.modules.erp.depot.entity.TblDepot; | 16 | import org.jeecg.modules.erp.depot.entity.TblDepot; |
| 18 | -import org.jeecg.modules.erp.depot.mapper.TblDepotMapper; | 17 | +import org.jeecg.modules.erp.depot.form.TblDepotForm; |
| 19 | import org.jeecg.modules.erp.depot.mapper.TblDepotTestMapper; | 18 | import org.jeecg.modules.erp.depot.mapper.TblDepotTestMapper; |
| 20 | import org.jeecg.modules.erp.depot.service.ITblDepotService; | 19 | import org.jeecg.modules.erp.depot.service.ITblDepotService; |
| 20 | +import org.jeecg.modules.erp.robot.service.impl.YjRobotService; | ||
| 21 | import org.jeecg.modules.erp.meterial.entity.TblMaterial; | 21 | import org.jeecg.modules.erp.meterial.entity.TblMaterial; |
| 22 | import org.jeecg.modules.erp.meterial.service.ITblMaterialService; | 22 | import org.jeecg.modules.erp.meterial.service.ITblMaterialService; |
| 23 | import org.springframework.beans.factory.annotation.Autowired; | 23 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -26,12 +26,9 @@ import org.springframework.web.servlet.ModelAndView; | @@ -26,12 +26,9 @@ import org.springframework.web.servlet.ModelAndView; | ||
| 26 | 26 | ||
| 27 | import javax.servlet.http.HttpServletRequest; | 27 | import javax.servlet.http.HttpServletRequest; |
| 28 | import javax.servlet.http.HttpServletResponse; | 28 | import javax.servlet.http.HttpServletResponse; |
| 29 | -import java.util.Arrays; | ||
| 30 | -import java.util.HashMap; | ||
| 31 | -import java.util.List; | ||
| 32 | -import java.util.Map; | 29 | +import java.util.*; |
| 33 | 30 | ||
| 34 | - /** | 31 | +/** |
| 35 | * @Description: tbl_depot | 32 | * @Description: tbl_depot |
| 36 | * @Author: jeecg-boot | 33 | * @Author: jeecg-boot |
| 37 | * @Date: 2022-07-06 | 34 | * @Date: 2022-07-06 |
| @@ -48,6 +45,9 @@ public class TblDepotController extends JeecgController<TblDepot, ITblDepotServi | @@ -48,6 +45,9 @@ public class TblDepotController extends JeecgController<TblDepot, ITblDepotServi | ||
| 48 | private ITblMaterialService tblMaterialService; | 45 | private ITblMaterialService tblMaterialService; |
| 49 | 46 | ||
| 50 | @Autowired | 47 | @Autowired |
| 48 | + private YjRobotService yjRobotService; | ||
| 49 | + | ||
| 50 | + @Autowired | ||
| 51 | TblDepotTestMapper tblDepotMapper; | 51 | TblDepotTestMapper tblDepotMapper; |
| 52 | 52 | ||
| 53 | @GetMapping("/updateData") | 53 | @GetMapping("/updateData") |
| @@ -77,15 +77,15 @@ public class TblDepotController extends JeecgController<TblDepot, ITblDepotServi | @@ -77,15 +77,15 @@ public class TblDepotController extends JeecgController<TblDepot, ITblDepotServi | ||
| 77 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | 77 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| 78 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | 78 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| 79 | HttpServletRequest req) { | 79 | HttpServletRequest req) { |
| 80 | - Map<String,String[]> map = new HashMap<>(req.getParameterMap()); | ||
| 81 | - System.out.println(JSONUtil.toJsonStr(map)); | 80 | +// Map<String,String[]> map = new HashMap<>(req.getParameterMap()); |
| 81 | +// System.out.println(JSONUtil.toJsonStr(map)); | ||
| 82 | // if (!(map.containsKey("operTime_begin") || map.containsKey("operTime_end"))){ | 82 | // if (!(map.containsKey("operTime_begin") || map.containsKey("operTime_end"))){ |
| 83 | // String[] time_begin = new String[]{DateUtil.formatDate(DateUtil.beginOfMonth(DateUtil.date()))}; | 83 | // String[] time_begin = new String[]{DateUtil.formatDate(DateUtil.beginOfMonth(DateUtil.date()))}; |
| 84 | // map.put("operTime_begin",time_begin); | 84 | // map.put("operTime_begin",time_begin); |
| 85 | // map.put("operTime_end",new String[]{DateUtil.now()}); | 85 | // map.put("operTime_end",new String[]{DateUtil.now()}); |
| 86 | // } | 86 | // } |
| 87 | // System.out.println(JSONUtil.toJsonStr(map)); | 87 | // System.out.println(JSONUtil.toJsonStr(map)); |
| 88 | - QueryWrapper<TblDepot> queryWrapper = QueryGenerator.initQueryWrapper(tblDepot, map); | 88 | + QueryWrapper<TblDepot> queryWrapper = QueryGenerator.initQueryWrapper(tblDepot, req.getParameterMap()); |
| 89 | Page<TblDepot> page = new Page<TblDepot>(pageNo, pageSize); | 89 | Page<TblDepot> page = new Page<TblDepot>(pageNo, pageSize); |
| 90 | IPage<TblDepot> pageList = tblDepotService.page(page, queryWrapper); | 90 | IPage<TblDepot> pageList = tblDepotService.page(page, queryWrapper); |
| 91 | return Result.OK(pageList); | 91 | return Result.OK(pageList); |
| @@ -108,13 +108,13 @@ public class TblDepotController extends JeecgController<TblDepot, ITblDepotServi | @@ -108,13 +108,13 @@ public class TblDepotController extends JeecgController<TblDepot, ITblDepotServi | ||
| 108 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | 108 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| 109 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | 109 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| 110 | HttpServletRequest req) { | 110 | HttpServletRequest req) { |
| 111 | - Map<String,String[]> map = new HashMap<>(req.getParameterMap()); | 111 | +// Map<String,String[]> map = new HashMap<>(req.getParameterMap()); |
| 112 | // if (!(map.containsKey("operTime_begin") || map.containsKey("operTime_end"))){ | 112 | // if (!(map.containsKey("operTime_begin") || map.containsKey("operTime_end"))){ |
| 113 | // String[] time_begin = new String[]{DateUtil.formatDate(DateUtil.beginOfMonth(DateUtil.date()))}; | 113 | // String[] time_begin = new String[]{DateUtil.formatDate(DateUtil.beginOfMonth(DateUtil.date()))}; |
| 114 | // map.put("operTime_begin",time_begin); | 114 | // map.put("operTime_begin",time_begin); |
| 115 | // map.put("operTime_end",new String[]{DateUtil.now()}); | 115 | // map.put("operTime_end",new String[]{DateUtil.now()}); |
| 116 | // } | 116 | // } |
| 117 | - QueryWrapper<TblDepot> queryWrapper = QueryGenerator.initQueryWrapper(tblDepot, map); | 117 | + QueryWrapper<TblDepot> queryWrapper = QueryGenerator.initQueryWrapper(tblDepot, req.getParameterMap()); |
| 118 | Page<TblDepot> page = new Page<TblDepot>(pageNo, pageSize); | 118 | Page<TblDepot> page = new Page<TblDepot>(pageNo, pageSize); |
| 119 | IPage<TblDepot> pageList = tblDepotService.page(page, queryWrapper); | 119 | IPage<TblDepot> pageList = tblDepotService.page(page, queryWrapper); |
| 120 | return Result.OK(pageList); | 120 | return Result.OK(pageList); |
| @@ -146,15 +146,16 @@ public class TblDepotController extends JeecgController<TblDepot, ITblDepotServi | @@ -146,15 +146,16 @@ public class TblDepotController extends JeecgController<TblDepot, ITblDepotServi | ||
| 146 | /** | 146 | /** |
| 147 | * 添加 | 147 | * 添加 |
| 148 | * | 148 | * |
| 149 | - * @param tblDepot | 149 | + * @param tblDepotForm |
| 150 | * @return | 150 | * @return |
| 151 | */ | 151 | */ |
| 152 | @AutoLog(value = "tbl_depot-添加") | 152 | @AutoLog(value = "tbl_depot-添加") |
| 153 | @ApiOperation(value="tbl_depot-添加", notes="tbl_depot-添加") | 153 | @ApiOperation(value="tbl_depot-添加", notes="tbl_depot-添加") |
| 154 | @PostMapping(value = "/add") | 154 | @PostMapping(value = "/add") |
| 155 | - public Result<String> add(@RequestBody TblDepot tblDepot) { | ||
| 156 | - | ||
| 157 | - TblDepot tblDepot1 = tblDepotService.selectByPartNumber(tblDepot.getPartNumber()); | 155 | + public Result<String> add(@RequestBody TblDepotForm tblDepotForm) { |
| 156 | + TblDepot tblDepot = new TblDepot(); | ||
| 157 | + BeanUtil.copyProperties(tblDepotForm, tblDepot); | ||
| 158 | + TblDepot tblDepot1 = tblDepotService.selectByPartNumber(tblDepotForm.getPartNumber()); | ||
| 158 | if(tblDepot.getDepotType().equals("入库")){ | 159 | if(tblDepot.getDepotType().equals("入库")){ |
| 159 | tblDepot.setCurrentInventory((tblDepot1 != null && tblDepot1.getCurrentInventory() != null) ? tblDepot1.getCurrentInventory() + tblDepot.getOperNumber() : tblDepot.getOperNumber()); | 160 | tblDepot.setCurrentInventory((tblDepot1 != null && tblDepot1.getCurrentInventory() != null) ? tblDepot1.getCurrentInventory() + tblDepot.getOperNumber() : tblDepot.getOperNumber()); |
| 160 | tblDepotService.save(tblDepot); | 161 | tblDepotService.save(tblDepot); |
| @@ -180,11 +181,21 @@ public class TblDepotController extends JeecgController<TblDepot, ITblDepotServi | @@ -180,11 +181,21 @@ public class TblDepotController extends JeecgController<TblDepot, ITblDepotServi | ||
| 180 | tblDepotService.save(tblDepot); | 181 | tblDepotService.save(tblDepot); |
| 181 | } | 182 | } |
| 182 | } | 183 | } |
| 184 | +// int code = 0; | ||
| 185 | +// if(tblDepot.getDepotType().equals("入库") || (tblDepot.getDepotType().equals("出库") && "1".equals(tblDepotForm.getIsCallRobot()))) { | ||
| 186 | +// Map<String, Object> returnMap = yjRobotService.movetoTarget(tblDepotForm.getTemplateId(), tblDepotForm.getRobotName(), tblDepotForm.getPointId()); | ||
| 187 | +// code = Integer.parseInt(returnMap.get("code").toString()); | ||
| 188 | +// } | ||
| 189 | +// if(code ==0){ | ||
| 190 | +// return Result.OK("添加成功!召唤机器人送物成功"); | ||
| 191 | +// } | ||
| 183 | 192 | ||
| 184 | - | ||
| 185 | - return Result.OK("添加成功!"); | 193 | +// return Result.OK("添加成功!召唤机器人送物失败,再次召唤机器人"); |
| 194 | + return Result.OK("操作成功"); | ||
| 186 | } | 195 | } |
| 187 | 196 | ||
| 197 | + | ||
| 198 | + | ||
| 188 | /** | 199 | /** |
| 189 | * 获取数据 | 200 | * 获取数据 |
| 190 | * @return | 201 | * @return |
| @@ -206,6 +217,21 @@ public class TblDepotController extends JeecgController<TblDepot, ITblDepotServi | @@ -206,6 +217,21 @@ public class TblDepotController extends JeecgController<TblDepot, ITblDepotServi | ||
| 206 | @AutoLog(value = "tbl_depot-编辑") | 217 | @AutoLog(value = "tbl_depot-编辑") |
| 207 | @ApiOperation(value="tbl_depot-编辑", notes="tbl_depot-编辑") | 218 | @ApiOperation(value="tbl_depot-编辑", notes="tbl_depot-编辑") |
| 208 | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | 219 | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
| 220 | +// public Result<String> edit(@RequestBody TblDepotForm tblDepotForm) { | ||
| 221 | +// TblDepot tblDepot = new TblDepot(); | ||
| 222 | +// BeanUtil.copyProperties(tblDepotForm, tblDepot); | ||
| 223 | +// tblDepotService.updateById(tblDepot); | ||
| 224 | +// int code = 0; | ||
| 225 | +// if(tblDepot.getDepotType().equals("出库") && "1".equals(tblDepotForm.getIsCallRobot())) { | ||
| 226 | +// Map<String, Object> returnMap = yjRobotService.movetoTarget(tblDepotForm.getTemplateId(), tblDepotForm.getRobotName(), tblDepotForm.getPointId()); | ||
| 227 | +// code = Integer.parseInt(returnMap.get("code").toString()); | ||
| 228 | +// } | ||
| 229 | +// if(code ==0){ | ||
| 230 | +// return Result.OK("编辑成功!召唤机器人送物成功"); | ||
| 231 | +// } | ||
| 232 | +// return Result.OK("编辑成功!召唤机器人送物失败,再次召唤机器人"); | ||
| 233 | +// } | ||
| 234 | + | ||
| 209 | public Result<String> edit(@RequestBody TblDepot tblDepot) { | 235 | public Result<String> edit(@RequestBody TblDepot tblDepot) { |
| 210 | tblDepotService.updateById(tblDepot); | 236 | tblDepotService.updateById(tblDepot); |
| 211 | return Result.OK("编辑成功!"); | 237 | return Result.OK("编辑成功!"); |
| 1 | +package org.jeecg.modules.erp.depot.form; | ||
| 2 | + | ||
| 3 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
| 4 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 6 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 7 | +import io.swagger.annotations.ApiModel; | ||
| 8 | +import io.swagger.annotations.ApiModelProperty; | ||
| 9 | +import lombok.Data; | ||
| 10 | +import lombok.EqualsAndHashCode; | ||
| 11 | +import lombok.experimental.Accessors; | ||
| 12 | +import org.jeecg.common.aspect.annotation.Dict; | ||
| 13 | +import org.jeecgframework.poi.excel.annotation.Excel; | ||
| 14 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 15 | + | ||
| 16 | +import java.io.Serializable; | ||
| 17 | +import java.util.Date; | ||
| 18 | + | ||
| 19 | +/** | ||
| 20 | + * @Description: tbl_depot | ||
| 21 | + * @Author: jeecg-boot | ||
| 22 | + * @Date: 2022-07-06 | ||
| 23 | + * @Version: V1.0 | ||
| 24 | + */ | ||
| 25 | +@Data | ||
| 26 | +@Accessors(chain = true) | ||
| 27 | +@EqualsAndHashCode(callSuper = false) | ||
| 28 | +@ApiModel(value="tbl_depot对象", description="tbl_depot") | ||
| 29 | +public class TblDepotForm implements Serializable { | ||
| 30 | + private static final long serialVersionUID = 1L; | ||
| 31 | + | ||
| 32 | + /**id*/ | ||
| 33 | + private java.lang.String id; | ||
| 34 | + /**创建人*/ | ||
| 35 | + private java.lang.String createBy; | ||
| 36 | + /**创建日期*/ | ||
| 37 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") | ||
| 38 | + @DateTimeFormat(pattern="yyyy-MM-dd") | ||
| 39 | + private java.util.Date createTime; | ||
| 40 | + /**更新人*/ | ||
| 41 | + private java.lang.String updateBy; | ||
| 42 | + /**更新日期*/ | ||
| 43 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") | ||
| 44 | + @DateTimeFormat(pattern="yyyy-MM-dd") | ||
| 45 | + private java.util.Date updateTime; | ||
| 46 | + /**领料人*/ | ||
| 47 | + private java.lang.String ling; | ||
| 48 | + /**领料环节*/ | ||
| 49 | + private java.lang.String lingSysOrgCode; | ||
| 50 | + /**所属部门*/ | ||
| 51 | + private java.lang.String sysOrgCode; | ||
| 52 | + /**零件编号*/ | ||
| 53 | + private java.lang.String partNumber; | ||
| 54 | + /**品名*/ | ||
| 55 | + private java.lang.String productName; | ||
| 56 | + /**规格*/ | ||
| 57 | + private java.lang.String spec; | ||
| 58 | + /**型号*/ | ||
| 59 | + private java.lang.String type; | ||
| 60 | + /**采购性质*/ | ||
| 61 | + @Dict(dicCode = "buying_classify") | ||
| 62 | + private java.lang.String buyingClassify; | ||
| 63 | + /**数量*/ | ||
| 64 | + private java.lang.Integer operNumber; | ||
| 65 | + /**类型(出库/入库)*/ | ||
| 66 | + private java.lang.String depotType; | ||
| 67 | + private java.lang.String workOrder; | ||
| 68 | + /**出入库时间*/ | ||
| 69 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") | ||
| 70 | + @DateTimeFormat(pattern="yyyy-MM-dd") | ||
| 71 | + private java.util.Date operTime; | ||
| 72 | + /**当前库存量*/ | ||
| 73 | + private java.lang.Integer currentInventory; | ||
| 74 | + | ||
| 75 | + private String isCallRobot; | ||
| 76 | + private String robotName; | ||
| 77 | + private String pointId; | ||
| 78 | + private String templateId; | ||
| 79 | + | ||
| 80 | +} |
jeecg-boot-erp/src/main/java/org/jeecg/modules/erp/depot/service/impl/RestTempService.java
0 → 100644
| 1 | +/** | ||
| 2 | + * | ||
| 3 | + */ | ||
| 4 | +package org.jeecg.modules.erp.depot.service.impl; | ||
| 5 | + | ||
| 6 | +import java.net.URI; | ||
| 7 | + | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.http.HttpEntity; | ||
| 10 | +import org.springframework.http.HttpHeaders; | ||
| 11 | +import org.springframework.http.HttpMethod; | ||
| 12 | +import org.springframework.http.MediaType; | ||
| 13 | +import org.springframework.http.ResponseEntity; | ||
| 14 | +import org.springframework.stereotype.Service; | ||
| 15 | +import org.springframework.web.client.RestTemplate; | ||
| 16 | + | ||
| 17 | +@Service | ||
| 18 | +public class RestTempService { | ||
| 19 | + | ||
| 20 | + private final RestTemplate restTemplate; | ||
| 21 | + | ||
| 22 | + @Autowired | ||
| 23 | + public RestTempService(RestTemplate restTemplate) { | ||
| 24 | + this.restTemplate = restTemplate; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public String getWithHeaderAuth(String apiUrl, String authToken) { | ||
| 28 | + HttpHeaders headers = new HttpHeaders(); | ||
| 29 | + headers.setContentType(MediaType.APPLICATION_JSON); | ||
| 30 | + headers.set("Authorization", "Bearer " + authToken); // 假设使用Bearer Token认证 | ||
| 31 | + | ||
| 32 | + HttpEntity<String> entity = new HttpEntity<>("", headers); | ||
| 33 | + | ||
| 34 | + ResponseEntity<String> response = restTemplate.exchange(apiUrl, HttpMethod.GET, entity, String.class); | ||
| 35 | + | ||
| 36 | + if (response.getStatusCode().is2xxSuccessful()) { | ||
| 37 | + return response.getBody(); | ||
| 38 | + } else { | ||
| 39 | + throw new RuntimeException("Failed to call API: " + response.getStatusCode()); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | +// return response.getBody(); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + public String postWithHeaderAuth(String apiUrl, String authToken, Object requestBody) { | ||
| 46 | + HttpHeaders headers = new HttpHeaders(); | ||
| 47 | + headers.setContentType(MediaType.APPLICATION_JSON); | ||
| 48 | + headers.set("Authorization", "Bearer " + authToken); | ||
| 49 | + | ||
| 50 | + HttpEntity<Object> entity = new HttpEntity<>(requestBody, headers); | ||
| 51 | + | ||
| 52 | + ResponseEntity<String> response = restTemplate.postForEntity(apiUrl, entity, String.class); | ||
| 53 | + | ||
| 54 | + return response.getBody(); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public String postWithHeaderAuth3(String apiUrl, String authToken, Object requestBody) { | ||
| 58 | + HttpHeaders headers = new HttpHeaders(); | ||
| 59 | + headers.setContentType(MediaType.APPLICATION_JSON); | ||
| 60 | + headers.set("token", authToken); | ||
| 61 | + | ||
| 62 | + HttpEntity<Object> entity = new HttpEntity<>(requestBody, headers); | ||
| 63 | + | ||
| 64 | + ResponseEntity<String> response = restTemplate.postForEntity(apiUrl, entity, String.class); | ||
| 65 | + | ||
| 66 | + return response.getBody(); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + | ||
| 70 | + public String postWithHeaderAuth2(String apiUrl, Object requestBody) { | ||
| 71 | + HttpHeaders headers = new HttpHeaders(); | ||
| 72 | + headers.setContentType(MediaType.APPLICATION_JSON); | ||
| 73 | +// headers.set("Custom-Header", "XXXX-TESTXXXX"); | ||
| 74 | + | ||
| 75 | + HttpEntity<Object> entity = new HttpEntity<>(requestBody, headers); | ||
| 76 | + | ||
| 77 | + ResponseEntity<String> response = restTemplate.postForEntity(apiUrl, entity, String.class); | ||
| 78 | + | ||
| 79 | + return response.getBody(); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + /** | ||
| 83 | + * @param entity | ||
| 84 | + * @return | ||
| 85 | + */ | ||
| 86 | + public String getWithHeaderAuth(String apiUrl, HttpEntity<Object> entity) { | ||
| 87 | + ResponseEntity<String> response = restTemplate.getForEntity(apiUrl, String.class); | ||
| 88 | + | ||
| 89 | + return response.getBody(); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + /** | ||
| 93 | + * @param uri | ||
| 94 | + * @return | ||
| 95 | + */ | ||
| 96 | + public String getWithHeaderAuth(URI uri) { | ||
| 97 | + ResponseEntity<String> response = restTemplate.getForEntity(uri, String.class); | ||
| 98 | + | ||
| 99 | + return response.getBody(); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + /** | ||
| 103 | + * @param url | ||
| 104 | + * @param entity | ||
| 105 | + * @return | ||
| 106 | + */ | ||
| 107 | + public String postWithHeaderAuth3(String url, HttpEntity<Object> entity) { | ||
| 108 | + ResponseEntity<String> response = restTemplate.postForEntity(url, entity, String.class); | ||
| 109 | + | ||
| 110 | + return response.getBody(); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * @param url | ||
| 115 | + * @param entity | ||
| 116 | + * @return | ||
| 117 | + */ | ||
| 118 | + public String putWithHeaderAuth(String url, HttpEntity<Object> entity) { | ||
| 119 | +// ResponseEntity<String> response = restTemplate.put(url, entity, String.class); | ||
| 120 | +// | ||
| 121 | +// return response.getBody(); | ||
| 122 | + // 发送 PUT 请求 | ||
| 123 | + ResponseEntity<String> responseEntity = restTemplate.exchange( | ||
| 124 | + url, | ||
| 125 | + HttpMethod.PUT, | ||
| 126 | + entity, | ||
| 127 | + String.class // 这里假设你期望的响应体是 String 类型的,你可以根据需要更改 | ||
| 128 | + ); | ||
| 129 | + | ||
| 130 | + // 检查响应状态码并处理 | ||
| 131 | + if (responseEntity.getStatusCode().is2xxSuccessful()) { | ||
| 132 | + // 请求成功,返回响应体 | ||
| 133 | + return responseEntity.getBody(); | ||
| 134 | + } else { | ||
| 135 | + // 请求失败,可以抛出异常或者返回错误信息等 | ||
| 136 | + throw new RuntimeException("PUT 请求失败: " + responseEntity.getStatusCode()); | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | +} |
jeecg-boot-erp/src/main/java/org/jeecg/modules/erp/robot/controller/TblRobotCabinController.java
0 → 100644
| 1 | +package org.jeecg.modules.erp.robot.controller; | ||
| 2 | + | ||
| 3 | +import java.util.Arrays; | ||
| 4 | +import java.util.List; | ||
| 5 | +import java.util.Map; | ||
| 6 | +import javax.servlet.http.HttpServletRequest; | ||
| 7 | +import javax.servlet.http.HttpServletResponse; | ||
| 8 | +import org.jeecg.common.api.vo.Result; | ||
| 9 | +import org.jeecg.common.system.query.QueryGenerator; | ||
| 10 | +import org.jeecg.modules.erp.robot.entity.TblRobotCabin; | ||
| 11 | +import org.jeecg.modules.erp.robot.service.ITblRobotCabinService; | ||
| 12 | + | ||
| 13 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
| 14 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
| 15 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
| 16 | +import lombok.extern.slf4j.Slf4j; | ||
| 17 | + | ||
| 18 | +import org.jeecg.common.system.base.controller.JeecgController; | ||
| 19 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 20 | +import org.springframework.web.bind.annotation.*; | ||
| 21 | +import org.springframework.web.servlet.ModelAndView; | ||
| 22 | +import io.swagger.annotations.Api; | ||
| 23 | +import io.swagger.annotations.ApiOperation; | ||
| 24 | +import org.jeecg.common.aspect.annotation.AutoLog; | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * @Description: tbl_robot_cabin | ||
| 28 | + * @Author: jeecg-boot | ||
| 29 | + * @Date: 2024-10-24 | ||
| 30 | + * @Version: V1.0 | ||
| 31 | + */ | ||
| 32 | +@Api(tags="tbl_robot_cabin") | ||
| 33 | +@RestController | ||
| 34 | +@RequestMapping("/robotCabin/tblRobotCabin") | ||
| 35 | +@Slf4j | ||
| 36 | +public class TblRobotCabinController extends JeecgController<TblRobotCabin, ITblRobotCabinService> { | ||
| 37 | + @Autowired | ||
| 38 | + private ITblRobotCabinService tblRobotCabinService; | ||
| 39 | + | ||
| 40 | + | ||
| 41 | + @GetMapping(value = "/queryList") | ||
| 42 | + public Result<List<Map<String,Object>>> queryList(HttpServletRequest req) { | ||
| 43 | + List<Map<String, Object>> list = tblRobotCabinService.getList(); | ||
| 44 | + return Result.OK(list); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 分页列表查询 | ||
| 49 | + * | ||
| 50 | + * @param tblRobotCabin | ||
| 51 | + * @param pageNo | ||
| 52 | + * @param pageSize | ||
| 53 | + * @param req | ||
| 54 | + * @return | ||
| 55 | + */ | ||
| 56 | + //@AutoLog(value = "tbl_robot_cabin-分页列表查询") | ||
| 57 | + @ApiOperation(value="tbl_robot_cabin-分页列表查询", notes="tbl_robot_cabin-分页列表查询") | ||
| 58 | + @GetMapping(value = "/list") | ||
| 59 | + public Result<IPage<TblRobotCabin>> queryPageList(TblRobotCabin tblRobotCabin, | ||
| 60 | + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | ||
| 61 | + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | ||
| 62 | + HttpServletRequest req) { | ||
| 63 | + QueryWrapper<TblRobotCabin> queryWrapper = QueryGenerator.initQueryWrapper(tblRobotCabin, req.getParameterMap()); | ||
| 64 | + Page<TblRobotCabin> page = new Page<TblRobotCabin>(pageNo, pageSize); | ||
| 65 | + IPage<TblRobotCabin> pageList = tblRobotCabinService.page(page, queryWrapper); | ||
| 66 | + return Result.OK(pageList); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * 添加 | ||
| 71 | + * | ||
| 72 | + * @param tblRobotCabin | ||
| 73 | + * @return | ||
| 74 | + */ | ||
| 75 | + @AutoLog(value = "tbl_robot_cabin-添加") | ||
| 76 | + @ApiOperation(value="tbl_robot_cabin-添加", notes="tbl_robot_cabin-添加") | ||
| 77 | + @PostMapping(value = "/add") | ||
| 78 | + public Result<String> add(@RequestBody TblRobotCabin tblRobotCabin) { | ||
| 79 | + tblRobotCabinService.save(tblRobotCabin); | ||
| 80 | + return Result.OK("添加成功!"); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + /** | ||
| 84 | + * 编辑 | ||
| 85 | + * | ||
| 86 | + * @param tblRobotCabin | ||
| 87 | + * @return | ||
| 88 | + */ | ||
| 89 | + @AutoLog(value = "tbl_robot_cabin-编辑") | ||
| 90 | + @ApiOperation(value="tbl_robot_cabin-编辑", notes="tbl_robot_cabin-编辑") | ||
| 91 | + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | ||
| 92 | + public Result<String> edit(@RequestBody TblRobotCabin tblRobotCabin) { | ||
| 93 | + tblRobotCabinService.updateById(tblRobotCabin); | ||
| 94 | + return Result.OK("编辑成功!"); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * 通过id删除 | ||
| 99 | + * | ||
| 100 | + * @param id | ||
| 101 | + * @return | ||
| 102 | + */ | ||
| 103 | + @AutoLog(value = "tbl_robot_cabin-通过id删除") | ||
| 104 | + @ApiOperation(value="tbl_robot_cabin-通过id删除", notes="tbl_robot_cabin-通过id删除") | ||
| 105 | + @DeleteMapping(value = "/delete") | ||
| 106 | + public Result<String> delete(@RequestParam(name="id",required=true) String id) { | ||
| 107 | + tblRobotCabinService.removeById(id); | ||
| 108 | + return Result.OK("删除成功!"); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * 批量删除 | ||
| 113 | + * | ||
| 114 | + * @param ids | ||
| 115 | + * @return | ||
| 116 | + */ | ||
| 117 | + @AutoLog(value = "tbl_robot_cabin-批量删除") | ||
| 118 | + @ApiOperation(value="tbl_robot_cabin-批量删除", notes="tbl_robot_cabin-批量删除") | ||
| 119 | + @DeleteMapping(value = "/deleteBatch") | ||
| 120 | + public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | ||
| 121 | + this.tblRobotCabinService.removeByIds(Arrays.asList(ids.split(","))); | ||
| 122 | + return Result.OK("批量删除成功!"); | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + /** | ||
| 126 | + * 通过id查询 | ||
| 127 | + * | ||
| 128 | + * @param id | ||
| 129 | + * @return | ||
| 130 | + */ | ||
| 131 | + //@AutoLog(value = "tbl_robot_cabin-通过id查询") | ||
| 132 | + @ApiOperation(value="tbl_robot_cabin-通过id查询", notes="tbl_robot_cabin-通过id查询") | ||
| 133 | + @GetMapping(value = "/queryById") | ||
| 134 | + public Result<TblRobotCabin> queryById(@RequestParam(name="id",required=true) String id) { | ||
| 135 | + TblRobotCabin tblRobotCabin = tblRobotCabinService.getById(id); | ||
| 136 | + if(tblRobotCabin==null) { | ||
| 137 | + return Result.error("未找到对应数据"); | ||
| 138 | + } | ||
| 139 | + return Result.OK(tblRobotCabin); | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + /** | ||
| 143 | + * 导出excel | ||
| 144 | + * | ||
| 145 | + * @param request | ||
| 146 | + * @param tblRobotCabin | ||
| 147 | + */ | ||
| 148 | + @RequestMapping(value = "/exportXls") | ||
| 149 | + public ModelAndView exportXls(HttpServletRequest request, TblRobotCabin tblRobotCabin) { | ||
| 150 | + return super.exportXls(request, tblRobotCabin, TblRobotCabin.class, "tbl_robot_cabin"); | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + /** | ||
| 154 | + * 通过excel导入数据 | ||
| 155 | + * | ||
| 156 | + * @param request | ||
| 157 | + * @param response | ||
| 158 | + * @return | ||
| 159 | + */ | ||
| 160 | + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | ||
| 161 | + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | ||
| 162 | + return super.importExcel(request, response, TblRobotCabin.class); | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | +} |
jeecg-boot-erp/src/main/java/org/jeecg/modules/erp/robot/controller/TblRobotController.java
0 → 100644
| 1 | +package org.jeecg.modules.erp.robot.controller; | ||
| 2 | + | ||
| 3 | +import java.util.Arrays; | ||
| 4 | +import java.util.List; | ||
| 5 | +import java.util.Map; | ||
| 6 | +import java.util.stream.Collectors; | ||
| 7 | +import java.io.IOException; | ||
| 8 | +import java.io.UnsupportedEncodingException; | ||
| 9 | +import java.net.URLDecoder; | ||
| 10 | +import javax.servlet.http.HttpServletRequest; | ||
| 11 | +import javax.servlet.http.HttpServletResponse; | ||
| 12 | +import org.jeecg.common.api.vo.Result; | ||
| 13 | +import org.jeecg.common.system.query.QueryGenerator; | ||
| 14 | +import org.jeecg.common.util.oConvertUtils; | ||
| 15 | +import org.jeecg.modules.erp.robot.entity.TblRobot; | ||
| 16 | +import org.jeecg.modules.erp.robot.service.ITblRobotService; | ||
| 17 | + | ||
| 18 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
| 19 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
| 20 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
| 21 | +import lombok.extern.slf4j.Slf4j; | ||
| 22 | + | ||
| 23 | +import org.jeecgframework.poi.excel.ExcelImportUtil; | ||
| 24 | +import org.jeecgframework.poi.excel.def.NormalExcelConstants; | ||
| 25 | +import org.jeecgframework.poi.excel.entity.ExportParams; | ||
| 26 | +import org.jeecgframework.poi.excel.entity.ImportParams; | ||
| 27 | +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | ||
| 28 | +import org.jeecg.common.system.base.controller.JeecgController; | ||
| 29 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 30 | +import org.springframework.web.bind.annotation.*; | ||
| 31 | +import org.springframework.web.multipart.MultipartFile; | ||
| 32 | +import org.springframework.web.multipart.MultipartHttpServletRequest; | ||
| 33 | +import org.springframework.web.servlet.ModelAndView; | ||
| 34 | +import com.alibaba.fastjson.JSON; | ||
| 35 | +import io.swagger.annotations.Api; | ||
| 36 | +import io.swagger.annotations.ApiOperation; | ||
| 37 | +import org.jeecg.common.aspect.annotation.AutoLog; | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * @Description: tbl_robot | ||
| 41 | + * @Author: jeecg-boot | ||
| 42 | + * @Date: 2024-11-06 | ||
| 43 | + * @Version: V1.0 | ||
| 44 | + */ | ||
| 45 | +@Api(tags="tbl_robot") | ||
| 46 | +@RestController | ||
| 47 | +@RequestMapping("/robot/tblRobot") | ||
| 48 | +@Slf4j | ||
| 49 | +public class TblRobotController extends JeecgController<TblRobot, ITblRobotService> { | ||
| 50 | + @Autowired | ||
| 51 | + private ITblRobotService tblRobotService; | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 分页列表查询 | ||
| 55 | + * | ||
| 56 | + * @param tblRobot | ||
| 57 | + * @param pageNo | ||
| 58 | + * @param pageSize | ||
| 59 | + * @param req | ||
| 60 | + * @return | ||
| 61 | + */ | ||
| 62 | + //@AutoLog(value = "tbl_robot-分页列表查询") | ||
| 63 | + @ApiOperation(value="tbl_robot-分页列表查询", notes="tbl_robot-分页列表查询") | ||
| 64 | + @GetMapping(value = "/list") | ||
| 65 | + public Result<IPage<TblRobot>> queryPageList(TblRobot tblRobot, | ||
| 66 | + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | ||
| 67 | + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | ||
| 68 | + HttpServletRequest req) { | ||
| 69 | + QueryWrapper<TblRobot> queryWrapper = QueryGenerator.initQueryWrapper(tblRobot, req.getParameterMap()); | ||
| 70 | + Page<TblRobot> page = new Page<TblRobot>(pageNo, pageSize); | ||
| 71 | + IPage<TblRobot> pageList = tblRobotService.page(page, queryWrapper); | ||
| 72 | + return Result.OK(pageList); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 添加 | ||
| 77 | + * | ||
| 78 | + * @param tblRobot | ||
| 79 | + * @return | ||
| 80 | + */ | ||
| 81 | + @AutoLog(value = "tbl_robot-添加") | ||
| 82 | + @ApiOperation(value="tbl_robot-添加", notes="tbl_robot-添加") | ||
| 83 | + @PostMapping(value = "/add") | ||
| 84 | + public Result<String> add(@RequestBody TblRobot tblRobot) { | ||
| 85 | + tblRobotService.save(tblRobot); | ||
| 86 | + return Result.OK("添加成功!"); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * 编辑 | ||
| 91 | + * | ||
| 92 | + * @param tblRobot | ||
| 93 | + * @return | ||
| 94 | + */ | ||
| 95 | + @AutoLog(value = "tbl_robot-编辑") | ||
| 96 | + @ApiOperation(value="tbl_robot-编辑", notes="tbl_robot-编辑") | ||
| 97 | + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | ||
| 98 | + public Result<String> edit(@RequestBody TblRobot tblRobot) { | ||
| 99 | + tblRobotService.updateById(tblRobot); | ||
| 100 | + return Result.OK("编辑成功!"); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + /** | ||
| 104 | + * 通过id删除 | ||
| 105 | + * | ||
| 106 | + * @param id | ||
| 107 | + * @return | ||
| 108 | + */ | ||
| 109 | + @AutoLog(value = "tbl_robot-通过id删除") | ||
| 110 | + @ApiOperation(value="tbl_robot-通过id删除", notes="tbl_robot-通过id删除") | ||
| 111 | + @DeleteMapping(value = "/delete") | ||
| 112 | + public Result<String> delete(@RequestParam(name="id",required=true) String id) { | ||
| 113 | + tblRobotService.removeById(id); | ||
| 114 | + return Result.OK("删除成功!"); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + /** | ||
| 118 | + * 批量删除 | ||
| 119 | + * | ||
| 120 | + * @param ids | ||
| 121 | + * @return | ||
| 122 | + */ | ||
| 123 | + @AutoLog(value = "tbl_robot-批量删除") | ||
| 124 | + @ApiOperation(value="tbl_robot-批量删除", notes="tbl_robot-批量删除") | ||
| 125 | + @DeleteMapping(value = "/deleteBatch") | ||
| 126 | + public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | ||
| 127 | + this.tblRobotService.removeByIds(Arrays.asList(ids.split(","))); | ||
| 128 | + return Result.OK("批量删除成功!"); | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * 通过id查询 | ||
| 133 | + * | ||
| 134 | + * @param id | ||
| 135 | + * @return | ||
| 136 | + */ | ||
| 137 | + //@AutoLog(value = "tbl_robot-通过id查询") | ||
| 138 | + @ApiOperation(value="tbl_robot-通过id查询", notes="tbl_robot-通过id查询") | ||
| 139 | + @GetMapping(value = "/queryById") | ||
| 140 | + public Result<TblRobot> queryById(@RequestParam(name="id",required=true) String id) { | ||
| 141 | + TblRobot tblRobot = tblRobotService.getById(id); | ||
| 142 | + if(tblRobot==null) { | ||
| 143 | + return Result.error("未找到对应数据"); | ||
| 144 | + } | ||
| 145 | + return Result.OK(tblRobot); | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + /** | ||
| 149 | + * 导出excel | ||
| 150 | + * | ||
| 151 | + * @param request | ||
| 152 | + * @param tblRobot | ||
| 153 | + */ | ||
| 154 | + @RequestMapping(value = "/exportXls") | ||
| 155 | + public ModelAndView exportXls(HttpServletRequest request, TblRobot tblRobot) { | ||
| 156 | + return super.exportXls(request, tblRobot, TblRobot.class, "tbl_robot"); | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + /** | ||
| 160 | + * 通过excel导入数据 | ||
| 161 | + * | ||
| 162 | + * @param request | ||
| 163 | + * @param response | ||
| 164 | + * @return | ||
| 165 | + */ | ||
| 166 | + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | ||
| 167 | + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | ||
| 168 | + return super.importExcel(request, response, TblRobot.class); | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | +} |
jeecg-boot-erp/src/main/java/org/jeecg/modules/erp/robot/controller/TblRobotPointsController.java
0 → 100644
| 1 | +package org.jeecg.modules.erp.robot.controller; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | +import javax.servlet.http.HttpServletRequest; | ||
| 6 | + | ||
| 7 | +import org.jeecg.common.api.vo.Result; | ||
| 8 | +import org.jeecg.modules.erp.robot.service.impl.YjRobotService; | ||
| 9 | +import org.jeecg.modules.erp.robot.entity.TblRobotPoints; | ||
| 10 | +import org.jeecg.modules.erp.robot.service.ITblRobotPointsService; | ||
| 11 | + | ||
| 12 | +import lombok.extern.slf4j.Slf4j; | ||
| 13 | + | ||
| 14 | +import org.jeecg.common.system.base.controller.JeecgController; | ||
| 15 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 16 | +import org.springframework.beans.factory.annotation.Value; | ||
| 17 | +import org.springframework.web.bind.annotation.*; | ||
| 18 | +import io.swagger.annotations.Api; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * @Description: 机器人点位设置 | ||
| 22 | + * @Author: jeecg-boot | ||
| 23 | + * @Date: 2024-10-23 | ||
| 24 | + * @Version: V1.0 | ||
| 25 | + */ | ||
| 26 | +@Api(tags="机器人点位设置") | ||
| 27 | +@RestController | ||
| 28 | +@RequestMapping("/robotPoints/tblRobotPoints") | ||
| 29 | +@Slf4j | ||
| 30 | +public class TblRobotPointsController extends JeecgController<TblRobotPoints, ITblRobotPointsService> { | ||
| 31 | + @Autowired | ||
| 32 | + private ITblRobotPointsService tblRobotPointsService; | ||
| 33 | + | ||
| 34 | + @Autowired | ||
| 35 | + private YjRobotService yjRobotService; | ||
| 36 | + | ||
| 37 | +// /** | ||
| 38 | +// * 分页列表查询 | ||
| 39 | +// * | ||
| 40 | +// * @param tblRobotPoints | ||
| 41 | +// * @param pageNo | ||
| 42 | +// * @param pageSize | ||
| 43 | +// * @param req | ||
| 44 | +// * @return | ||
| 45 | +// */ | ||
| 46 | + //@AutoLog(value = "机器人点位设置-分页列表查询") | ||
| 47 | +// @ApiOperation(value="机器人点位设置-分页列表查询", notes="机器人点位设置-分页列表查询") | ||
| 48 | +// @GetMapping(value = "/list") | ||
| 49 | +// public Result<IPage<TblRobotPoints>> queryPageList(TblRobotPoints tblRobotPoints, | ||
| 50 | +// @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | ||
| 51 | +// @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | ||
| 52 | +// HttpServletRequest req) { | ||
| 53 | +// QueryWrapper<TblRobotPoints> queryWrapper = QueryGenerator.initQueryWrapper(tblRobotPoints, req.getParameterMap()); | ||
| 54 | +// Page<TblRobotPoints> page = new Page<TblRobotPoints>(pageNo, pageSize); | ||
| 55 | +// IPage<TblRobotPoints> pageList = tblRobotPointsService.page(page, queryWrapper); | ||
| 56 | +// return Result.OK(pageList); | ||
| 57 | +// } | ||
| 58 | + | ||
| 59 | + @GetMapping(value = "/queryList") | ||
| 60 | + public Result<List<Map<String,Object>>> queryList(HttpServletRequest req) { | ||
| 61 | + List<Map<String, Object>> list = tblRobotPointsService.getList(); | ||
| 62 | + return Result.OK(list); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + @Value("${robot.yunji.storeId}") | ||
| 66 | + private String storeId; | ||
| 67 | + @Value("${robot.yunji.deviceName}") | ||
| 68 | + private String deviceName; | ||
| 69 | + @Value("${robot.yunji.pointId}") | ||
| 70 | + private String pointId; | ||
| 71 | + @Value("${robot.yunji.deviceId}") | ||
| 72 | + private String deviceId; | ||
| 73 | + | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 召唤机器人送物 | ||
| 77 | + * @return | ||
| 78 | + */ | ||
| 79 | + @PostMapping(value = "/movetoTarget") | ||
| 80 | + public Result<String> movetoTarget(@RequestBody Map<String,Object> map) { | ||
| 81 | + String robotName = map.get("robotName").toString(); | ||
| 82 | + String pointId = map.get("pointId").toString(); | ||
| 83 | + Map<String, Object> returnMap = null; | ||
| 84 | + if(robotName.startsWith("SCWM")){ | ||
| 85 | + String templateId = map.get("templateId").toString(); | ||
| 86 | + int overtime = Integer.parseInt(map.get("overtime").toString()); | ||
| 87 | + returnMap = yjRobotService.movetoTarget(templateId,robotName, pointId,overtime); | ||
| 88 | + }else if(robotName.startsWith("SCSK")){ | ||
| 89 | + String via = map.get("via").toString(); | ||
| 90 | + returnMap = yjRobotService.callAndDelivery(pointId,via); | ||
| 91 | + | ||
| 92 | + } | ||
| 93 | + int code = Integer.parseInt(returnMap.get("code").toString()); | ||
| 94 | + if(code==0){ | ||
| 95 | + return Result.OK("召唤成功!"); | ||
| 96 | + }else{ | ||
| 97 | + return Result.error("召唤失败,请重试!"); | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + @PostMapping(value = "/returnToCabin") | ||
| 102 | + public Result<String> returnToCabin(@RequestBody Map<String,Object> map) { | ||
| 103 | + String robotName = map.get("robotName").toString(); | ||
| 104 | + String cabinId = map.get("cabinId").toString(); | ||
| 105 | + Map<String, Object> map1 = yjRobotService.dockingCabinAndDockingDown(robotName,cabinId); | ||
| 106 | + int code = Integer.parseInt(map1.get("code").toString()); | ||
| 107 | + if(code == 0){ | ||
| 108 | + return Result.OK("操作成功"); | ||
| 109 | + } | ||
| 110 | + return Result.error("操作失败"); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + @GetMapping(value = "/getRobotGoCharge") | ||
| 114 | + public Result<String> getRobotGoCharge(HttpServletRequest req) { | ||
| 115 | + Map<String, Object> gochargeMap = yjRobotService.gocharge(deviceId); | ||
| 116 | + int code1 = Integer.parseInt(gochargeMap.get("code").toString()); | ||
| 117 | + if(code1 == 0) { | ||
| 118 | + return Result.OK("操作成功"); | ||
| 119 | + } | ||
| 120 | + return Result.error("操作失败"); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + @PostMapping(value = "/cancleMove") | ||
| 124 | + public Result<Map<String,Object>> cancleMove(@RequestBody Map<String,Object> map) { | ||
| 125 | + String option = map.get("option").toString(); | ||
| 126 | + Map<String, Object> gochargeMap = yjRobotService.canceltask(option); | ||
| 127 | + int code1 = Integer.parseInt(gochargeMap.get("code").toString()); | ||
| 128 | + if(code1 == 0) { | ||
| 129 | + return Result.OK("操作成功",gochargeMap); | ||
| 130 | + }else if(code1 == 501) { | ||
| 131 | + return Result.OK("机器人暂时没有进行中的任务",gochargeMap); | ||
| 132 | + } | ||
| 133 | + return Result.error("操作失败"); | ||
| 134 | + } | ||
| 135 | + /** | ||
| 136 | + * 添加 | ||
| 137 | + * | ||
| 138 | + * @param tblRobotPoints | ||
| 139 | + * @return | ||
| 140 | + */ | ||
| 141 | +// @AutoLog(value = "机器人点位设置-添加") | ||
| 142 | +// @ApiOperation(value="机器人点位设置-添加", notes="机器人点位设置-添加") | ||
| 143 | +// @PostMapping(value = "/add") | ||
| 144 | +// public Result<String> add(@RequestBody TblRobotPoints tblRobotPoints) { | ||
| 145 | +// tblRobotPointsService.save(tblRobotPoints); | ||
| 146 | +// return Result.OK("添加成功!"); | ||
| 147 | +// } | ||
| 148 | + | ||
| 149 | + /** | ||
| 150 | + * 编辑 | ||
| 151 | + * | ||
| 152 | + * @param tblRobotPoints | ||
| 153 | + * @return | ||
| 154 | + */ | ||
| 155 | +// @AutoLog(value = "机器人点位设置-编辑") | ||
| 156 | +// @ApiOperation(value="机器人点位设置-编辑", notes="机器人点位设置-编辑") | ||
| 157 | +// @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | ||
| 158 | +// public Result<String> edit(@RequestBody TblRobotPoints tblRobotPoints) { | ||
| 159 | +// tblRobotPointsService.updateById(tblRobotPoints); | ||
| 160 | +// return Result.OK("编辑成功!"); | ||
| 161 | +// } | ||
| 162 | + | ||
| 163 | + /** | ||
| 164 | + * 通过id删除 | ||
| 165 | + * | ||
| 166 | + * @param id | ||
| 167 | + * @return | ||
| 168 | + */ | ||
| 169 | +// @AutoLog(value = "机器人点位设置-通过id删除") | ||
| 170 | +// @ApiOperation(value="机器人点位设置-通过id删除", notes="机器人点位设置-通过id删除") | ||
| 171 | +// @DeleteMapping(value = "/delete") | ||
| 172 | +// public Result<String> delete(@RequestParam(name="id",required=true) String id) { | ||
| 173 | +// tblRobotPointsService.removeById(id); | ||
| 174 | +// return Result.OK("删除成功!"); | ||
| 175 | +// } | ||
| 176 | + | ||
| 177 | + /** | ||
| 178 | + * 批量删除 | ||
| 179 | + * | ||
| 180 | + * @param ids | ||
| 181 | + * @return | ||
| 182 | + */ | ||
| 183 | +// @AutoLog(value = "机器人点位设置-批量删除") | ||
| 184 | +// @ApiOperation(value="机器人点位设置-批量删除", notes="机器人点位设置-批量删除") | ||
| 185 | +// @DeleteMapping(value = "/deleteBatch") | ||
| 186 | +// public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | ||
| 187 | +// this.tblRobotPointsService.removeByIds(Arrays.asList(ids.split(","))); | ||
| 188 | +// return Result.OK("批量删除成功!"); | ||
| 189 | +// } | ||
| 190 | + | ||
| 191 | + /** | ||
| 192 | + * 通过id查询 | ||
| 193 | + * | ||
| 194 | + * @param id | ||
| 195 | + * @return | ||
| 196 | + */ | ||
| 197 | + //@AutoLog(value = "机器人点位设置-通过id查询") | ||
| 198 | +// @ApiOperation(value="机器人点位设置-通过id查询", notes="机器人点位设置-通过id查询") | ||
| 199 | +// @GetMapping(value = "/queryById") | ||
| 200 | +// public Result<TblRobotPoints> queryById(@RequestParam(name="id",required=true) String id) { | ||
| 201 | +// TblRobotPoints tblRobotPoints = tblRobotPointsService.getById(id); | ||
| 202 | +// if(tblRobotPoints==null) { | ||
| 203 | +// return Result.error("未找到对应数据"); | ||
| 204 | +// } | ||
| 205 | +// return Result.OK(tblRobotPoints); | ||
| 206 | +// } | ||
| 207 | + | ||
| 208 | + /** | ||
| 209 | + * 导出excel | ||
| 210 | + * | ||
| 211 | + * @param request | ||
| 212 | + * @param tblRobotPoints | ||
| 213 | + */ | ||
| 214 | +// @RequestMapping(value = "/exportXls") | ||
| 215 | +// public ModelAndView exportXls(HttpServletRequest request, TblRobotPoints tblRobotPoints) { | ||
| 216 | +// return super.exportXls(request, tblRobotPoints, TblRobotPoints.class, "机器人点位设置"); | ||
| 217 | +// } | ||
| 218 | + | ||
| 219 | + /** | ||
| 220 | + * 通过excel导入数据 | ||
| 221 | + * | ||
| 222 | + * @param request | ||
| 223 | + * @param response | ||
| 224 | + * @return | ||
| 225 | + */ | ||
| 226 | +// @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | ||
| 227 | +// public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | ||
| 228 | +// return super.importExcel(request, response, TblRobotPoints.class); | ||
| 229 | +// } | ||
| 230 | + | ||
| 231 | +} |
| 1 | +/** | ||
| 2 | + * | ||
| 3 | + */ | ||
| 4 | +package org.jeecg.modules.erp.robot.entity; | ||
| 5 | + | ||
| 6 | +import org.springframework.beans.factory.annotation.Value; | ||
| 7 | +import org.springframework.stereotype.Component; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * | ||
| 11 | + */ | ||
| 12 | +@Component | ||
| 13 | +public class ApiConfigYJ { | ||
| 14 | + | ||
| 15 | + | ||
| 16 | + @Value("${robot.yunji.storeId}") | ||
| 17 | + private String storeId; | ||
| 18 | + @Value("${robot.yunji.accessKeyId}") | ||
| 19 | + private String accessKeyId; | ||
| 20 | + @Value("${robot.yunji.accessKeySecret}") | ||
| 21 | + private String accessKeySecret; | ||
| 22 | + @Value("${robot.yunji.deviceId}") | ||
| 23 | + private String deviceId; | ||
| 24 | + | ||
| 25 | + public String getDeviceId() { | ||
| 26 | + return deviceId; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + public void setDeviceId(String deviceId) { | ||
| 30 | + this.deviceId = deviceId; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * @return | ||
| 35 | + */ | ||
| 36 | + public String getStoreId() { | ||
| 37 | + return storeId; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * @param storeId | ||
| 42 | + */ | ||
| 43 | + public void setStoreId(String storeId) { | ||
| 44 | + this.storeId = storeId; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public String getAccessKeyId() { | ||
| 48 | + return accessKeyId; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public void setAccessKeyId(String accessKeyId) { | ||
| 52 | + this.accessKeyId = accessKeyId; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * @return | ||
| 57 | + */ | ||
| 58 | + public String getAccessKeySecret() { | ||
| 59 | + return accessKeySecret; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * @param accessKeySecret | ||
| 64 | + */ | ||
| 65 | + public void setAccessKeySecret(String accessKeySecret) { | ||
| 66 | + this.accessKeySecret = accessKeySecret; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | +} |
| 1 | +package org.jeecg.modules.erp.robot.entity; | ||
| 2 | + | ||
| 3 | +import java.io.Serializable; | ||
| 4 | +import java.io.UnsupportedEncodingException; | ||
| 5 | +import java.util.Date; | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
| 8 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 9 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 10 | +import lombok.Data; | ||
| 11 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 12 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 13 | +import org.jeecgframework.poi.excel.annotation.Excel; | ||
| 14 | +import org.jeecg.common.aspect.annotation.Dict; | ||
| 15 | +import io.swagger.annotations.ApiModel; | ||
| 16 | +import io.swagger.annotations.ApiModelProperty; | ||
| 17 | +import lombok.EqualsAndHashCode; | ||
| 18 | +import lombok.experimental.Accessors; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * @Description: tbl_robot | ||
| 22 | + * @Author: jeecg-boot | ||
| 23 | + * @Date: 2024-11-06 | ||
| 24 | + * @Version: V1.0 | ||
| 25 | + */ | ||
| 26 | +@Data | ||
| 27 | +@TableName("tbl_robot") | ||
| 28 | +@Accessors(chain = true) | ||
| 29 | +@EqualsAndHashCode(callSuper = false) | ||
| 30 | +@ApiModel(value="tbl_robot对象", description="tbl_robot") | ||
| 31 | +public class TblRobot implements Serializable { | ||
| 32 | + private static final long serialVersionUID = 1L; | ||
| 33 | + | ||
| 34 | + /**id*/ | ||
| 35 | + @TableId(type = IdType.ASSIGN_ID) | ||
| 36 | + @ApiModelProperty(value = "id") | ||
| 37 | + private String id; | ||
| 38 | + /**设备id*/ | ||
| 39 | + @Excel(name = "设备id", width = 15) | ||
| 40 | + @ApiModelProperty(value = "设备id") | ||
| 41 | + private String deviceId; | ||
| 42 | + /**设备编号*/ | ||
| 43 | + @Excel(name = "设备编号", width = 15) | ||
| 44 | + @ApiModelProperty(value = "设备编号") | ||
| 45 | + private String devicename; | ||
| 46 | + /**产品名称*/ | ||
| 47 | + @Excel(name = "产品名称", width = 15) | ||
| 48 | + @ApiModelProperty(value = "产品名称") | ||
| 49 | + private String productName; | ||
| 50 | + /**创建人*/ | ||
| 51 | + @ApiModelProperty(value = "创建人") | ||
| 52 | + private String createBy; | ||
| 53 | + /**创建日期*/ | ||
| 54 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") | ||
| 55 | + @DateTimeFormat(pattern="yyyy-MM-dd") | ||
| 56 | + @ApiModelProperty(value = "创建日期") | ||
| 57 | + private Date createTime; | ||
| 58 | + /**更新人*/ | ||
| 59 | + @ApiModelProperty(value = "更新人") | ||
| 60 | + private String updateBy; | ||
| 61 | + /**更新日期*/ | ||
| 62 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") | ||
| 63 | + @DateTimeFormat(pattern="yyyy-MM-dd") | ||
| 64 | + @ApiModelProperty(value = "更新日期") | ||
| 65 | + private Date updateTime; | ||
| 66 | + /**所属部门*/ | ||
| 67 | + @ApiModelProperty(value = "所属部门") | ||
| 68 | + private String sysOrgCode; | ||
| 69 | +} |
| 1 | +package org.jeecg.modules.erp.robot.entity; | ||
| 2 | + | ||
| 3 | +import java.io.Serializable; | ||
| 4 | + | ||
| 5 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
| 6 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 7 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 8 | +import lombok.Data; | ||
| 9 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 10 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 11 | +import org.jeecgframework.poi.excel.annotation.Excel; | ||
| 12 | +import io.swagger.annotations.ApiModel; | ||
| 13 | +import io.swagger.annotations.ApiModelProperty; | ||
| 14 | +import lombok.EqualsAndHashCode; | ||
| 15 | +import lombok.experimental.Accessors; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * @Description: tbl_robot_cabin | ||
| 19 | + * @Author: jeecg-boot | ||
| 20 | + * @Date: 2024-10-24 | ||
| 21 | + * @Version: V1.0 | ||
| 22 | + */ | ||
| 23 | +@Data | ||
| 24 | +@TableName("tbl_robot_cabins") | ||
| 25 | +@Accessors(chain = true) | ||
| 26 | +@EqualsAndHashCode(callSuper = false) | ||
| 27 | +@ApiModel(value="tbl_robot_cabin对象", description="tbl_robot_cabin") | ||
| 28 | +public class TblRobotCabin implements Serializable { | ||
| 29 | + private static final long serialVersionUID = 1L; | ||
| 30 | + | ||
| 31 | + /**id*/ | ||
| 32 | + @TableId(type = IdType.ASSIGN_ID) | ||
| 33 | + @ApiModelProperty(value = "id") | ||
| 34 | + private java.lang.String id; | ||
| 35 | + /**点位id*/ | ||
| 36 | + @Excel(name = "点位id", width = 15) | ||
| 37 | + @ApiModelProperty(value = "点位id") | ||
| 38 | + private java.lang.String cabinId; | ||
| 39 | + /**点位名称*/ | ||
| 40 | + @Excel(name = "点位名称", width = 15) | ||
| 41 | + @ApiModelProperty(value = "点位名称") | ||
| 42 | + private java.lang.String cabinName; | ||
| 43 | + /**创建人*/ | ||
| 44 | + @ApiModelProperty(value = "创建人") | ||
| 45 | + private java.lang.String createBy; | ||
| 46 | + /**创建日期*/ | ||
| 47 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") | ||
| 48 | + @DateTimeFormat(pattern="yyyy-MM-dd") | ||
| 49 | + @ApiModelProperty(value = "创建日期") | ||
| 50 | + private java.util.Date createTime; | ||
| 51 | + /**更新人*/ | ||
| 52 | + @ApiModelProperty(value = "更新人") | ||
| 53 | + private java.lang.String updateBy; | ||
| 54 | + /**更新日期*/ | ||
| 55 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") | ||
| 56 | + @DateTimeFormat(pattern="yyyy-MM-dd") | ||
| 57 | + @ApiModelProperty(value = "更新日期") | ||
| 58 | + private java.util.Date updateTime; | ||
| 59 | + /**所属部门*/ | ||
| 60 | + @ApiModelProperty(value = "所属部门") | ||
| 61 | + private java.lang.String sysOrgCode; | ||
| 62 | +} |
| 1 | +package org.jeecg.modules.erp.robot.entity; | ||
| 2 | + | ||
| 3 | +import java.io.Serializable; | ||
| 4 | + | ||
| 5 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
| 6 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 7 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 8 | +import lombok.Data; | ||
| 9 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
| 10 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 11 | +import org.jeecgframework.poi.excel.annotation.Excel; | ||
| 12 | +import io.swagger.annotations.ApiModel; | ||
| 13 | +import io.swagger.annotations.ApiModelProperty; | ||
| 14 | +import lombok.EqualsAndHashCode; | ||
| 15 | +import lombok.experimental.Accessors; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * @Description: 机器人点位设置 | ||
| 19 | + * @Author: jeecg-boot | ||
| 20 | + * @Date: 2024-10-23 | ||
| 21 | + * @Version: V1.0 | ||
| 22 | + */ | ||
| 23 | +@Data | ||
| 24 | +@TableName("tbl_robot_points") | ||
| 25 | +@Accessors(chain = true) | ||
| 26 | +@EqualsAndHashCode(callSuper = false) | ||
| 27 | +@ApiModel(value="tbl_robot_points对象", description="机器人点位设置") | ||
| 28 | +public class TblRobotPoints implements Serializable { | ||
| 29 | + private static final long serialVersionUID = 1L; | ||
| 30 | + | ||
| 31 | + /**主键*/ | ||
| 32 | + @TableId(type = IdType.ASSIGN_ID) | ||
| 33 | + @ApiModelProperty(value = "主键") | ||
| 34 | + private java.lang.String id; | ||
| 35 | + /**点位id*/ | ||
| 36 | + @Excel(name = "点位id", width = 15) | ||
| 37 | + @ApiModelProperty(value = "点位id") | ||
| 38 | + private java.lang.String pointId; | ||
| 39 | + /**点位名称*/ | ||
| 40 | + @Excel(name = "点位名称", width = 15) | ||
| 41 | + @ApiModelProperty(value = "点位名称") | ||
| 42 | + private java.lang.String pointName; | ||
| 43 | + /**创建人*/ | ||
| 44 | + @ApiModelProperty(value = "创建人") | ||
| 45 | + private java.lang.String createBy; | ||
| 46 | + /**创建日期*/ | ||
| 47 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
| 48 | + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
| 49 | + @ApiModelProperty(value = "创建日期") | ||
| 50 | + private java.util.Date createTime; | ||
| 51 | + /**更新人*/ | ||
| 52 | + @ApiModelProperty(value = "更新人") | ||
| 53 | + private java.lang.String updateBy; | ||
| 54 | + /**更新日期*/ | ||
| 55 | + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") | ||
| 56 | + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") | ||
| 57 | + @ApiModelProperty(value = "更新日期") | ||
| 58 | + private java.util.Date updateTime; | ||
| 59 | + /**所属部门*/ | ||
| 60 | + @ApiModelProperty(value = "所属部门") | ||
| 61 | + private java.lang.String sysOrgCode; | ||
| 62 | +} |
| 1 | +package org.jeecg.modules.erp.robot.mapper; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.apache.ibatis.annotations.Mapper; | ||
| 7 | +import org.jeecg.modules.erp.robot.entity.TblRobotCabin; | ||
| 8 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * @Description: tbl_robot_cabin | ||
| 12 | + * @Author: jeecg-boot | ||
| 13 | + * @Date: 2024-10-24 | ||
| 14 | + * @Version: V1.0 | ||
| 15 | + */ | ||
| 16 | +@Mapper | ||
| 17 | +public interface TblRobotCabinMapper extends BaseMapper<TblRobotCabin> { | ||
| 18 | + List<Map<String, Object>> getList(); | ||
| 19 | +} |
| 1 | +package org.jeecg.modules.erp.robot.mapper; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | + | ||
| 5 | +import org.apache.ibatis.annotations.Param; | ||
| 6 | +import org.jeecg.modules.erp.robot.entity.TblRobot; | ||
| 7 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @Description: tbl_robot | ||
| 11 | + * @Author: jeecg-boot | ||
| 12 | + * @Date: 2024-11-06 | ||
| 13 | + * @Version: V1.0 | ||
| 14 | + */ | ||
| 15 | +public interface TblRobotMapper extends BaseMapper<TblRobot> { | ||
| 16 | + | ||
| 17 | +} |
jeecg-boot-erp/src/main/java/org/jeecg/modules/erp/robot/mapper/TblRobotPointsMapper.java
0 → 100644
| 1 | +package org.jeecg.modules.erp.robot.mapper; | ||
| 2 | + | ||
| 3 | +import java.util.List; | ||
| 4 | +import java.util.Map; | ||
| 5 | + | ||
| 6 | +import org.apache.ibatis.annotations.Mapper; | ||
| 7 | +import org.jeecg.modules.erp.robot.entity.TblRobotPoints; | ||
| 8 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * @Description: 机器人点位设置 | ||
| 12 | + * @Author: jeecg-boot | ||
| 13 | + * @Date: 2024-10-23 | ||
| 14 | + * @Version: V1.0 | ||
| 15 | + */ | ||
| 16 | +@Mapper | ||
| 17 | +public interface TblRobotPointsMapper extends BaseMapper<TblRobotPoints> { | ||
| 18 | + List<Map<String, Object>> getList(); | ||
| 19 | +} |
jeecg-boot-erp/src/main/java/org/jeecg/modules/erp/robot/mapper/xml/TblRobotCabinMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 3 | +<mapper namespace="org.jeecg.modules.erp.robot.mapper.TblRobotCabinMapper"> | ||
| 4 | + | ||
| 5 | + <select id="getList" resultType="java.util.HashMap"> | ||
| 6 | + SELECT cabin_id cabinId,cabin_name cabinName FROM tbl_robot_cabins | ||
| 7 | + </select> | ||
| 8 | +</mapper> |
jeecg-boot-erp/src/main/java/org/jeecg/modules/erp/robot/mapper/xml/TblRobotPointsMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
| 3 | +<mapper namespace="org.jeecg.modules.erp.robot.mapper.TblRobotPointsMapper"> | ||
| 4 | + | ||
| 5 | + <select id="getList" resultType="java.util.HashMap"> | ||
| 6 | + SELECT point_id pointId,point_name pointName FROM tbl_robot_points | ||
| 7 | + </select> | ||
| 8 | +</mapper> |
jeecg-boot-erp/src/main/java/org/jeecg/modules/erp/robot/service/ITblRobotCabinService.java
0 → 100644
| 1 | +package org.jeecg.modules.erp.robot.service; | ||
| 2 | + | ||
| 3 | +import org.jeecg.modules.erp.robot.entity.TblRobotCabin; | ||
| 4 | +import com.baomidou.mybatisplus.extension.service.IService; | ||
| 5 | + | ||
| 6 | +import java.util.List; | ||
| 7 | +import java.util.Map; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @Description: tbl_robot_cabin | ||
| 11 | + * @Author: jeecg-boot | ||
| 12 | + * @Date: 2024-10-24 | ||
| 13 | + * @Version: V1.0 | ||
| 14 | + */ | ||
| 15 | +public interface ITblRobotCabinService extends IService<TblRobotCabin> { | ||
| 16 | + | ||
| 17 | + List<Map<String,Object>> getList(); | ||
| 18 | +} |
jeecg-boot-erp/src/main/java/org/jeecg/modules/erp/robot/service/ITblRobotPointsService.java
0 → 100644
| 1 | +package org.jeecg.modules.erp.robot.service; | ||
| 2 | + | ||
| 3 | +import org.jeecg.modules.erp.robot.entity.TblRobotPoints; | ||
| 4 | +import com.baomidou.mybatisplus.extension.service.IService; | ||
| 5 | + | ||
| 6 | +import java.util.List; | ||
| 7 | +import java.util.Map; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @Description: 机器人点位设置 | ||
| 11 | + * @Author: jeecg-boot | ||
| 12 | + * @Date: 2024-10-23 | ||
| 13 | + * @Version: V1.0 | ||
| 14 | + */ | ||
| 15 | +public interface ITblRobotPointsService extends IService<TblRobotPoints> { | ||
| 16 | + | ||
| 17 | + List<Map<String,Object>> getList(); | ||
| 18 | +} |
| 1 | +package org.jeecg.modules.erp.robot.service; | ||
| 2 | + | ||
| 3 | +import org.jeecg.modules.erp.robot.entity.TblRobot; | ||
| 4 | +import com.baomidou.mybatisplus.extension.service.IService; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * @Description: tbl_robot | ||
| 8 | + * @Author: jeecg-boot | ||
| 9 | + * @Date: 2024-11-06 | ||
| 10 | + * @Version: V1.0 | ||
| 11 | + */ | ||
| 12 | +public interface ITblRobotService extends IService<TblRobot> { | ||
| 13 | + | ||
| 14 | +} |
jeecg-boot-erp/src/main/java/org/jeecg/modules/erp/robot/service/impl/TblRobotCabinServiceImpl.java
0 → 100644
| 1 | +package org.jeecg.modules.erp.robot.service.impl; | ||
| 2 | + | ||
| 3 | +import org.jeecg.modules.erp.robot.entity.TblRobotCabin; | ||
| 4 | +import org.jeecg.modules.erp.robot.mapper.TblRobotCabinMapper; | ||
| 5 | +import org.jeecg.modules.erp.robot.service.ITblRobotCabinService; | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.stereotype.Service; | ||
| 8 | + | ||
| 9 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
| 10 | + | ||
| 11 | +import java.util.List; | ||
| 12 | +import java.util.Map; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @Description: tbl_robot_cabin | ||
| 16 | + * @Author: jeecg-boot | ||
| 17 | + * @Date: 2024-10-24 | ||
| 18 | + * @Version: V1.0 | ||
| 19 | + */ | ||
| 20 | +@Service | ||
| 21 | +public class TblRobotCabinServiceImpl extends ServiceImpl<TblRobotCabinMapper, TblRobotCabin> implements ITblRobotCabinService { | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + @Autowired | ||
| 25 | + private TblRobotCabinMapper tblRobotCabinMapper; | ||
| 26 | + | ||
| 27 | + @Override | ||
| 28 | + public List<Map<String, Object>> getList() { | ||
| 29 | + return tblRobotCabinMapper.getList(); | ||
| 30 | + } | ||
| 31 | +} |
jeecg-boot-erp/src/main/java/org/jeecg/modules/erp/robot/service/impl/TblRobotPointsServiceImpl.java
0 → 100644
| 1 | +package org.jeecg.modules.erp.robot.service.impl; | ||
| 2 | + | ||
| 3 | +import org.jeecg.modules.erp.robot.entity.TblRobotPoints; | ||
| 4 | +import org.jeecg.modules.erp.robot.mapper.TblRobotPointsMapper; | ||
| 5 | +import org.jeecg.modules.erp.robot.service.ITblRobotPointsService; | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.stereotype.Service; | ||
| 8 | + | ||
| 9 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
| 10 | + | ||
| 11 | +import java.util.List; | ||
| 12 | +import java.util.Map; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @Description: 机器人点位设置 | ||
| 16 | + * @Author: jeecg-boot | ||
| 17 | + * @Date: 2024-10-23 | ||
| 18 | + * @Version: V1.0 | ||
| 19 | + */ | ||
| 20 | +@Service | ||
| 21 | +public class TblRobotPointsServiceImpl extends ServiceImpl<TblRobotPointsMapper, TblRobotPoints> implements ITblRobotPointsService { | ||
| 22 | + | ||
| 23 | + @Autowired | ||
| 24 | + private TblRobotPointsMapper tblRobotPointsMapper; | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + public List<Map<String, Object>> getList() { | ||
| 28 | + return tblRobotPointsMapper.getList(); | ||
| 29 | + } | ||
| 30 | +} |
jeecg-boot-erp/src/main/java/org/jeecg/modules/erp/robot/service/impl/TblRobotServiceImpl.java
0 → 100644
| 1 | +package org.jeecg.modules.erp.robot.service.impl; | ||
| 2 | + | ||
| 3 | +import org.jeecg.modules.erp.robot.entity.TblRobot; | ||
| 4 | +import org.jeecg.modules.erp.robot.mapper.TblRobotMapper; | ||
| 5 | +import org.jeecg.modules.erp.robot.service.ITblRobotService; | ||
| 6 | +import org.springframework.stereotype.Service; | ||
| 7 | + | ||
| 8 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * @Description: tbl_robot | ||
| 12 | + * @Author: jeecg-boot | ||
| 13 | + * @Date: 2024-11-06 | ||
| 14 | + * @Version: V1.0 | ||
| 15 | + */ | ||
| 16 | +@Service | ||
| 17 | +public class TblRobotServiceImpl extends ServiceImpl<TblRobotMapper, TblRobot> implements ITblRobotService { | ||
| 18 | + | ||
| 19 | +} |
jeecg-boot-erp/src/main/java/org/jeecg/modules/erp/robot/service/impl/YjRobotService.java
0 → 100644
| 1 | +package org.jeecg.modules.erp.robot.service.impl; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.date.DatePattern; | ||
| 4 | +import cn.hutool.core.date.DateUtil; | ||
| 5 | +import cn.hutool.core.util.StrUtil; | ||
| 6 | +import cn.hutool.json.JSONUtil; | ||
| 7 | +import com.alibaba.fastjson.JSON; | ||
| 8 | +import com.alibaba.fastjson.JSONArray; | ||
| 9 | +import com.alibaba.fastjson.JSONObject; | ||
| 10 | +import com.fasterxml.jackson.core.JsonProcessingException; | ||
| 11 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 12 | +import lombok.extern.slf4j.Slf4j; | ||
| 13 | +import org.jeecg.common.util.RedisUtil; | ||
| 14 | +import org.jeecg.modules.erp.depot.service.impl.RestTempService; | ||
| 15 | +import org.jeecg.modules.erp.robot.entity.ApiConfigYJ; | ||
| 16 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 17 | +import org.springframework.http.HttpEntity; | ||
| 18 | +import org.springframework.http.HttpHeaders; | ||
| 19 | +import org.springframework.http.MediaType; | ||
| 20 | +import org.springframework.stereotype.Service; | ||
| 21 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 22 | +import org.springframework.web.util.UriComponentsBuilder; | ||
| 23 | + | ||
| 24 | +import javax.servlet.http.HttpServletRequest; | ||
| 25 | +import java.io.UnsupportedEncodingException; | ||
| 26 | +import java.net.URI; | ||
| 27 | +import java.security.InvalidKeyException; | ||
| 28 | +import java.security.NoSuchAlgorithmException; | ||
| 29 | +import java.time.ZoneId; | ||
| 30 | +import java.time.ZonedDateTime; | ||
| 31 | +import java.time.format.DateTimeFormatter; | ||
| 32 | +import java.util.*; | ||
| 33 | + | ||
| 34 | +@Service | ||
| 35 | +@Slf4j | ||
| 36 | +public class YjRobotService { | ||
| 37 | + | ||
| 38 | + @Autowired | ||
| 39 | + private ApiConfigYJ apiConfigYJ; | ||
| 40 | + private final RestTempService restTempService; | ||
| 41 | + | ||
| 42 | + public YjRobotService(RestTempService restTempService) { | ||
| 43 | + this.restTempService = restTempService; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 获取点位 | ||
| 48 | + * @param storeId | ||
| 49 | + * @return | ||
| 50 | + */ | ||
| 51 | + public Map<String, Object> getPoints(@RequestParam String storeId) { | ||
| 52 | + log.info("开始获取点位"); | ||
| 53 | + HashMap<String, Object> r = new HashMap<>(); | ||
| 54 | + String tk = getaccessToken(); | ||
| 55 | + if(StrUtil.isBlank(tk)){ | ||
| 56 | + r.put("code", 501); | ||
| 57 | + r.put("message", "获取token失败"); | ||
| 58 | + return r; | ||
| 59 | + } | ||
| 60 | + log.info("token: " + tk); | ||
| 61 | + | ||
| 62 | + String tempUrl1 = "https://open-api.yunjiai.cn/v3/stores/"; | ||
| 63 | + String tempUrl2 = "/points"; | ||
| 64 | + StringBuilder stringBuilder = new StringBuilder(); | ||
| 65 | + String url = stringBuilder.append(tempUrl1).append(storeId).append(tempUrl2).toString(); | ||
| 66 | + String p1 = "accessToken"; | ||
| 67 | + String v1 = tk; | ||
| 68 | + | ||
| 69 | + // 使用UriComponentsBuilder构建完整的URL | ||
| 70 | + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url) | ||
| 71 | + .queryParam(p1, v1); | ||
| 72 | + | ||
| 73 | + // 构建完整的URI | ||
| 74 | + URI uri = builder.build().toUri(); | ||
| 75 | + log.info("url:" + uri); | ||
| 76 | + | ||
| 77 | + String response = restTempService.getWithHeaderAuth(uri); | ||
| 78 | + log.info("response:" + response); | ||
| 79 | + | ||
| 80 | + JSONObject jsonObject = JSON.parseObject(response); | ||
| 81 | + int code = jsonObject.getIntValue("code"); | ||
| 82 | + r.put("code", code); | ||
| 83 | + if (code == 0) { | ||
| 84 | + } else { | ||
| 85 | + log.info("设备列表获取异常"); | ||
| 86 | + r.put("message", "设备列表获取异常"); | ||
| 87 | + return r; | ||
| 88 | + } | ||
| 89 | + // 取出data数组并遍历 | ||
| 90 | + JSONArray dataArray = jsonObject.getJSONArray("data"); | ||
| 91 | + if (code == 0) { | ||
| 92 | + r.put("message", "SUCCESS"); | ||
| 93 | + } else { | ||
| 94 | + r.put("message", "FAILED"); | ||
| 95 | + } | ||
| 96 | + r.put("data", dataArray); | ||
| 97 | + return r; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @Autowired | ||
| 101 | + private RedisUtil redisUtil; | ||
| 102 | + | ||
| 103 | + public Map<String, Object> movetoTarget(@RequestParam String templateId, | ||
| 104 | + @RequestParam String deviceId, | ||
| 105 | + @RequestParam String pointId, | ||
| 106 | + @RequestParam int overtime) { | ||
| 107 | + log.info("机器人任务流:{}",templateId); | ||
| 108 | + // 创建一个ObjectMapper实例(如果尚未创建) | ||
| 109 | + ObjectMapper objectMapper = new ObjectMapper(); | ||
| 110 | + log.info("店铺-->{}", apiConfigYJ.getStoreId()); | ||
| 111 | + log.info("上舱-->{}", deviceId); | ||
| 112 | + log.info("目标位置-->{}", pointId); | ||
| 113 | + | ||
| 114 | + // 您的JSON对象 | ||
| 115 | + Map<String, Object> taskMap = new HashMap<>(); | ||
| 116 | + String outTaskId = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN); | ||
| 117 | + log.info("outTaskId-->" + outTaskId); | ||
| 118 | + taskMap.put("outTaskId", outTaskId); | ||
| 119 | + taskMap.put("templateId", templateId); | ||
| 120 | + taskMap.put("storeId", apiConfigYJ.getStoreId()); | ||
| 121 | + Map<String, Object> params = new HashMap<>(); | ||
| 122 | + params.put("dockCabinId", deviceId); | ||
| 123 | + params.put("target", pointId); | ||
| 124 | + if("dock_cabin_and_move_target_with_wait_action".equals(templateId)){ | ||
| 125 | + params.put("overtime", overtime); | ||
| 126 | + params.put("overtimeEvent", "back"); | ||
| 127 | + } | ||
| 128 | + taskMap.put("params", params); | ||
| 129 | + | ||
| 130 | + //taskMap转String | ||
| 131 | + String taskRequest = getTaskRequest(taskMap); | ||
| 132 | + //组装header | ||
| 133 | + HttpHeaders headers = getHttpHeaders(); | ||
| 134 | + | ||
| 135 | + String url = "https://open-api.yunjiai.cn/v3/rcs/task/flow/execute"; | ||
| 136 | + | ||
| 137 | + HttpEntity<Object> entity = new HttpEntity<>(taskRequest, headers); | ||
| 138 | + | ||
| 139 | + String response = restTempService.postWithHeaderAuth3(url, entity); | ||
| 140 | + log.info("url:" + url); | ||
| 141 | + log.info("response:" + response); | ||
| 142 | + | ||
| 143 | + Map<String, Object> map = JSONUtil.toBean(response, Map.class); | ||
| 144 | + int code = Integer.parseInt(map.get("code").toString()); | ||
| 145 | + if(code == 0){ | ||
| 146 | + String data = map.get("data").toString(); | ||
| 147 | + Map<String, Object> map1 = JSONUtil.toBean(data, Map.class); | ||
| 148 | + String taskId = map1.get("taskId").toString(); | ||
| 149 | + redisUtil.set(apiConfigYJ.getDeviceId(),taskId,3600); | ||
| 150 | + } | ||
| 151 | + return map; | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + | ||
| 155 | + | ||
| 156 | + /** | ||
| 157 | + * 取消移动 | ||
| 158 | + * @param option | ||
| 159 | + * @return | ||
| 160 | + */ | ||
| 161 | +// @PutMapping("/canceltask") | ||
| 162 | + public Map<String,Object> canceltask(@RequestParam String option) { | ||
| 163 | + | ||
| 164 | + // 创建一个ObjectMapper实例(如果尚未创建) | ||
| 165 | + ObjectMapper objectMapper = new ObjectMapper(); | ||
| 166 | + Object object = redisUtil.get(apiConfigYJ.getDeviceId()); | ||
| 167 | + if(null == object){ | ||
| 168 | + Map<String, Object> returnMap = new HashMap<>(); | ||
| 169 | + returnMap.put("code", 501); | ||
| 170 | + return returnMap; | ||
| 171 | + } | ||
| 172 | + String taskId = object.toString(); | ||
| 173 | + log.info("取消任务的taskId: {}", taskId); | ||
| 174 | + // 您的JSON对象 | ||
| 175 | + Map<String, Object> taskMap = new HashMap<>(); | ||
| 176 | + taskMap.put("newStatus", "cancelled"); | ||
| 177 | + taskMap.put("robotId", apiConfigYJ.getDeviceId()); | ||
| 178 | + taskMap.put("option", option); | ||
| 179 | + | ||
| 180 | + // 将Map转换为JSON字符串 | ||
| 181 | + String taskRequest = null; | ||
| 182 | + try { | ||
| 183 | + taskRequest = objectMapper.writeValueAsString(taskMap); | ||
| 184 | + } catch (JsonProcessingException e) { | ||
| 185 | + e.printStackTrace(); | ||
| 186 | + // 处理异常或返回错误消息 | ||
| 187 | + } | ||
| 188 | + | ||
| 189 | + String url = "https://open-api.yunjiai.cn/v3/stores/" + apiConfigYJ.getStoreId() + "/tasks/" + taskId+"/status"; | ||
| 190 | + | ||
| 191 | + HttpHeaders headers = getHttpHeaders(); | ||
| 192 | + | ||
| 193 | + HttpEntity<Object> entity = new HttpEntity<>(taskRequest, headers); | ||
| 194 | + | ||
| 195 | + String response = restTempService.putWithHeaderAuth(url, entity); | ||
| 196 | + | ||
| 197 | + log.info("url: {}",url); | ||
| 198 | + log.info("response: {}",response); | ||
| 199 | + Map<String, Object> map = JSONUtil.toBean(response, Map.class); | ||
| 200 | + return map; | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + | ||
| 204 | + public Map<String, Object> callAndDelivery(@RequestParam String target, | ||
| 205 | + @RequestParam String via) { | ||
| 206 | + // 创建一个ObjectMapper实例(如果尚未创建) | ||
| 207 | + ObjectMapper objectMapper = new ObjectMapper(); | ||
| 208 | + log.info("店铺-->{}", apiConfigYJ.getStoreId()); | ||
| 209 | + | ||
| 210 | + // 您的JSON对象 | ||
| 211 | + Map<String, Object> taskMap = new HashMap<>(); | ||
| 212 | + String outTaskId = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN); | ||
| 213 | + log.info("outTaskId-->" + outTaskId); | ||
| 214 | + taskMap.put("storeId", apiConfigYJ.getStoreId()); | ||
| 215 | + taskMap.put("outTaskId", outTaskId); | ||
| 216 | + taskMap.put("target", target); | ||
| 217 | + taskMap.put("via", via); | ||
| 218 | + | ||
| 219 | + Map<String, Object> goodMap = new HashMap<>(); | ||
| 220 | + goodMap.put("goodsId","take-out-goods-"+ DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN)); | ||
| 221 | + goodMap.put("goodsName","外卖商品"); | ||
| 222 | + goodMap.put("quantity",2); | ||
| 223 | + List<Map> maps = new ArrayList<>(); | ||
| 224 | + maps.add(goodMap); | ||
| 225 | + taskMap.put("goods", maps); | ||
| 226 | + | ||
| 227 | + //taskMap转String | ||
| 228 | + String taskRequest = getTaskRequest(taskMap); | ||
| 229 | + //组装header | ||
| 230 | + HttpHeaders headers = getHttpHeaders(); | ||
| 231 | + | ||
| 232 | + String url = "https://open-api.yunjiai.cn/v3/rcs/task/create/merchant-call"; | ||
| 233 | + | ||
| 234 | + HttpEntity<Object> entity = new HttpEntity<>(taskRequest, headers); | ||
| 235 | + | ||
| 236 | + String response = restTempService.postWithHeaderAuth3(url, entity); | ||
| 237 | + log.info("url:" + url); | ||
| 238 | + log.info("response:" + response); | ||
| 239 | + | ||
| 240 | + Map<String, Object> map = JSONUtil.toBean(response, Map.class); | ||
| 241 | +// int code = Integer.parseInt(map.get("code").toString()); | ||
| 242 | +// if(code == 0){ | ||
| 243 | +// String data = map.get("data").toString(); | ||
| 244 | +// Map<String, Object> map1 = JSONUtil.toBean(data, Map.class); | ||
| 245 | +// String taskId = map1.get("taskId").toString(); | ||
| 246 | +// redisUtil.set(apiConfigYJ.getDeviceId(),taskId,3600); | ||
| 247 | +// } | ||
| 248 | + return map; | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + /** | ||
| 252 | + * dock_cabin_to_move_and_lift_down | ||
| 253 | + * 调度底盘(具体调哪个底盘云迹自己调度系统分配)去某个上仓举起并移动到另外点位放下 | ||
| 254 | + * | ||
| 255 | + * @param deviceId | ||
| 256 | + * @param pointId | ||
| 257 | + * @return | ||
| 258 | + */ | ||
| 259 | +// @PostMapping("/dockCabinToMoveAndLiftDown") | ||
| 260 | + public Map<String,Object> dockCabinToMoveAndLiftDown( String deviceId, | ||
| 261 | + String pointId) { | ||
| 262 | + | ||
| 263 | + Map<String, Object> r = new HashMap<>(); | ||
| 264 | + log.info("=============dock_cabin_to_move_and_lift_down=============="); | ||
| 265 | + String tk = getaccessToken(); | ||
| 266 | + if("".equals(tk)) { | ||
| 267 | + r.put("code", 501); | ||
| 268 | + r.put("message", "获取token失败"); | ||
| 269 | + return r; | ||
| 270 | + } | ||
| 271 | + | ||
| 272 | + log.info("店铺-->" + apiConfigYJ.getStoreId()); | ||
| 273 | + log.info("上舱-->" + deviceId); | ||
| 274 | + log.info("目标位置-->" + pointId); | ||
| 275 | + | ||
| 276 | + Map<String, Object> taskMap = new HashMap<>(); | ||
| 277 | + String outTaskId = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN); | ||
| 278 | + log.info("outTaskId-->" + outTaskId); | ||
| 279 | + taskMap.put("outTaskId", outTaskId); | ||
| 280 | + taskMap.put("templateId", "dock_cabin_to_move_and_lift_down"); | ||
| 281 | + taskMap.put("storeId", apiConfigYJ.getStoreId()); | ||
| 282 | + Map<String, Object> params = new HashMap<>(); | ||
| 283 | + | ||
| 284 | + //执行任务中需要对接的上舱设备 ID | ||
| 285 | + params.put("dockCabinId", deviceId); | ||
| 286 | + params.put("target", pointId); | ||
| 287 | + taskMap.put("params", params); | ||
| 288 | + | ||
| 289 | + //taskMap转String | ||
| 290 | + String taskRequest = getTaskRequest(taskMap); | ||
| 291 | + //组装header | ||
| 292 | + HttpHeaders headers = getHttpHeaders(); | ||
| 293 | + | ||
| 294 | + String url = "https://open-api.yunjiai.cn/v3/rcs/task/flow/execute"; | ||
| 295 | + | ||
| 296 | + HttpEntity<Object> entity = new HttpEntity<>(taskRequest, headers); | ||
| 297 | + log.info("url:" + url); | ||
| 298 | + | ||
| 299 | + String response = restTempService.postWithHeaderAuth3(url, entity); | ||
| 300 | + log.info("response:" + response); | ||
| 301 | + Map<String, Object> map = JSONUtil.toBean(response, Map.class); | ||
| 302 | + return map; | ||
| 303 | + } | ||
| 304 | + /** | ||
| 305 | + * docking_cabin_and_docking_down | ||
| 306 | + * 调度底盘(具体调哪个底盘云迹自己调度系统分配,以直线距离最近的空闲底盘优先)移动上舱举起并移动到另外一个舱位放下 | ||
| 307 | + * @param deviceId | ||
| 308 | + * @param pointId | ||
| 309 | + * @return | ||
| 310 | + */ | ||
| 311 | +// @PostMapping("/dockingCabinAndDockingDown") | ||
| 312 | + public Map<String, Object> dockingCabinAndDockingDown( | ||
| 313 | + @RequestParam String deviceId, | ||
| 314 | + @RequestParam String pointId) { | ||
| 315 | + Map<String, Object> r = new HashMap<>(); | ||
| 316 | + log.info("=============docking_cabin_and_docking_down=============="); | ||
| 317 | + // 创建一个ObjectMapper实例(如果尚未创建) | ||
| 318 | + log.info("店铺: {}", apiConfigYJ.getStoreId()); | ||
| 319 | + log.info("上舱: {}", deviceId); | ||
| 320 | + log.info("目标位置: {}", pointId); | ||
| 321 | + | ||
| 322 | + // 您的JSON对象 | ||
| 323 | + Map<String, Object> taskMap = new HashMap<>(); | ||
| 324 | + String outTaskId = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN); | ||
| 325 | + log.info("outTaskId: {}", outTaskId); | ||
| 326 | + taskMap.put("outTaskId", outTaskId); | ||
| 327 | + taskMap.put("templateId", "docking_cabin_and_docking_down"); | ||
| 328 | + taskMap.put("storeId", apiConfigYJ.getStoreId()); | ||
| 329 | + Map<String, Object> params = new HashMap<>(); | ||
| 330 | + params.put("dockCabinId", deviceId); | ||
| 331 | + params.put("target", pointId); | ||
| 332 | + taskMap.put("params", params); | ||
| 333 | + | ||
| 334 | + //taskMap转String | ||
| 335 | + String taskRequest = getTaskRequest(taskMap); | ||
| 336 | + //组装header | ||
| 337 | + HttpHeaders headers = getHttpHeaders(); | ||
| 338 | + | ||
| 339 | + String url = "https://open-api.yunjiai.cn/v3/rcs/task/flow/execute"; | ||
| 340 | + | ||
| 341 | + HttpEntity<Object> entity = new HttpEntity<>(taskRequest, headers); | ||
| 342 | + | ||
| 343 | + String response = restTempService.postWithHeaderAuth3(url, entity); | ||
| 344 | + log.info("url:{}", url); | ||
| 345 | + log.info("response:{}", response); | ||
| 346 | + | ||
| 347 | + Map<String, Object> map = JSONUtil.toBean(response, Map.class); | ||
| 348 | + return map; | ||
| 349 | + } | ||
| 350 | + | ||
| 351 | + /** | ||
| 352 | + * docking_cabin_and_move_target | ||
| 353 | + * 调度底盘(具体调哪个底盘云迹自己调度系统分配,以直线距离最近的空闲底盘优先)移动上舱举起并移动到目标点 | ||
| 354 | + * @param httpServletRequest | ||
| 355 | + * @param storeId | ||
| 356 | + * @param deviceId | ||
| 357 | + * @param pointId | ||
| 358 | + * @return | ||
| 359 | + */ | ||
| 360 | +// @PostMapping("/dockingCabinAndMoveTarget") | ||
| 361 | + public Map<String, Object> dockingCabinAndMoveTarget(HttpServletRequest httpServletRequest, | ||
| 362 | + @RequestParam String storeId, @RequestParam String deviceId, | ||
| 363 | + @RequestParam String pointId) { | ||
| 364 | + log.info("=============docking_cabin_and_move_target=============="); | ||
| 365 | + | ||
| 366 | + Map<String, Object> r = new HashMap<>(); | ||
| 367 | + // 创建一个ObjectMapper实例(如果尚未创建) | ||
| 368 | + | ||
| 369 | + log.info("店铺-->" + storeId); | ||
| 370 | + log.info("上舱-->" + deviceId); | ||
| 371 | + log.info("目标位置-->" + pointId); | ||
| 372 | + | ||
| 373 | + // 您的JSON对象 | ||
| 374 | + Map<String, Object> taskMap = new HashMap<>(); | ||
| 375 | + String outTaskId = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN); | ||
| 376 | + log.info("outTaskId-->" + outTaskId); | ||
| 377 | + taskMap.put("outTaskId", outTaskId); | ||
| 378 | + taskMap.put("templateId", "docking_cabin_and_move_target"); | ||
| 379 | + taskMap.put("storeId", storeId); | ||
| 380 | + Map<String, Object> params = new HashMap<>(); | ||
| 381 | + params.put("dockCabinId", deviceId); | ||
| 382 | + params.put("target", pointId); | ||
| 383 | + taskMap.put("params", params); | ||
| 384 | + | ||
| 385 | + //taskMap转String | ||
| 386 | + String taskRequest = getTaskRequest(taskMap); | ||
| 387 | + //组装header | ||
| 388 | + HttpHeaders headers = getHttpHeaders(); | ||
| 389 | + String url = "https://open-api.yunjiai.cn/v3/rcs/task/flow/execute"; | ||
| 390 | + | ||
| 391 | + HttpEntity<Object> entity = new HttpEntity<>(taskRequest, headers); | ||
| 392 | + | ||
| 393 | + log.info("taskRequest-->" + taskRequest); | ||
| 394 | + log.info("url:" + url); | ||
| 395 | + String response = restTempService.postWithHeaderAuth3(url, entity); | ||
| 396 | + log.info("response:" + response); | ||
| 397 | + | ||
| 398 | + JSONObject jsonObject2 = JSON.parseObject(response); | ||
| 399 | + | ||
| 400 | + r.put("data", jsonObject2); | ||
| 401 | + | ||
| 402 | + return r; | ||
| 403 | + } | ||
| 404 | + | ||
| 405 | + /** | ||
| 406 | + * move_target_and_lift_down | ||
| 407 | + * 托举上舱移动到目的地并且放下上舱 | ||
| 408 | + * @param httpServletRequest | ||
| 409 | + * @param storeId | ||
| 410 | + * @param deviceId | ||
| 411 | + * @param pointId | ||
| 412 | + * @return | ||
| 413 | + */ | ||
| 414 | +// @PostMapping("/moveTargetAndLiftDown") | ||
| 415 | + public Map<String, Object> moveTargetAndLiftDown(HttpServletRequest httpServletRequest, | ||
| 416 | + @RequestParam String storeId, @RequestParam String deviceId, | ||
| 417 | + @RequestParam String pointId) { | ||
| 418 | + | ||
| 419 | + log.info("=============move_target_and_lift_down=============="); | ||
| 420 | + Map<String, Object> r = new HashMap<>(); | ||
| 421 | + | ||
| 422 | + // 创建一个ObjectMapper实例(如果尚未创建) | ||
| 423 | + log.info("店铺-->" + storeId); | ||
| 424 | + log.info("上舱-->" + deviceId); | ||
| 425 | + log.info("目标位置-->" + pointId); | ||
| 426 | + | ||
| 427 | + // 您的JSON对象 | ||
| 428 | + Map<String, Object> taskMap = new HashMap<>(); | ||
| 429 | + String outTaskId = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN); | ||
| 430 | + log.info("outTaskId-->" + outTaskId); | ||
| 431 | + taskMap.put("outTaskId", outTaskId); | ||
| 432 | + taskMap.put("templateId", "move_target_and_lift_down"); | ||
| 433 | + taskMap.put("storeId", storeId); | ||
| 434 | + Map<String, Object> params = new HashMap<>(); | ||
| 435 | + params.put("dockCabinId", deviceId); | ||
| 436 | + params.put("target", pointId); | ||
| 437 | + taskMap.put("params", params); | ||
| 438 | + | ||
| 439 | + //taskMap转String | ||
| 440 | + String taskRequest = getTaskRequest(taskMap); | ||
| 441 | + //组装header | ||
| 442 | + HttpHeaders headers = getHttpHeaders(); | ||
| 443 | + | ||
| 444 | + String url = "https://open-api.yunjiai.cn/v3/rcs/task/flow/execute"; | ||
| 445 | + | ||
| 446 | + HttpEntity<Object> entity = new HttpEntity<>(taskRequest, headers); | ||
| 447 | + | ||
| 448 | + log.info("=============url==============" + url); | ||
| 449 | + String response1 = restTempService.postWithHeaderAuth3(url, entity); | ||
| 450 | + | ||
| 451 | + log.info("=============response==============" + response1); | ||
| 452 | + | ||
| 453 | + System.out.println("url----------- -----\n" + url); | ||
| 454 | + System.out.println("response1-----------restemp-----\n" + response1); | ||
| 455 | + | ||
| 456 | + JSONObject jsonObject2 = JSON.parseObject(response1); | ||
| 457 | + | ||
| 458 | + r.put("data", jsonObject2); | ||
| 459 | + | ||
| 460 | + return r; | ||
| 461 | + } | ||
| 462 | + | ||
| 463 | + | ||
| 464 | + | ||
| 465 | + /** | ||
| 466 | + * 让某舱到某目的地 | ||
| 467 | + * dock_cabin_and_move_target_with_wait_action | ||
| 468 | + * @param httpServletRequest | ||
| 469 | + * @param storeId | ||
| 470 | + * @param deviceId | ||
| 471 | + * @param pointId | ||
| 472 | + * @param overtime | ||
| 473 | + * @param overtimeEvent | ||
| 474 | + * @return | ||
| 475 | + */ | ||
| 476 | +// @PostMapping("/dockCabinAndMoveTargetWithWaitAction") | ||
| 477 | + public Map<String, Object> dockCabinAndMoveTargetWithWaitAction(HttpServletRequest httpServletRequest, | ||
| 478 | + @RequestParam String storeId, @RequestParam String deviceId, | ||
| 479 | + @RequestParam String pointId, @RequestParam String overtime, @RequestParam String overtimeEvent) { | ||
| 480 | + | ||
| 481 | + log.info("=============dock_cabin_and_move_target_with_wait_action=============="); | ||
| 482 | + Map<String, Object> r = new HashMap<>(); | ||
| 483 | + | ||
| 484 | + // 创建一个ObjectMapper实例(如果尚未创建) | ||
| 485 | + ObjectMapper objectMapper = new ObjectMapper(); | ||
| 486 | + log.info("店铺: " + storeId); | ||
| 487 | + log.info("上舱: " + deviceId); | ||
| 488 | + log.info("目标位置: " + pointId); | ||
| 489 | + | ||
| 490 | + // 您的JSON对象 | ||
| 491 | + Map<String, Object> taskMap = new HashMap<>(); | ||
| 492 | + String outTaskId = DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_PATTERN); | ||
| 493 | + log.info( "outTaskId: " + outTaskId); | ||
| 494 | + taskMap.put("outTaskId", outTaskId); | ||
| 495 | + taskMap.put("templateId", "dock_cabin_and_move_target_with_wait_action"); | ||
| 496 | + taskMap.put("storeId", storeId); | ||
| 497 | + Map<String, Object> params = new HashMap<>(); | ||
| 498 | + params.put("dockCabinId", deviceId); | ||
| 499 | + params.put("target", pointId); | ||
| 500 | + params.put("overtime", overtime); | ||
| 501 | + params.put("overtimeEvent", overtimeEvent); | ||
| 502 | + taskMap.put("params", params); | ||
| 503 | + | ||
| 504 | + //taskMap转String | ||
| 505 | + String taskRequest = getTaskRequest(taskMap); | ||
| 506 | + //组装header | ||
| 507 | + HttpHeaders headers = getHttpHeaders(); | ||
| 508 | + | ||
| 509 | + String url = "https://open-api.yunjibot.com/v3/rcs/task/flow/execute"; | ||
| 510 | + | ||
| 511 | + HttpEntity<Object> entity = new HttpEntity<>(taskRequest, headers); | ||
| 512 | + | ||
| 513 | + log.info("taskRequest-->" + taskRequest); | ||
| 514 | + log.info("=============url==============" + url); | ||
| 515 | + String response1 = restTempService.postWithHeaderAuth3(url, entity); | ||
| 516 | + | ||
| 517 | + log.info("=============response==============" + response1); | ||
| 518 | + System.out.println("url----------- -----\n" + url); | ||
| 519 | + System.out.println("response1-----------restemp-----\n" + response1); | ||
| 520 | + | ||
| 521 | + JSONObject jsonObject2 = JSON.parseObject(response1); | ||
| 522 | + | ||
| 523 | + | ||
| 524 | + r.put("data", jsonObject2); | ||
| 525 | + | ||
| 526 | + return r; | ||
| 527 | + } | ||
| 528 | + | ||
| 529 | + /** | ||
| 530 | + * 返回充电 | ||
| 531 | + * @param deviceId | ||
| 532 | + * @return | ||
| 533 | + */ | ||
| 534 | +// @PostMapping("/gocharge") | ||
| 535 | + public Map<String,Object> gocharge(@RequestParam String deviceId) { | ||
| 536 | + | ||
| 537 | + | ||
| 538 | + String baseUrl = "https://open-api.yunjiai.cn/v3/robot/" + deviceId + "/goto-charge"; | ||
| 539 | + String p1 = "accessToken"; | ||
| 540 | + String v1 = getaccessToken(); | ||
| 541 | + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseUrl) | ||
| 542 | + .queryParam(p1, v1); // 添加查询参数 | ||
| 543 | + | ||
| 544 | + // 构建完整的URI | ||
| 545 | + URI uri = builder.build().toUri(); | ||
| 546 | + | ||
| 547 | + Map<String, Object> taskMap = new HashMap<>(); | ||
| 548 | + taskMap.put("chargeId", ""); | ||
| 549 | + | ||
| 550 | + | ||
| 551 | + ObjectMapper objectMapper = new ObjectMapper(); | ||
| 552 | + //taskMap转String | ||
| 553 | + String taskRequest = getTaskRequest(taskMap); | ||
| 554 | + | ||
| 555 | + HttpHeaders headers = new HttpHeaders(); | ||
| 556 | + | ||
| 557 | + headers.setContentType(MediaType.APPLICATION_JSON); | ||
| 558 | + | ||
| 559 | + HttpEntity<Object> entity = new HttpEntity<>(taskRequest, headers); | ||
| 560 | + | ||
| 561 | + String response = restTempService.postWithHeaderAuth3(uri.toString(), entity); | ||
| 562 | + log.info("response: {}", response); | ||
| 563 | + Map<String, Object> map = JSONUtil.toBean(response, Map.class); | ||
| 564 | + return map; | ||
| 565 | + } | ||
| 566 | + private String getaccessToken() { | ||
| 567 | + String url = "https://open-api.yunjiai.cn/v3/auth/accessToken";//中国 | ||
| 568 | + | ||
| 569 | + String accessKeyId = apiConfigYJ.getAccessKeyId(); | ||
| 570 | + String key = apiConfigYJ.getAccessKeySecret(); | ||
| 571 | + | ||
| 572 | + List<String> paraAllList = new java.util.ArrayList<>(); | ||
| 573 | + | ||
| 574 | + // 获取当前的中国时间(东八区) | ||
| 575 | + ZonedDateTime now = ZonedDateTime.now(ZoneId.of("Asia/Shanghai")); | ||
| 576 | + | ||
| 577 | + // 定义ISO 8601格式,包含时区信息 | ||
| 578 | + DateTimeFormatter formatter = DateTimeFormatter | ||
| 579 | + .ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX"); | ||
| 580 | + | ||
| 581 | + // 格式化时间 | ||
| 582 | + String timestamp = now.format(formatter); | ||
| 583 | + | ||
| 584 | + UUID uuid = UUID.randomUUID(); | ||
| 585 | + paraAllList.add("signatureNonce=" + uuid); | ||
| 586 | + paraAllList.add("accessKeyId=" + accessKeyId); | ||
| 587 | + paraAllList.add("timestamp=" + timestamp); | ||
| 588 | + | ||
| 589 | + // 排序 | ||
| 590 | + Object[] params = paraAllList.toArray(); | ||
| 591 | + java.util.Arrays.sort(params); | ||
| 592 | + | ||
| 593 | + // 签名 | ||
| 594 | + StringBuffer paramBuffer = new StringBuffer(); | ||
| 595 | + for (Object param : params) { | ||
| 596 | + if (paramBuffer.length() > 0) { | ||
| 597 | + paramBuffer.append("&"); | ||
| 598 | + } | ||
| 599 | + paramBuffer.append(String.valueOf(param)); | ||
| 600 | + } | ||
| 601 | + | ||
| 602 | + String MAC_NAME = "HmacSHA1"; | ||
| 603 | + String ENCODING = "UTF-8"; | ||
| 604 | + byte[] data = null; | ||
| 605 | + byte[] text = null; | ||
| 606 | + String signatureStr = ""; | ||
| 607 | + | ||
| 608 | + try { | ||
| 609 | + data = (key + "&").getBytes(ENCODING); | ||
| 610 | + javax.crypto.SecretKey secretKey = new javax.crypto.spec.SecretKeySpec( | ||
| 611 | + data, MAC_NAME); | ||
| 612 | + javax.crypto.Mac mac = null; | ||
| 613 | + | ||
| 614 | + mac = javax.crypto.Mac.getInstance(MAC_NAME); | ||
| 615 | + mac.init(secretKey); | ||
| 616 | + text = paramBuffer.toString().getBytes(ENCODING); | ||
| 617 | + | ||
| 618 | + byte[] bytes = mac.doFinal(text); | ||
| 619 | + signatureStr = java.util.Base64.getEncoder().encodeToString(bytes); | ||
| 620 | + | ||
| 621 | + log.info("签名值: {}", signatureStr); | ||
| 622 | + } catch (NoSuchAlgorithmException e) { | ||
| 623 | + | ||
| 624 | + log.error("异常: " + e.getMessage()); | ||
| 625 | + return "NG"; | ||
| 626 | + | ||
| 627 | + } catch (InvalidKeyException e) { | ||
| 628 | + | ||
| 629 | + log.error("异常: " + e.getMessage()); | ||
| 630 | + return "NG"; | ||
| 631 | + | ||
| 632 | + } catch (UnsupportedEncodingException e) { | ||
| 633 | + | ||
| 634 | + log.error("异常: " + e.getMessage()); | ||
| 635 | + return "NG"; | ||
| 636 | + } | ||
| 637 | + | ||
| 638 | + Map<String, Object> requestBody = new HashMap<>(); | ||
| 639 | + requestBody.put("signature", signatureStr); | ||
| 640 | + requestBody.put("accessKeyId", accessKeyId); | ||
| 641 | + requestBody.put("signatureNonce", uuid); | ||
| 642 | + requestBody.put("timestamp", timestamp); | ||
| 643 | + | ||
| 644 | + // 你可以通过键来获取值 | ||
| 645 | + Integer code = null; | ||
| 646 | + String message = null; | ||
| 647 | + String accessToken = null; | ||
| 648 | + try { | ||
| 649 | + String response1 = restTempService.postWithHeaderAuth2(url, | ||
| 650 | + requestBody); | ||
| 651 | + log.info("response: " + response1); | ||
| 652 | + | ||
| 653 | + // 使用fastjson2的JSON类来解析JSON字符串为Map | ||
| 654 | + Map<String, Object> map = JSON.parseObject(response1, Map.class); | ||
| 655 | + | ||
| 656 | + code = (Integer) map.get("code"); | ||
| 657 | + message = (String) map.get("message"); | ||
| 658 | + if(code==0){ | ||
| 659 | + // 如果JSON字符串中还嵌套了其他JSON对象,你也可以相应地处理它们 | ||
| 660 | + Map<String, Object> dataMap = (Map<String, Object>) map.get("data"); | ||
| 661 | + accessToken = (String) dataMap.get("accessToken"); | ||
| 662 | + } | ||
| 663 | + | ||
| 664 | + } catch (Exception e) { | ||
| 665 | + log.error("异常: " + e.getMessage()); | ||
| 666 | + return "NG"; | ||
| 667 | + } | ||
| 668 | +// // 输出结果 | ||
| 669 | + log.info("Code: {}", code); | ||
| 670 | + log.info("Message: {}", message); | ||
| 671 | + log.info("Access Token: {}", accessToken); | ||
| 672 | + | ||
| 673 | + return accessToken; | ||
| 674 | + } | ||
| 675 | + | ||
| 676 | + private HttpHeaders getHttpHeaders() { | ||
| 677 | + UUID uuid = UUID.randomUUID(); | ||
| 678 | + HttpHeaders headers = new HttpHeaders(); | ||
| 679 | + //获取token | ||
| 680 | + String tk = getaccessToken(); | ||
| 681 | + // 获取当前的中国时间(东八区) | ||
| 682 | + ZonedDateTime now = ZonedDateTime.now(ZoneId.of("Asia/Shanghai")); | ||
| 683 | + | ||
| 684 | + // 定义ISO 8601格式,包含时区信息 | ||
| 685 | + DateTimeFormatter formatter = DateTimeFormatter | ||
| 686 | + .ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX"); | ||
| 687 | + | ||
| 688 | + // 格式化时间 | ||
| 689 | + String timestamp = now.format(formatter); | ||
| 690 | + | ||
| 691 | + headers.setContentType(MediaType.APPLICATION_JSON); | ||
| 692 | + headers.set("token", tk); | ||
| 693 | + headers.set("signatureNonce", uuid.toString()); | ||
| 694 | + headers.set("timestamp", timestamp); | ||
| 695 | + headers.set("accessKeyId",apiConfigYJ.getAccessKeyId()); | ||
| 696 | + return headers; | ||
| 697 | + } | ||
| 698 | + | ||
| 699 | + private String getTaskRequest(Map<String, Object> taskMap) { | ||
| 700 | + // 创建一个ObjectMapper实例 | ||
| 701 | + ObjectMapper objectMapper = new ObjectMapper(); | ||
| 702 | + String taskRequest = null; | ||
| 703 | + try { | ||
| 704 | + taskRequest = objectMapper.writeValueAsString(taskMap); | ||
| 705 | + } catch (JsonProcessingException e) { | ||
| 706 | + e.printStackTrace(); | ||
| 707 | + // 处理异常或返回错误消息 | ||
| 708 | + } | ||
| 709 | + | ||
| 710 | + log.info("taskRequest-->" + taskRequest); | ||
| 711 | + return taskRequest; | ||
| 712 | + } | ||
| 713 | +} |
| @@ -136,7 +136,7 @@ spring: | @@ -136,7 +136,7 @@ spring: | ||
| 136 | connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 | 136 | connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 |
| 137 | datasource: | 137 | datasource: |
| 138 | master: | 138 | master: |
| 139 | - url: jdbc:mysql://rm-2zeiuncjm75qti641.mysql.rds.aliyuncs.com:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai | 139 | + url: jdbc:mysql://rm-2zeiuncjm75qti641ho.mysql.rds.aliyuncs.com:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai |
| 140 | username: ntsd_root | 140 | username: ntsd_root |
| 141 | password: L3bHRJwg6lJ2SC4WFfGA | 141 | password: L3bHRJwg6lJ2SC4WFfGA |
| 142 | driver-class-name: com.mysql.cj.jdbc.Driver | 142 | driver-class-name: com.mysql.cj.jdbc.Driver |
| @@ -2,4 +2,16 @@ spring: | @@ -2,4 +2,16 @@ spring: | ||
| 2 | application: | 2 | application: |
| 3 | name: jeecg-system | 3 | name: jeecg-system |
| 4 | profiles: | 4 | profiles: |
| 5 | - active: '@profile.name@' | ||
| 5 | + active: '@profile.name@' | ||
| 6 | + | ||
| 7 | +robot: | ||
| 8 | + yunji: | ||
| 9 | + storeId: '202412982974802314947855922176' | ||
| 10 | + accessKeyId: 'imn2zcWgsA6QU1w2' | ||
| 11 | + accessKeySecret: 'bejziWxAhX8vYG9k4x8N0uH760ddlWtm' | ||
| 12 | +# 开放舱deviceName | ||
| 13 | + deviceName: 'SCWM00JS48YF01635' | ||
| 14 | +# 开放舱点位 | ||
| 15 | + pointId: 'standby_1F_SCWM00JS48YF01635' | ||
| 16 | +# 底盘deviceId | ||
| 17 | + deviceId: '1283375168185569280' |
-
请 注册 或 登录 后发表评论