|
@@ -0,0 +1,64 @@
|
|
|
|
+package com.github.zuihou.business.controller.externalApi;
|
|
|
|
+
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.github.zuihou.base.R;
|
|
|
|
+import com.github.zuihou.business.productionResourceCenter.dao.ProductionresourceBizMapper;
|
|
|
|
+import com.github.zuihou.context.BaseContextHandler;
|
|
|
|
+import com.github.zuihou.log.annotation.SysLog;
|
|
|
|
+import com.github.zuihou.tenant.entity.Productionresource;
|
|
|
|
+import com.github.zuihou.tenant.service.ProductionresourceService;
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * <p>
|
|
|
|
+ * 前端控制器
|
|
|
|
+ * 产线设备信息同步
|
|
|
|
+ * </p>
|
|
|
|
+ *
|
|
|
|
+ * @author imcs
|
|
|
|
+ * @date 2022-07-27
|
|
|
|
+ */
|
|
|
|
+@Slf4j
|
|
|
|
+@Validated
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("/synStatus")
|
|
|
|
+@Api(value = "AgvInfo", tags = "agv交互")
|
|
|
|
+@SysLog(enabled = true)
|
|
|
|
+public class SynProductionStatus {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private ProductionresourceService productionresourceService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ProductionresourceBizMapper productionresourceBizMapper;
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "设备状态同步", notes = "设备状态同步")
|
|
|
|
+ @PostMapping("/synProductionStatus")
|
|
|
|
+ public R agvCallback(@RequestBody Map<String, String> data) {
|
|
|
|
+ log.info("接收到设备状态集合信息,参数是{}", data.toString());
|
|
|
|
+
|
|
|
|
+ String productionStatus = data.get("productionStatus");
|
|
|
|
+ List<Productionresource> productionResources = JSONArray.parseArray(productionStatus,Productionresource.class);
|
|
|
|
+ productionresourceService.updateBatchById(productionResources);
|
|
|
|
+
|
|
|
|
+ BaseContextHandler.setTenant("0000");
|
|
|
|
+
|
|
|
|
+ List<com.github.zuihou.business.productionResourceCenter.entity.Productionresource> bizProductionResources = JSONArray.parseArray(productionStatus, com.github.zuihou.business.productionResourceCenter.entity.Productionresource.class);
|
|
|
|
+ for(com.github.zuihou.business.productionResourceCenter.entity.Productionresource bizProductionResource : bizProductionResources){
|
|
|
|
+ productionresourceBizMapper.updateById(bizProductionResource);
|
|
|
|
+ }
|
|
|
|
+ return R.success();
|
|
|
|
+ }
|
|
|
|
+}
|