diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java index fdfe2df..be202cf 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java @@ -179,10 +179,8 @@ public class EmInfoServiceImpl extends BaseServiceImpl 0) { - em_info.getParams().forEach(param -> { - param.setInfoId(infoId); - }); + if (em_info.getParams() != null && !em_info.getParams().isEmpty()) { + em_info.getParams().forEach(param -> param.setInfoId(infoId)); paramService.saveBatch(em_info.getParams()); } if (em_info.getIsModel().equals(EquipmentContants.isModelEnum.yes.getValue())) { @@ -277,14 +275,13 @@ public class EmInfoServiceImpl extends BaseServiceImpl data = listR.getData(); Map> stationKeyMap = new HashMap<>(); - for (int i = 0; i < data.size(); i++) { - StationEntity stationEntity = data.get(i); - List collect = list.stream().filter(o -> o.getCreateDept().toString(). - equals(stationEntity.getRefDept().toString())).collect(Collectors.toList()); - if (CollectionUtil.isNotEmpty(collect)) { - stationKeyMap.put(stationEntity.getCode(), collect); - } - } + for (StationEntity stationEntity : data) { + List collect = list.stream().filter(o -> o.getCreateDept().toString(). + equals(stationEntity.getRefDept().toString())).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(collect)) { + stationKeyMap.put(stationEntity.getCode(), collect); + } + } redisTemplate.opsForValue().set(deviceCodePath, JSONObject.toJSONString(stationKeyMap)); } } @@ -293,10 +290,9 @@ public class EmInfoServiceImpl extends BaseServiceImpl> redisStationCode() { Object json = redisTemplate.opsForValue().get(deviceCodePath); if (ObjectUtil.isNotEmpty(json)) { - LinkedHashMap> stringListLinkedHashMap = JSONObject.parseObject(json.toString(), + return JSONObject.parseObject(json.toString(), new TypeReference>>() { }); - return stringListLinkedHashMap; } return null; } @@ -305,10 +301,9 @@ public class EmInfoServiceImpl extends BaseServiceImpl redisCode() { Object json = redisTemplate.opsForValue().get(em_info_list_path); if (ObjectUtil.isNotEmpty(json)) { - List emInfoExtendVos = JSONObject.parseObject(json.toString(), + return JSONObject.parseObject(json.toString(), new TypeReference>() { }); - return emInfoExtendVos; } return null; } @@ -340,7 +335,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl createGroupAndStationTrees(List resultList, List rootNodes) { - if (rootNodes == null || rootNodes.size() < 1) { + if (rootNodes == null || rootNodes.isEmpty()) { return null; } //遍历根节点 @@ -353,7 +348,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl childNodes = listGroupNodeByPids(resultList, rootNode.getId() + "", rootNode.getLevel()); //如果没有数据了,就跳出循环 - if (childNodes == null || childNodes.size() == 0) { + if (childNodes == null || childNodes.isEmpty()) { continue; } //遍历子节点 @@ -384,7 +379,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl modelQw = new QueryWrapper<>(); modelQw.lambda().eq(EmModelEntity::getModelName, modelName); List modelList = modelService.list(modelQw); - if (modelList.size() > 0) { + if (!modelList.isEmpty()) { return R.fail("母版名已存在"); } else { modelEntity.setType(type + ""); @@ -420,18 +415,13 @@ public class EmInfoServiceImpl extends BaseServiceImpl boot, List shutdown) { - boolean refresh = false; if(CollectionUtil.isNotEmpty(boot)){ this.baseMapper.updateBachEmState(boot,1); - refresh = true; } if(CollectionUtil.isNotEmpty(shutdown)){ this.baseMapper.updateBachEmState(shutdown,2); - refresh = true; } - if(!refresh){ - } - } + } /** * 获取设备表建表sql @@ -669,13 +659,12 @@ public class EmInfoServiceImpl extends BaseServiceImpl emInfoList = this.list(queryWrapper); - List result = emInfoList.stream().map(emInfoEntity -> { + return emInfoList.stream().map(emInfoEntity -> { JSONObject object = JSONObject.parseObject(JSON.toJSONString(emInfoEntity)); object.put("disabled", !emCodes.contains(emInfoEntity.getNumber())); - object.put("children",this.getEmInfoTree(deptId,emInfoEntity.getNumber(),emCodes)); + object.put("children", this.getEmInfoTree(deptId,emInfoEntity.getNumber(),emCodes)); return object; }).collect(Collectors.toList()); - return result; } /** @@ -708,7 +697,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl{ - item.setRideCount(1); + item.setRideCount(1.0); item.setInstalledCapacity(0.0); List signages = analys.stream().filter(o-> item.getEmCode().equals(o.getDeviceCode()) && !StringUtil.isEmpty(o.getSignage()) && !StringUtil.isEmpty(o.getRealId())).collect(Collectors.toList()); if(CollectionUtil.isNotEmpty(signages)){ @@ -723,10 +712,10 @@ public class EmInfoServiceImpl extends BaseServiceImpl { -// throw new ServiceException("设备编号已存在"); -// }); - } - - private List getFatherAndSonDevice(EmInfoEntity emInfo, List treeIds){ - List fatherAndSonList = new ArrayList<>(); - List parentSignages = new ArrayList<>(); - List emTreeList = emTreeService.listByIds(treeIds); - for (EmTreeEntity emTree : emTreeList) { - LambdaQueryWrapper emTreeWrapper = new LambdaQueryWrapper(); - emTreeWrapper.eq(EmTreeEntity::getDefinitionId, emTree.getDefinitionId()); - emTreeWrapper.likeRight(EmTreeEntity::getPath, emTree.getPath()); - if (Func.isNotEmpty(emInfo)) { - // 有设备信息说明是导入子设备,防止本级设备二次导入 - emTreeWrapper.ne(EmTreeEntity::getId, emInfo.getTreeId()); - } - - // 获取所有子设备 - List list = emTreeService.list(emTreeWrapper); - if (Func.isNotEmpty(list)) { - fatherAndSonList.addAll(list); - } - - int index = 0; - if (Func.isNotEmpty(emInfo)) { - EmTreeEntity parentEmTree = emTreeService.getById(emInfo.getTreeId()); - // 导入子设备根目录从父设备后面开始 - index = emTree.getPath().indexOf(parentEmTree.getSignage()) + parentEmTree.getSignage().length(); - } - // 通过path获取所有父设备标识,不包括自己 - String parentPath = emTree.getPath().substring(index, emTree.getPath().lastIndexOf("/")); - if (parentPath.length() > 0) { - parentSignages.addAll(Arrays.asList(parentPath.split("/"))); - } - } - - if (Func.isNotEmpty(parentSignages)) { - LambdaQueryWrapper parentWrapper = new LambdaQueryWrapper(); - parentWrapper.eq(EmTreeEntity::getDefinitionId, emTreeList.get(0).getDefinitionId()); - parentWrapper.in(EmTreeEntity::getSignage, parentSignages); - // 通过标识获取父设备 - List parentList = emTreeService.list(parentWrapper); - fatherAndSonList.addAll(parentList); - } - - // 把List结构数据转换成树结构 - Map> fatherAndSonMap = fatherAndSonList.stream().collect(Collectors.groupingBy(EmTreeEntity::getPid)); - fatherAndSonList.forEach(emTree -> { - emTree.setChildren(fatherAndSonMap.get(emTree.getId())); - }); - List resultList = fatherAndSonList.stream().filter(item -> item.getPid() == 0).collect(Collectors.toList()); - return resultList; } - @Override public List getVideoDeviceByEmCode(EmInfoEntity emInfo){ LambdaQueryWrapper emTreeWrapper = new LambdaQueryWrapper(); emTreeWrapper.eq(EmInfoEntity::getEmType, emInfo.getEmType()); emTreeWrapper.eq(EmInfoEntity::getIsDeleted, "0"); - List emInfoEntities = baseMapper.selectList(emTreeWrapper); - return emInfoEntities; + return baseMapper.selectList(emTreeWrapper); } private void copyDeviceTree(StationEntity station, Long pid, Long definitionId, String modelSignage, List treeIds) { diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java index 93315e7..28a5187 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/RealTargetServiceImpl.java @@ -22,12 +22,6 @@ import com.hnac.hzims.scheduled.service.operation.fill.*; import com.hnac.hzims.scheduled.service.operation.home.ModelStationService; import com.hnac.hzims.scheduled.service.operation.home.RealTargetService; import com.hnac.hzims.scheduled.service.operation.plate.DataService; -import com.hnac.hzims.scheduled.service.operation.fill.GenerateService; -import com.hnac.hzims.scheduled.service.operation.fill.PowerService; -import com.hnac.hzims.scheduled.service.operation.fill.UseService; -import com.hnac.hzims.scheduled.service.operation.home.ModelStationService; -import com.hnac.hzims.scheduled.service.operation.home.RealTargetService; -import com.hnac.hzims.scheduled.service.operation.plate.DataService; import com.hnac.hzims.scheduled.service.operation.station.StationAttributeService; import com.hnac.hzims.scheduled.service.operation.station.StationService; import com.hnac.hzinfo.datasearch.PointData; @@ -75,6 +69,8 @@ public class RealTargetServiceImpl implements RealTargetService { private final DataService dataService; + private final WindService windService; + private final PowerService powerService; private final DeviceService deviceService; @@ -112,6 +108,7 @@ public class RealTargetServiceImpl implements RealTargetService { private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target:key"; private final static String loadwaterpump_target_key = "hzims:operation:loadwaterpump:target:key"; private final static String loadwaterpump_real_key = "hzims:operation:loadwaterpump:real:key"; + private final static String loadwaterpump_rain_key = "hzims:operation:loadwaterpump:rain:key"; private final static String loadwater_level_key = "hzims:operation:loadwater:level:key"; private final static String load_photovoltaic_real_key = "hzims:operation:photovoltaic:real:key"; private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key"; @@ -169,10 +166,10 @@ public class RealTargetServiceImpl implements RealTargetService { String param_name = paramEntity.getParamName(); switch (param_name){ case "ct": - item.setCt(Double.valueOf(param.getParamValue())); + item.setCt(Double.parseDouble(paramEntity.getParamValue())); break; case "pt": - item.setPt(Double.valueOf(param.getParamValue())); + item.setPt(Double.valueOf(paramEntity.getParamValue())); break; case "installedCapacity": item.setInstalledCapacity(Double.valueOf(paramEntity.getParamValue())); @@ -870,7 +867,11 @@ public class RealTargetServiceImpl implements RealTargetService { PowerMonthVo generate = new PowerMonthVo(); Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); generate.setStrMonth(DateUtil.format(time, DateUtil.PATTERN_DATE)); - generate.setPower(Float.parseFloat(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount()); + if(StringUtil.isEmpty(record.getVal())){ + generate.setPower(0f); + }else{ + generate.setPower(Float.parseFloat(String.valueOf(Double.parseDouble(record.getVal()) * device.getRideCount()))); + } return generate; }).collect(Collectors.toMap(PowerMonthVo::getStrMonth,PowerMonthVo::getPower)); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java index b941918..28a7be4 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java @@ -82,7 +82,6 @@ public class ShowServiceImpl implements ShowService { private final PlanService planService; private final WindService windService; private final PowerService powerService; - private final WindService windService; private final SolveService solveService; private final OtherService otherService; private final AccessService accessService; diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/DataService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/DataService.java index d94c11d..cdc85b5 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/DataService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/DataService.java @@ -3,6 +3,7 @@ package com.hnac.hzims.scheduled.service.operation.plate; import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO; +import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO; import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO; import org.springblade.core.tool.api.R; @@ -25,7 +26,5 @@ public interface DataService { List periodTargetSignages(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, List signages); - Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, Integer ride ,String signages); - - void multipleTargetData(String startTime, String endTime); + Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, Double ride ,String signages); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/impl/DataServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/impl/DataServiceImpl.java index d53b234..c55036d 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/impl/DataServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/plate/impl/DataServiceImpl.java @@ -204,12 +204,4 @@ public class DataServiceImpl implements DataService { } return Float.parseFloat(String.valueOf(Double.parseDouble(analyseDataTaosVO.getVal()) * ride)); } - - - @Override - public void multipleTargetData(String startTime, String endTime) { - HisDataDeviceDTO his = new HisDataDeviceDTO(); - deviceDataClient.getHisDataByMultipleDeviceCode(his); - } - } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java index 2cee5f9..bf6d557 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/report/impl/ReportServiceImpl.java @@ -243,8 +243,6 @@ public class ReportServiceImpl implements ReportService { * @return */ private List getAreaReportByMon(List deptList, Map> powerMap, List stationList, String mon) { - LocalDateTime startTime = LocalDateTime.parse(mon + "-01 00:00:00", DateUtil.DATETIME_FORMATTER); - LocalDateTime endTime = getEndTime(mon); // 查询所有站点的计划发电量 List planList = this.planPower(stationList, mon); // 站点实际发电量 @@ -287,17 +285,6 @@ public class ReportServiceImpl implements ReportService { } /** - * 获取结束时间 - */ - private LocalDateTime getEndTime(String mon) { - Date date = DateUtil.parse(mon + "-01 00:00:00",DateUtil.DATETIME_FORMAT); - Calendar calendar = Calendar.getInstance(); - calendar.setTime(date); - calendar.add(Calendar.MONTH, 1); - return calendar.getTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); - } - - /** * 获取站点计划发电量 */ private List planPower(List stationList, String mon) { @@ -697,7 +684,7 @@ public class ReportServiceImpl implements ReportService { * @param ride * @return */ - private Double generate(int type,String deviceCode,int ride) { + private Double generate(int type,String deviceCode,double ride) { Calendar calendar = Calendar.getInstance(); calendar.setTime(DateUtil.parse("2024-01-01 00:00:00",DateUtil.PATTERN_DATETIME)); //calendar.setTime(new Date()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java index 2ac7929..900d3d4 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.java @@ -37,9 +37,6 @@ public interface OperAccessTaskMapper extends UserDataScopeBaseMapper getAccessTaskByDisposer(Map params); - @SqlParser(filter = true) - List> getAccessConclusion(Map params); - List selectAccessTask(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("list")List list); List getRepairBill(@Param("deviceCodes") List deviceCodes,@Param("startTime") String startTime, @Param("endTime") String endTime); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml index baa3ca2..e7cf870 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessTaskMapper.xml @@ -181,26 +181,6 @@ group by hoat.`HANDLER` -