1.调整河北pms国网上送主配网逻辑

2.技术监督调整
This commit is contained in:
2024-03-12 10:38:55 +08:00
parent af4600f0e9
commit 4b09070081
50 changed files with 1058 additions and 564 deletions

View File

@@ -39,7 +39,7 @@ public interface CommLedgerDeptClient {
@GetMapping("/existMonitorDeptTree") @GetMapping("/existMonitorDeptTree")
public HttpResult<List<String>> existMonitorDeptTree(); HttpResult<List<Dept>> existMonitorDeptTree();
} }

View File

@@ -38,7 +38,7 @@ public class CommLedgerDeptClientFallbackFactory implements FallbackFactory<Comm
} }
@Override @Override
public HttpResult<List<String>> existMonitorDeptTree() { public HttpResult<List<Dept>> existMonitorDeptTree() {
log.error("{}异常,降级处理,异常为:{}", "获取存在投运监测点的部门id集合", throwable.toString()); log.error("{}异常,降级处理,异常为:{}", "获取存在投运监测点的部门id集合", throwable.toString());
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }

View File

@@ -162,9 +162,9 @@ public class PmsLedgerDeptController extends BaseController {
@OperateInfo(info = LogEnum.SYSTEM_COMMON) @OperateInfo(info = LogEnum.SYSTEM_COMMON)
@GetMapping("/existMonitorDeptTree") @GetMapping("/existMonitorDeptTree")
@ApiOperation("获取部门树(存在监测点的)") @ApiOperation("获取部门树(存在监测点的)")
public HttpResult<List<String>> existMonitorDeptTree() { public HttpResult<List<Dept>> existMonitorDeptTree() {
String methodDescribe = getMethodDescribe("existMonitorDeptTree"); String methodDescribe = getMethodDescribe("existMonitorDeptTree");
List<String> result = iMonitorService.existMonitorDeptTree(); List<Dept> result = iMonitorService.existMonitorDeptTree();
//删除返回失败查不到数据返回空数组兼容治理项目没有部门直接报错的bug //删除返回失败查不到数据返回空数组兼容治理项目没有部门直接报错的bug
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);

View File

@@ -14,6 +14,7 @@ import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.vo.MonitorVO; import com.njcn.device.pms.pojo.vo.MonitorVO;
import com.njcn.device.pms.pojo.vo.PmsMonitorVO; import com.njcn.device.pms.pojo.vo.PmsMonitorVO;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.user.pojo.po.Dept;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@@ -195,5 +196,5 @@ public interface IMonitorService extends IService<Monitor> {
* @author cdf * @author cdf
* @date 2024/2/26 * @date 2024/2/26
*/ */
List<String> existMonitorDeptTree(); List<Dept> existMonitorDeptTree();
} }

View File

@@ -603,14 +603,13 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
} }
@Override @Override
public List<String> existMonitorDeptTree() { public List<Dept> existMonitorDeptTree() {
DictData dictData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.LINE_STATE.getName(), DicDataEnum.RUN.getName()).getData(); DictData dictData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.LINE_STATE.getName(), DicDataEnum.RUN.getName()).getData();
List<Dept> deptList = deptFeignClient.getAllDept().getData(); List<Dept> deptList = deptFeignClient.getAllDept().getData();
List<String> monitorList = this.lambdaQuery().select(Monitor::getOrgId).eq(Monitor::getMonitorState,dictData.getId()).list().stream().map(Monitor::getOrgId).distinct().collect(Collectors.toList()); List<String> monitorList = this.lambdaQuery().select(Monitor::getOrgId).eq(Monitor::getMonitorState,dictData.getId()).list().stream().map(Monitor::getOrgId).distinct().collect(Collectors.toList());
List<Dept> deptTem = deptList.stream().filter(it->monitorList.contains(it.getCode())).collect(Collectors.toList()); List<Dept> deptTem = deptList.stream().filter(it->monitorList.contains(it.getCode())).collect(Collectors.toList());
List<String> resultDeptId = deptTem.stream().map(item->item.getPids().split(",")).flatMap(Arrays::stream).distinct().collect(Collectors.toList());
resultDeptId.addAll(deptTem.stream().map(Dept::getId).collect(Collectors.toList())); return deptTem;
return resultDeptId;
} }

View File

@@ -109,6 +109,8 @@ public class RUploadSubstationStatisticalDataD {
@MppMultiId @MppMultiId
private String statisticalType; private String statisticalType;
private String statisticalMonth;
/** /**
* 上送状态(0:未上送 1:已上送) * 上送状态(0:未上送 1:已上送)
*/ */

View File

@@ -29,10 +29,9 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils; import org.apache.commons.collections4.ListUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Arrays; import java.time.LocalDate;
import java.util.List; import java.time.format.DateTimeFormatter;
import java.util.Map; import java.util.*;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -136,12 +135,17 @@ public class RSubstationStatisticalDataServiceImpl extends ServiceImpl<RUploadSu
default: default:
break; break;
} }
lambdaQueryWrapper.eq(RUploadSubstationStatisticalDataD::getStatisticalType,param.getDataType());
return lambdaQueryWrapper; return lambdaQueryWrapper;
} }
private String formatBeginMonth(String searchBeginTime, String dataType) { private String formatBeginMonth(String searchBeginTime, String dataType) {
if (Objects.equals(dataType, "02")) { if (Objects.equals(dataType, "02")) {
return DateUtil.format(DateUtil.beginOfMonth(DateUtil.parse(searchBeginTime, DatePattern.NORM_MONTH_PATTERN)), DatePattern.NORM_MONTH_PATTERN); return DateUtil.format(DateUtil.beginOfMonth(DateUtil.parse(searchBeginTime, DatePattern.NORM_MONTH_PATTERN)), DatePattern.NORM_MONTH_PATTERN);
}else if(Objects.equals(dataType, "01")){
String year = DateUtil.format(DateUtil.parse(searchBeginTime,DatePattern.NORM_DATE_PATTERN),DatePattern.NORM_YEAR_PATTERN);
String month = DateUtil.format(new Date(),DatePattern.NORM_MONTH_PATTERN).split("-")[1];
return year+"-"+month;
} }
return searchBeginTime; return searchBeginTime;
} }

View File

@@ -1,29 +1,29 @@
package com.njcn.executor.handler; //package com.njcn.executor.handler;
//
import com.njcn.prepare.harmonic.api.line.ThsSuperviseClient; //import com.njcn.prepare.harmonic.api.line.ThsSuperviseClient;
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam; //import com.njcn.process.pojo.param.SuperviseParam;
import com.xxl.job.core.handler.annotation.XxlJob; //import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.RequiredArgsConstructor; //import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; //import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; //import org.springframework.stereotype.Component;
//
/** ///**
* 每日生成技术监督任务 // * 每日生成技术监督任务
* // *
* @author Lee // * @author Lee
* @date 2023/04/11 // * @date 2023/04/11
*/ // */
@Slf4j //@Slf4j
@Component //@Component
@RequiredArgsConstructor //@RequiredArgsConstructor
public class ThsSuperviseJob { //public class ThsSuperviseJob {
//
private final ThsSuperviseClient thsSuperviseClient; // private final ThsSuperviseClient thsSuperviseClient;
//
@XxlJob("thsSuperviseJob") // @XxlJob("thsSuperviseJob")
public void thsSuperviseJob() { // public void thsSuperviseJob() {
SuperviseParam superviseParam = new SuperviseParam(); // SuperviseParam superviseParam = new SuperviseParam();
superviseParam.setInitType(0); // superviseParam.setInitType(0);
thsSuperviseClient.creatSupervise(superviseParam); // thsSuperviseClient.creatSupervise(superviseParam);
} // }
} //}

View File

@@ -1,36 +1,36 @@
package com.njcn.prepare.harmonic.api.line; //package com.njcn.prepare.harmonic.api.line;
//
import com.njcn.common.pojo.constant.ServerInfo; //import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult; //import com.njcn.common.pojo.response.HttpResult;
import com.njcn.prepare.harmonic.api.line.fallback.ThsSuperviseClientFallbackFactory; //import com.njcn.prepare.harmonic.api.line.fallback.ThsSuperviseClientFallbackFactory;
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam; //import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
import org.springframework.cloud.openfeign.FeignClient; //import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated; //import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; //import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; //import org.springframework.web.bind.annotation.RequestBody;
//
@FeignClient( //@FeignClient(
value = ServerInfo.PREPARE_BOOT,//对应模块名 // value = ServerInfo.PREPARE_BOOT,//对应模块名
path = "/thsSupervise",//对应controller请求类 // path = "/thsSupervise",//对应controller请求类
fallbackFactory = ThsSuperviseClientFallbackFactory.class//服务降级处理类 // fallbackFactory = ThsSuperviseClientFallbackFactory.class//服务降级处理类
) //)
public interface ThsSuperviseClient { //public interface ThsSuperviseClient {
/** // /**
* 预警/告警事务的初始化 // * 预警/告警事务的初始化
* // *
* @param superviseParam // * @param superviseParam
* @return // * @return
*/ // */
@PostMapping("/initSupervise") // @PostMapping("/initSupervise")
HttpResult<String> initSupervise(@RequestBody @Validated SuperviseParam superviseParam); // HttpResult<String> initSupervise(@RequestBody @Validated SuperviseParam superviseParam);
//
//
/** // /**
* 预警/告警事务的生成 // * 预警/告警事务的生成
* // *
* @param superviseParam // * @param superviseParam
* @return // * @return
*/ // */
@PostMapping("/creatSupervise") // @PostMapping("/creatSupervise")
HttpResult<String> creatSupervise(@RequestBody @Validated SuperviseParam superviseParam); // HttpResult<String> creatSupervise(@RequestBody @Validated SuperviseParam superviseParam);
} //}

View File

@@ -1,41 +1,40 @@
package com.njcn.prepare.harmonic.api.line.fallback; //package com.njcn.prepare.harmonic.api.line.fallback;
//
import com.njcn.common.pojo.enums.response.CommonResponseEnum; //import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException; //import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult; //import com.njcn.common.pojo.response.HttpResult;
//
import com.njcn.prepare.harmonic.api.line.ThsSuperviseClient; //import com.njcn.prepare.harmonic.api.line.ThsSuperviseClient;
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam; //import com.njcn.prepare.harmonic.utils.PrepareEnumUtil;
import com.njcn.prepare.harmonic.utils.PrepareEnumUtil; //import feign.hystrix.FallbackFactory;
import feign.hystrix.FallbackFactory; //import lombok.extern.slf4j.Slf4j;
import lombok.extern.slf4j.Slf4j; //import org.springframework.stereotype.Component;
import org.springframework.stereotype.Component; //import org.springframework.validation.annotation.Validated;
import org.springframework.validation.annotation.Validated; //import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestBody; //
//@Slf4j
@Slf4j //@Component
@Component //public class ThsSuperviseClientFallbackFactory implements FallbackFactory<ThsSuperviseClient> {
public class ThsSuperviseClientFallbackFactory implements FallbackFactory<ThsSuperviseClient> { // @Override
@Override // public ThsSuperviseClient create(Throwable throwable) {
public ThsSuperviseClient create(Throwable throwable) { // Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK; // if (throwable.getCause() instanceof BusinessException) {
if (throwable.getCause() instanceof BusinessException) { // BusinessException businessException = (BusinessException) throwable.getCause();
BusinessException businessException = (BusinessException) throwable.getCause(); // exceptionEnum = PrepareEnumUtil.getExceptionEnum(businessException.getResult());
exceptionEnum = PrepareEnumUtil.getExceptionEnum(businessException.getResult()); // }
} // Enum<?> finalExceptionEnum = exceptionEnum;
Enum<?> finalExceptionEnum = exceptionEnum; // return new ThsSuperviseClient() {
return new ThsSuperviseClient() { // @Override
@Override // public HttpResult<String> initSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
public HttpResult<String> initSupervise(@RequestBody @Validated SuperviseParam superviseParam) { // log.error("{}异常,降级处理,异常为:{}", "预警/告警事务的初始化: ", throwable.toString());
log.error("{}异常,降级处理,异常为:{}", "预警/告警事务的初始化: ", throwable.toString()); // throw new BusinessException(finalExceptionEnum);
throw new BusinessException(finalExceptionEnum); // }
} //
// @Override
@Override // public HttpResult<String> creatSupervise(SuperviseParam superviseParam) {
public HttpResult<String> creatSupervise(SuperviseParam superviseParam) { // log.error("{}异常,降级处理,异常为:{}", "预警/告警事务的生成: ", throwable.toString());
log.error("{}异常,降级处理,异常为:{}", "预警/告警事务的生成: ", throwable.toString()); // throw new BusinessException(finalExceptionEnum);
throw new BusinessException(finalExceptionEnum); // }
} // };
}; // }
} //}
}

View File

