|
@@ -3,6 +3,7 @@ package com.github.zuihou.tenant.service.impl;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.github.zuihou.authority.entity.auth.User;
|
|
@@ -17,6 +18,7 @@ import com.github.zuihou.authority.utils.XxlJobUtil;
|
|
|
import com.github.zuihou.base.service.SuperCacheServiceImpl;
|
|
|
import com.github.zuihou.common.constant.BizConstant;
|
|
|
import com.github.zuihou.common.constant.CacheKey;
|
|
|
+import com.github.zuihou.common.constant.DictionaryKey;
|
|
|
import com.github.zuihou.common.constant.DictionaryType;
|
|
|
import com.github.zuihou.common.util.StringUtil;
|
|
|
import com.github.zuihou.context.BaseContextHandler;
|
|
@@ -45,8 +47,12 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
+import org.springframework.http.HttpEntity;
|
|
|
+import org.springframework.http.HttpHeaders;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
@@ -102,6 +108,9 @@ public class ProductionresourceServiceImpl extends SuperCacheServiceImpl<Product
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RestTemplate restTemplate;
|
|
|
+
|
|
|
@Value("${xxl.job.admin.addresses}")
|
|
|
private String jobAdminUrl;
|
|
|
@Value("${xxl.job.login.username}")
|
|
@@ -161,10 +170,10 @@ public class ProductionresourceServiceImpl extends SuperCacheServiceImpl<Product
|
|
|
//需要查询状态
|
|
|
String resourceStatus = map.get("resourceStatus")==null?"":map.get("resourceStatus").toString();
|
|
|
String gatherSql = "";
|
|
|
- if("1".equals(resourceStatus)){
|
|
|
- gatherSql = getGatherSQL();
|
|
|
- map.put("gatherSql",gatherSql);
|
|
|
- }
|
|
|
+// if("1".equals(resourceStatus)){
|
|
|
+// gatherSql = getGatherSQL();
|
|
|
+// map.put("gatherSql",gatherSql);
|
|
|
+// }
|
|
|
|
|
|
String getOrgIds = this.getOrgIds();
|
|
|
if(StringUtil.isNotEmpty(getOrgIds)){
|
|
@@ -803,21 +812,26 @@ public class ProductionresourceServiceImpl extends SuperCacheServiceImpl<Product
|
|
|
Map<String, DictionaryItem> productionMap = dictMap.get(DictionaryType.PRODUCTION_STATUS);
|
|
|
Map<String, DictionaryItem> categoryMap = dictMap.get(DictionaryType.RESOURCES_CATEGORY);
|
|
|
|
|
|
+
|
|
|
+ Map <String,Map>equipMap = getEquipListByInterface();
|
|
|
list.stream().map((item) -> {
|
|
|
//把三种状态,拼对象进去
|
|
|
- String linkStatus = item.get("linkStatus")==null?"0":item.get("linkStatus").toString();
|
|
|
- String controlStatus = item.get("controlStatus")==null?"0":item.get("controlStatus").toString();
|
|
|
- String productionStatus = item.get("productionStatus")==null?"0":item.get("productionStatus").toString();
|
|
|
+// String linkStatus = item.get("linkStatus")==null?"0":item.get("linkStatus").toString();
|
|
|
+// String controlStatus = item.get("controlStatus")==null?"0":item.get("controlStatus").toString();
|
|
|
+// String productionStatus = item.get("productionStatus")==null?"0":item.get("productionStatus").toString();
|
|
|
+ String no = item.get("code").toString();
|
|
|
+ String controlStatus = equipMap.get(no)==null?"":equipMap.get(no).get("controlStatus").toString();
|
|
|
+ String productionStatus = equipMap.get(no)==null?"":equipMap.get(no).get("status").toString();
|
|
|
|
|
|
//String category = item.get("category")==null?"":item.get("category").toString();
|
|
|
|
|
|
String showStatus = item.get("showStatus")==null?"0":item.get("showStatus").toString();
|
|
|
if("1".equals(showStatus)){
|
|
|
- item.put("linkStatus",buildMap(linkMap.get(linkStatus)));
|
|
|
+// item.put("linkStatus",buildMap(linkMap.get(linkStatus)));
|
|
|
item.put("controlStatus",buildMap(controlMap.get(controlStatus)));
|
|
|
item.put("productionStatus",buildMap(productionMap.get(productionStatus)));
|
|
|
}else {
|
|
|
- item.put("linkStatus","");
|
|
|
+// item.put("linkStatus","");
|
|
|
item.put("controlStatus","");
|
|
|
item.put("productionStatus","");
|
|
|
}
|
|
@@ -1028,4 +1042,37 @@ public class ProductionresourceServiceImpl extends SuperCacheServiceImpl<Product
|
|
|
params.put("name","保障中心_上下料站");
|
|
|
return baseMapper.getStations(params);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过接口获取
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Map getEquipListByInterface() {
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
|
|
|
+ HttpEntity<String> formEntity = new HttpEntity<String>("", headers);
|
|
|
+ String instructionUrl = DictionaryKey.INSTRUCTION_URL + "/api/getEquipment" ;
|
|
|
+ String returnData = restTemplate.postForObject(instructionUrl, formEntity, String.class);
|
|
|
+ //TODO
|
|
|
+ Map<String,Map>returnMap = new HashMap<>();
|
|
|
+ if(StringUtil.isNotEmpty(returnData)){
|
|
|
+ JSONArray jsonArray = JSONArray.parseArray(returnData);
|
|
|
+ for(Object obj:jsonArray){
|
|
|
+ if(obj!=null){
|
|
|
+ JSONObject jsonObject = (JSONObject)obj;
|
|
|
+ String no = jsonObject.getString("SerialNo");
|
|
|
+ String status = jsonObject.getString("Status");
|
|
|
+ String controlStatus = jsonObject.getString("ControlStatus");
|
|
|
+ Map childMap = new HashMap();
|
|
|
+ childMap.put("no",no);
|
|
|
+ childMap.put("status",status);
|
|
|
+ childMap.put("controlStatus",controlStatus);
|
|
|
+ returnMap.put(no,childMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return returnMap;
|
|
|
+ }
|
|
|
}
|