diff --git a/pqs-common/common-echarts/src/main/java/com/njcn/echarts/util/DrawPicUtil.java b/pqs-common/common-echarts/src/main/java/com/njcn/echarts/util/DrawPicUtil.java index ba66c83b8..a98a94b95 100644 --- a/pqs-common/common-echarts/src/main/java/com/njcn/echarts/util/DrawPicUtil.java +++ b/pqs-common/common-echarts/src/main/java/com/njcn/echarts/util/DrawPicUtil.java @@ -24,7 +24,7 @@ import java.util.*; public class DrawPicUtil { //目前写死,后续作为配置 - @Value("${DrawPicUtil.URL:http://192.168.1.24:5174/picture}") + @Value("${DrawPicUtil.URL:http://localhost:3008/generate-chart}") private String URL; diff --git a/pqs-common/common-web/src/main/java/com/njcn/web/advice/ResponseAdvice.java b/pqs-common/common-web/src/main/java/com/njcn/web/advice/ResponseAdvice.java index 8f196cf66..c3c67afa6 100644 --- a/pqs-common/common-web/src/main/java/com/njcn/web/advice/ResponseAdvice.java +++ b/pqs-common/common-web/src/main/java/com/njcn/web/advice/ResponseAdvice.java @@ -1,17 +1,13 @@ package com.njcn.web.advice; import com.njcn.common.config.GeneralInfo; -import com.njcn.common.pojo.constant.SecurityConstants; import com.njcn.common.pojo.response.HttpResult; -import com.njcn.common.pojo.constant.LogInfo; import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.utils.ReflectCommonUtil; -import com.njcn.web.utils.RequestUtil; import com.njcn.web.service.ILogService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.MethodParameter; -import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.server.ServerHttpRequest; import org.springframework.http.server.ServerHttpResponse; @@ -19,7 +15,6 @@ import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; import javax.annotation.Nonnull; -import javax.servlet.http.HttpServletRequest; import java.util.Arrays; import java.util.List; diff --git a/pqs-common/common-web/src/main/java/com/njcn/web/service/impl/LogServiceImpl.java b/pqs-common/common-web/src/main/java/com/njcn/web/service/impl/LogServiceImpl.java index 3c8b94bd8..c1b697e26 100644 --- a/pqs-common/common-web/src/main/java/com/njcn/web/service/impl/LogServiceImpl.java +++ b/pqs-common/common-web/src/main/java/com/njcn/web/service/impl/LogServiceImpl.java @@ -84,19 +84,19 @@ public class LogServiceImpl implements ILogService { LogInfoDTO logInfoDTO = new LogInfoDTO(loginName, userName, ip, methodDescribe, operateType, result.equalsIgnoreCase("失败") ? 0 : 1, "", severity, type.equalsIgnoreCase("业务事件") ? 0 : 1, generalInfo.getMicroServiceName(), userIndex, LocalDateTime.now()); publisher.send("/userLog", PubUtils.obj2json(logInfoDTO), 2, false); //推送审计消息功能 - if(severity!=0){ - if(!logInfoDTO.getLoginName().equals(LogInfo.UNKNOWN_USER)){ + if (severity != 0) { + if (!logInfoDTO.getLoginName().equals(LogInfo.UNKNOWN_USER)) { publisher.send("/userLogPush", PubUtils.obj2json(logInfoDTO), 2, false); //发送邮箱功能 - if(severity==2&&logInfoDTO.getResult()==0){ + if (severity == 2 && logInfoDTO.getResult() == 0) { //publisher.send("/userLogEmailPush", PubUtils.obj2json(logInfoDTO), 2, false); } } } //如果存在设备日志注解,则记录设备日志 - if(Objects.nonNull((returnType.getMethod()))&& (returnType.getMethod()).isAnnotationPresent(DeviceLog.class)){ - String deviceOperate = returnType.getMethod().getAnnotation(DeviceLog.class).operateType(); - DeviceLogDTO deviceLogDTO = new DeviceLogDTO(userName,deviceOperate,result.equalsIgnoreCase("失败") ? 0 : 1,"",loginName,userIndex); + if (Objects.nonNull((returnType.getMethod())) && (returnType.getMethod()).isAnnotationPresent(DeviceLog.class)) { + String deviceOperate = returnType.getMethod().getAnnotation(DeviceLog.class).operateType(); + DeviceLogDTO deviceLogDTO = new DeviceLogDTO(userName, deviceOperate, result.equalsIgnoreCase("失败") ? 0 : 1, "", loginName, userIndex); publisher.send("/deviceLog", PubUtils.obj2json(deviceLogDTO), 2, false); } @@ -169,8 +169,8 @@ public class LogServiceImpl implements ILogService { private void auditPush(Integer severity, LogInfoDTO logInfoDTO) { //推送审计消息功能 - if(severity !=0){ - if(!logInfoDTO.getLoginName().equals(LogInfo.UNKNOWN_USER)) { + if (severity != 0) { + if (!logInfoDTO.getLoginName().equals(LogInfo.UNKNOWN_USER)) { publisher.send("/userLogPush", PubUtils.obj2json(logInfoDTO), 2, false); //发送邮箱功能 if (severity == 2 && logInfoDTO.getResult() == 0) { diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/LineDetailMapper.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/LineDetailMapper.java index a9372847b..313ff3379 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/LineDetailMapper.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/LineDetailMapper.java @@ -56,6 +56,7 @@ public interface LineDetailMapper extends BaseMapper { void updateLineRunFlag(@Param("id")String lineId, @Param("runFlag")Integer status); + void updateLineRunFlagBatch(@Param("lineIds") List lineIds, @Param("runFlag") Integer status); /** * 根据监测点信息获取监测点详情(关联终端和母线) @@ -69,4 +70,6 @@ public interface LineDetailMapper extends BaseMapper { * 判断该新能源场站信息是否绑定了测点ID */ Integer checkExistsLineByNewStationId(@Param("newStationId") String newStationId); + + } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/LineMapper.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/LineMapper.java index 05c15ff0f..bcc95fc48 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/LineMapper.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/LineMapper.java @@ -581,4 +581,9 @@ public interface LineMapper extends BaseMapper { List getLineDeviceByDevIds(@Param("powerFlag") Integer powerFlag, @Param("lineIds") List lineIds, @Param("devIds") List devIds); + + /** + * 根据Pid获取所有子节点 + */ + List getSubIdByPid(@Param("pid") String pid); } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineDetailMapper.xml b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineDetailMapper.xml index a6952ab87..236608a74 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineDetailMapper.xml +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/mapper/mapping/LineDetailMapper.xml @@ -101,6 +101,15 @@ where id = #{id} + + update pq_line_detail + set run_flag = #{runFlag} + where id in + + #{item} + + + + + + diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/LineService.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/LineService.java index a6409a6ab..02f4bfb29 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/LineService.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/LineService.java @@ -249,4 +249,13 @@ public interface LineService extends IService { */ List getPollutionLineInfo(List id); + /** + * 根据pid获取所有子节点的ID + */ + List getSubIdByPid(String pid); + + /** + * 终端运行状态修改时,同时调整监测点的运行状态 + */ + void updateLineRunFlag(String id, Integer status); } diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineServiceImpl.java index f309a064d..e23e45afb 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/LineServiceImpl.java @@ -865,6 +865,30 @@ public class LineServiceImpl extends ServiceImpl implements Li return pollutionLineInfoDTOList; } + @Override + public List getSubIdByPid(String pid) { + List subIdList = lineMapper.getSubIdByPid(pid); + if(CollUtil.isNotEmpty(subIdList)){ + return subIdList; + } + return Collections.emptyList(); + } + + @Override + public void updateLineRunFlag(String devId, Integer status) { + List lineIds = new ArrayList<>(); + // 获取母线 + List subLineIds = lineMapper.getSubIdByPid(devId); + // 母线再获取所有监测点id + for (String subLineId : subLineIds) { + List lineIdsTemp = lineMapper.getSubIdByPid(subLineId); + lineIds.addAll(lineIdsTemp); + } + if(CollUtil.isNotEmpty(lineIds)){ + lineDetailMapper.updateLineRunFlagBatch(lineIds, status); + } + } + @Override public List getOverLimitByList(PollutionParamDTO pollutionParamDTO) { diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalMaintainServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalMaintainServiceImpl.java index 4a4da5fd3..73c3368c0 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalMaintainServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalMaintainServiceImpl.java @@ -77,6 +77,7 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService { private final DevFuctionMapper devFuctionMapper; private final CldStatisticsFlowMapper cldStatisticsFlowMapper; + private final LineService lineService; @Override public List getTerminalMainList(TerminalMainQueryParam terminalMainQueryParam) { @@ -139,12 +140,17 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService { @Override public boolean updateRunFlagManage(TerminalParam terminalParam) { + List devIds = terminalParam.getIds(); + if(CollectionUtils.isEmpty(devIds)){ + return true; + } QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.in("id", terminalParam.getIds()); + wrapper.in("id", devIds); List newList = iDeviceService.listByIds(terminalParam.getIds()); boolean b = iDeviceService.update(new LambdaUpdateWrapper() .set(Device::getRunFlag,terminalParam.getRunFlag()) .in(Device::getId,terminalParam.getIds())); + devIds.forEach(id -> {lineService.updateLineRunFlag(id,terminalParam.getRunFlag());}); //添加日志信息 if (b) { List oldList = iDeviceService.list(wrapper); diff --git a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalOnlineRateDataServiceImpl.java b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalOnlineRateDataServiceImpl.java index b3d3454f7..296e54a42 100644 --- a/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalOnlineRateDataServiceImpl.java +++ b/pqs-device/pq-device/pq-device-boot/src/main/java/com/njcn/device/pq/service/impl/TerminalOnlineRateDataServiceImpl.java @@ -299,8 +299,6 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData mapAlarm.put(0,0); } - - for (TerminalOnlineRateDataVO proItem : terminalOnlineRateData) { List gds = proItem.getChildren(); if (CollectionUtil.isNotEmpty(gds)) { diff --git a/pqs-harmonic/harmonic-boot/src/main/resources/bootstrap.yml b/pqs-harmonic/harmonic-boot/src/main/resources/bootstrap.yml index 19cb511ff..db9f602b3 100644 --- a/pqs-harmonic/harmonic-boot/src/main/resources/bootstrap.yml +++ b/pqs-harmonic/harmonic-boot/src/main/resources/bootstrap.yml @@ -35,8 +35,8 @@ spring: - data-id: share-config.yaml refresh: true #数据中心使用 - #- data-Id: share-config-datasource-db.yaml - # refresh: true +# - data-Id: share-config-datasource-db.yaml +# refresh: true #PMS使用 - data-Id: share-config-harmonic-db.yaml refresh: true