|
@@ -51,6 +51,8 @@ public class BaseGgpFacilityServiceImpl extends AbstractCrudService<BaseGgpFacil
|
|
|
private BaseFacilityTypeMapper baseFacilityTypeMapper;
|
|
|
@Autowired
|
|
|
private DmpProductInfoService dmpProductInfoService;
|
|
|
+ @Autowired
|
|
|
+ private BaseAlarmService baseAlarmService;
|
|
|
|
|
|
@Override
|
|
|
public boolean add(BaseGgpFacility baseGgpFacility) {
|
|
@@ -202,7 +204,7 @@ public class BaseGgpFacilityServiceImpl extends AbstractCrudService<BaseGgpFacil
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public CommonPage<Object> deviceBindInfo(Integer deviceType,String deviceId,Integer id,Integer current,
|
|
|
+ public CommonPage<Object> deviceBindInfo(String deviceType,String deviceId,Integer id,Integer current,
|
|
|
Integer size) {
|
|
|
List<Object> list = new ArrayList<>();
|
|
|
IPage<DmpDeviceInfo> page = new Page<>(current, size);
|
|
@@ -213,7 +215,7 @@ public class BaseGgpFacilityServiceImpl extends AbstractCrudService<BaseGgpFacil
|
|
|
queryWrapper1.select(DmpDeviceInfo::getId, DmpDeviceInfo::getDeviceId,
|
|
|
DmpDeviceInfo::getDeviceName, DmpDeviceInfo::getInstallAddress,DmpDeviceInfo::getDeviceType)
|
|
|
.eq(StringUtils.isNotBlank(deviceId),DmpDeviceInfo::getDeviceId, deviceId)
|
|
|
- .eq(ObjectUtils.isNotEmpty(deviceType),DmpDeviceInfo::getDeviceType,deviceType)
|
|
|
+ .eq(StringUtils.isNotBlank(deviceType),DmpDeviceInfo::getDeviceType,Integer.parseInt(deviceType))
|
|
|
.eq(DmpDeviceInfo::getTenantId,SecurityUtils.getTenantId())
|
|
|
.eq(DmpDeviceInfo::getDeleteFlag,0);
|
|
|
page = dmpDeviceInfoService.page(page,queryWrapper1);
|
|
@@ -288,6 +290,7 @@ public class BaseGgpFacilityServiceImpl extends AbstractCrudService<BaseGgpFacil
|
|
|
@Override
|
|
|
public List<Object> facilityPopInfo(Integer id) {
|
|
|
List<Object> list = new ArrayList<>();
|
|
|
+ List<Object> list5 = new ArrayList<>();
|
|
|
LambdaQueryWrapper<BaseGgpFacility> queryWrapper = Wrappers.lambdaQuery();
|
|
|
queryWrapper.eq(BaseGgpFacility::getId, id);
|
|
|
List<BaseGgpFacility> baseGgpFacilityList = this.list(queryWrapper);
|
|
@@ -305,30 +308,77 @@ public class BaseGgpFacilityServiceImpl extends AbstractCrudService<BaseGgpFacil
|
|
|
for (int i = 0; i < baseFacilityDeviceList.size(); i++) {
|
|
|
deviceIdList.add(baseFacilityDeviceList.get(i).getDeviceId());
|
|
|
}
|
|
|
- QueryWrapper<DmpDeviceInfo> query1 = Wrappers.query();
|
|
|
+ QueryWrapper<BaseAlarm> query1 = Wrappers.query();
|
|
|
query1.select("product_code as productCode","count(id) as count")
|
|
|
.in("device_id",deviceIdList)
|
|
|
- .eq("delete_flag",0)
|
|
|
.groupBy("product_code");
|
|
|
- List<DmpDeviceInfo> dmpDeviceInfoList1 = dmpDeviceInfoService.list(query1);
|
|
|
-
|
|
|
+ List<Map<String, Object>> baseAlarmList = baseAlarmService.listMaps(query1);
|
|
|
+ QueryWrapper<BaseAlarm> query2 = Wrappers.query();
|
|
|
+ query2.select("product_code as productCode","count(id) as count")
|
|
|
+ .in("device_id",deviceIdList)
|
|
|
+ .eq("handle_status",1)
|
|
|
+ .groupBy("product_code");
|
|
|
+ List<Map<String, Object>> baseAlarmList1 = baseAlarmService.listMaps(query2);
|
|
|
+ List<Map<String, Object>> list1 = new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(baseAlarmList)){
|
|
|
+ for (int k = 0; k < baseAlarmList.size(); k++){
|
|
|
+ if (CollectionUtils.isNotEmpty(baseAlarmList1)){
|
|
|
+ for (int l = 0; l < baseAlarmList1.size(); l++){
|
|
|
+ if (baseAlarmList.get(k).get("productCode").equals(baseAlarmList1.get(l).get("productCode"))){
|
|
|
+ int count1 = Integer.parseInt(String.valueOf(baseAlarmList1.get(l).get("count")));
|
|
|
+ int count = Integer.parseInt(String.valueOf(baseAlarmList.get(k).get("count")));
|
|
|
+ double disposalRate = 0;
|
|
|
+ if (count>0){
|
|
|
+ disposalRate = Math.round(count1/count)*100;
|
|
|
+ }
|
|
|
+ Map<String, Object> map1 = new HashMap<>();
|
|
|
+ map1.put("productCode",baseAlarmList.get(k).get("productCode"));
|
|
|
+ map1.put("disposalRate",disposalRate);
|
|
|
+ list1.add(map1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
QueryWrapper<DmpDeviceInfo> query = Wrappers.query();
|
|
|
query.select("product_code as productCode","count(id) as count")
|
|
|
.in("device_id",deviceIdList)
|
|
|
.eq("delete_flag",0)
|
|
|
.groupBy("product_code");
|
|
|
- List<DmpDeviceInfo> dmpDeviceInfoList = dmpDeviceInfoService.list(query);
|
|
|
+ List<Map<String, Object>> dmpDeviceInfoList = dmpDeviceInfoService.listMaps(query);
|
|
|
if (CollectionUtils.isNotEmpty(dmpDeviceInfoList)){
|
|
|
List<String> productCodeList = new ArrayList<>();
|
|
|
for (int j = 0; j < dmpDeviceInfoList.size(); j++) {
|
|
|
- productCodeList.add(dmpDeviceInfoList.get(j).getProductCode());
|
|
|
+ productCodeList.add(String.valueOf(dmpDeviceInfoList.get(j).get("productCode")));
|
|
|
}
|
|
|
LambdaQueryWrapper<DmpProductInfo> queryWrapper2 = Wrappers.lambdaQuery();
|
|
|
queryWrapper2.in(DmpProductInfo::getProductCode, productCodeList);
|
|
|
List<DmpProductInfo> dmpProductInfoList = dmpProductInfoService.list(queryWrapper2);
|
|
|
-
|
|
|
+ if (CollectionUtils.isNotEmpty(dmpProductInfoList)){
|
|
|
+ for (int m = 0; m < dmpProductInfoList.size(); m++){
|
|
|
+ Map<String, Object> map2 = new HashMap<>();
|
|
|
+ map2.put("productName",dmpProductInfoList.get(m).getProductName());
|
|
|
+ for (int n = 0; n < dmpDeviceInfoList.size(); n++){
|
|
|
+ if (dmpProductInfoList.get(m).getProductCode().equals(dmpDeviceInfoList.get(n).get("productCode"))){
|
|
|
+ map2.put("deviceCount",dmpDeviceInfoList.get(n).get("count"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isNotEmpty(list1)){
|
|
|
+ for (int o = 0; o < list1.size(); o++){
|
|
|
+ if (dmpProductInfoList.get(m).getProductCode().equals(list1.get(o).get("productCode"))){
|
|
|
+ map2.put("disposalRate",list1.get(o).get("disposalRate"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ map2.put("disposalRate",0);
|
|
|
+ }
|
|
|
+ list5.add(map2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put("productList",list5);
|
|
|
}
|
|
|
}
|
|
|
+ list.add(map);
|
|
|
return list;
|
|
|
}
|
|
|
}
|