add:新增异常设备查询页面
This commit is contained in:
@@ -73,4 +73,13 @@ public class FaultDeviceController {
|
||||
faultDeviceService.syncInfo();
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/getAllerrorDevice")
|
||||
@Log("查询所有设备故障")
|
||||
|
||||
public ResponseEntity<Object> getAllerrorDevice(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(faultDeviceService.getAllerrorDevice(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -82,4 +82,13 @@ public interface FaultDeviceService {
|
||||
* 同步信息
|
||||
*/
|
||||
void syncInfo();
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> getAllerrorDevice(Map whereJson, Pageable page);
|
||||
}
|
||||
|
||||
@@ -326,29 +326,72 @@ public class FaultDeviceServiceImpl implements FaultDeviceService {
|
||||
}
|
||||
|
||||
public Map<String, Object> getAllerrorDevice(Map whereJson, Pageable page) {
|
||||
String device_code = MapUtil.getStr(whereJson, "device_code");
|
||||
String region_code = MapUtil.getStr(whereJson, "region_code");
|
||||
|
||||
UserDeviceService userDeviceService = SpringContextHolder.getBean(UserDeviceService.class);
|
||||
|
||||
String inArea = userDeviceService.getInArea();
|
||||
|
||||
//查询当前人员对应的设备是多少
|
||||
JSONArray device_rows = WQLObject.getWQLObject("em_bi_monitordevice").query("region_code in " + inArea + "").getResultJSONArray(0);
|
||||
List<String> deviceList = new ArrayList<>();
|
||||
for (int i = 0; i < device_rows.size(); i++) {
|
||||
JSONObject row = device_rows.getJSONObject(i);
|
||||
deviceList.add(row.getString("device_code"));
|
||||
String query_sql = "region_code in " + inArea + "";
|
||||
if (StrUtil.isNotEmpty(region_code)) {
|
||||
query_sql += " and region_code='" + region_code + "'";
|
||||
}
|
||||
|
||||
// 调用acs接口获取设备
|
||||
JSONObject result = SpringContextHolder.getBean(WmsToAcsServiceImpl.class).getDeviceErrorInfo(deviceList);
|
||||
JSONArray data = result.getJSONArray("data");
|
||||
WmsToAcsServiceImpl bean = SpringContextHolder.getBean(WmsToAcsServiceImpl.class);
|
||||
|
||||
|
||||
//查询当前人员对应的设备是多少
|
||||
JSONArray b1_rows = WQLObject.getWQLObject("em_bi_monitordevice").query(query_sql + "AND product_area = 'B1'").getResultJSONArray(0);
|
||||
List<String> b1List = new ArrayList<>();
|
||||
for (int i = 0; i < b1_rows.size(); i++) {
|
||||
JSONObject row = b1_rows.getJSONObject(i);
|
||||
b1List.add(row.getString("device_code"));
|
||||
}
|
||||
|
||||
JSONObject result = bean.getDeviceErrorInfo(b1List,"B1");
|
||||
// 调用acs接口获取设备
|
||||
JSONArray b1_data = result.getJSONArray("data");
|
||||
|
||||
JSONArray blk_rows = WQLObject.getWQLObject("em_bi_monitordevice").query(query_sql + "AND product_area = 'BLK'").getResultJSONArray(0);
|
||||
List<String> blkList = new ArrayList<>();
|
||||
for (int i = 0; i < blk_rows.size(); i++) {
|
||||
JSONObject row = blk_rows.getJSONObject(i);
|
||||
blkList.add(row.getString("device_code"));
|
||||
}
|
||||
|
||||
JSONObject result2 = bean.getDeviceErrorInfo(blkList,"BLK");
|
||||
// 调用acs接口获取设备
|
||||
JSONArray blk_data = result2.getJSONArray("data");
|
||||
|
||||
JSONArray data = new JSONArray();
|
||||
if (ObjectUtil.isNotEmpty(b1_data)) {
|
||||
for (int i = 0; i < b1_rows.size(); i++) {
|
||||
JSONObject row = b1_rows.getJSONObject(i);
|
||||
for (int j = 0; j < b1_data.size(); j++) {
|
||||
JSONObject b1 = b1_data.getJSONObject(j);
|
||||
if (b1.getString("device_code").equals(row.getString("device_code"))) {
|
||||
b1.put("region_code", row.getString("region_code"));
|
||||
}
|
||||
data.add(b1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(blk_data)) {
|
||||
for (int i = 0; i < blk_rows.size(); i++) {
|
||||
JSONObject row = blk_rows.getJSONObject(i);
|
||||
for (int j = 0; j < blk_data.size(); j++) {
|
||||
JSONObject blk = blk_data.getJSONObject(j);
|
||||
if (blk.getString("device_code").equals(row.getString("device_code"))) {
|
||||
blk.put("region_code", row.getString("region_code"));
|
||||
}
|
||||
data.add(blk);
|
||||
}
|
||||
}
|
||||
}
|
||||
//查询内包间套轴对接位的异常
|
||||
if (inArea.contains("NBJ")) {
|
||||
IBstIvtCutpointivtService bean = SpringContextHolder.getBean(IBstIvtCutpointivtService.class);
|
||||
List<BstIvtCutpointivt> list = bean.list(new LambdaQueryWrapper<BstIvtCutpointivt>()
|
||||
IBstIvtCutpointivtService bean2 = SpringContextHolder.getBean(IBstIvtCutpointivtService.class);
|
||||
List<BstIvtCutpointivt> list = bean2.list(new LambdaQueryWrapper<BstIvtCutpointivt>()
|
||||
.eq(BstIvtCutpointivt::getPoint_type, "1")
|
||||
.eq(BstIvtCutpointivt::getIs_used, "1")
|
||||
.ne(BstIvtCutpointivt::getRemark, "")
|
||||
@@ -358,6 +401,7 @@ public class FaultDeviceServiceImpl implements FaultDeviceService {
|
||||
JSONObject row = new JSONObject();
|
||||
row.put("device_code", a.getPoint_code());
|
||||
row.put("device_name", a.getPoint_code());
|
||||
row.put("region_code", "NBJ");
|
||||
row.put("error_code", "");
|
||||
row.put("error_message", a.getRemark());
|
||||
data.add(row);
|
||||
|
||||
@@ -155,5 +155,5 @@ public interface WmsToAcsService {
|
||||
*/
|
||||
JSONObject queryBoxWeigh(JSONObject jo);
|
||||
|
||||
JSONObject getDeviceErrorInfo(List<String> list);
|
||||
JSONObject getDeviceErrorInfo(List<String> list,String product_area);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.wms.ext.acs.service.impl;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -520,7 +521,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceErrorInfo(List<String> list) {
|
||||
public JSONObject getDeviceErrorInfo(List<String> list,String product_area) {
|
||||
String api = "api/wms/getDeviceErrorInfo";
|
||||
//判断是否连接ACS系统
|
||||
String isConnect = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_connect_acs").getValue();
|
||||
@@ -532,8 +533,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
return result;
|
||||
}
|
||||
|
||||
String product_area = "LK";
|
||||
|
||||
String acs_url = URLEnum.find(product_area);
|
||||
if (StrUtil.isEmpty(acs_url)) {
|
||||
log.info(product_area);
|
||||
@@ -543,7 +542,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
String url = acs_url + api;
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(String.valueOf(list))
|
||||
.body(JSON.toJSONString(list))
|
||||
.execute().body();
|
||||
result = JSONObject.parseObject(resultMsg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user