@@ -142,7 +142,7 @@ public class SubStationExecutor extends BaseExecutor{
String tag = bindCmp.getTag(); String tag = bindCmp.getTag();
CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam = bindCmp.getRequestData(); CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam = bindCmp.getRequestData();
if (tag.equalsIgnoreCase("r_upload_substation_statistical_data_d")) { if (tag.equalsIgnoreCase("r_upload_substation_statistical_data_d")) {
// //
rUploadSubstationStatisticalDataDService.insertSubStatisticalDataDay(bindCmp.getRequestData()); rUploadSubstationStatisticalDataDService.insertSubStatisticalDataDay(bindCmp.getRequestData());
} else if (tag.equalsIgnoreCase("r_upload_substation_statistical_data_m")) { } else if (tag.equalsIgnoreCase("r_upload_substation_statistical_data_m")) {
//数据补招不执行非日表算法 //数据补招不执行非日表算法

View File

@@ -4,7 +4,7 @@
//import com.njcn.common.pojo.enums.response.CommonResponseEnum; //import com.njcn.common.pojo.enums.response.CommonResponseEnum;
//import com.njcn.common.pojo.response.HttpResult; //import com.njcn.common.pojo.response.HttpResult;
//import com.njcn.common.utils.HttpResultUtil; //import com.njcn.common.utils.HttpResultUtil;
//import com.njcn.prepare.harmonic.pojo.param.SuperviseParam; //import com.njcn.process.pojo.param.SuperviseParam;
// //
//import com.njcn.web.controller.BaseController; //import com.njcn.web.controller.BaseController;
//import io.swagger.annotations.Api; //import io.swagger.annotations.Api;

View File

@@ -18,7 +18,8 @@
round(avg(coverage_rate),4) coverageRate, round(avg(coverage_rate),4) coverageRate,
case when avg(run_substation_num) = 0 then 0 else round(avg(monitor_substaion_num)/avg(run_substation_num)*100,4) end monitoringRate, case when avg(run_substation_num) = 0 then 0 else round(avg(monitor_substaion_num)/avg(run_substation_num)*100,4) end monitoringRate,
#{monthDate} statisticalDate, #{monthDate} statisticalDate,
'02' statisticalType, #{monthDate} statisticalMonth,
'01' statisticalType,
0 uploadStatus 0 uploadStatus
from from
r_upload_substation_statistical_data_d r_upload_substation_statistical_data_d

View File

@@ -1,71 +1,70 @@
package com.njcn.prepare.harmonic.service.mysql.Impl.line; //package com.njcn.prepare.harmonic.service.mysql.Impl.line;
//
import cn.hutool.core.collection.CollectionUtil; //import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.dynamic.datasource.annotation.DS; //import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; //import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; //import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.enums.response.CommonResponseEnum; //import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult; //import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil; //import com.njcn.common.utils.HttpResultUtil;
import com.njcn.prepare.harmonic.mapper.mysql.line.ThsOverRunLogMapper; //import com.njcn.prepare.harmonic.mapper.mysql.line.ThsOverRunLogMapper;
import com.njcn.prepare.harmonic.mapper.mysql.line.ThsSuperviseMapper; //import com.njcn.prepare.harmonic.mapper.mysql.line.ThsSuperviseMapper;
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam; //import com.njcn.process.pojo.param.SuperviseParam;
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog; //import com.njcn.process.pojo.po.ThsOverRunLog;
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise; //import com.njcn.process.pojo.po.ThsSupervise;
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo; //import com.njcn.prepare.harmonic.service.mysql.line.ThsOverRunLogService;
import com.njcn.prepare.harmonic.service.mysql.line.ThsOverRunLogService; //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.stereotype.Service;
import org.springframework.stereotype.Service; //import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Transactional; //
//import java.util.List;
import java.util.List; //import java.util.stream.Collectors;
import java.util.stream.Collectors; //
///**
/** // * <p>
* <p> // * 告警/预警监测点列表 服务实现类
* 告警/预警监测点列表 服务实现类 // * </p>
* </p> // *
* // * @author lxp
* @author lxp // * @since 2023-03-16
* @since 2023-03-16 // */
*/ //@Service
@Service //@Slf4j
@Slf4j //@DS("process")
@DS("process") //public class ThsOverRunLogServiceImpl extends ServiceImpl<ThsOverRunLogMapper, ThsOverRunLog> implements ThsOverRunLogService {
public class ThsOverRunLogServiceImpl extends ServiceImpl<ThsOverRunLogMapper, ThsOverRunLog> implements ThsOverRunLogService { // @Autowired
@Autowired // private ThsOverRunLogMapper thsOverRunLogMapper;
private ThsOverRunLogMapper thsOverRunLogMapper; // @Autowired
@Autowired // private ThsSuperviseMapper thsSuperviseMapper;
private ThsSuperviseMapper thsSuperviseMapper; //
// @Override
@Override // @Transactional(rollbackFor = Exception.class)
@Transactional(rollbackFor = Exception.class) // public void saveOverRunLog(SuperviseParam superviseParam) {
public void saveOverRunLog(SuperviseParam superviseParam) { // this.saveBatch(superviseParam.getOverRunLog());
this.saveBatch(superviseParam.getOverRunLog()); // }
} //
// @Override
@Override // public SuperviceRunLogVo superviseDetail(String supIndex) {
public SuperviceRunLogVo superviseDetail(String supIndex) { // ThsSupervise thsSupervise = thsSuperviseMapper.selectOne(new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, supIndex));
ThsSupervise thsSupervise = thsSuperviseMapper.selectOne(new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, supIndex)); // List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex)); // SuperviceRunLogVo superviceRunLogVo = new SuperviceRunLogVo();
SuperviceRunLogVo superviceRunLogVo = new SuperviceRunLogVo(); // superviceRunLogVo.setThsSupervise(thsSupervise);
superviceRunLogVo.setThsSupervise(thsSupervise); // superviceRunLogVo.setOverRunLog(thsOverRunLogs);
superviceRunLogVo.setOverRunLog(thsOverRunLogs); // return superviceRunLogVo;
return superviceRunLogVo; // }
} //
// @Override
@Override // public HttpResult updateSupervise(SuperviseParam superviseParam) {
public HttpResult updateSupervise(SuperviseParam superviseParam) { // List<ThsOverRunLog> overRunLog = superviseParam.getOverRunLog();
List<ThsOverRunLog> overRunLog = superviseParam.getOverRunLog(); // if (CollectionUtil.isEmpty(overRunLog)) {
if (CollectionUtil.isEmpty(overRunLog)) { // HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "监测点不能为空", null);
HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "监测点不能为空", null); // }
} // List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, superviseParam.getSupIndex()));
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, superviseParam.getSupIndex())); // List<String> saveIds = superviseParam.getOverRunLog().stream().map(ThsOverRunLog::getId).collect(Collectors.toList());
List<String> saveIds = superviseParam.getOverRunLog().stream().map(ThsOverRunLog::getId).collect(Collectors.toList()); // List<String> allIds = thsOverRunLogs.stream().map(ThsOverRunLog::getId).collect(Collectors.toList());
List<String> allIds = thsOverRunLogs.stream().map(ThsOverRunLog::getId).collect(Collectors.toList()); // allIds.removeAll(saveIds);
allIds.removeAll(saveIds); // thsOverRunLogMapper.delete(new LambdaQueryWrapper<ThsOverRunLog>().in(ThsOverRunLog::getId, allIds));
thsOverRunLogMapper.delete(new LambdaQueryWrapper<ThsOverRunLog>().in(ThsOverRunLog::getId, allIds)); // return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, null);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, null); // }
} //}
}

View File

@@ -17,9 +17,9 @@
//import com.njcn.oss.utils.FileStorageUtil; //import com.njcn.oss.utils.FileStorageUtil;
//import com.njcn.prepare.enums.*; //import com.njcn.prepare.enums.*;
//import com.njcn.prepare.harmonic.mapper.mysql.line.*; //import com.njcn.prepare.harmonic.mapper.mysql.line.*;
//import com.njcn.prepare.harmonic.pojo.param.SuperviseParam; //import com.njcn.process.pojo.param.SuperviseParam;
//import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog; //import com.njcn.process.pojo.po.ThsOverRunLog;
//import com.njcn.prepare.harmonic.pojo.po.ThsSupervise; //import com.njcn.process.pojo.po.ThsSupervise;
//import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo; //import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
//import com.njcn.prepare.harmonic.service.mysql.day.IRStatLimitRateDService; //import com.njcn.prepare.harmonic.service.mysql.day.IRStatLimitRateDService;
//import com.njcn.prepare.harmonic.service.mysql.line.ThsSuperviseService; //import com.njcn.prepare.harmonic.service.mysql.line.ThsSuperviseService;

View File

