1
This commit is contained in:
@@ -24,7 +24,7 @@ import java.util.*;
|
|||||||
public class DrawPicUtil {
|
public class DrawPicUtil {
|
||||||
|
|
||||||
//目前写死,后续作为配置
|
//目前写死,后续作为配置
|
||||||
@Value("${DrawPicUtil.URL:http://192.168.1.24:5174/picture}")
|
@Value("${DrawPicUtil.URL:http://localhost:3008/generate-chart}")
|
||||||
private String URL;
|
private String URL;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
package com.njcn.web.advice;
|
package com.njcn.web.advice;
|
||||||
|
|
||||||
import com.njcn.common.config.GeneralInfo;
|
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.response.HttpResult;
|
||||||
import com.njcn.common.pojo.constant.LogInfo;
|
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.utils.ReflectCommonUtil;
|
import com.njcn.common.utils.ReflectCommonUtil;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
|
||||||
import com.njcn.web.service.ILogService;
|
import com.njcn.web.service.ILogService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.core.MethodParameter;
|
import org.springframework.core.MethodParameter;
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.server.ServerHttpRequest;
|
import org.springframework.http.server.ServerHttpRequest;
|
||||||
import org.springframework.http.server.ServerHttpResponse;
|
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 org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -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());
|
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);
|
publisher.send("/userLog", PubUtils.obj2json(logInfoDTO), 2, false);
|
||||||
//推送审计消息功能
|
//推送审计消息功能
|
||||||
if(severity!=0){
|
if (severity != 0) {
|
||||||
if(!logInfoDTO.getLoginName().equals(LogInfo.UNKNOWN_USER)){
|
if (!logInfoDTO.getLoginName().equals(LogInfo.UNKNOWN_USER)) {
|
||||||
publisher.send("/userLogPush", PubUtils.obj2json(logInfoDTO), 2, false);
|
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);
|
//publisher.send("/userLogEmailPush", PubUtils.obj2json(logInfoDTO), 2, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//如果存在设备日志注解,则记录设备日志
|
//如果存在设备日志注解,则记录设备日志
|
||||||
if(Objects.nonNull((returnType.getMethod()))&& (returnType.getMethod()).isAnnotationPresent(DeviceLog.class)){
|
if (Objects.nonNull((returnType.getMethod())) && (returnType.getMethod()).isAnnotationPresent(DeviceLog.class)) {
|
||||||
String deviceOperate = returnType.getMethod().getAnnotation(DeviceLog.class).operateType();
|
String deviceOperate = returnType.getMethod().getAnnotation(DeviceLog.class).operateType();
|
||||||
DeviceLogDTO deviceLogDTO = new DeviceLogDTO(userName,deviceOperate,result.equalsIgnoreCase("失败") ? 0 : 1,"",loginName,userIndex);
|
DeviceLogDTO deviceLogDTO = new DeviceLogDTO(userName, deviceOperate, result.equalsIgnoreCase("失败") ? 0 : 1, "", loginName, userIndex);
|
||||||
publisher.send("/deviceLog", PubUtils.obj2json(deviceLogDTO), 2, false);
|
publisher.send("/deviceLog", PubUtils.obj2json(deviceLogDTO), 2, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -169,8 +169,8 @@ public class LogServiceImpl implements ILogService {
|
|||||||
|
|
||||||
private void auditPush(Integer severity, LogInfoDTO logInfoDTO) {
|
private void auditPush(Integer severity, LogInfoDTO logInfoDTO) {
|
||||||
//推送审计消息功能
|
//推送审计消息功能
|
||||||
if(severity !=0){
|
if (severity != 0) {
|
||||||
if(!logInfoDTO.getLoginName().equals(LogInfo.UNKNOWN_USER)) {
|
if (!logInfoDTO.getLoginName().equals(LogInfo.UNKNOWN_USER)) {
|
||||||
publisher.send("/userLogPush", PubUtils.obj2json(logInfoDTO), 2, false);
|
publisher.send("/userLogPush", PubUtils.obj2json(logInfoDTO), 2, false);
|
||||||
//发送邮箱功能
|
//发送邮箱功能
|
||||||
if (severity == 2 && logInfoDTO.getResult() == 0) {
|
if (severity == 2 && logInfoDTO.getResult() == 0) {
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ public interface LineDetailMapper extends BaseMapper<LineDetail> {
|
|||||||
|
|
||||||
void updateLineRunFlag(@Param("id")String lineId, @Param("runFlag")Integer status);
|
void updateLineRunFlag(@Param("id")String lineId, @Param("runFlag")Integer status);
|
||||||
|
|
||||||
|
void updateLineRunFlagBatch(@Param("lineIds") List<String> lineIds, @Param("runFlag") Integer status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据监测点信息获取监测点详情(关联终端和母线)
|
* 根据监测点信息获取监测点详情(关联终端和母线)
|
||||||
@@ -69,4 +70,6 @@ public interface LineDetailMapper extends BaseMapper<LineDetail> {
|
|||||||
* 判断该新能源场站信息是否绑定了测点ID
|
* 判断该新能源场站信息是否绑定了测点ID
|
||||||
*/
|
*/
|
||||||
Integer checkExistsLineByNewStationId(@Param("newStationId") String newStationId);
|
Integer checkExistsLineByNewStationId(@Param("newStationId") String newStationId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -581,4 +581,9 @@ public interface LineMapper extends BaseMapper<Line> {
|
|||||||
List<DevDetailVO> getLineDeviceByDevIds(@Param("powerFlag") Integer powerFlag,
|
List<DevDetailVO> getLineDeviceByDevIds(@Param("powerFlag") Integer powerFlag,
|
||||||
@Param("lineIds") List<String> lineIds,
|
@Param("lineIds") List<String> lineIds,
|
||||||
@Param("devIds") List<String> devIds);
|
@Param("devIds") List<String> devIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据Pid获取所有子节点
|
||||||
|
*/
|
||||||
|
List<String> getSubIdByPid(@Param("pid") String pid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,15 @@
|
|||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updateLineRunFlagBatch" >
|
||||||
|
update pq_line_detail
|
||||||
|
set run_flag = #{runFlag}
|
||||||
|
where id in
|
||||||
|
<foreach item="item" collection="lineIds" index="index" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
<select id="checkExistsLineByNewStationId" resultType="int">
|
<select id="checkExistsLineByNewStationId" resultType="int">
|
||||||
select count(1) from pq_line pl inner join pq_line_detail pld
|
select count(1) from pq_line pl inner join pq_line_detail pld
|
||||||
on pl.id = pld.id and pl.State = 1 and pld.New_Station_Id = #{newStationId}
|
on pl.id = pld.id and pl.State = 1 and pld.New_Station_Id = #{newStationId}
|
||||||
|
|||||||
@@ -104,6 +104,7 @@
|
|||||||
<if test="lineGrade != null and lineGrade != ''">
|
<if test="lineGrade != null and lineGrade != ''">
|
||||||
and pld.Line_Grade = #{lineGrade}
|
and pld.Line_Grade = #{lineGrade}
|
||||||
</if>
|
</if>
|
||||||
|
order by line.sort
|
||||||
</select>
|
</select>
|
||||||
<select id="getAlarmAlgoDescribe" resultType="com.njcn.device.pq.pojo.vo.AlarmStrategyVO">
|
<select id="getAlarmAlgoDescribe" resultType="com.njcn.device.pq.pojo.vo.AlarmStrategyVO">
|
||||||
SELECT
|
SELECT
|
||||||
|
|||||||
@@ -1893,4 +1893,9 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getSubIdByPid" resultType="String">
|
||||||
|
SELECT id from pq_line where pid = #{pid}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -246,4 +246,13 @@ public interface LineService extends IService<Line> {
|
|||||||
*/
|
*/
|
||||||
List<PollutionLineInfoDTO> getPollutionLineInfo(List<String> id);
|
List<PollutionLineInfoDTO> getPollutionLineInfo(List<String> id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据pid获取所有子节点的ID
|
||||||
|
*/
|
||||||
|
List<String> getSubIdByPid(String pid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终端运行状态修改时,同时调整监测点的运行状态
|
||||||
|
*/
|
||||||
|
void updateLineRunFlag(String id, Integer status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -847,6 +847,30 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
return pollutionLineInfoDTOList;
|
return pollutionLineInfoDTOList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getSubIdByPid(String pid) {
|
||||||
|
List<String> subIdList = lineMapper.getSubIdByPid(pid);
|
||||||
|
if(CollUtil.isNotEmpty(subIdList)){
|
||||||
|
return subIdList;
|
||||||
|
}
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateLineRunFlag(String devId, Integer status) {
|
||||||
|
List<String> lineIds = new ArrayList<>();
|
||||||
|
// 获取母线
|
||||||
|
List<String> subLineIds = lineMapper.getSubIdByPid(devId);
|
||||||
|
// 母线再获取所有监测点id
|
||||||
|
for (String subLineId : subLineIds) {
|
||||||
|
List<String> lineIdsTemp = lineMapper.getSubIdByPid(subLineId);
|
||||||
|
lineIds.addAll(lineIdsTemp);
|
||||||
|
}
|
||||||
|
if(CollUtil.isNotEmpty(lineIds)){
|
||||||
|
lineDetailMapper.updateLineRunFlagBatch(lineIds, status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Overlimit> getOverLimitByList(PollutionParamDTO pollutionParamDTO) {
|
public List<Overlimit> getOverLimitByList(PollutionParamDTO pollutionParamDTO) {
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService {
|
|||||||
private final DevFuctionMapper devFuctionMapper;
|
private final DevFuctionMapper devFuctionMapper;
|
||||||
|
|
||||||
private final CldStatisticsFlowMapper cldStatisticsFlowMapper;
|
private final CldStatisticsFlowMapper cldStatisticsFlowMapper;
|
||||||
|
private final LineService lineService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TerminalMaintainVO> getTerminalMainList(TerminalMainQueryParam terminalMainQueryParam) {
|
public List<TerminalMaintainVO> getTerminalMainList(TerminalMainQueryParam terminalMainQueryParam) {
|
||||||
@@ -139,12 +140,17 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateRunFlagManage(TerminalParam terminalParam) {
|
public boolean updateRunFlagManage(TerminalParam terminalParam) {
|
||||||
|
List<String> devIds = terminalParam.getIds();
|
||||||
|
if(CollectionUtils.isEmpty(devIds)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
QueryWrapper<Device> wrapper = new QueryWrapper<>();
|
QueryWrapper<Device> wrapper = new QueryWrapper<>();
|
||||||
wrapper.in("id", terminalParam.getIds());
|
wrapper.in("id", devIds);
|
||||||
List<Device> newList = iDeviceService.listByIds(terminalParam.getIds());
|
List<Device> newList = iDeviceService.listByIds(terminalParam.getIds());
|
||||||
boolean b = iDeviceService.update(new LambdaUpdateWrapper<Device>()
|
boolean b = iDeviceService.update(new LambdaUpdateWrapper<Device>()
|
||||||
.set(Device::getRunFlag,terminalParam.getRunFlag())
|
.set(Device::getRunFlag,terminalParam.getRunFlag())
|
||||||
.in(Device::getId,terminalParam.getIds()));
|
.in(Device::getId,terminalParam.getIds()));
|
||||||
|
devIds.forEach(id -> {lineService.updateLineRunFlag(id,terminalParam.getRunFlag());});
|
||||||
//添加日志信息
|
//添加日志信息
|
||||||
if (b) {
|
if (b) {
|
||||||
List<Device> oldList = iDeviceService.list(wrapper);
|
List<Device> oldList = iDeviceService.list(wrapper);
|
||||||
|
|||||||
@@ -299,8 +299,6 @@ public class TerminalOnlineRateDataServiceImpl implements TerminalOnlineRateData
|
|||||||
mapAlarm.put(0,0);
|
mapAlarm.put(0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (TerminalOnlineRateDataVO proItem : terminalOnlineRateData) {
|
for (TerminalOnlineRateDataVO proItem : terminalOnlineRateData) {
|
||||||
List<TerminalOnlineRateDataVO> gds = proItem.getChildren();
|
List<TerminalOnlineRateDataVO> gds = proItem.getChildren();
|
||||||
if (CollectionUtil.isNotEmpty(gds)) {
|
if (CollectionUtil.isNotEmpty(gds)) {
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ spring:
|
|||||||
- data-id: share-config.yaml
|
- data-id: share-config.yaml
|
||||||
refresh: true
|
refresh: true
|
||||||
#数据中心使用
|
#数据中心使用
|
||||||
#- data-Id: share-config-datasource-db.yaml
|
# - data-Id: share-config-datasource-db.yaml
|
||||||
# refresh: true
|
# refresh: true
|
||||||
#PMS使用
|
#PMS使用
|
||||||
- data-Id: share-config-harmonic-db.yaml
|
- data-Id: share-config-harmonic-db.yaml
|
||||||
refresh: true
|
refresh: true
|
||||||
|
|||||||
Reference in New Issue
Block a user