@@ -63,9 +63,9 @@ public class StationBusBarReportServiceImpl extends MppServiceImpl<StationBusBar
Map<String, List<RStatDataVDPO>> vMap = rStatDataVDPOList.stream().collect(Collectors.groupingBy(RStatDataVDPO::getValueType)); Map<String, List<RStatDataVDPO>> vMap = rStatDataVDPOList.stream().collect(Collectors.groupingBy(RStatDataVDPO::getValueType));
if (vMap.containsKey("MAX")) { if (vMap.containsKey("MAX")) {
List<RStatDataVDPO> maxList = vMap.get("MAX"); List<RStatDataVDPO> maxList = vMap.get("MAX");
Double rms = maxList.stream().filter(item -> !item.getPhasicType().equals("T")).map(RStatDataVDPO::getRms).max(Comparator.comparing(Function.identity())).orElse(3.14159); Double rms = maxList.stream().filter(item -> !item.getPhasicType().equals("A")).map(RStatDataVDPO::getRms).max(Comparator.comparing(Function.identity())).orElse(3.14159);
Double thd = maxList.stream().filter(item -> item.getPhasicType().equals("T")).map(RStatDataVDPO::getVThd).max(Comparator.comparing(Function.identity())).orElse(3.14159); Double thd = maxList.stream().filter(item -> item.getPhasicType().equals("A")).map(RStatDataVDPO::getVThd).max(Comparator.comparing(Function.identity())).orElse(3.14159);
Double un = maxList.stream().filter(item -> item.getPhasicType().equals("T")).map(RStatDataVDPO::getVUnbalance).max(Comparator.comparing(Function.identity())).orElse(3.14159); Double un = maxList.stream().filter(item -> item.getPhasicType().equals("A")).map(RStatDataVDPO::getVUnbalance).max(Comparator.comparing(Function.identity())).orElse(3.14159);
rStatBusbarHarmonicYPO.setVEffectiveMax(rms); rStatBusbarHarmonicYPO.setVEffectiveMax(rms);
rStatBusbarHarmonicYPO.setVThdMax(thd); rStatBusbarHarmonicYPO.setVThdMax(thd);
rStatBusbarHarmonicYPO.setUnbalanceMax(un); rStatBusbarHarmonicYPO.setUnbalanceMax(un);
@@ -77,9 +77,9 @@ public class StationBusBarReportServiceImpl extends MppServiceImpl<StationBusBar
if (vMap.containsKey("MIN")) { if (vMap.containsKey("MIN")) {
List<RStatDataVDPO> maxList = vMap.get("MIN"); List<RStatDataVDPO> maxList = vMap.get("MIN");
Double rms = maxList.stream().filter(item -> !item.getPhasicType().equals("T")).map(RStatDataVDPO::getRms).min(Comparator.comparing(Function.identity())).orElse(3.14159); Double rms = maxList.stream().filter(item -> !item.getPhasicType().equals("A")).map(RStatDataVDPO::getRms).min(Comparator.comparing(Function.identity())).orElse(3.14159);
Double thd = maxList.stream().filter(item -> item.getPhasicType().equals("T")).map(RStatDataVDPO::getVThd).min(Comparator.comparing(Function.identity())).orElse(3.14159); Double thd = maxList.stream().filter(item -> item.getPhasicType().equals("A")).map(RStatDataVDPO::getVThd).min(Comparator.comparing(Function.identity())).orElse(3.14159);
Double un = maxList.stream().filter(item -> item.getPhasicType().equals("T")).map(RStatDataVDPO::getVUnbalance).min(Comparator.comparing(Function.identity())).orElse(3.14159); Double un = maxList.stream().filter(item -> item.getPhasicType().equals("A")).map(RStatDataVDPO::getVUnbalance).min(Comparator.comparing(Function.identity())).orElse(3.14159);
rStatBusbarHarmonicYPO.setVEffectiveMin(rms); rStatBusbarHarmonicYPO.setVEffectiveMin(rms);
rStatBusbarHarmonicYPO.setVThdMin(thd); rStatBusbarHarmonicYPO.setVThdMin(thd);
rStatBusbarHarmonicYPO.setUnbalanceMin(un); rStatBusbarHarmonicYPO.setUnbalanceMin(un);
@@ -91,9 +91,9 @@ public class StationBusBarReportServiceImpl extends MppServiceImpl<StationBusBar
if (vMap.containsKey("AVG")) { if (vMap.containsKey("AVG")) {
List<RStatDataVDPO> maxList = vMap.get("AVG"); List<RStatDataVDPO> maxList = vMap.get("AVG");
Double rms = maxList.stream().filter(item -> !item.getPhasicType().equals("T")).mapToDouble(RStatDataVDPO::getRms).average().orElse(3.14159); Double rms = maxList.stream().filter(item -> !item.getPhasicType().equals("A")).mapToDouble(RStatDataVDPO::getRms).average().orElse(3.14159);
Double thd = maxList.stream().filter(item -> item.getPhasicType().equals("T")).mapToDouble(RStatDataVDPO::getVThd).average().orElse(3.14159); Double thd = maxList.stream().filter(item -> item.getPhasicType().equals("A")).mapToDouble(RStatDataVDPO::getVThd).average().orElse(3.14159);
Double un = maxList.stream().filter(item -> item.getPhasicType().equals("T")).mapToDouble(RStatDataVDPO::getVUnbalance).average().orElse(3.14159); Double un = maxList.stream().filter(item -> item.getPhasicType().equals("A")).mapToDouble(RStatDataVDPO::getVUnbalance).average().orElse(3.14159);
rStatBusbarHarmonicYPO.setVEffectiveAvg(rms); rStatBusbarHarmonicYPO.setVEffectiveAvg(rms);
rStatBusbarHarmonicYPO.setVThdAvg(thd); rStatBusbarHarmonicYPO.setVThdAvg(thd);
rStatBusbarHarmonicYPO.setUnbalanceAvg(un); rStatBusbarHarmonicYPO.setUnbalanceAvg(un);
@@ -105,9 +105,9 @@ public class StationBusBarReportServiceImpl extends MppServiceImpl<StationBusBar
if (vMap.containsKey("CP95")) { if (vMap.containsKey("CP95")) {
List<RStatDataVDPO> cp95List = vMap.get("CP95"); List<RStatDataVDPO> cp95List = vMap.get("CP95");
Double rms = cp95List.stream().filter(item -> !item.getPhasicType().equals("T")).map(RStatDataVDPO::getRms).max(Comparator.comparing(Function.identity())).orElse(3.14159); Double rms = cp95List.stream().filter(item -> !item.getPhasicType().equals("A")).map(RStatDataVDPO::getRms).max(Comparator.comparing(Function.identity())).orElse(3.14159);
Double thd = cp95List.stream().filter(item -> item.getPhasicType().equals("T")).map(RStatDataVDPO::getVThd).max(Comparator.comparing(Function.identity())).orElse(3.14159); Double thd = cp95List.stream().filter(item -> item.getPhasicType().equals("A")).map(RStatDataVDPO::getVThd).max(Comparator.comparing(Function.identity())).orElse(3.14159);
Double un = cp95List.stream().filter(item -> item.getPhasicType().equals("T")).map(RStatDataVDPO::getVUnbalance).max(Comparator.comparing(Function.identity())).orElse(3.14159); Double un = cp95List.stream().filter(item -> item.getPhasicType().equals("A")).map(RStatDataVDPO::getVUnbalance).max(Comparator.comparing(Function.identity())).orElse(3.14159);
rStatBusbarHarmonicYPO.setVEffective95(rms); rStatBusbarHarmonicYPO.setVEffective95(rms);
rStatBusbarHarmonicYPO.setVThd95(thd); rStatBusbarHarmonicYPO.setVThd95(thd);
rStatBusbarHarmonicYPO.setUnbalance95(un); rStatBusbarHarmonicYPO.setUnbalance95(un);

View File

@@ -1,43 +1,40 @@
package com.njcn.prepare.harmonic.service.mysql.line; //package com.njcn.prepare.harmonic.service.mysql.line;
//
import com.baomidou.mybatisplus.extension.service.IService; //import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.common.pojo.response.HttpResult; //import com.njcn.common.pojo.response.HttpResult;
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam; //import com.njcn.process.pojo.param.SuperviseParam;
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog; //import com.njcn.process.pojo.po.ThsOverRunLog;
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo; //
///**
import java.util.List; // * <p>
// * 告警/预警监测点列表 服务类
/** // * </p>
* <p> // *
* 告警/预警监测点列表 服务类 // * @author lxp
* </p> // * @since 2023-03-16
* // */
* @author lxp //public interface ThsOverRunLogService extends IService<ThsOverRunLog> {
* @since 2023-03-16 //
*/ // /**
public interface ThsOverRunLogService extends IService<ThsOverRunLog> { // * 保存技术监督监测点
// *
/** // * @param superviseParam
* 保存技术监督监测点 // * @return
* // */
* @param superviseParam // void saveOverRunLog(SuperviseParam superviseParam);
* @return //
*/ // /**
void saveOverRunLog(SuperviseParam superviseParam); // * 查询技术监督监测点集合
// *
/** // * @param supIndex
* 查询技术监督监测点集合 // * @return
* // */
* @param supIndex // SuperviceRunLogVo superviseDetail(String supIndex);
* @return //
*/ // /**
SuperviceRunLogVo superviseDetail(String supIndex); // * 更新技术监督
// *
/** // * @param superviseParam
* 更新技术监督 // */
* // HttpResult updateSupervise(SuperviseParam superviseParam);
* @param superviseParam //}
*/
HttpResult updateSupervise(SuperviseParam superviseParam);
}

View File

@@ -7,9 +7,9 @@
//import com.njcn.harmonic.pojo.vo.SourceSteadyIndicator; //import com.njcn.harmonic.pojo.vo.SourceSteadyIndicator;
//import com.njcn.harmonic.pojo.vo.ThsStrategyVo; //import com.njcn.harmonic.pojo.vo.ThsStrategyVo;
//import com.njcn.prepare.enums.TypeEnum; //import com.njcn.prepare.enums.TypeEnum;
//import com.njcn.prepare.harmonic.pojo.param.SuperviseParam; //import com.njcn.process.pojo.param.SuperviseParam;
//import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog; //import com.njcn.process.pojo.po.ThsOverRunLog;
//import com.njcn.prepare.harmonic.pojo.po.ThsSupervise; //import com.njcn.process.pojo.po.ThsSupervise;
//import com.njcn.process.pojo.po.ThsWarnStrategyAss; //import com.njcn.process.pojo.po.ThsWarnStrategyAss;
//import com.njcn.user.pojo.po.Dept; //import com.njcn.user.pojo.po.Dept;
// //

View File

@@ -69,7 +69,7 @@ public class RStatLoadTypeServiceImpl implements RStatLoadTypeService {
LocalDate localDate = LocalDateTimeUtil.parseDate(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN); LocalDate localDate = LocalDateTimeUtil.parseDate(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN);
List<RStatLoadTypeDPO> result = new ArrayList<>(); List<RStatLoadTypeDPO> result = new ArrayList<>();
List<DictData> dataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.MONITORING_LABELS.getCode()).getData(); List<DictData> dataList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.MONITORING_LABELS.getCode()).getData();
//过滤监测对象类型(陆上风电、分布式光伏、电气化铁路、其他非线性负荷) //过滤监测对象类型(陆上风电、光伏电站、电气化铁路、其他非线性负荷)
Map<String, DictData> collect = dataList.stream().filter(temp -> Objects.equals(temp.getLevel(), 1)).collect(Collectors.toMap(DictData::getId, dictData -> dictData)); Map<String, DictData> collect = dataList.stream().filter(temp -> Objects.equals(temp.getLevel(), 1)).collect(Collectors.toMap(DictData::getId, dictData -> dictData));
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData(); List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();

View File

@@ -78,7 +78,7 @@ public class RUploadSubstationStatisticalDataDServiceImpl extends MppServiceImpl
if (list.size() > 1){ if (list.size() > 1){
RUploadSubstationStatisticalDataD rUploadSubstationStatisticalDataD = new RUploadSubstationStatisticalDataD(); RUploadSubstationStatisticalDataD rUploadSubstationStatisticalDataD = new RUploadSubstationStatisticalDataD();
rUploadSubstationStatisticalDataD.setId(IdUtil.simpleUUID()); rUploadSubstationStatisticalDataD.setId(IdUtil.simpleUUID());
rUploadSubstationStatisticalDataD.setStatisticalDate(calculatedParam.getDataDate()); rUploadSubstationStatisticalDataD.setStatisticalDate(DateUtil.format(DateUtil.parse(calculatedParam.getDataDate()),DatePattern.NORM_MONTH_PATTERN));
rUploadSubstationStatisticalDataD.setStatisticalType(UploadEnum.STATISTICAL_TYPE_02.getCode()); rUploadSubstationStatisticalDataD.setStatisticalType(UploadEnum.STATISTICAL_TYPE_02.getCode());
rUploadSubstationStatisticalDataD.setProvinceId(dept.getCode()); rUploadSubstationStatisticalDataD.setProvinceId(dept.getCode());
rUploadSubstationStatisticalDataD.setProvinceName(dept.getName()); rUploadSubstationStatisticalDataD.setProvinceName(dept.getName());
@@ -116,11 +116,14 @@ public class RUploadSubstationStatisticalDataDServiceImpl extends MppServiceImpl
//开始月份 //开始月份
String beginMonth = DateUtil.format(DateUtil.beginOfMonth(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_MONTH_PATTERN)), DatePattern.NORM_MONTH_PATTERN); String beginMonth = DateUtil.format(DateUtil.beginOfMonth(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_MONTH_PATTERN)), DatePattern.NORM_MONTH_PATTERN);
//起始时间 //起始时间
String startTime = DateUtil.format(DateUtil.beginOfMonth(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATE_PATTERN); String startTime = DateUtil.format(DateUtil.beginOfYear(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATE_PATTERN);
//结束时间 //结束时间
String endTime = DateUtil.format(DateUtil.endOfMonth(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATE_PATTERN); String endTime = DateUtil.format(DateUtil.endOfYear(DateUtil.parse(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATE_PATTERN);
//数据集 //数据集
List<RUploadSubstationStatisticalDataD> list = this.baseMapper.substationStatisticalMonthData(beginMonth,startTime,endTime); List<RUploadSubstationStatisticalDataD> list = this.baseMapper.substationStatisticalMonthData(beginMonth,startTime,endTime);
if (CollUtil.isNotEmpty(list)){ if (CollUtil.isNotEmpty(list)){
list.forEach(item->{ list.forEach(item->{
item.setId(IdUtil.simpleUUID()); item.setId(IdUtil.simpleUUID());

View File

@@ -43,10 +43,10 @@
<artifactId>pms-device-api</artifactId> <artifactId>pms-device-api</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <!-- <dependency>
<groupId>org.influxdb</groupId> <groupId>org.influxdb</groupId>
<artifactId>influxdb-java</artifactId> <artifactId>influxdb-java</artifactId>
</dependency> </dependency>-->
<dependency> <dependency>
<groupId>com.njcn</groupId> <groupId>com.njcn</groupId>
<artifactId>pq-device-api</artifactId> <artifactId>pq-device-api</artifactId>

View File

@@ -1,27 +0,0 @@
//package com.njcn.process.constant;
//
//import com.google.common.collect.Maps;
//import com.njcn.device.pq.pojo.po.DataV;
//import org.springframework.cglib.beans.BeanMap;
//
//import java.util.Map;
//
///**
// * Description:
// * 接口文档访问地址http://serverIP:port/swagger-ui.html
// * Date: 2022/12/7 15:18【需求编号】
// *
// * @author clam
// * @version V1.0.0
// */
//public class Test {
// public static void main(String[] args) {
//
// Map<String, Object> map = Maps.newHashMap ( );
// DataV d = new DataV ( );
// BeanMap beanMap = BeanMap.create (d);
// for (Object key : beanMap.keySet ( )) {
// }
// }
//
//}

View File

@@ -9,14 +9,19 @@ import org.apache.commons.lang3.StringUtils;
@Getter @Getter
public enum SteadyIndicatorEnum { public enum SteadyIndicatorEnum {
Negative_Voltage("Negative_Voltage", "负序电压不平衡度超标"), Negative_Voltage("phase_Voltage", "负序电压不平衡度超标"),
Interhar_Voltage("Interhar_Voltage", "间谐波电压超标"), Interhar_Voltage("Interharmonic_Voltage", "间谐波电压超标"),
Neg_Current("Neg_Current", "负序电流超标"), Neg_Current("Neg_Current", "负序电流超标"),
Fre_Deviation("Fre_Deviation", "频率偏差超标"), Fre_Deviation("Frequency_Dev", "频率偏差超标"),
Voltage_Dev("Voltage_Dev", "电压偏差超标"), Voltage_Dev("Voltage_Dev", "电压偏差超标"),
Har_Current("Har_Current", "谐波电流超标"), Har_Current("Harmonic_Current", "谐波电流超标"),
Voltage_Fluc("Voltage_Fluc", "电压波动与闪变超标"), Voltage_Fluc("Flicker", "电压波动与闪变超标"),
Har_Voltage("Har_Voltage", "谐波电压超标"); Har_Voltage("Harmonic_Voltage", "谐波电压超标"),
Thd_V("Thd_V","电压总谐波畸变率")
;
private final String code; private final String code;

View File

@@ -20,6 +20,8 @@ public class StrategyParam {
@Data @Data
public static class StrategyPageParam extends StrategyParam { public static class StrategyPageParam extends StrategyParam {
private String deptId;
@ApiModelProperty(value = "页码") @ApiModelProperty(value = "页码")
private Integer PageNum; private Integer PageNum;
@@ -62,22 +64,42 @@ public class StrategyParam {
@Data @Data
public static class BindParam { public static class BindParam {
@ApiModelProperty(value = "部门id")
@NotNull(message = "部门id不可为空")
private String deptId;
@ApiModelProperty(value = "预警单id") @ApiModelProperty(value = "策略id")
@NotBlank(message = "id不能为空")
private String id; private String id;
@ApiModelProperty(value = "关系01只存在于指标类型中") @ApiModelProperty(value = "0.预警单 1.告警单")
@NotNull(message = "id不能为空") @NotNull(message = "策略类型不能为空")
private Integer strategyType;
@ApiModelProperty(value = "0自动策略1手动策略2排他策略")
@NotNull(message = "等级")
private Integer grade;
@ApiModelProperty(value = "策略名称")
@NotNull(message = "策略名称不能为空")
private String strategyName;
@ApiModelProperty(value = "关系01只存在于指标类型中,三级策略不分与或")
//@NotNull(message = "id不能为空")
private Integer operation; private Integer operation;
@ApiModelProperty(value = "监测点标签") @ApiModelProperty(value = "监测点标签")
@NotEmpty(message = "监测点标签集合不能为空") //@NotEmpty(message = "监测点标签集合不能为空")
private List<String> monitorTag; private List<String> monitorTag;
@ApiModelProperty(value = "指标类型") @ApiModelProperty(value = "指标类型")
@NotEmpty(message = "指标类型集合不能为空") @NotEmpty(message = "指标类型集合不能为空")
private List<String> indicatorTypes; private List<String> indicatorTypes;
@ApiModelProperty(value = "监测点id集合")
private List<String> monitorIds;
} }
@Data @Data
@@ -94,6 +116,8 @@ public class StrategyParam {
@NotEmpty(message = "指标类型集合不能为空") @NotEmpty(message = "指标类型集合不能为空")
private List<String> indicatorTypes; private List<String> indicatorTypes;
private List<String> monitorIds;
} }
@Data @Data
@@ -105,6 +129,9 @@ public class StrategyParam {
@NotBlank(message = "名称不能为空") @NotBlank(message = "名称不能为空")
private String name; private String name;
@ApiModelProperty(value = "部门id")
private String deptId;
@ApiModelProperty(value = "0.通用策略 1.定值策略") @ApiModelProperty(value = "0.通用策略 1.定值策略")
@NotNull(message = "策略选择不能为空") @NotNull(message = "策略选择不能为空")
private Integer bigType; private Integer bigType;

View File

@@ -1,7 +1,7 @@
package com.njcn.prepare.harmonic.pojo.param; package com.njcn.process.pojo.param;
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog; import com.njcn.process.pojo.po.ThsOverRunLog;
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise; import com.njcn.process.pojo.po.ThsSupervise;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@@ -27,5 +27,8 @@ public class SuperviseParam {
@ApiModelProperty(name = "thsSupervise", value = "技术监督参数") @ApiModelProperty(name = "thsSupervise", value = "技术监督参数")
private ThsSupervise thsSupervise; private ThsSupervise thsSupervise;
@ApiModelProperty(name = "type", value = "类型0预警1告警") @ApiModelProperty(name = "type", value = "类型0预警1告警")
@NotNull(message = "类型不可为空")
private Integer type; private Integer type;
} }

View File

@@ -0,0 +1,31 @@
package com.njcn.process.pojo.param;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* pqs
*
* @author cdf
* @date 2024/3/5
*/
@Data
public class ThsSuperviseParam {
@NotBlank(message = "部门id不可为空")
private String deptId;
@NotBlank(message = "开始时间不可为空")
private String startTime;
@NotBlank(message = "结束时间不可为空")
private String endTime;
@NotNull(message = "分页")
private Integer pageNum;
@NotNull(message = "每页数量")
private Integer pageSize;
}

View File

@@ -0,0 +1,21 @@
package com.njcn.process.pojo.po;
import lombok.Data;
/**
* pqs
*
* @author cdf
* @date 2024/1/30
*/
@Data
public class ThsDeptMonitor {
private String id;
private String deptId;
private String monitor;
}

View File

@@ -1,4 +1,4 @@
package com.njcn.prepare.harmonic.pojo.po; package com.njcn.process.pojo.po;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;

View File

@@ -1,4 +1,4 @@
package com.njcn.prepare.harmonic.pojo.po; package com.njcn.process.pojo.po;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;

View File

@@ -32,6 +32,9 @@ public class ThsWarnStrategy extends BaseEntity implements Serializable {
@TableId(value = "Id", type = IdType.ASSIGN_ID) @TableId(value = "Id", type = IdType.ASSIGN_ID)
private String id; private String id;
@ApiModelProperty(value = "部门id")
private String deptId;
@ApiModelProperty(value = "预警单名称") @ApiModelProperty(value = "预警单名称")
@TableField("Name") @TableField("Name")
private String name; private String name;

View File

@@ -1,13 +1,14 @@
package com.njcn.prepare.harmonic.pojo.vo; package com.njcn.process.pojo.vo;
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog; import com.njcn.process.pojo.po.ThsOverRunLog;
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise; import com.njcn.process.pojo.po.ThsSupervise;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.ToString; import lombok.ToString;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Data @Data
@@ -19,6 +20,6 @@ public class SuperviceRunLogVo {
@ApiModelProperty(name = "thsSupervise", value = "技术监督参数", required = true) @ApiModelProperty(name = "thsSupervise", value = "技术监督参数", required = true)
private ThsSupervise thsSupervise; private ThsSupervise thsSupervise;
@ApiModelProperty(name = "overRunLog", value = "监测点集合", required = true) @ApiModelProperty(name = "overRunLog", value = "监测点集合", required = true)
private List<ThsOverRunLog> overRunLog; private List<ThsOverRunLog> overRunLog = new ArrayList<>();
} }

View File

@@ -1,4 +1,4 @@
package com.njcn.prepare.harmonic.pojo.vo; package com.njcn.process.pojo.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.njcn.prepare.harmonic.pojo.vo; package com.njcn.process.pojo.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;

View File

@@ -1,12 +1,5 @@
FROM eclipse-temurin:8-jdk-centos7 FROM openjdk:8-jdk-alpine
MAINTAINER hongawen_13914774158@163.com
ENV JAVA_OPTS="-Xms1024m -Xmx1024m"
# 挂载时区的目录
VOLUME /usr/share/zoneinfo
# 设置时区为上海
ENV TZ=Asia/Shanghai
# 设置时区信息
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ADD target/processboot.jar processboot.jar ADD target/processboot.jar processboot.jar
ENTRYPOINT java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /processboot.jar ENTRYPOINT ["java","-jar","/processboot.jar"]
EXPOSE 10222 EXPOSE 10222
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \&& echo 'Asia/Shanghai' >/etc/timezone

View File

@@ -34,11 +34,11 @@
<artifactId>common-swagger</artifactId> <artifactId>common-swagger</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <!--<dependency>
<groupId>com.njcn</groupId> <groupId>com.njcn</groupId>
<artifactId>pqs-influx</artifactId> <artifactId>pqs-influx</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>-->
<dependency> <dependency>
<groupId>com.njcn</groupId> <groupId>com.njcn</groupId>
<artifactId>pq-device-api</artifactId> <artifactId>pq-device-api</artifactId>

View File

@@ -1,7 +1,6 @@
package com.njcn.process.controller; package com.njcn.process.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType; import com.njcn.common.pojo.constant.OperateType;
@@ -9,13 +8,14 @@ import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil; import com.njcn.common.utils.HttpResultUtil;
import com.njcn.prepare.harmonic.api.line.ThsSuperviseClient;
import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto; import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto;
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam; import com.njcn.process.pojo.param.SuperviseParam;
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo; import com.njcn.process.pojo.vo.SuperviceRunLogVo;
import com.njcn.prepare.harmonic.pojo.vo.SuperviseVo; import com.njcn.process.pojo.vo.SuperviseVo;
import com.njcn.prepare.harmonic.pojo.vo.ThsSuperviseVo; import com.njcn.process.pojo.vo.ThsSuperviseVo;
import com.njcn.process.pojo.param.FileParam; import com.njcn.process.pojo.param.FileParam;
import com.njcn.process.pojo.param.ThsSuperviseParam;
import com.njcn.process.pojo.po.ThsSupervise;
import com.njcn.process.service.ThsOverRunLogService; import com.njcn.process.service.ThsOverRunLogService;
import com.njcn.process.service.ThsSuperviseService; import com.njcn.process.service.ThsSuperviseService;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
@@ -50,20 +50,45 @@ public class ThsSuperviseController extends BaseController {
private ThsSuperviseService thsSuperviseService; private ThsSuperviseService thsSuperviseService;
@Autowired @Autowired
private ThsOverRunLogService thsOverRunLogService; private ThsOverRunLogService thsOverRunLogService;
@Autowired
private ThsSuperviseClient thsSuperviseClient;
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("预警/告警事务生成") @ApiOperation("预警/告警事务生成手动")
@ApiImplicitParam(name = "superviseParam", value = "创建技术监督参数", required = true)
@PostMapping("/initSuperviseHand")
public HttpResult<SuperviceRunLogVo> initSuperviseHand(@RequestBody @Validated SuperviseParam superviseParam) {
String methodDescribe = getMethodDescribe("initSuperviseHand");
SuperviceRunLogVo result = thsSuperviseService.initSuperviseHand(superviseParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("预警/告警事务生成自动")
@ApiImplicitParam(name = "superviseParam", value = "创建技术监督参数", required = true) @ApiImplicitParam(name = "superviseParam", value = "创建技术监督参数", required = true)
@PostMapping("/initSupervise") @PostMapping("/initSupervise")
public HttpResult<SuperviceRunLogVo> initSupervise(@RequestBody @Validated SuperviseParam superviseParam) { public HttpResult<SuperviceRunLogVo> initSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
String methodDescribe = getMethodDescribe("initSupervise"); String methodDescribe = getMethodDescribe("initSupervise");
HttpResult<String> superviceRunLogVoHttpResult = thsSuperviseClient.initSupervise(superviseParam); SuperviceRunLogVo result = thsSuperviseService.initSupervise(superviseParam);
SuperviceRunLogVo superviceRunLogVo = JSON.parseObject(superviceRunLogVoHttpResult.getData(), SuperviceRunLogVo.class); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, superviceRunLogVo, methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("技术监督单详细列表")
@ApiImplicitParam(name = "thsSuperviseParam", value = "创建技术监督参数", required = true)
@PostMapping("/queryPage")
public HttpResult<Page<ThsSupervise>> queryPage(@RequestBody @Validated ThsSuperviseParam thsSuperviseParam) {
String methodDescribe = getMethodDescribe("queryPage");
Page<ThsSupervise> page = thsSuperviseService.queryPage(thsSuperviseParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD) @OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.ADD)
@ApiOperation("保存技术监督监测点") @ApiOperation("保存技术监督监测点")
@ApiImplicitParam(name = "superviceRunLogVo", value = "技术监督监测点参数", required = true) @ApiImplicitParam(name = "superviceRunLogVo", value = "技术监督监测点参数", required = true)
@@ -167,10 +192,10 @@ public class ThsSuperviseController extends BaseController {
@ApiOperation("技术监督首页") @ApiOperation("技术监督首页")
@ApiImplicitParam(name = "superviseDto", value = "查询技术监督列表参数", required = true) @ApiImplicitParam(name = "superviseDto", value = "查询技术监督列表参数", required = true)
@PostMapping("/superviseIndex") @PostMapping("/superviseIndex")
public HttpResult<Page<ThsSuperviseVo>> superviseIndex(@RequestBody SuperviseDto superviseDto) { public HttpResult<ThsSuperviseVo> superviseIndex(@RequestBody SuperviseDto superviseDto) {
Page<ThsSuperviseVo> pageResult = thsSuperviseService.superviseIndex(superviseDto); ThsSuperviseVo resultList = thsSuperviseService.superviseIndex(superviseDto);
String methodDescribe = getMethodDescribe("superviseIndex"); String methodDescribe = getMethodDescribe("superviseIndex");
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pageResult, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, resultList, methodDescribe);
} }
@@ -183,5 +208,8 @@ public class ThsSuperviseController extends BaseController {
HttpServletResponse resp = thsSuperviseService.downloadFeedBackFile(fileParam, request, response); HttpServletResponse resp = thsSuperviseService.downloadFeedBackFile(fileParam, request, response);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, resp, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, resp, methodDescribe);
} }
} }

View File

@@ -0,0 +1,17 @@
package com.njcn.process.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.process.pojo.po.ThsDeptAlarm;
import com.njcn.process.pojo.po.ThsDeptMonitor;
/**
* <p>
* Mapper 接口
* </p>
*
* @author wr
* @since 2023-03-10
*/
public interface ThsDeptMonitorMapper extends BaseMapper<ThsDeptMonitor> {
}

View File

@@ -1,7 +1,7 @@
package com.njcn.process.mapper; package com.njcn.process.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog; import com.njcn.process.pojo.po.ThsOverRunLog;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**

View File

@@ -3,11 +3,13 @@ package com.njcn.process.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto; import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto;
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise; import com.njcn.process.pojo.po.ThsSupervise;
import com.njcn.prepare.harmonic.pojo.vo.SuperviseVo; import com.njcn.process.pojo.vo.SuperviseVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p> * <p>
* Mapper 接口 * Mapper 接口
@@ -24,5 +26,8 @@ public interface ThsSuperviseMapper extends BaseMapper<ThsSupervise> {
* @param superviseDto * @param superviseDto
* @return * @return
*/ */
Page<SuperviseVo> querySuperviseList(Page<SuperviseVo> page, @Param("param") SuperviseDto superviseDto); List<SuperviseVo> querySuperviseList(@Param("param") SuperviseDto superviseDto);
Page<SuperviseVo> querySupervisePage(@Param("page")Page<SuperviseVo> page,@Param("param") SuperviseDto superviseDto);
} }

View File

@@ -2,7 +2,7 @@ package com.njcn.process.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.harmonic.pojo.vo.ThsStrategyVo; import com.njcn.harmonic.pojo.vo.ThsStrategyVo;
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam; import com.njcn.process.pojo.param.SuperviseParam;
import com.njcn.process.pojo.param.StrategyParam; import com.njcn.process.pojo.param.StrategyParam;
import com.njcn.process.pojo.po.ThsWarnStrategy; import com.njcn.process.pojo.po.ThsWarnStrategy;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -47,6 +47,16 @@ public interface ThsWarnStrategyMapper extends BaseMapper<ThsWarnStrategy> {
*/ */
List<String> getMonitorTagDetail(@Param("id") String id); List<String> getMonitorTagDetail(@Param("id") String id);
/***
* 获取监测点
* @author wr
* @date 2023-03-10 13:46
* @param id
* @return List<String>
*/
List<String> getMonitorIds(@Param("id") String id);
/** /**
* 查询策略的集合 * 查询策略的集合
*/ */

View File

@@ -3,7 +3,31 @@
<mapper namespace="com.njcn.process.mapper.ThsSuperviseMapper"> <mapper namespace="com.njcn.process.mapper.ThsSuperviseMapper">
<!--查询技术监督列表--> <!--查询技术监督列表-->
<select id="querySuperviseList" parameterType="com.njcn.prepare.harmonic.pojo.dto.SuperviseDto" <select id="querySuperviseList" parameterType="com.njcn.prepare.harmonic.pojo.dto.SuperviseDto"
resultType="com.njcn.prepare.harmonic.pojo.vo.SuperviseVo"> resultType="com.njcn.process.pojo.vo.SuperviseVo">
select ts.*,ass.pro_index as deploymentId,exec_index as execId from ths_supervise ts
left join ths_flowable_ass ass on ts.sup_index = ass.ths_index
where 1=1
<if test="param.searchValue != null and param.searchValue != ''">
AND ts.name like CONCAT(CONCAT('%', #{param.searchValue}), '%')
</if>
<if test="param.searchBeginTime != null and param.searchBeginTime != ''">
AND DATE_FORMAT(ts.create_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{param.searchBeginTime}, '%Y-%m-%d')
</if>
<if test="param.searchEndTime != null and param.searchEndTime != ''">
AND DATE_FORMAT(ts.create_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{param.searchEndTime}, '%Y-%m-%d')
</if>
<if test="param.searchState != null">
AND ts.progress=#{param.searchState}
</if>
<if test="param.type != null">
AND ts.type=#{param.type}
</if>
order by ts.create_time desc
</select>
<select id="querySupervisePage" parameterType="com.njcn.prepare.harmonic.pojo.dto.SuperviseDto"
resultType="com.njcn.process.pojo.vo.SuperviseVo">
select ts.*,ass.pro_index as deploymentId,exec_index as execId from ths_supervise ts select ts.*,ass.pro_index as deploymentId,exec_index as execId from ths_supervise ts
left join ths_flowable_ass ass on ts.sup_index = ass.ths_index left join ths_flowable_ass ass on ts.sup_index = ass.ths_index
where 1=1 where 1=1

View File

@@ -31,12 +31,19 @@
column="{id = id}" column="{id = id}"
select="com.njcn.process.mapper.ThsWarnStrategyMapper.getStrategyDetail"> select="com.njcn.process.mapper.ThsWarnStrategyMapper.getStrategyDetail">
</collection> </collection>
<collection
property="monitorIds"
column="{id = id}"
select="com.njcn.process.mapper.ThsWarnStrategyMapper.getMonitorIds">
</collection>
</resultMap> </resultMap>
<select id="selectUpdateStrategy" resultMap="StrategyResultMap"> <select id="selectUpdateStrategy" resultMap="StrategyResultMap">
SELECT SELECT
ts.Id AS id, ts.Id AS id,
ts.NAME AS NAME, ts.NAME AS NAME,
ts.Grade AS grade, ts.Grade AS grade,
ts.dept_id,
ts.type,
ts.Operation AS operation ts.Operation AS operation
FROM FROM
ths_warn_strategy ts ths_warn_strategy ts
@@ -52,7 +59,7 @@
Warn_Id = #{id} and ts.Type=1 Warn_Id = #{id} and ts.Type=1
</select> </select>
<!--查询策略的集合--> <!--查询策略的集合-->
<select id="selectStrategyList" parameterType="com.njcn.prepare.harmonic.pojo.param.SuperviseParam" <select id="selectStrategyList" parameterType="com.njcn.process.pojo.param.SuperviseParam"
resultType="com.njcn.harmonic.pojo.vo.ThsStrategyVo"> resultType="com.njcn.harmonic.pojo.vo.ThsStrategyVo">
select select
tws.id, tws.id,
@@ -60,12 +67,9 @@
tws.grade, tws.grade,
tws.operation, tws.operation,
tws.type, tws.type,
Monitor_Id as monitorId, tws.dept_Id as deptId
tda.dept_Id as deptId
from from
ths_warn_strategy tws ths_warn_strategy tws
INNER join ths_dept_alarm tda on
tws.Id = tda.Alarm_Id
<where> <where>
<choose> <choose>
<when test="param.initType==0"> <when test="param.initType==0">
@@ -76,12 +80,11 @@
</when> </when>
</choose> </choose>
<if test="param.deptId !=null and param.deptId !=''"> <if test="param.deptId !=null and param.deptId !=''">
and tda.Dept_Id=#{param.deptId} and tws.Dept_Id=#{param.deptId}
</if> </if>
<if test="param.type !=null"> <if test="param.type !=null">
and tda.type=#{param.type} and tws.type=#{param.type}
</if> </if>
and tws.Big_Type=1
</where> </where>
</select> </select>
@@ -94,4 +97,13 @@
Warn_Id = #{id} and ts.Type=0 Warn_Id = #{id} and ts.Type=0
</select> </select>
<select id="getMonitorIds" resultType="java.lang.String">
SELECT
Ass_Id
FROM
ths_warn_strategy_ass ts
WHERE
Warn_Id = #{id} and ts.Type=2
</select>
</mapper> </mapper>

View File

@@ -2,8 +2,8 @@ package com.njcn.process.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog; import com.njcn.process.pojo.po.ThsOverRunLog;
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo; import com.njcn.process.pojo.vo.SuperviceRunLogVo;
/** /**
* <p> * <p>

View File

@@ -4,11 +4,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto; import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto;
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise; import com.njcn.process.pojo.param.SuperviseParam;
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo; import com.njcn.process.pojo.po.ThsSupervise;
import com.njcn.prepare.harmonic.pojo.vo.SuperviseVo; import com.njcn.process.pojo.vo.SuperviceRunLogVo;
import com.njcn.prepare.harmonic.pojo.vo.ThsSuperviseVo; import com.njcn.process.pojo.vo.SuperviseVo;
import com.njcn.process.pojo.vo.ThsSuperviseVo;
import com.njcn.process.pojo.param.FileParam; import com.njcn.process.pojo.param.FileParam;
import com.njcn.process.pojo.param.ThsSuperviseParam;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@@ -91,7 +95,7 @@ public interface ThsSuperviseService extends IService<ThsSupervise> {
* @param superviseDto * @param superviseDto
* @return * @return
*/ */
Page<ThsSuperviseVo> superviseIndex(SuperviseDto superviseDto); ThsSuperviseVo superviseIndex(SuperviseDto superviseDto);
/** /**
* 下载反馈文件 * 下载反馈文件
@@ -101,4 +105,19 @@ public interface ThsSuperviseService extends IService<ThsSupervise> {
* @return * @return
*/ */
HttpServletResponse downloadFeedBackFile(FileParam fileParam, HttpServletRequest request, HttpServletResponse response); HttpServletResponse downloadFeedBackFile(FileParam fileParam, HttpServletRequest request, HttpServletResponse response);
/**
* 生成预警单告警单
* @author cdf
* @date 2024/1/29
*/
SuperviceRunLogVo initSupervise(@RequestBody @Validated SuperviseParam superviseParam);
SuperviceRunLogVo initSuperviseHand(@RequestBody @Validated SuperviseParam superviseParam);
Page<ThsSupervise> queryPage(ThsSuperviseParam thsSuperviseParam);
} }

View File

@@ -10,12 +10,12 @@ import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO; import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PmsMonitorParam; import com.njcn.device.pms.pojo.param.PmsMonitorParam;
import com.njcn.oss.utils.FileStorageUtil; import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog; import com.njcn.process.pojo.po.ThsOverRunLog;
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise; import com.njcn.process.pojo.po.ThsSupervise;
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
import com.njcn.process.enums.ProgressEnum; import com.njcn.process.enums.ProgressEnum;
import com.njcn.process.mapper.ThsOverRunLogMapper; import com.njcn.process.mapper.ThsOverRunLogMapper;
import com.njcn.process.mapper.ThsSuperviseMapper; import com.njcn.process.mapper.ThsSuperviseMapper;
import com.njcn.process.pojo.vo.SuperviceRunLogVo;
import com.njcn.process.service.ThsOverRunLogService; import com.njcn.process.service.ThsOverRunLogService;
import com.njcn.user.api.DeptFeignClient; import com.njcn.user.api.DeptFeignClient;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;

View File

@@ -1,6 +1,7 @@
package com.njcn.process.service.impl; package com.njcn.process.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
@@ -12,29 +13,44 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil; import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
import com.njcn.device.biz.pojo.dto.CommMonitorInfoDTO;
import com.njcn.device.biz.pojo.param.MonitorGetParam;
import com.njcn.device.pms.api.MonitorClient; import com.njcn.device.pms.api.MonitorClient;
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO; import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PmsMonitorParam; import com.njcn.device.pms.pojo.param.PmsMonitorParam;
import com.njcn.harmonic.api.RStatLimitRateDClient;
import com.njcn.harmonic.pojo.param.RStatLimitQueryParam;
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
import com.njcn.harmonic.pojo.vo.ThsStrategyVo;
import com.njcn.oss.constant.OssPath; import com.njcn.oss.constant.OssPath;
import com.njcn.oss.utils.FileStorageUtil; import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto; import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto;
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog; import com.njcn.process.pojo.param.SuperviseParam;
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise; import com.njcn.process.pojo.po.ThsOverRunLog;
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo; import com.njcn.process.pojo.po.ThsSupervise;
import com.njcn.prepare.harmonic.pojo.vo.SuperviseVo; import com.njcn.process.pojo.vo.SuperviceRunLogVo;
import com.njcn.prepare.harmonic.pojo.vo.ThsSuperviseVo; import com.njcn.process.pojo.vo.SuperviseVo;
import com.njcn.process.pojo.vo.ThsSuperviseVo;
import com.njcn.harmonic.annotaion.HarCurrent;
import com.njcn.harmonic.annotaion.HarVoltage;
import com.njcn.harmonic.annotaion.InterharVoltage;
import com.njcn.process.enums.*; import com.njcn.process.enums.*;
import com.njcn.process.mapper.*; import com.njcn.process.mapper.*;
import com.njcn.process.pojo.param.FileParam; import com.njcn.process.pojo.param.FileParam;
import com.njcn.process.pojo.param.ThsSuperviseParam;
import com.njcn.process.pojo.po.FlowableAss; import com.njcn.process.pojo.po.FlowableAss;
import com.njcn.process.pojo.po.ThsAlarmFormwork; import com.njcn.process.pojo.po.ThsAlarmFormwork;
import com.njcn.process.pojo.po.ThsWarnStrategyAss;
import com.njcn.process.pojo.vo.flowable.FlowTaskVo; import com.njcn.process.pojo.vo.flowable.FlowTaskVo;
import com.njcn.process.service.ThsOverRunLogService;
import com.njcn.process.service.ThsSuperviseService; import com.njcn.process.service.ThsSuperviseService;
import com.njcn.process.service.flowable.IFlowDefinitionService; import com.njcn.process.service.flowable.IFlowDefinitionService;
import com.njcn.process.service.flowable.IFlowTaskService; import com.njcn.process.service.flowable.IFlowTaskService;
import com.njcn.process.utils.ReadPatientExcelUtil; import com.njcn.process.utils.ReadPatientExcelUtil;
import com.njcn.system.api.DicDataFeignClient; import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.enums.DicDataTypeEnum;
import com.njcn.system.pojo.po.DictData;
import com.njcn.user.api.DeptFeignClient; import com.njcn.user.api.DeptFeignClient;
import com.njcn.user.pojo.po.Dept; import com.njcn.user.pojo.po.Dept;
import com.njcn.web.factory.PageFactory; import com.njcn.web.factory.PageFactory;
@@ -53,13 +69,18 @@ import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.zip.Adler32; import java.util.zip.Adler32;
import java.util.zip.CheckedOutputStream; import java.util.zip.CheckedOutputStream;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import static com.njcn.process.enums.SteadyIndicatorEnum.Negative_Voltage;
/** /**
* <p> * <p>
* 服务实现类 * 服务实现类
@@ -74,7 +95,7 @@ import java.util.zip.ZipOutputStream;
public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, ThsSupervise> implements ThsSuperviseService { public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, ThsSupervise> implements ThsSuperviseService {
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
private final ThsWarnStrategyMapper thsWarnStrategyMapper; private final ThsWarnStrategyMapper thsWarnStrategyMapper;
@@ -87,7 +108,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
private final ThsSuperviseMapper thsSuperviseMapper; private final ThsSuperviseMapper thsSuperviseMapper;
private final ThsOverRunLogMapper thsOverRunLogMapper; private final ThsOverRunLogService thsOverRunLogService;
private final DeptFeignClient deptFeignClient; private final DeptFeignClient deptFeignClient;
@@ -104,6 +125,13 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
private final FlowableAssMapper flowableAssMapper; private final FlowableAssMapper flowableAssMapper;
private final ThsDeptMonitorMapper thsDeptMonitorMapper;
private final CommTerminalGeneralClient commTerminalGeneralClient;
private final RStatLimitRateDClient rStatLimitRateDClient;
/** /**
* 构建技术监督名称 * 构建技术监督名称
* *
@@ -135,7 +163,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
thsSupervise.setModifyTime(date); thsSupervise.setModifyTime(date);
thsSupervise.setSupIndex(IdUtil.simpleUUID()); thsSupervise.setSupIndex(IdUtil.simpleUUID());
this.buildSuperviseName(thsSupervise, superviceRunLogVo.getOverRunLog(), dept); this.buildSuperviseName(thsSupervise, superviceRunLogVo.getOverRunLog(), dept);
this.thsSuperviseMapper.insert(thsSupervise); this.save(thsSupervise);
//TODO 解决工作流写死问题 //TODO 解决工作流写死问题
Map<String, Object> mapParam = new HashMap<>(); Map<String, Object> mapParam = new HashMap<>();
String proInId = ""; String proInId = "";
@@ -150,7 +178,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
for (ThsOverRunLog thsOverRunLog : superviceRunLogVo.getOverRunLog()) { for (ThsOverRunLog thsOverRunLog : superviceRunLogVo.getOverRunLog()) {
thsOverRunLog.setCreateTime(date); thsOverRunLog.setCreateTime(date);
thsOverRunLog.setSupIndex(thsSupervise.getSupIndex()); thsOverRunLog.setSupIndex(thsSupervise.getSupIndex());
this.thsOverRunLogMapper.insert(thsOverRunLog); thsOverRunLogService.save(thsOverRunLog);
} }
} }
} }
@@ -160,12 +188,12 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
Integer pageNum = PageFactory.getPageNum(superviseDto); Integer pageNum = PageFactory.getPageNum(superviseDto);
Integer pageSize = PageFactory.getPageSize(superviseDto); Integer pageSize = PageFactory.getPageSize(superviseDto);
Page<SuperviseVo> superviseVoPage = new Page<>(pageNum, pageSize); Page<SuperviseVo> superviseVoPage = new Page<>(pageNum, pageSize);
Page<SuperviseVo> page = thsSuperviseMapper.querySuperviseList(superviseVoPage, superviseDto); Page<SuperviseVo> page = thsSuperviseMapper.querySupervisePage(superviseVoPage,superviseDto);
List<SuperviseVo> pageRecords = page.getRecords(); List<SuperviseVo> pageRecords = page.getRecords();
if (CollectionUtil.isNotEmpty(pageRecords)) { if (CollectionUtil.isNotEmpty(pageRecords)) {
for (SuperviseVo superviseVo : pageRecords) { for (SuperviseVo superviseVo : pageRecords) {
superviseVo.setCompanyName(deptFeignClient.getDeptById(superviseVo.getDeptId()).getData().getName()); superviseVo.setCompanyName(deptFeignClient.getDeptById(superviseVo.getDeptId()).getData().getName());
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, superviseVo.getSupIndex())); List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, superviseVo.getSupIndex()));
if (CollectionUtil.isNotEmpty(thsOverRunLogs)) { if (CollectionUtil.isNotEmpty(thsOverRunLogs)) {
List<String> alarmTickets = thsOverRunLogs.stream().filter(r -> StringUtils.isNotBlank(r.getAlarmTicket())).map(ThsOverRunLog::getAlarmTicket).collect(Collectors.toList()); List<String> alarmTickets = thsOverRunLogs.stream().filter(r -> StringUtils.isNotBlank(r.getAlarmTicket())).map(ThsOverRunLog::getAlarmTicket).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(alarmTickets)) { if (CollectionUtil.isNotEmpty(alarmTickets)) {
@@ -199,7 +227,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
public HttpResult deleteSupervise(SuperviseDto superviseDto) { public HttpResult deleteSupervise(SuperviseDto superviseDto) {
if (CollectionUtil.isNotEmpty(superviseDto.getDeleteIds())) { if (CollectionUtil.isNotEmpty(superviseDto.getDeleteIds())) {
superviseDto.getDeleteIds().forEach(id -> { superviseDto.getDeleteIds().forEach(id -> {
thsOverRunLogMapper.delete(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, id)); thsOverRunLogService.remove(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, id));
thsSuperviseMapper.delete(new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, id)); thsSuperviseMapper.delete(new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, id));
//删除同时删除工作流程 //删除同时删除工作流程
@@ -223,20 +251,20 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
ThsSupervise thsSuperObj = thsSuperviseMapper.selectById(supIndex); ThsSupervise thsSuperObj = thsSuperviseMapper.selectById(supIndex);
if (files != null && files.length == 1) { if (files != null && files.length == 1) {
ThsOverRunLog thsOverRunLog = thsOverRunLogMapper.selectById(id); ThsOverRunLog thsOverRunLog = thsOverRunLogService.getById(id);
thsOverRunLog.setId(id); thsOverRunLog.setId(id);
String path = fileStorageUtil.uploadMultipart(files[0], OssPath.ELECTRICITY_QUALITY); String path = fileStorageUtil.uploadMultipart(files[0], OssPath.ELECTRICITY_QUALITY);
this.updateSuperviesData(path, thsOverRunLog, ticketType, thsSupervise); this.updateSuperviesData(path, thsOverRunLog, ticketType, thsSupervise);
this.updateProcess(thsSupervise, ticketType,thsSuperObj.getType()); this.updateProcess(thsSupervise, ticketType,thsSuperObj.getType());
} }
if (files != null && files.length > 1) { if (files != null && files.length > 1) {
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex)); List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
this.batchUploadFile(thsSupervise, thsOverRunLogs, files, ticketType); this.batchUploadFile(thsSupervise, thsOverRunLogs, files, ticketType);
this.updateProcess(thsSupervise, ticketType,thsSuperObj.getType()); this.updateProcess(thsSupervise, ticketType,thsSuperObj.getType());
} }
//判断当监督单下面的监测点报告都被上传则认为流程完成 //判断当监督单下面的监测点报告都被上传则认为流程完成
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex)); List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
List<String> fileNames = thsOverRunLogs.stream().filter(item-> StrUtil.isNotBlank(item.getFeedback())).map(ThsOverRunLog::getFileName).distinct().collect(Collectors.toList()); List<String> fileNames = thsOverRunLogs.stream().filter(item-> StrUtil.isNotBlank(item.getFeedback())).map(ThsOverRunLog::getFileName).distinct().collect(Collectors.toList());
if(fileNames.size() == thsOverRunLogs.size()){ if(fileNames.size() == thsOverRunLogs.size()){
FlowableAss flowableAss = flowableAssMapper.selectById(supIndex); FlowableAss flowableAss = flowableAssMapper.selectById(supIndex);
@@ -354,7 +382,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
thsOverRunLog.setReviseFeedback(path); thsOverRunLog.setReviseFeedback(path);
break; break;
} }
thsOverRunLogMapper.updateById(thsOverRunLog); thsOverRunLogService.updateById(thsOverRunLog);
} }
@@ -408,7 +436,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
thsSupervise.setProgress(ProgressEnum.REVISE_FEEDBACK.getCode()); thsSupervise.setProgress(ProgressEnum.REVISE_FEEDBACK.getCode());
thsOverRunLog.setReviseNotice(thsAlarmFormwork.getPath()); thsOverRunLog.setReviseNotice(thsAlarmFormwork.getPath());
} }
thsOverRunLogMapper.update(thsOverRunLog, new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex)); thsOverRunLogService.update(thsOverRunLog, new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
thsSuperviseMapper.update(thsSupervise, new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, supIndex)); thsSuperviseMapper.update(thsSupervise, new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, supIndex));
FlowableAss flowableAss = flowableAssMapper.selectById(supIndex); FlowableAss flowableAss = flowableAssMapper.selectById(supIndex);
@@ -423,47 +451,48 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
} }
@Override @Override
public Page<ThsSuperviseVo> superviseIndex(SuperviseDto superviseDto) { public ThsSuperviseVo superviseIndex(SuperviseDto superviseDto) {
Integer pageNum = PageFactory.getPageNum(superviseDto); List<SuperviseVo> querySuperviseList = thsSuperviseMapper.querySuperviseList(superviseDto);
Integer pageSize = PageFactory.getPageSize(superviseDto);
Page<SuperviseVo> superviseVoPage = new Page<>(pageNum, pageSize);
Page<SuperviseVo> page = thsSuperviseMapper.querySuperviseList(superviseVoPage, superviseDto);
List<SuperviseVo> pageRecords = page.getRecords();
Page<ThsSuperviseVo> thsSuperviseVoPage = new Page<>(pageNum, pageSize);
thsSuperviseVoPage.setTotal(superviseVoPage.getTotal());
ThsSuperviseVo thsSuperviseVo = new ThsSuperviseVo(); ThsSuperviseVo thsSuperviseVo = new ThsSuperviseVo();
if (CollectionUtil.isNotEmpty(pageRecords)) { if (CollectionUtil.isNotEmpty(querySuperviseList)) {
for (SuperviseVo superviseVo : pageRecords) { for (SuperviseVo superviseVo : querySuperviseList) {
superviseVo.setCompanyName(deptFeignClient.getDeptById(superviseVo.getDeptId()).getData().getName()); superviseVo.setCompanyName(deptFeignClient.getDeptById(superviseVo.getDeptId()).getData().getName());
//处理预警类型 //处理预警类型
Date modifyTime = superviseVo.getModifyTime(); Date modifyTime = superviseVo.getModifyTime();
Long progressTime = DateUtil.between(modifyTime, new Date(), DateUnit.DAY); if (Objects.nonNull(modifyTime)) {
superviseVo.setProgressTime(progressTime.intValue());
switch (ProgressEnum.getProgressEnumByCode(superviseVo.getProgress())) { Long progressTime = DateUtil.between(modifyTime, new Date(), DateUnit.DAY);
case START: superviseVo.setProgressTime(progressTime.intValue());
case ALARM_TICKET_ISSUE: switch (ProgressEnum.getProgressEnumByCode(superviseVo.getProgress())) {
if (progressTime >= 1) { case START:
superviseVo.setAlertType(AlertTypeEnum.RED.getCode());
} else { case ALARM_TICKET_ISSUE:
superviseVo.setAlertType(AlertTypeEnum.BLACK.getCode()); if (progressTime >= 1) {
} superviseVo.setAlertType(AlertTypeEnum.RED.getCode());
break; } else {
default: superviseVo.setAlertType(AlertTypeEnum.BLACK.getCode());
if (progressTime >= 10) { }
superviseVo.setAlertType(AlertTypeEnum.RED.getCode()); break;
} else if (progressTime >= 8) { default:
superviseVo.setAlertType(AlertTypeEnum.ORANGE.getCode()); if (progressTime >= 10) {
} else if (progressTime >= 5) { superviseVo.setAlertType(AlertTypeEnum.RED.getCode());
superviseVo.setAlertType(AlertTypeEnum.YELLOW.getCode()); } else if (progressTime >= 8) {
} else { superviseVo.setAlertType(AlertTypeEnum.ORANGE.getCode());
superviseVo.setAlertType(AlertTypeEnum.BLACK.getCode()); } else if (progressTime >= 5) {
} superviseVo.setAlertType(AlertTypeEnum.YELLOW.getCode());
break; } else {
superviseVo.setAlertType(AlertTypeEnum.BLACK.getCode());
}
break;
}
} }
} }
thsSuperviseVo.setSuperviseVoList(pageRecords); thsSuperviseVo.setSuperviseVoList(querySuperviseList);
//分组计算每种流程状态的数量 //分组计算每种流程状态的数量
Map<Integer, List<SuperviseVo>> map = pageRecords.stream().collect(Collectors.groupingBy(SuperviseVo::getProgress)); Map<Integer, List<SuperviseVo>> map = querySuperviseList.stream().collect(Collectors.groupingBy(SuperviseVo::getProgress));
for (Map.Entry<Integer, List<SuperviseVo>> entry : map.entrySet()) { for (Map.Entry<Integer, List<SuperviseVo>> entry : map.entrySet()) {
Integer code = entry.getKey(); Integer code = entry.getKey();
switch (ProgressEnum.getProgressEnumByCode(code)) { switch (ProgressEnum.getProgressEnumByCode(code)) {
@@ -491,7 +520,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
} }
} }
//分组计算预/告警单数量 //分组计算预/告警单数量
Map<Integer, List<SuperviseVo>> typeMap = pageRecords.stream().collect(Collectors.groupingBy(SuperviseVo::getType)); Map<Integer, List<SuperviseVo>> typeMap = querySuperviseList.stream().collect(Collectors.groupingBy(SuperviseVo::getType));
for (Map.Entry<Integer, List<SuperviseVo>> entry : typeMap.entrySet()) { for (Map.Entry<Integer, List<SuperviseVo>> entry : typeMap.entrySet()) {
Integer code = entry.getKey(); Integer code = entry.getKey();
switch (AlarmTypeEnum.getAlarmTypeEnumByCode(code)) { switch (AlarmTypeEnum.getAlarmTypeEnumByCode(code)) {
@@ -504,8 +533,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
} }
} }
} }
thsSuperviseVoPage.setRecords(Collections.singletonList(thsSuperviseVo)); return thsSuperviseVo;
return thsSuperviseVoPage;
} }
@@ -515,7 +543,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
if (ticketTypeEnum == null) { if (ticketTypeEnum == null) {
throw new BusinessException("上传单据参数类型错误!"); throw new BusinessException("上传单据参数类型错误!");
} }
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().in(ThsOverRunLog::getId, fileParam.getIds())); List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogService.list(new LambdaQueryWrapper<ThsOverRunLog>().in(ThsOverRunLog::getId, fileParam.getIds()));
if (CollectionUtil.isNotEmpty(thsOverRunLogs)) { if (CollectionUtil.isNotEmpty(thsOverRunLogs)) {
Map<String, String> filePathMap = new HashedMap(); Map<String, String> filePathMap = new HashedMap();
switch (ticketTypeEnum) { switch (ticketTypeEnum) {
@@ -536,6 +564,259 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
return response; return response;
} }
/**
* 生成预警单告警单(自动)
* @author cdf
* @date 2024/1/29
*/
@Override
public SuperviceRunLogVo initSupervise(SuperviseParam superviseParam) {
SuperviceRunLogVo superviceRunLogVo = new SuperviceRunLogVo();
List<ThsSupervise> thsSuperviseListPO = new ArrayList<>();
List<ThsOverRunLog> allThsLogPO = new ArrayList<>();
String yesterday = LocalDate.now().minusDays(1).format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
List<DictData> dictTargetList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData();
List<ThsStrategyVo> thsStrategyList = this.thsWarnStrategyMapper.selectStrategyList(superviseParam);
//按部门进行分组
if (CollectionUtil.isNotEmpty(thsStrategyList)) {
List<ThsStrategyVo> oneLevel = thsStrategyList.stream().filter(r -> !GradeEnum.THREE_LEVEL.getCode().equals(r.getGrade())).collect(Collectors.toList());//一级或二级策略集合
Map<String, List<ThsStrategyVo>> deptMap = oneLevel.stream().collect(Collectors.groupingBy(ThsStrategyVo::getDeptId));
for (Map.Entry<String, List<ThsStrategyVo>> entry : deptMap.entrySet()) {
String depId = entry.getKey();
List<String> deptAllIds = deptFeignClient.getDepSonIdtByDeptId(depId).getData();
Dept dept = deptFeignClient.getDeptById(depId).getData();
List<ThsOverRunLog> thsOverRunLogList = new ArrayList<>();
ThsSupervise thsSupervise = null;
List<ThsStrategyVo> deptStrategyList = entry.getValue();
if (CollectionUtil.isNotEmpty(deptStrategyList)) {
//遍历当前部门下面的所有策略
for (ThsStrategyVo oneStrategyVo : deptStrategyList) {
List<ThsWarnStrategyAss> oneInterferenceSourceAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.SOURCE_TYPE);//干扰源列表
List<ThsWarnStrategyAss> oneSteadyIndicatorAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.INTERFERENCE_TYPE);//指标类型列表
List<ThsWarnStrategyAss> oneMonitorAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.MONITOR_TYPE);//监测点列表
List<String> tagIds = oneInterferenceSourceAsses.stream().map(ThsWarnStrategyAss::getAssId).distinct().collect(Collectors.toList());
List<String> targetIds = oneSteadyIndicatorAsses.stream().map(ThsWarnStrategyAss::getAssId).distinct().collect(Collectors.toList());
List<String> monitorIds = oneMonitorAsses.stream().map(ThsWarnStrategyAss::getAssId).collect(Collectors.toList());
MonitorGetParam monitorGetParam = new MonitorGetParam();
monitorGetParam.setTagList(tagIds);
monitorGetParam.setMonitorIds(monitorIds);
monitorGetParam.setDeptIds(deptAllIds);
//TODO 需要校验
List<CommMonitorInfoDTO> commMonitorInfoDTOList = commTerminalGeneralClient.tagOrIdGetMonitorList(monitorGetParam).getData();
Map<String,CommMonitorInfoDTO> monitorInfoDTOMap = commMonitorInfoDTOList.stream().collect(Collectors.toMap(CommMonitorInfoDTO::getId,Function.identity()));
List<String> temIds= commMonitorInfoDTOList.stream().map(CommMonitorInfoDTO::getId).distinct().collect(Collectors.toList());
List<RStatLimitRateDPO> rStatLimitRateDPOList = rStatLimitRateDClient.monitorIdsGetLimitInfo(RStatLimitQueryParam.builder().ids(temIds).date(yesterday).build()).getData();
//TODO 数据中心和pms这边稳态指标没用一个需要考虑兼容问题
dictTargetList = dictTargetList.stream().filter(item->targetIds.contains(item.getId())).collect(Collectors.toList());
//判断指标是否在策略中
if(CollectionUtil.isNotEmpty(rStatLimitRateDPOList)){
for(RStatLimitRateDPO rStatLimitRateDPO :rStatLimitRateDPOList ){
List<String> descriptionList = new ArrayList<>();
Integer[] count = {0};
Map<String,Boolean> limitBoolMap = verifyLimit(rStatLimitRateDPO,dictTargetList,descriptionList,count);
if(oneStrategyVo.getOperation().equals(OperationEnum.AND.getCode()) ){
//与
boolean res = limitBoolMap.containsValue(false);
if(res){
continue;
}
}else {
//或
boolean res = limitBoolMap.containsValue(true);
if(!res){
continue;
}
}
//到这一步说明符合策略保留该条数据,开始组装实体
if(Objects.isNull(thsSupervise)){
thsSupervise = new ThsSupervise();
buildSuperviseData(yesterday,dept,superviseParam,oneStrategyVo,superviseParam.getInitType(),thsSupervise);
thsSuperviseListPO.add(thsSupervise);
}
buildOverRunLog(thsSupervise,monitorInfoDTOMap.get(rStatLimitRateDPO.getLineId()),descriptionList,thsOverRunLogList,count);
}
allThsLogPO.addAll(thsOverRunLogList);
}
}
if(superviseParam.getInitType().equals(InitTypeEnum.AUTO.getCode())){
if(CollectionUtil.isNotEmpty(thsSuperviseListPO)){
this.saveBatch(thsSuperviseListPO);
thsOverRunLogService.saveBatch(allThsLogPO);
return null;
}
}else {
superviceRunLogVo.setOverRunLog(allThsLogPO);
return superviceRunLogVo;
}
}
}
}
return superviceRunLogVo;
}
@Override
public SuperviceRunLogVo initSuperviseHand(SuperviseParam superviseParam) {
SuperviceRunLogVo superviceRunLogVo = new SuperviceRunLogVo();
List<ThsOverRunLog> thsOverRunLogList = new ArrayList<>();
String yesterday = LocalDate.now().minusDays(1).format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN));
List<DictData> dictTargetList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.STEADY_STATIS.getCode()).getData();
if (InitTypeEnum.MANUAL.getCode().equals(superviseParam.getInitType()) && StringUtils.isBlank(superviseParam.getDeptId())) {
throw new BusinessException(CommonResponseEnum.INVALID_PARAMETER.getMessage());
}
List<ThsStrategyVo> thsStrategyList = this.thsWarnStrategyMapper.selectStrategyList(superviseParam);
//按部门进行分组
if (CollectionUtil.isNotEmpty(thsStrategyList)) {
ThsSupervise thsSupervise = null;
List<ThsStrategyVo> oneLevel = thsStrategyList.stream().filter(r -> !GradeEnum.THREE_LEVEL.getCode().equals(r.getGrade())).collect(Collectors.toList());//一级或二级策略集合
if (CollectionUtil.isNotEmpty(oneLevel)) {
//遍历当前部门下面的所有策略
for (ThsStrategyVo oneStrategyVo : oneLevel) {
Dept dept = deptFeignClient.getDeptById(oneStrategyVo.getDeptId()).getData();
List<ThsWarnStrategyAss> oneInterferenceSourceAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.SOURCE_TYPE);//干扰源列表
List<ThsWarnStrategyAss> oneSteadyIndicatorAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.INTERFERENCE_TYPE);//指标类型列表
List<ThsWarnStrategyAss> oneMonitorAsses = this.queryWarnStrategyAss(oneStrategyVo.getId(), TypeEnum.MONITOR_TYPE);//监测点列表
List<String> tagIds = oneInterferenceSourceAsses.stream().map(ThsWarnStrategyAss::getAssId).distinct().collect(Collectors.toList());
List<String> targetIds = oneSteadyIndicatorAsses.stream().map(ThsWarnStrategyAss::getAssId).distinct().collect(Collectors.toList());
List<String> monitorIds = oneMonitorAsses.stream().map(ThsWarnStrategyAss::getAssId).collect(Collectors.toList());
MonitorGetParam monitorGetParam = new MonitorGetParam();
monitorGetParam.setTagList(tagIds);
monitorGetParam.setMonitorIds(monitorIds);
List<String> deptAllIds = deptFeignClient.getDepSonIdtByDeptId(oneStrategyVo.getDeptId()).getData();
monitorGetParam.setDeptIds(deptAllIds);
//TODO 需要校验
List<CommMonitorInfoDTO> commMonitorInfoDTOList = commTerminalGeneralClient.tagOrIdGetMonitorList(monitorGetParam).getData();
Map<String,CommMonitorInfoDTO> monitorInfoDTOMap = commMonitorInfoDTOList.stream().collect(Collectors.toMap(CommMonitorInfoDTO::getId,Function.identity()));
List<String> temIds= commMonitorInfoDTOList.stream().map(CommMonitorInfoDTO::getId).distinct().collect(Collectors.toList());
List<RStatLimitRateDPO> rStatLimitRateDPOList = rStatLimitRateDClient.monitorIdsGetLimitInfo(RStatLimitQueryParam.builder().ids(temIds).date(yesterday).build()).getData();
//TODO 数据中心和pms这边稳态指标没用一个需要考虑兼容问题
dictTargetList = dictTargetList.stream().filter(item->targetIds.contains(item.getId())).collect(Collectors.toList());
//判断指标是否在策略中
if(CollectionUtil.isNotEmpty(rStatLimitRateDPOList)){
for(RStatLimitRateDPO rStatLimitRateDPO :rStatLimitRateDPOList ){
List<String> descriptionList = new ArrayList<>();
Integer[] count = {0};
Map<String,Boolean> limitBoolMap = verifyLimit(rStatLimitRateDPO,dictTargetList,descriptionList,count);
if(oneStrategyVo.getOperation().equals(OperationEnum.AND.getCode()) ){
//与
boolean res = limitBoolMap.containsValue(false);
if(res){
continue;
}
}else {
//或
boolean res = limitBoolMap.containsValue(true);
if(!res){
continue;
}
}
//到这一步说明符合策略保留该条数据,开始组装实体
if(Objects.isNull(thsSupervise)){
thsSupervise = new ThsSupervise();
buildSuperviseData(yesterday,dept,superviseParam,oneStrategyVo,superviseParam.getInitType(),thsSupervise);
}
buildOverRunLog(thsSupervise,monitorInfoDTOMap.get(rStatLimitRateDPO.getLineId()),descriptionList,thsOverRunLogList,count);
}
}
}
}
}
superviceRunLogVo.setOverRunLog(thsOverRunLogList);
return superviceRunLogVo;
}
@Override
public Page<ThsSupervise> queryPage(ThsSuperviseParam thsSuperviseParam) {
return this.page(new Page<>(thsSuperviseParam.getPageNum(),thsSuperviseParam.getPageSize()),new LambdaQueryWrapper<ThsSupervise>()
.between(ThsSupervise::getCreateTime,DateUtil.beginOfDay(DateUtil.parse(thsSuperviseParam.getStartTime())),DateUtil.endOfDay(DateUtil.parse(thsSuperviseParam.getEndTime())))
.eq(ThsSupervise::getDeptId,thsSuperviseParam.getDeptId()));
}
public void buildSuperviseData(String yesterday,Dept dept ,SuperviseParam superviseParam,ThsStrategyVo steady,Integer initType, ThsSupervise thsSupervise) {
if (thsSupervise != null && StringUtils.isBlank(thsSupervise.getSupIndex())) {
thsSupervise.setName(yesterday+dept.getName()+AlarmTypeEnum.getAlarmTypeEnumByCode(superviseParam.getType()).getMessage());
thsSupervise.setSupIndex(IdUtil.simpleUUID());
thsSupervise.setDeptId(steady.getDeptId());
thsSupervise.setCreateTime(new Date());
thsSupervise.setType(steady.getType());
thsSupervise.setCreateUser(RequestUtil.getUsername());
thsSupervise.setProgress(ProgressEnum.START.getCode());
thsSupervise.setCreateType(initType);
}
}
public void buildOverRunLog(ThsSupervise thsSupervise, CommMonitorInfoDTO monitor,List<String> descriptionList,List<ThsOverRunLog> thsOverRunLogs,Integer[] count) {
ThsOverRunLog thsOverRunLog = new ThsOverRunLog();
thsOverRunLog.setId(IdUtil.simpleUUID());
thsOverRunLog.setSupIndex(thsSupervise.getSupIndex());
thsOverRunLog.setLineIndex(monitor.getId());
thsOverRunLog.setName(monitor.getPowerStationName() + "_" + monitor.getName() + "_" + DateUtil.today() + "_" + monitor.getId());
thsOverRunLog.setUpdateTime(new Date());
thsOverRunLog.setCreateTime(new Date());
thsOverRunLog.setDescription(StringUtils.join(descriptionList, ","));
thsOverRunLog.setCompanyName(monitor.getPowerStationName());
thsOverRunLog.setLineIndexName(monitor.getName());
thsOverRunLog.setOverTime(count[0]);
thsOverRunLogs.add(thsOverRunLog);
}
private List<ThsWarnStrategyAss> queryWarnStrategyAss(String warnId, TypeEnum typeEnum) {
return thsWarnStrategyAssMapper.selectList(new LambdaQueryWrapper<ThsWarnStrategyAss>()
.eq(ThsWarnStrategyAss::getWarnId, warnId)
.eq(ThsWarnStrategyAss::getType, typeEnum.getCode()));
}
/** /**
* 批量下载.zip文件 * 批量下载.zip文件
* *
@@ -548,7 +829,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
private HttpServletResponse dowloadZipFile(FileParam fileParam, Map<String, String> filePathMap, HttpServletRequest request, HttpServletResponse response, TicketTypeEnum ticketTypeEnum) { private HttpServletResponse dowloadZipFile(FileParam fileParam, Map<String, String> filePathMap, HttpServletRequest request, HttpServletResponse response, TicketTypeEnum ticketTypeEnum) {
try { try {
if (CollectionUtil.isNotEmpty(filePathMap)) { if (CollectionUtil.isNotEmpty(filePathMap)) {
ThsOverRunLog thsOverRunLog = thsOverRunLogMapper.selectById(fileParam.getIds().get(0)); ThsOverRunLog thsOverRunLog = thsOverRunLogService.getById(fileParam.getIds().get(0));
ThsSupervise thsSupervise = thsSuperviseMapper.selectOne(new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, thsOverRunLog.getSupIndex()).last("limit 1")); ThsSupervise thsSupervise = thsSuperviseMapper.selectOne(new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, thsOverRunLog.getSupIndex()).last("limit 1"));
//改为自己的名称 //改为自己的名称
String fileName = thsSupervise.getName() + ".zip"; String fileName = thsSupervise.getName() + ".zip";
@@ -563,7 +844,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
// 用于将数据压缩成Zip文件格式 // 用于将数据压缩成Zip文件格式
ZipOutputStream zos = new ZipOutputStream(csum); ZipOutputStream zos = new ZipOutputStream(csum);
for (Map.Entry<String, String> entry : filePathMap.entrySet()) { for (Map.Entry<String, String> entry : filePathMap.entrySet()) {
ThsOverRunLog runLog = thsOverRunLogMapper.selectById(entry.getKey()); ThsOverRunLog runLog = thsOverRunLogService.getById(entry.getKey());
PmsMonitorParam pmsMonitorParam = new PmsMonitorParam(); PmsMonitorParam pmsMonitorParam = new PmsMonitorParam();
pmsMonitorParam.setMonitorIds(Collections.singletonList(runLog.getLineIndex())); pmsMonitorParam.setMonitorIds(Collections.singletonList(runLog.getLineIndex()));
HttpResult<List<PmsMonitorDTO>> monitorInfoListByCond = monitorClient.getMonitorInfoListByCond(pmsMonitorParam); HttpResult<List<PmsMonitorDTO>> monitorInfoListByCond = monitorClient.getMonitorInfoListByCond(pmsMonitorParam);
@@ -605,96 +886,106 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
/** /**
* 判断监测数据是否超标 * 判断监测数据是否超标
* *
* @param limitRate * @param rStatLimitRateDPO
* @param steady * @param dictTargetList
*/ */
// private Map<String, Object> verifyLimit(LimitRate limitRate, SourceSteadyIndicator steady) { private Map<String, Boolean> verifyLimit(RStatLimitRateDPO rStatLimitRateDPO,List<DictData> dictTargetList,List<String> descriptionList,Integer[] count) {
// if (limitRate != null) {
// List<String> steadyIndicator = steady.getSteadyIndicator();
// Map<String, Object> limitBoolMap = new HashedMap(); Map<String, Boolean> limitBoolMap = new HashMap<>();
// List<String> descriptionList = new ArrayList<>(); for(DictData dic : dictTargetList){
// steadyIndicator.forEach(id -> { SteadyIndicatorEnum steadyIndicatorEnum = SteadyIndicatorEnum.getSteadyIndicatorEnumByCode(dic.getCode());
// HttpResult<DictData> dicDataById = dicDataFeignClient.getDicDataById(id); switch (steadyIndicatorEnum) {
// if (CommonResponseEnum.SUCCESS.getCode().equals(dicDataById.getCode()) && dicDataById.getData() != null) { case Negative_Voltage://负序电压不平衡度
// SteadyIndicatorEnum steadyIndicatorEnum = SteadyIndicatorEnum.getSteadyIndicatorEnumByCode(dicDataById.getData().getCode()); if (rStatLimitRateDPO.getUbalanceOvertime() > 0) {
// if (null != steadyIndicatorEnum) { limitBoolMap.put(Negative_Voltage.getCode(), true);
// switch (steadyIndicatorEnum) { descriptionList.add(Negative_Voltage.getMessage().concat(rStatLimitRateDPO.getUbalanceOvertime() + ""));
// case Negative_Voltage://负序电压不平衡度 count[0] = count[0]+rStatLimitRateDPO.getUbalanceOvertime();
// if (limitRate.getUbalanceOvertime() > 0) { } else {
// limitBoolMap.put(SteadyIndicatorEnum.Negative_Voltage.getCode(), true); limitBoolMap.put(Negative_Voltage.getCode(), false);
// descriptionList.add(SteadyIndicatorEnum.Negative_Voltage.getMessage().concat(limitRate.getUbalanceOvertime() + "次")); }
// } else { break;
// limitBoolMap.put(SteadyIndicatorEnum.Negative_Voltage.getCode(), false); case Interhar_Voltage://间谐波电压
// } Integer interharVoltageOvertime = this.maxOverTime(rStatLimitRateDPO, InterharVoltage.class);
// break; if (interharVoltageOvertime > 0) {
// case Interhar_Voltage://间谐波电压 limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), true);
// Integer interharVoltageOvertime = this.maxOverTime(limitRate, InterharVoltage.class); descriptionList.add(SteadyIndicatorEnum.Interhar_Voltage.getMessage().concat(interharVoltageOvertime + ""));
// if (interharVoltageOvertime > 0) { count[0] = count[0]+interharVoltageOvertime;
// limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), true); } else {
// descriptionList.add(SteadyIndicatorEnum.Interhar_Voltage.getMessage().concat(interharVoltageOvertime + "次")); limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), false);
// } else { }
// limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), false); break;
// } case Neg_Current://负序电流
// break; if (rStatLimitRateDPO.getINegOvertime() > 0) {
// case Neg_Current://负序电流 limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), true);
// if (limitRate.getINegOvertime() > 0) { descriptionList.add(SteadyIndicatorEnum.Neg_Current.getMessage().concat(rStatLimitRateDPO.getINegOvertime() + ""));
// limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), true); count[0] = count[0]+rStatLimitRateDPO.getINegOvertime();
// descriptionList.add(SteadyIndicatorEnum.Neg_Current.getMessage().concat(limitRate.getINegOvertime() + "次")); } else {
// } else { limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), false);
// limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), false); }
// } break;
// break; case Fre_Deviation://频率偏差
// case Fre_Deviation://频率偏差 if (rStatLimitRateDPO.getFreqDevOvertime() > 0) {
// if (limitRate.getFreqDevOvertime() > 0) { limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), true);
// limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), true); descriptionList.add(SteadyIndicatorEnum.Fre_Deviation.getMessage().concat(rStatLimitRateDPO.getFreqDevOvertime() + ""));
// descriptionList.add(SteadyIndicatorEnum.Fre_Deviation.getMessage().concat(limitRate.getFreqDevOvertime() + "次")); count[0] = count[0]+rStatLimitRateDPO.getFreqDevOvertime();
// } else { } else {
// limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), false); limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), false);
// } }
// break; break;
// case Voltage_Dev://电压偏差 case Voltage_Dev://电压偏差
// if (limitRate.getVoltageDevOvertime() > 0) { if (rStatLimitRateDPO.getVoltageDevOvertime() > 0) {
// limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), true); limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), true);
// descriptionList.add(SteadyIndicatorEnum.Voltage_Dev.getMessage().concat(limitRate.getVoltageDevOvertime() + "次")); descriptionList.add(SteadyIndicatorEnum.Voltage_Dev.getMessage().concat(rStatLimitRateDPO.getVoltageDevOvertime() + ""));
// } else { count[0] = count[0]+rStatLimitRateDPO.getVoltageDevOvertime();
// limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), false); } else {
// } limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), false);
// break; }
// case Har_Current://谐波电流 break;
// Integer harCurrentOvertime = this.maxOverTime(limitRate, HarCurrent.class); case Har_Current://谐波电流
// if (harCurrentOvertime > 0) { Integer harCurrentOvertime = this.maxOverTime(rStatLimitRateDPO, HarCurrent.class);
// limitBoolMap.put(SteadyIndicatorEnum.Har_Current.getCode(), true); if (harCurrentOvertime > 0) {
// descriptionList.add(SteadyIndicatorEnum.Har_Current.getMessage().concat(harCurrentOvertime + "次")); limitBoolMap.put(SteadyIndicatorEnum.Har_Current.getCode(), true);
// } else { descriptionList.add(SteadyIndicatorEnum.Har_Current.getMessage().concat(harCurrentOvertime + ""));
// limitBoolMap.put(SteadyIndicatorEnum.Har_Current.getCode(), false); count[0] = count[0]+harCurrentOvertime;
// }
// break;
// case Voltage_Fluc://电压波动与闪变 } else {
// if (limitRate.getFlickerOvertime() > 0) { limitBoolMap.put(SteadyIndicatorEnum.Har_Current.getCode(), false);
// limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), true); }
// descriptionList.add(SteadyIndicatorEnum.Voltage_Fluc.getMessage().concat(limitRate.getFlickerOvertime() + "次")); break;
// } else { case Voltage_Fluc://电压波动与闪变
// limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), false); if (rStatLimitRateDPO.getFlickerOvertime() > 0) {
// } limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), true);
// break; descriptionList.add(SteadyIndicatorEnum.Voltage_Fluc.getMessage().concat(rStatLimitRateDPO.getFlickerOvertime() + ""));
// case Har_Voltage://谐波电压 count[0] = count[0]+rStatLimitRateDPO.getFlickerOvertime();
// Integer harVoltageOvertime = this.maxOverTime(limitRate, HarVoltage.class); } else {
// if (harVoltageOvertime > 0) { limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), false);
// limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), true); }
// descriptionList.add(SteadyIndicatorEnum.Har_Voltage.getMessage().concat(harVoltageOvertime + "次")); break;
// } else { case Har_Voltage://谐波电压
// limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), false); Integer harVoltageOvertime = this.maxOverTime(rStatLimitRateDPO, HarVoltage.class);
// } if (harVoltageOvertime > 0) {
// break; limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), true);
// } descriptionList.add(SteadyIndicatorEnum.Har_Voltage.getMessage().concat(harVoltageOvertime + ""));
// } count[0] = count[0]+harVoltageOvertime;
// } } else {
// }); limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), false);
// limitBoolMap.put(DESCRIPTION, descriptionList); }
// return limitBoolMap; break;
// } case Thd_V://畸变
// return null; if (rStatLimitRateDPO.getUaberranceOvertime() > 0) {
// } limitBoolMap.put(SteadyIndicatorEnum.Thd_V.getCode(), true);
descriptionList.add(SteadyIndicatorEnum.Thd_V.getMessage().concat(rStatLimitRateDPO.getUaberranceOvertime() + ""));
count[0] = count[0]+rStatLimitRateDPO.getUaberranceOvertime();
} else {
limitBoolMap.put(SteadyIndicatorEnum.Thd_V.getCode(), false);
}
break;
}
}
return limitBoolMap;
}
/*** /***
* 获取越限最大值 * 获取越限最大值

View File

@@ -3,6 +3,7 @@ package com.njcn.process.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -66,11 +67,12 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
@Override @Override
public List<ThsWarnStrategy> strategyList(StrategyParam.StrategyPageParam param) { public List<ThsWarnStrategy> strategyList(StrategyParam.StrategyPageParam param) {
return this.list(new LambdaQueryWrapper<ThsWarnStrategy>() return this.list(new LambdaQueryWrapper<ThsWarnStrategy>()
.like(StrUtil.isNotBlank(param.getName()), ThsWarnStrategy::getName, param.getName()) .like(StrUtil.isNotBlank(param.getName()), ThsWarnStrategy::getName, param.getName())
.eq(param.getGrade() != null, ThsWarnStrategy::getGrade, param.getGrade()) .eq(param.getGrade() != null, ThsWarnStrategy::getGrade, param.getGrade())
.eq(param.getType() != null, ThsWarnStrategy::getType, param.getType()) .eq(param.getType() != null, ThsWarnStrategy::getType, param.getType())
.ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode()) .eq(ThsWarnStrategy::getDeptId,param.getDeptId())
.ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode())
); );
} }
@@ -81,16 +83,16 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
List<ThsWarnStrategy> one = this.list(new LambdaQueryWrapper<ThsWarnStrategy>() List<ThsWarnStrategy> one = this.list(new LambdaQueryWrapper<ThsWarnStrategy>()
.ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode()) .ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode())
.eq(ThsWarnStrategy::getName, param.getName()) .eq(ThsWarnStrategy::getName, param.getName())
.eq(ThsWarnStrategy::getType,param.getType()) .eq(ThsWarnStrategy::getType, param.getType())
.or(param.getBigType()==0,wrapper -> .or(param.getBigType() == 0, wrapper ->
wrapper.eq(ThsWarnStrategy::getGrade, param.getGrade()) wrapper.eq(ThsWarnStrategy::getGrade, param.getGrade())
.eq(ThsWarnStrategy::getBigType, 0) .eq(ThsWarnStrategy::getBigType, 0)
.eq(ThsWarnStrategy::getType,param.getType()) .eq(ThsWarnStrategy::getType, param.getType())
.ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode()) .ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode())
) )
); );
if (CollectionUtil.isNotEmpty(one)) { if (CollectionUtil.isNotEmpty(one)) {
if(one.size()>1||one.get(0).getName().equals(param.getName())){ if (one.size() > 1 || one.get(0).getName().equals(param.getName())) {
throw new BusinessException(PmsDeviceResponseEnum.MODEL_NAME_REPEAT); throw new BusinessException(PmsDeviceResponseEnum.MODEL_NAME_REPEAT);
} }
throw new BusinessException(ProcessResponseEnum.THERE_IS_ONLY_ONE_STRATEGY); throw new BusinessException(ProcessResponseEnum.THERE_IS_ONLY_ONE_STRATEGY);
@@ -106,20 +108,37 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
@Transactional(rollbackFor = {Exception.class}) @Transactional(rollbackFor = {Exception.class})
public Boolean bindStrategy(StrategyParam.BindParam param) { public Boolean bindStrategy(StrategyParam.BindParam param) {
List<ThsWarnStrategyAss> assList = new ArrayList<>(); List<ThsWarnStrategyAss> assList = new ArrayList<>();
//删除之前绑定信息
thsWarnStrategyAssService.removeById(param.getId());
ThsWarnStrategy thsWarnStrategy = new ThsWarnStrategy();
thsWarnStrategy.setOperation(param.getOperation());
thsWarnStrategy.setName(param.getStrategyName());
thsWarnStrategy.setDeptId(param.getDeptId());
thsWarnStrategy.setGrade(param.getGrade());
thsWarnStrategy.setType(param.getStrategyType());
thsWarnStrategy.setState(DataStateEnum.ENABLE.getCode());
if (StrUtil.isBlank(param.getId())) {
//新增
thsWarnStrategy.setId(IdUtil.simpleUUID());
this.save(thsWarnStrategy);
} else {
//修改
//删除之前绑定信息
thsWarnStrategy.setId(param.getId());
thsWarnStrategyAssService.removeById(param.getId());
this.updateById(thsWarnStrategy);
}
//监测点标签绑定 //监测点标签绑定
add(assList, param.getId(), 0, param.getMonitorTag()); if (CollectionUtil.isNotEmpty(param.getMonitorTag())) {
add(assList, thsWarnStrategy.getId(), 0, param.getMonitorTag());
}
//监测点
if (CollectionUtil.isNotEmpty(param.getMonitorIds())) {
add(assList, thsWarnStrategy.getId(), 2, param.getMonitorIds());
}
//指标类型绑定 //指标类型绑定
add(assList, param.getId(), 1, param.getIndicatorTypes()); add(assList,thsWarnStrategy.getId(), 1, param.getIndicatorTypes());
thsWarnStrategyAssService.saveBatch(assList); thsWarnStrategyAssService.saveBatch(assList);
ThsWarnStrategy warnStrategy = new ThsWarnStrategy(); return true;
warnStrategy.setId(param.getId());
warnStrategy.setOperation(param.getOperation());
return this.updateById(warnStrategy);
} }
@Override @Override
@@ -134,12 +153,12 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
.ne(ThsWarnStrategy::getId, param.getId()) .ne(ThsWarnStrategy::getId, param.getId())
.and(wrapper -> .and(wrapper ->
wrapper.eq(ThsWarnStrategy::getName, param.getName()) wrapper.eq(ThsWarnStrategy::getName, param.getName())
.eq(ThsWarnStrategy::getType,param.getType()) .eq(ThsWarnStrategy::getType, param.getType())
) )
.or(param.getBigType()==0,wrapper -> .or(param.getBigType() == 0, wrapper ->
wrapper.eq( ThsWarnStrategy::getGrade, param.getGrade()) wrapper.eq(ThsWarnStrategy::getGrade, param.getGrade())
.eq(ThsWarnStrategy::getBigType, 0) .eq(ThsWarnStrategy::getBigType, 0)
.eq(ThsWarnStrategy::getType,param.getType()) .eq(ThsWarnStrategy::getType, param.getType())
.ne(ThsWarnStrategy::getId, param.getId()) .ne(ThsWarnStrategy::getId, param.getId())
.ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode()) .ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode())
@@ -147,7 +166,7 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
); );
if (CollectionUtil.isNotEmpty(one)) { if (CollectionUtil.isNotEmpty(one)) {
if(one.size()>1||one.get(0).getName().equals(param.getName())){ if (one.size() > 1 || one.get(0).getName().equals(param.getName())) {
throw new BusinessException(PmsDeviceResponseEnum.MODEL_NAME_REPEAT); throw new BusinessException(PmsDeviceResponseEnum.MODEL_NAME_REPEAT);
} }
throw new BusinessException(ProcessResponseEnum.THERE_IS_ONLY_ONE_STRATEGY); throw new BusinessException(ProcessResponseEnum.THERE_IS_ONLY_ONE_STRATEGY);
@@ -198,16 +217,16 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
thsDeptAlarmService.remove(lambdaQueryWrapper); thsDeptAlarmService.remove(lambdaQueryWrapper);
//信息添加 //信息添加
List<ThsDeptAlarm> info=new ArrayList(); List<ThsDeptAlarm> info = new ArrayList();
List<String> alarmIds= param.getAlarmId(); List<String> alarmIds = param.getAlarmId();
List<String> monitorIds= param.getMonitorId(); List<String> monitorIds = param.getMonitorId();
String deptId= param.getDeptId(); String deptId = param.getDeptId();
Integer type= param.getType(); Integer type = param.getType();
//便利信息 //便利信息
ThsDeptAlarm alarm; ThsDeptAlarm alarm;
for (String s : alarmIds) { for (String s : alarmIds) {
for (String monitorId : monitorIds) { for (String monitorId : monitorIds) {
alarm=new ThsDeptAlarm(); alarm = new ThsDeptAlarm();
alarm.setDeptId(deptId); alarm.setDeptId(deptId);
alarm.setType(type); alarm.setType(type);
alarm.setAlarmId(s); alarm.setAlarmId(s);
@@ -220,15 +239,15 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
} }
@Override @Override
public StrategyParam.MonitorTree echoMonitor(String org,Integer type,Integer grade) { public StrategyParam.MonitorTree echoMonitor(String org, Integer type, Integer grade) {
List<ThsDeptAlarm> list = thsDeptAlarmService.list(new LambdaQueryWrapper<ThsDeptAlarm>() List<ThsDeptAlarm> list = thsDeptAlarmService.list(new LambdaQueryWrapper<ThsDeptAlarm>()
.eq(ThsDeptAlarm::getDeptId, org) .eq(ThsDeptAlarm::getDeptId, org)
.eq(ThsDeptAlarm::getType, type) .eq(ThsDeptAlarm::getType, type)
.eq(ThsDeptAlarm::getGrade, grade) .eq(ThsDeptAlarm::getGrade, grade)
); );
StrategyParam.MonitorTree tree=new StrategyParam.MonitorTree(); StrategyParam.MonitorTree tree = new StrategyParam.MonitorTree();
List<String> collect = list.stream().map(ThsDeptAlarm::getAlarmId).distinct().collect(Collectors.toList()); List<String> collect = list.stream().map(ThsDeptAlarm::getAlarmId).distinct().collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(collect)){ if (CollectionUtil.isNotEmpty(collect)) {
tree.setId(collect.get(0)); tree.setId(collect.get(0));
} }
tree.setChildren(list.stream().map(ThsDeptAlarm::getMonitorId).distinct().collect(Collectors.toList())); tree.setChildren(list.stream().map(ThsDeptAlarm::getMonitorId).distinct().collect(Collectors.toList()));
@@ -240,13 +259,13 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
public Boolean delStrategy(String ids) { public Boolean delStrategy(String ids) {
Assert.isTrue(StrUtil.isNotBlank(ids), "id为空,不能删除"); Assert.isTrue(StrUtil.isNotBlank(ids), "id为空,不能删除");
ThsWarnStrategy byId = this.getById(ids); ThsWarnStrategy byId = this.getById(ids);
if(ObjectUtil.isNull(byId)){ if (ObjectUtil.isNull(byId)) {
throw new BusinessException(ProcessResponseEnum.QUERY_IS_EMPTY); throw new BusinessException(ProcessResponseEnum.QUERY_IS_EMPTY);
} }
if(byId.getState() == 1){ if (byId.getState() == 1) {
throw new BusinessException(ProcessResponseEnum.ENABLED_CANNOT_BE_DELETED); throw new BusinessException(ProcessResponseEnum.ENABLED_CANNOT_BE_DELETED);
} }
// thsWarnStrategyAssService.removeById(ids); thsWarnStrategyAssService.removeById(ids);
ThsWarnStrategy thsWarnStrategy = new ThsWarnStrategy(); ThsWarnStrategy thsWarnStrategy = new ThsWarnStrategy();
thsWarnStrategy.setId(ids); thsWarnStrategy.setId(ids);
thsWarnStrategy.setState(0); thsWarnStrategy.setState(0);
@@ -319,14 +338,14 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
StrategyParam.MonitorTree power = new StrategyParam.MonitorTree(); StrategyParam.MonitorTree power = new StrategyParam.MonitorTree();
//生成随机数 //生成随机数
RandomDataGenerator randomDataGenerator = new RandomDataGenerator(); RandomDataGenerator randomDataGenerator = new RandomDataGenerator();
power.setId(split[0]+randomDataGenerator.nextInt(1,9)); power.setId(split[0] + randomDataGenerator.nextInt(1, 9));
power.setName("变电站名称: "+split[1]); power.setName("变电站名称: " + split[1]);
//监测点信息 //监测点信息
List<StrategyParam.Monitor> monitors = new ArrayList(); List<StrategyParam.Monitor> monitors = new ArrayList();
for (PmsMonitorDTO dto : value) { for (PmsMonitorDTO dto : value) {
StrategyParam.Monitor childMonitor = new StrategyParam.Monitor(); StrategyParam.Monitor childMonitor = new StrategyParam.Monitor();
childMonitor.setId(dto.getId()); childMonitor.setId(dto.getId());
childMonitor.setName("监测点名称: "+dto.getName()); childMonitor.setName("监测点名称: " + dto.getName());
monitors.add(childMonitor); monitors.add(childMonitor);
} }
power.setChildren(monitors); power.setChildren(monitors);

View File

@@ -1,6 +1,6 @@
package com.njcn.process.utils; package com.njcn.process.utils;
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog; import com.njcn.process.pojo.po.ThsOverRunLog;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;

View File

@@ -38,6 +38,8 @@ public class DeptTreeVO extends BaseVO {
@ApiModelProperty("排序") @ApiModelProperty("排序")
private Integer sort; private Integer sort;
private Integer level;
@ApiModelProperty("子节点详细信息") @ApiModelProperty("子节点详细信息")
private List<DeptTreeVO> children; private List<DeptTreeVO> children;

View File

@@ -39,10 +39,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.*;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -177,17 +174,27 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
@Override @Override
public List<DeptTreeVO> existMonitorDeptTree() { public List<DeptTreeVO> existMonitorDeptTree() {
List<String> deptIds = commLedgerDeptClient.existMonitorDeptTree().getData(); List<Dept> deptTem = commLedgerDeptClient.existMonitorDeptTree().getData();
if(CollectionUtil.isEmpty(deptIds)){ if(CollectionUtil.isEmpty(deptTem)){
throw new BusinessException("当前没有部门存在监测点"); throw new BusinessException("当前没有部门存在监测点");
} }
List<String> useMonitorIds = deptTem.stream().map(Dept::getId).collect(Collectors.toList());
List<String> resultDeptId = deptTem.stream().map(item->item.getPids().split(",")).flatMap(Arrays::stream).distinct().collect(Collectors.toList());
resultDeptId.addAll(useMonitorIds);
List<Integer> deptType = WebUtil.filterDeptType(); List<Integer> deptType = WebUtil.filterDeptType();
String deptIndex = RequestUtil.getDeptIndex(); String deptIndex = RequestUtil.getDeptIndex();
List<DeptTreeVO> deptList = this.baseMapper.getDeptTree(deptIndex, deptType); List<DeptTreeVO> deptList = this.baseMapper.getDeptTree(deptIndex, deptType);
List<DeptTreeVO> finalDeptList = deptList.stream().filter(item->deptIds.contains(item.getId())).collect(Collectors.toList()); List<DeptTreeVO> finalDeptList = deptList.stream().filter(item->resultDeptId.contains(item.getId())).collect(Collectors.toList());
return finalDeptList.stream() List<DeptTreeVO> lastList = finalDeptList.stream().peek(item->{
if(useMonitorIds.contains(item.getId())){
item.setLevel(2);
}
}).collect(Collectors.toList());
return lastList.stream()
.filter(deptVO -> deptVO.getId().equals(deptIndex)) .filter(deptVO -> deptVO.getId().equals(deptIndex))
.peek(deptFirst -> deptFirst.setChildren(getChildren(deptFirst, finalDeptList))) .peek(deptFirst -> deptFirst.setChildren(getChildren(deptFirst, lastList)))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@@ -198,9 +205,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
List<DeptAllTreeVO> deptList = this.baseMapper.getAllDeptTree(deptIndex, deptType); List<DeptAllTreeVO> deptList = this.baseMapper.getAllDeptTree(deptIndex, deptType);
return deptList.stream() return deptList.stream()
.filter(deptVO -> deptVO.getId().equals(deptIndex)) .filter(deptVO -> deptVO.getId().equals(deptIndex))
.peek(deptFirst -> { .peek(deptFirst -> deptFirst.setChildren(getChildrens(deptFirst, deptList)))
deptFirst.setChildren(getChildrens(deptFirst, deptList));
})
.collect(Collectors.toList()); .collect(Collectors.toList());
} }