1.调整河北pms国网上送主配网逻辑
2.技术监督调整
This commit is contained in:
@@ -39,7 +39,7 @@ public interface CommLedgerDeptClient {
|
||||
|
||||
|
||||
@GetMapping("/existMonitorDeptTree")
|
||||
public HttpResult<List<String>> existMonitorDeptTree();
|
||||
HttpResult<List<Dept>> existMonitorDeptTree();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class CommLedgerDeptClientFallbackFactory implements FallbackFactory<Comm
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<String>> existMonitorDeptTree() {
|
||||
public HttpResult<List<Dept>> existMonitorDeptTree() {
|
||||
log.error("{}异常,降级处理,异常为:{}", "获取存在投运监测点的部门id集合", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@@ -162,9 +162,9 @@ public class PmsLedgerDeptController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/existMonitorDeptTree")
|
||||
@ApiOperation("获取部门树(存在监测点的)")
|
||||
public HttpResult<List<String>> existMonitorDeptTree() {
|
||||
public HttpResult<List<Dept>> existMonitorDeptTree() {
|
||||
String methodDescribe = getMethodDescribe("existMonitorDeptTree");
|
||||
List<String> result = iMonitorService.existMonitorDeptTree();
|
||||
List<Dept> result = iMonitorService.existMonitorDeptTree();
|
||||
//删除返回失败,查不到数据返回空数组,兼容治理项目没有部门直接报错的bug
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
|
||||
|
||||
@@ -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.PmsMonitorVO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
@@ -195,5 +196,5 @@ public interface IMonitorService extends IService<Monitor> {
|
||||
* @author cdf
|
||||
* @date 2024/2/26
|
||||
*/
|
||||
List<String> existMonitorDeptTree();
|
||||
List<Dept> existMonitorDeptTree();
|
||||
}
|
||||
|
||||
@@ -603,14 +603,13 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> existMonitorDeptTree() {
|
||||
public List<Dept> existMonitorDeptTree() {
|
||||
DictData dictData = dicDataFeignClient.getDicDataByNameAndTypeName(DicDataTypeEnum.LINE_STATE.getName(), DicDataEnum.RUN.getName()).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<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 resultDeptId;
|
||||
|
||||
return deptTem;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -109,6 +109,8 @@ public class RUploadSubstationStatisticalDataD {
|
||||
@MppMultiId
|
||||
private String statisticalType;
|
||||
|
||||
private String statisticalMonth;
|
||||
|
||||
/**
|
||||
* 上送状态(0:未上送 1:已上送)
|
||||
*/
|
||||
|
||||
@@ -29,10 +29,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -136,12 +135,17 @@ public class RSubstationStatisticalDataServiceImpl extends ServiceImpl<RUploadSu
|
||||
default:
|
||||
break;
|
||||
}
|
||||
lambdaQueryWrapper.eq(RUploadSubstationStatisticalDataD::getStatisticalType,param.getDataType());
|
||||
return lambdaQueryWrapper;
|
||||
}
|
||||
|
||||
private String formatBeginMonth(String searchBeginTime, String dataType) {
|
||||
if (Objects.equals(dataType, "02")) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
package com.njcn.executor.handler;
|
||||
|
||||
import com.njcn.prepare.harmonic.api.line.ThsSuperviseClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 每日生成技术监督任务
|
||||
*
|
||||
* @author Lee
|
||||
* @date 2023/04/11
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class ThsSuperviseJob {
|
||||
|
||||
private final ThsSuperviseClient thsSuperviseClient;
|
||||
|
||||
@XxlJob("thsSuperviseJob")
|
||||
public void thsSuperviseJob() {
|
||||
SuperviseParam superviseParam = new SuperviseParam();
|
||||
superviseParam.setInitType(0);
|
||||
thsSuperviseClient.creatSupervise(superviseParam);
|
||||
}
|
||||
}
|
||||
//package com.njcn.executor.handler;
|
||||
//
|
||||
//import com.njcn.prepare.harmonic.api.line.ThsSuperviseClient;
|
||||
//import com.njcn.process.pojo.param.SuperviseParam;
|
||||
//import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
//import lombok.RequiredArgsConstructor;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
///**
|
||||
// * 每日生成技术监督任务
|
||||
// *
|
||||
// * @author Lee
|
||||
// * @date 2023/04/11
|
||||
// */
|
||||
//@Slf4j
|
||||
//@Component
|
||||
//@RequiredArgsConstructor
|
||||
//public class ThsSuperviseJob {
|
||||
//
|
||||
// private final ThsSuperviseClient thsSuperviseClient;
|
||||
//
|
||||
// @XxlJob("thsSuperviseJob")
|
||||
// public void thsSuperviseJob() {
|
||||
// SuperviseParam superviseParam = new SuperviseParam();
|
||||
// superviseParam.setInitType(0);
|
||||
// thsSuperviseClient.creatSupervise(superviseParam);
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
package com.njcn.prepare.harmonic.api.line;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.prepare.harmonic.api.line.fallback.ThsSuperviseClientFallbackFactory;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@FeignClient(
|
||||
value = ServerInfo.PREPARE_BOOT,//对应模块名
|
||||
path = "/thsSupervise",//对应controller请求类
|
||||
fallbackFactory = ThsSuperviseClientFallbackFactory.class//服务降级处理类
|
||||
)
|
||||
public interface ThsSuperviseClient {
|
||||
/**
|
||||
* 预警/告警事务的初始化
|
||||
*
|
||||
* @param superviseParam
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/initSupervise")
|
||||
HttpResult<String> initSupervise(@RequestBody @Validated SuperviseParam superviseParam);
|
||||
|
||||
|
||||
/**
|
||||
* 预警/告警事务的生成
|
||||
*
|
||||
* @param superviseParam
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/creatSupervise")
|
||||
HttpResult<String> creatSupervise(@RequestBody @Validated SuperviseParam superviseParam);
|
||||
}
|
||||
//package com.njcn.prepare.harmonic.api.line;
|
||||
//
|
||||
//import com.njcn.common.pojo.constant.ServerInfo;
|
||||
//import com.njcn.common.pojo.response.HttpResult;
|
||||
//import com.njcn.prepare.harmonic.api.line.fallback.ThsSuperviseClientFallbackFactory;
|
||||
//import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||
//import org.springframework.cloud.openfeign.FeignClient;
|
||||
//import org.springframework.validation.annotation.Validated;
|
||||
//import org.springframework.web.bind.annotation.PostMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestBody;
|
||||
//
|
||||
//@FeignClient(
|
||||
// value = ServerInfo.PREPARE_BOOT,//对应模块名
|
||||
// path = "/thsSupervise",//对应controller请求类
|
||||
// fallbackFactory = ThsSuperviseClientFallbackFactory.class//服务降级处理类
|
||||
//)
|
||||
//public interface ThsSuperviseClient {
|
||||
// /**
|
||||
// * 预警/告警事务的初始化
|
||||
// *
|
||||
// * @param superviseParam
|
||||
// * @return
|
||||
// */
|
||||
// @PostMapping("/initSupervise")
|
||||
// HttpResult<String> initSupervise(@RequestBody @Validated SuperviseParam superviseParam);
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 预警/告警事务的生成
|
||||
// *
|
||||
// * @param superviseParam
|
||||
// * @return
|
||||
// */
|
||||
// @PostMapping("/creatSupervise")
|
||||
// HttpResult<String> creatSupervise(@RequestBody @Validated SuperviseParam superviseParam);
|
||||
//}
|
||||
|
||||
@@ -1,41 +1,40 @@
|
||||
package com.njcn.prepare.harmonic.api.line.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
|
||||
import com.njcn.prepare.harmonic.api.line.ThsSuperviseClient;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||
import com.njcn.prepare.harmonic.utils.PrepareEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ThsSuperviseClientFallbackFactory implements FallbackFactory<ThsSuperviseClient> {
|
||||
@Override
|
||||
public ThsSuperviseClient create(Throwable throwable) {
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = PrepareEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new ThsSuperviseClient() {
|
||||
@Override
|
||||
public HttpResult<String> initSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "预警/告警事务的初始化: ", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<String> creatSupervise(SuperviseParam superviseParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "预警/告警事务的生成: ", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
//package com.njcn.prepare.harmonic.api.line.fallback;
|
||||
//
|
||||
//import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
//import com.njcn.common.pojo.exception.BusinessException;
|
||||
//import com.njcn.common.pojo.response.HttpResult;
|
||||
//
|
||||
//import com.njcn.prepare.harmonic.api.line.ThsSuperviseClient;
|
||||
//import com.njcn.prepare.harmonic.utils.PrepareEnumUtil;
|
||||
//import feign.hystrix.FallbackFactory;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//import org.springframework.validation.annotation.Validated;
|
||||
//import org.springframework.web.bind.annotation.RequestBody;
|
||||
//
|
||||
//@Slf4j
|
||||
//@Component
|
||||
//public class ThsSuperviseClientFallbackFactory implements FallbackFactory<ThsSuperviseClient> {
|
||||
// @Override
|
||||
// public ThsSuperviseClient create(Throwable throwable) {
|
||||
// Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
// if (throwable.getCause() instanceof BusinessException) {
|
||||
// BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
// exceptionEnum = PrepareEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
// }
|
||||
// Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
// return new ThsSuperviseClient() {
|
||||
// @Override
|
||||
// public HttpResult<String> initSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
|
||||
// log.error("{}异常,降级处理,异常为:{}", "预警/告警事务的初始化: ", throwable.toString());
|
||||
// throw new BusinessException(finalExceptionEnum);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public HttpResult<String> creatSupervise(SuperviseParam superviseParam) {
|
||||
// log.error("{}异常,降级处理,异常为:{}", "预警/告警事务的生成: ", throwable.toString());
|
||||
// throw new BusinessException(finalExceptionEnum);
|
||||
// }
|
||||
// };
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -142,7 +142,7 @@ public class SubStationExecutor extends BaseExecutor{
|
||||
String tag = bindCmp.getTag();
|
||||
CalculatedParam<DeptGetChildrenMoreDTO> calculatedParam = bindCmp.getRequestData();
|
||||
if (tag.equalsIgnoreCase("r_upload_substation_statistical_data_d")) {
|
||||
//日表
|
||||
//月表
|
||||
rUploadSubstationStatisticalDataDService.insertSubStatisticalDataDay(bindCmp.getRequestData());
|
||||
} else if (tag.equalsIgnoreCase("r_upload_substation_statistical_data_m")) {
|
||||
//数据补招不执行非日表算法
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
//import com.njcn.common.pojo.response.HttpResult;
|
||||
//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 io.swagger.annotations.Api;
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
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,
|
||||
#{monthDate} statisticalDate,
|
||||
'02' statisticalType,
|
||||
#{monthDate} statisticalMonth,
|
||||
'01' statisticalType,
|
||||
0 uploadStatus
|
||||
from
|
||||
r_upload_substation_statistical_data_d
|
||||
|
||||
@@ -1,71 +1,70 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.Impl.line;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.line.ThsOverRunLogMapper;
|
||||
import com.njcn.prepare.harmonic.mapper.mysql.line.ThsSuperviseMapper;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.prepare.harmonic.service.mysql.line.ThsOverRunLogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 告警/预警监测点列表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author lxp
|
||||
* @since 2023-03-16
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@DS("process")
|
||||
public class ThsOverRunLogServiceImpl extends ServiceImpl<ThsOverRunLogMapper, ThsOverRunLog> implements ThsOverRunLogService {
|
||||
@Autowired
|
||||
private ThsOverRunLogMapper thsOverRunLogMapper;
|
||||
@Autowired
|
||||
private ThsSuperviseMapper thsSuperviseMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveOverRunLog(SuperviseParam superviseParam) {
|
||||
this.saveBatch(superviseParam.getOverRunLog());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuperviceRunLogVo superviseDetail(String supIndex) {
|
||||
ThsSupervise thsSupervise = thsSuperviseMapper.selectOne(new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, supIndex));
|
||||
List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
|
||||
SuperviceRunLogVo superviceRunLogVo = new SuperviceRunLogVo();
|
||||
superviceRunLogVo.setThsSupervise(thsSupervise);
|
||||
superviceRunLogVo.setOverRunLog(thsOverRunLogs);
|
||||
return superviceRunLogVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult updateSupervise(SuperviseParam superviseParam) {
|
||||
List<ThsOverRunLog> overRunLog = superviseParam.getOverRunLog();
|
||||
if (CollectionUtil.isEmpty(overRunLog)) {
|
||||
HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "监测点不能为空", null);
|
||||
}
|
||||
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> allIds = thsOverRunLogs.stream().map(ThsOverRunLog::getId).collect(Collectors.toList());
|
||||
allIds.removeAll(saveIds);
|
||||
thsOverRunLogMapper.delete(new LambdaQueryWrapper<ThsOverRunLog>().in(ThsOverRunLog::getId, allIds));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, null);
|
||||
}
|
||||
}
|
||||
//package com.njcn.prepare.harmonic.service.mysql.Impl.line;
|
||||
//
|
||||
//import cn.hutool.core.collection.CollectionUtil;
|
||||
//import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
//import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
//import com.njcn.common.pojo.response.HttpResult;
|
||||
//import com.njcn.common.utils.HttpResultUtil;
|
||||
//import com.njcn.prepare.harmonic.mapper.mysql.line.ThsOverRunLogMapper;
|
||||
//import com.njcn.prepare.harmonic.mapper.mysql.line.ThsSuperviseMapper;
|
||||
//import com.njcn.process.pojo.param.SuperviseParam;
|
||||
//import com.njcn.process.pojo.po.ThsOverRunLog;
|
||||
//import com.njcn.process.pojo.po.ThsSupervise;
|
||||
//import com.njcn.prepare.harmonic.service.mysql.line.ThsOverRunLogService;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Service;
|
||||
//import org.springframework.transaction.annotation.Transactional;
|
||||
//
|
||||
//import java.util.List;
|
||||
//import java.util.stream.Collectors;
|
||||
//
|
||||
///**
|
||||
// * <p>
|
||||
// * 告警/预警监测点列表 服务实现类
|
||||
// * </p>
|
||||
// *
|
||||
// * @author lxp
|
||||
// * @since 2023-03-16
|
||||
// */
|
||||
//@Service
|
||||
//@Slf4j
|
||||
//@DS("process")
|
||||
//public class ThsOverRunLogServiceImpl extends ServiceImpl<ThsOverRunLogMapper, ThsOverRunLog> implements ThsOverRunLogService {
|
||||
// @Autowired
|
||||
// private ThsOverRunLogMapper thsOverRunLogMapper;
|
||||
// @Autowired
|
||||
// private ThsSuperviseMapper thsSuperviseMapper;
|
||||
//
|
||||
// @Override
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
// public void saveOverRunLog(SuperviseParam superviseParam) {
|
||||
// this.saveBatch(superviseParam.getOverRunLog());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public SuperviceRunLogVo superviseDetail(String supIndex) {
|
||||
// ThsSupervise thsSupervise = thsSuperviseMapper.selectOne(new LambdaQueryWrapper<ThsSupervise>().eq(ThsSupervise::getSupIndex, supIndex));
|
||||
// List<ThsOverRunLog> thsOverRunLogs = thsOverRunLogMapper.selectList(new LambdaQueryWrapper<ThsOverRunLog>().eq(ThsOverRunLog::getSupIndex, supIndex));
|
||||
// SuperviceRunLogVo superviceRunLogVo = new SuperviceRunLogVo();
|
||||
// superviceRunLogVo.setThsSupervise(thsSupervise);
|
||||
// superviceRunLogVo.setOverRunLog(thsOverRunLogs);
|
||||
// return superviceRunLogVo;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public HttpResult updateSupervise(SuperviseParam superviseParam) {
|
||||
// List<ThsOverRunLog> overRunLog = superviseParam.getOverRunLog();
|
||||
// if (CollectionUtil.isEmpty(overRunLog)) {
|
||||
// HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "监测点不能为空", null);
|
||||
// }
|
||||
// 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> allIds = thsOverRunLogs.stream().map(ThsOverRunLog::getId).collect(Collectors.toList());
|
||||
// allIds.removeAll(saveIds);
|
||||
// thsOverRunLogMapper.delete(new LambdaQueryWrapper<ThsOverRunLog>().in(ThsOverRunLog::getId, allIds));
|
||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, null);
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
//import com.njcn.oss.utils.FileStorageUtil;
|
||||
//import com.njcn.prepare.enums.*;
|
||||
//import com.njcn.prepare.harmonic.mapper.mysql.line.*;
|
||||
//import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||
//import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
//import com.njcn.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
//import com.njcn.process.pojo.param.SuperviseParam;
|
||||
//import com.njcn.process.pojo.po.ThsOverRunLog;
|
||||
//import com.njcn.process.pojo.po.ThsSupervise;
|
||||
//import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
//import com.njcn.prepare.harmonic.service.mysql.day.IRStatLimitRateDService;
|
||||
//import com.njcn.prepare.harmonic.service.mysql.line.ThsSuperviseService;
|
||||
|
||||
@@ -63,9 +63,9 @@ public class StationBusBarReportServiceImpl extends MppServiceImpl<StationBusBar
|
||||
Map<String, List<RStatDataVDPO>> vMap = rStatDataVDPOList.stream().collect(Collectors.groupingBy(RStatDataVDPO::getValueType));
|
||||
if (vMap.containsKey("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 thd = maxList.stream().filter(item -> item.getPhasicType().equals("T")).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 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("A")).map(RStatDataVDPO::getVThd).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.setVThdMax(thd);
|
||||
rStatBusbarHarmonicYPO.setUnbalanceMax(un);
|
||||
@@ -77,9 +77,9 @@ public class StationBusBarReportServiceImpl extends MppServiceImpl<StationBusBar
|
||||
|
||||
if (vMap.containsKey("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 thd = maxList.stream().filter(item -> item.getPhasicType().equals("T")).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 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("A")).map(RStatDataVDPO::getVThd).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.setVThdMin(thd);
|
||||
rStatBusbarHarmonicYPO.setUnbalanceMin(un);
|
||||
@@ -91,9 +91,9 @@ public class StationBusBarReportServiceImpl extends MppServiceImpl<StationBusBar
|
||||
|
||||
if (vMap.containsKey("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 thd = maxList.stream().filter(item -> item.getPhasicType().equals("T")).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 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("A")).mapToDouble(RStatDataVDPO::getVThd).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.setVThdAvg(thd);
|
||||
rStatBusbarHarmonicYPO.setUnbalanceAvg(un);
|
||||
@@ -105,9 +105,9 @@ public class StationBusBarReportServiceImpl extends MppServiceImpl<StationBusBar
|
||||
|
||||
if (vMap.containsKey("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 thd = cp95List.stream().filter(item -> item.getPhasicType().equals("T")).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 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("A")).map(RStatDataVDPO::getVThd).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.setVThd95(thd);
|
||||
rStatBusbarHarmonicYPO.setUnbalance95(un);
|
||||
|
||||
@@ -1,43 +1,40 @@
|
||||
package com.njcn.prepare.harmonic.service.mysql.line;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 告警/预警监测点列表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author lxp
|
||||
* @since 2023-03-16
|
||||
*/
|
||||
public interface ThsOverRunLogService extends IService<ThsOverRunLog> {
|
||||
|
||||
/**
|
||||
* 保存技术监督监测点
|
||||
*
|
||||
* @param superviseParam
|
||||
* @return
|
||||
*/
|
||||
void saveOverRunLog(SuperviseParam superviseParam);
|
||||
|
||||
/**
|
||||
* 查询技术监督监测点集合
|
||||
*
|
||||
* @param supIndex
|
||||
* @return
|
||||
*/
|
||||
SuperviceRunLogVo superviseDetail(String supIndex);
|
||||
|
||||
/**
|
||||
* 更新技术监督
|
||||
*
|
||||
* @param superviseParam
|
||||
*/
|
||||
HttpResult updateSupervise(SuperviseParam superviseParam);
|
||||
}
|
||||
//package com.njcn.prepare.harmonic.service.mysql.line;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.extension.service.IService;
|
||||
//import com.njcn.common.pojo.response.HttpResult;
|
||||
//import com.njcn.process.pojo.param.SuperviseParam;
|
||||
//import com.njcn.process.pojo.po.ThsOverRunLog;
|
||||
//
|
||||
///**
|
||||
// * <p>
|
||||
// * 告警/预警监测点列表 服务类
|
||||
// * </p>
|
||||
// *
|
||||
// * @author lxp
|
||||
// * @since 2023-03-16
|
||||
// */
|
||||
//public interface ThsOverRunLogService extends IService<ThsOverRunLog> {
|
||||
//
|
||||
// /**
|
||||
// * 保存技术监督监测点
|
||||
// *
|
||||
// * @param superviseParam
|
||||
// * @return
|
||||
// */
|
||||
// void saveOverRunLog(SuperviseParam superviseParam);
|
||||
//
|
||||
// /**
|
||||
// * 查询技术监督监测点集合
|
||||
// *
|
||||
// * @param supIndex
|
||||
// * @return
|
||||
// */
|
||||
// SuperviceRunLogVo superviseDetail(String supIndex);
|
||||
//
|
||||
// /**
|
||||
// * 更新技术监督
|
||||
// *
|
||||
// * @param superviseParam
|
||||
// */
|
||||
// HttpResult updateSupervise(SuperviseParam superviseParam);
|
||||
//}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
//import com.njcn.harmonic.pojo.vo.SourceSteadyIndicator;
|
||||
//import com.njcn.harmonic.pojo.vo.ThsStrategyVo;
|
||||
//import com.njcn.prepare.enums.TypeEnum;
|
||||
//import com.njcn.prepare.harmonic.pojo.param.SuperviseParam;
|
||||
//import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
//import com.njcn.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
//import com.njcn.process.pojo.param.SuperviseParam;
|
||||
//import com.njcn.process.pojo.po.ThsOverRunLog;
|
||||
//import com.njcn.process.pojo.po.ThsSupervise;
|
||||
//import com.njcn.process.pojo.po.ThsWarnStrategyAss;
|
||||
//import com.njcn.user.pojo.po.Dept;
|
||||
//
|
||||
|
||||
@@ -69,7 +69,7 @@ public class RStatLoadTypeServiceImpl implements RStatLoadTypeService {
|
||||
LocalDate localDate = LocalDateTimeUtil.parseDate(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN);
|
||||
List<RStatLoadTypeDPO> result = new ArrayList<>();
|
||||
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));
|
||||
|
||||
List<DictData> dataTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DATA_TYPE.getCode()).getData();
|
||||
|
||||
@@ -78,7 +78,7 @@ public class RUploadSubstationStatisticalDataDServiceImpl extends MppServiceImpl
|
||||
if (list.size() > 1){
|
||||
RUploadSubstationStatisticalDataD rUploadSubstationStatisticalDataD = new RUploadSubstationStatisticalDataD();
|
||||
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.setProvinceId(dept.getCode());
|
||||
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 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);
|
||||
|
||||
|
||||
|
||||
if (CollUtil.isNotEmpty(list)){
|
||||
list.forEach(item->{
|
||||
item.setId(IdUtil.simpleUUID());
|
||||
|
||||
@@ -43,10 +43,10 @@
|
||||
<artifactId>pms-device-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>org.influxdb</groupId>
|
||||
<artifactId>influxdb-java</artifactId>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pq-device-api</artifactId>
|
||||
|
||||
@@ -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 ( )) {
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -9,14 +9,19 @@ import org.apache.commons.lang3.StringUtils;
|
||||
@Getter
|
||||
public enum SteadyIndicatorEnum {
|
||||
|
||||
Negative_Voltage("Negative_Voltage", "负序电压不平衡度超标"),
|
||||
Interhar_Voltage("Interhar_Voltage", "间谐波电压超标"),
|
||||
Negative_Voltage("phase_Voltage", "负序电压不平衡度超标"),
|
||||
Interhar_Voltage("Interharmonic_Voltage", "间谐波电压超标"),
|
||||
Neg_Current("Neg_Current", "负序电流超标"),
|
||||
Fre_Deviation("Fre_Deviation", "频率偏差超标"),
|
||||
Fre_Deviation("Frequency_Dev", "频率偏差超标"),
|
||||
Voltage_Dev("Voltage_Dev", "电压偏差超标"),
|
||||
Har_Current("Har_Current", "谐波电流超标"),
|
||||
Voltage_Fluc("Voltage_Fluc", "电压波动与闪变超标"),
|
||||
Har_Voltage("Har_Voltage", "谐波电压超标");
|
||||
Har_Current("Harmonic_Current", "谐波电流超标"),
|
||||
Voltage_Fluc("Flicker", "电压波动与闪变超标"),
|
||||
Har_Voltage("Harmonic_Voltage", "谐波电压超标"),
|
||||
|
||||
Thd_V("Thd_V","电压总谐波畸变率")
|
||||
|
||||
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ public class StrategyParam {
|
||||
@Data
|
||||
public static class StrategyPageParam extends StrategyParam {
|
||||
|
||||
private String deptId;
|
||||
|
||||
@ApiModelProperty(value = "页码")
|
||||
private Integer PageNum;
|
||||
|
||||
@@ -62,22 +64,42 @@ public class StrategyParam {
|
||||
|
||||
@Data
|
||||
public static class BindParam {
|
||||
@ApiModelProperty(value = "部门id")
|
||||
@NotNull(message = "部门id不可为空")
|
||||
private String deptId;
|
||||
|
||||
@ApiModelProperty(value = "预警单id")
|
||||
@NotBlank(message = "id不能为空")
|
||||
@ApiModelProperty(value = "策略id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "关系(0:与;1:或)只存在于指标类型中")
|
||||
@NotNull(message = "id不能为空")
|
||||
@ApiModelProperty(value = "0.预警单 1.告警单")
|
||||
@NotNull(message = "策略类型不能为空")
|
||||
private Integer strategyType;
|
||||
|
||||
@ApiModelProperty(value = "0:自动策略;1:手动策略;2:排他策略")
|
||||
@NotNull(message = "等级")
|
||||
private Integer grade;
|
||||
|
||||
@ApiModelProperty(value = "策略名称")
|
||||
@NotNull(message = "策略名称不能为空")
|
||||
private String strategyName;
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty(value = "关系(0:与;1:或)只存在于指标类型中,三级策略不分与或")
|
||||
//@NotNull(message = "id不能为空")
|
||||
private Integer operation;
|
||||
|
||||
@ApiModelProperty(value = "监测点标签")
|
||||
@NotEmpty(message = "监测点标签集合不能为空")
|
||||
//@NotEmpty(message = "监测点标签集合不能为空")
|
||||
private List<String> monitorTag;
|
||||
|
||||
@ApiModelProperty(value = "指标类型")
|
||||
@NotEmpty(message = "指标类型集合不能为空")
|
||||
private List<String> indicatorTypes;
|
||||
|
||||
@ApiModelProperty(value = "监测点id集合")
|
||||
private List<String> monitorIds;
|
||||
}
|
||||
|
||||
@Data
|
||||
@@ -94,6 +116,8 @@ public class StrategyParam {
|
||||
@NotEmpty(message = "指标类型集合不能为空")
|
||||
private List<String> indicatorTypes;
|
||||
|
||||
private List<String> monitorIds;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@@ -105,6 +129,9 @@ public class StrategyParam {
|
||||
@NotBlank(message = "名称不能为空")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "部门id")
|
||||
private String deptId;
|
||||
|
||||
@ApiModelProperty(value = "0.通用策略 1.定值策略")
|
||||
@NotNull(message = "策略选择不能为空")
|
||||
private Integer bigType;
|
||||
|
||||
@@ -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.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
import com.njcn.process.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.process.pojo.po.ThsSupervise;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -27,5 +27,8 @@ public class SuperviseParam {
|
||||
@ApiModelProperty(name = "thsSupervise", value = "技术监督参数")
|
||||
private ThsSupervise thsSupervise;
|
||||
@ApiModelProperty(name = "type", value = "类型(0:预警;1:告警)")
|
||||
@NotNull(message = "类型不可为空")
|
||||
private Integer type;
|
||||
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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.TableName;
|
||||
@@ -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.TableName;
|
||||
@@ -32,6 +32,9 @@ public class ThsWarnStrategy extends BaseEntity implements Serializable {
|
||||
@TableId(value = "Id", type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "部门id")
|
||||
private String deptId;
|
||||
|
||||
@ApiModelProperty(value = "预警单名称")
|
||||
@TableField("Name")
|
||||
private String name;
|
||||
|
||||
@@ -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.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
import com.njcn.process.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.process.pojo.po.ThsSupervise;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@@ -19,6 +20,6 @@ public class SuperviceRunLogVo {
|
||||
@ApiModelProperty(name = "thsSupervise", value = "技术监督参数", required = true)
|
||||
private ThsSupervise thsSupervise;
|
||||
@ApiModelProperty(name = "overRunLog", value = "监测点集合", required = true)
|
||||
private List<ThsOverRunLog> overRunLog;
|
||||
private List<ThsOverRunLog> overRunLog = new ArrayList<>();
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.prepare.harmonic.pojo.vo;
|
||||
package com.njcn.process.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.prepare.harmonic.pojo.vo;
|
||||
package com.njcn.process.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -1,12 +1,5 @@
|
||||
FROM eclipse-temurin:8-jdk-centos7
|
||||
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
|
||||
FROM openjdk:8-jdk-alpine
|
||||
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
|
||||
RUN /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \&& echo 'Asia/Shanghai' >/etc/timezone
|
||||
|
||||
@@ -34,11 +34,11 @@
|
||||
<artifactId>common-swagger</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!--<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pqs-influx</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pq-device-api</artifactId>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.njcn.process.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
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.response.HttpResult;
|
||||
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.param.SuperviseParam;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviseVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.ThsSuperviseVo;
|
||||
import com.njcn.process.pojo.param.SuperviseParam;
|
||||
import com.njcn.process.pojo.vo.SuperviceRunLogVo;
|
||||
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.ThsSuperviseParam;
|
||||
import com.njcn.process.pojo.po.ThsSupervise;
|
||||
import com.njcn.process.service.ThsOverRunLogService;
|
||||
import com.njcn.process.service.ThsSuperviseService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -50,20 +50,45 @@ public class ThsSuperviseController extends BaseController {
|
||||
private ThsSuperviseService thsSuperviseService;
|
||||
@Autowired
|
||||
private ThsOverRunLogService thsOverRunLogService;
|
||||
@Autowired
|
||||
private ThsSuperviseClient thsSuperviseClient;
|
||||
|
||||
|
||||
|
||||
|
||||
@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)
|
||||
@PostMapping("/initSupervise")
|
||||
public HttpResult<SuperviceRunLogVo> initSupervise(@RequestBody @Validated SuperviseParam superviseParam) {
|
||||
String methodDescribe = getMethodDescribe("initSupervise");
|
||||
HttpResult<String> superviceRunLogVoHttpResult = thsSuperviseClient.initSupervise(superviseParam);
|
||||
SuperviceRunLogVo superviceRunLogVo = JSON.parseObject(superviceRunLogVoHttpResult.getData(), SuperviceRunLogVo.class);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, superviceRunLogVo, methodDescribe);
|
||||
SuperviceRunLogVo result = thsSuperviseService.initSupervise(superviseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, 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)
|
||||
@ApiOperation("保存技术监督监测点")
|
||||
@ApiImplicitParam(name = "superviceRunLogVo", value = "技术监督监测点参数", required = true)
|
||||
@@ -167,10 +192,10 @@ public class ThsSuperviseController extends BaseController {
|
||||
@ApiOperation("技术监督首页")
|
||||
@ApiImplicitParam(name = "superviseDto", value = "查询技术监督列表参数", required = true)
|
||||
@PostMapping("/superviseIndex")
|
||||
public HttpResult<Page<ThsSuperviseVo>> superviseIndex(@RequestBody SuperviseDto superviseDto) {
|
||||
Page<ThsSuperviseVo> pageResult = thsSuperviseService.superviseIndex(superviseDto);
|
||||
public HttpResult<ThsSuperviseVo> superviseIndex(@RequestBody SuperviseDto superviseDto) {
|
||||
ThsSuperviseVo resultList = thsSuperviseService.superviseIndex(superviseDto);
|
||||
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);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, resp, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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> {
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.njcn.process.mapper;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,11 +3,13 @@ package com.njcn.process.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviseVo;
|
||||
import com.njcn.process.pojo.po.ThsSupervise;
|
||||
import com.njcn.process.pojo.vo.SuperviseVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
@@ -24,5 +26,8 @@ public interface ThsSuperviseMapper extends BaseMapper<ThsSupervise> {
|
||||
* @param superviseDto
|
||||
* @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);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.njcn.process.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
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.po.ThsWarnStrategy;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -47,6 +47,16 @@ public interface ThsWarnStrategyMapper extends BaseMapper<ThsWarnStrategy> {
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* 查询策略的集合
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,31 @@
|
||||
<mapper namespace="com.njcn.process.mapper.ThsSuperviseMapper">
|
||||
<!--查询技术监督列表-->
|
||||
<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') >= 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') <= 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
|
||||
left join ths_flowable_ass ass on ts.sup_index = ass.ths_index
|
||||
where 1=1
|
||||
|
||||
@@ -31,12 +31,19 @@
|
||||
column="{id = id}"
|
||||
select="com.njcn.process.mapper.ThsWarnStrategyMapper.getStrategyDetail">
|
||||
</collection>
|
||||
<collection
|
||||
property="monitorIds"
|
||||
column="{id = id}"
|
||||
select="com.njcn.process.mapper.ThsWarnStrategyMapper.getMonitorIds">
|
||||
</collection>
|
||||
</resultMap>
|
||||
<select id="selectUpdateStrategy" resultMap="StrategyResultMap">
|
||||
SELECT
|
||||
ts.Id AS id,
|
||||
ts.NAME AS NAME,
|
||||
ts.Grade AS grade,
|
||||
ts.dept_id,
|
||||
ts.type,
|
||||
ts.Operation AS operation
|
||||
FROM
|
||||
ths_warn_strategy ts
|
||||
@@ -52,7 +59,7 @@
|
||||
Warn_Id = #{id} and ts.Type=1
|
||||
</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">
|
||||
select
|
||||
tws.id,
|
||||
@@ -60,12 +67,9 @@
|
||||
tws.grade,
|
||||
tws.operation,
|
||||
tws.type,
|
||||
Monitor_Id as monitorId,
|
||||
tda.dept_Id as deptId
|
||||
tws.dept_Id as deptId
|
||||
from
|
||||
ths_warn_strategy tws
|
||||
INNER join ths_dept_alarm tda on
|
||||
tws.Id = tda.Alarm_Id
|
||||
<where>
|
||||
<choose>
|
||||
<when test="param.initType==0">
|
||||
@@ -76,12 +80,11 @@
|
||||
</when>
|
||||
</choose>
|
||||
<if test="param.deptId !=null and param.deptId !=''">
|
||||
and tda.Dept_Id=#{param.deptId}
|
||||
and tws.Dept_Id=#{param.deptId}
|
||||
</if>
|
||||
<if test="param.type !=null">
|
||||
and tda.type=#{param.type}
|
||||
and tws.type=#{param.type}
|
||||
</if>
|
||||
and tws.Big_Type=1
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -94,4 +97,13 @@
|
||||
Warn_Id = #{id} and ts.Type=0
|
||||
</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>
|
||||
|
||||
@@ -2,8 +2,8 @@ package com.njcn.process.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.process.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.process.pojo.vo.SuperviceRunLogVo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
@@ -4,11 +4,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviseVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.ThsSuperviseVo;
|
||||
import com.njcn.process.pojo.param.SuperviseParam;
|
||||
import com.njcn.process.pojo.po.ThsSupervise;
|
||||
import com.njcn.process.pojo.vo.SuperviceRunLogVo;
|
||||
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.ThsSuperviseParam;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -91,7 +95,7 @@ public interface ThsSuperviseService extends IService<ThsSupervise> {
|
||||
* @param superviseDto
|
||||
* @return
|
||||
*/
|
||||
Page<ThsSuperviseVo> superviseIndex(SuperviseDto superviseDto);
|
||||
ThsSuperviseVo superviseIndex(SuperviseDto superviseDto);
|
||||
|
||||
/**
|
||||
* 下载反馈文件
|
||||
@@ -101,4 +105,19 @@ public interface ThsSuperviseService extends IService<ThsSupervise> {
|
||||
* @return
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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.param.PmsMonitorParam;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.process.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.process.pojo.po.ThsSupervise;
|
||||
import com.njcn.process.enums.ProgressEnum;
|
||||
import com.njcn.process.mapper.ThsOverRunLogMapper;
|
||||
import com.njcn.process.mapper.ThsSuperviseMapper;
|
||||
import com.njcn.process.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.process.service.ThsOverRunLogService;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.process.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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.response.HttpResult;
|
||||
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.PmsGeneralDeviceInfoClient;
|
||||
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
|
||||
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.utils.FileStorageUtil;
|
||||
import com.njcn.prepare.harmonic.pojo.dto.SuperviseDto;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.prepare.harmonic.pojo.po.ThsSupervise;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviceRunLogVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.SuperviseVo;
|
||||
import com.njcn.prepare.harmonic.pojo.vo.ThsSuperviseVo;
|
||||
import com.njcn.process.pojo.param.SuperviseParam;
|
||||
import com.njcn.process.pojo.po.ThsOverRunLog;
|
||||
import com.njcn.process.pojo.po.ThsSupervise;
|
||||
import com.njcn.process.pojo.vo.SuperviceRunLogVo;
|
||||
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.mapper.*;
|
||||
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.ThsAlarmFormwork;
|
||||
import com.njcn.process.pojo.po.ThsWarnStrategyAss;
|
||||
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.flowable.IFlowDefinitionService;
|
||||
import com.njcn.process.service.flowable.IFlowTaskService;
|
||||
import com.njcn.process.utils.ReadPatientExcelUtil;
|
||||
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.pojo.po.Dept;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
@@ -53,13 +69,18 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.Adler32;
|
||||
import java.util.zip.CheckedOutputStream;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import static com.njcn.process.enums.SteadyIndicatorEnum.Negative_Voltage;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
@@ -74,7 +95,7 @@ import java.util.zip.ZipOutputStream;
|
||||
public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, ThsSupervise> implements ThsSuperviseService {
|
||||
|
||||
|
||||
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
|
||||
|
||||
|
||||
|
||||
private final ThsWarnStrategyMapper thsWarnStrategyMapper;
|
||||
@@ -87,7 +108,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
|
||||
private final ThsSuperviseMapper thsSuperviseMapper;
|
||||
|
||||
private final ThsOverRunLogMapper thsOverRunLogMapper;
|
||||
private final ThsOverRunLogService thsOverRunLogService;
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
@@ -104,6 +125,13 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
|
||||
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.setSupIndex(IdUtil.simpleUUID());
|
||||
this.buildSuperviseName(thsSupervise, superviceRunLogVo.getOverRunLog(), dept);
|
||||
this.thsSuperviseMapper.insert(thsSupervise);
|
||||
this.save(thsSupervise);
|
||||
//TODO 解决工作流写死问题
|
||||
Map<String, Object> mapParam = new HashMap<>();
|
||||
String proInId = "";
|
||||
@@ -150,7 +178,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
for (ThsOverRunLog thsOverRunLog : superviceRunLogVo.getOverRunLog()) {
|
||||
thsOverRunLog.setCreateTime(date);
|
||||
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 pageSize = PageFactory.getPageSize(superviseDto);
|
||||
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();
|
||||
if (CollectionUtil.isNotEmpty(pageRecords)) {
|
||||
for (SuperviseVo superviseVo : pageRecords) {
|
||||
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)) {
|
||||
List<String> alarmTickets = thsOverRunLogs.stream().filter(r -> StringUtils.isNotBlank(r.getAlarmTicket())).map(ThsOverRunLog::getAlarmTicket).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(alarmTickets)) {
|
||||
@@ -199,7 +227,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
public HttpResult deleteSupervise(SuperviseDto superviseDto) {
|
||||
if (CollectionUtil.isNotEmpty(superviseDto.getDeleteIds())) {
|
||||
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));
|
||||
|
||||
//删除同时删除工作流程
|
||||
@@ -223,20 +251,20 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
ThsSupervise thsSuperObj = thsSuperviseMapper.selectById(supIndex);
|
||||
|
||||
if (files != null && files.length == 1) {
|
||||
ThsOverRunLog thsOverRunLog = thsOverRunLogMapper.selectById(id);
|
||||
ThsOverRunLog thsOverRunLog = thsOverRunLogService.getById(id);
|
||||
thsOverRunLog.setId(id);
|
||||
String path = fileStorageUtil.uploadMultipart(files[0], OssPath.ELECTRICITY_QUALITY);
|
||||
this.updateSuperviesData(path, thsOverRunLog, ticketType, thsSupervise);
|
||||
this.updateProcess(thsSupervise, ticketType,thsSuperObj.getType());
|
||||
}
|
||||
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.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());
|
||||
if(fileNames.size() == thsOverRunLogs.size()){
|
||||
FlowableAss flowableAss = flowableAssMapper.selectById(supIndex);
|
||||
@@ -354,7 +382,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
thsOverRunLog.setReviseFeedback(path);
|
||||
break;
|
||||
}
|
||||
thsOverRunLogMapper.updateById(thsOverRunLog);
|
||||
thsOverRunLogService.updateById(thsOverRunLog);
|
||||
}
|
||||
|
||||
|
||||
@@ -408,7 +436,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
thsSupervise.setProgress(ProgressEnum.REVISE_FEEDBACK.getCode());
|
||||
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));
|
||||
|
||||
FlowableAss flowableAss = flowableAssMapper.selectById(supIndex);
|
||||
@@ -423,47 +451,48 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ThsSuperviseVo> superviseIndex(SuperviseDto superviseDto) {
|
||||
Integer pageNum = PageFactory.getPageNum(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());
|
||||
public ThsSuperviseVo superviseIndex(SuperviseDto superviseDto) {
|
||||
List<SuperviseVo> querySuperviseList = thsSuperviseMapper.querySuperviseList(superviseDto);
|
||||
|
||||
|
||||
ThsSuperviseVo thsSuperviseVo = new ThsSuperviseVo();
|
||||
if (CollectionUtil.isNotEmpty(pageRecords)) {
|
||||
for (SuperviseVo superviseVo : pageRecords) {
|
||||
if (CollectionUtil.isNotEmpty(querySuperviseList)) {
|
||||
for (SuperviseVo superviseVo : querySuperviseList) {
|
||||
superviseVo.setCompanyName(deptFeignClient.getDeptById(superviseVo.getDeptId()).getData().getName());
|
||||
//处理预警类型
|
||||
|
||||
Date modifyTime = superviseVo.getModifyTime();
|
||||
Long progressTime = DateUtil.between(modifyTime, new Date(), DateUnit.DAY);
|
||||
superviseVo.setProgressTime(progressTime.intValue());
|
||||
switch (ProgressEnum.getProgressEnumByCode(superviseVo.getProgress())) {
|
||||
case START:
|
||||
case ALARM_TICKET_ISSUE:
|
||||
if (progressTime >= 1) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.RED.getCode());
|
||||
} else {
|
||||
superviseVo.setAlertType(AlertTypeEnum.BLACK.getCode());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (progressTime >= 10) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.RED.getCode());
|
||||
} else if (progressTime >= 8) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.ORANGE.getCode());
|
||||
} else if (progressTime >= 5) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.YELLOW.getCode());
|
||||
} else {
|
||||
superviseVo.setAlertType(AlertTypeEnum.BLACK.getCode());
|
||||
}
|
||||
break;
|
||||
if (Objects.nonNull(modifyTime)) {
|
||||
|
||||
Long progressTime = DateUtil.between(modifyTime, new Date(), DateUnit.DAY);
|
||||
superviseVo.setProgressTime(progressTime.intValue());
|
||||
switch (ProgressEnum.getProgressEnumByCode(superviseVo.getProgress())) {
|
||||
case START:
|
||||
|
||||
case ALARM_TICKET_ISSUE:
|
||||
if (progressTime >= 1) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.RED.getCode());
|
||||
} else {
|
||||
superviseVo.setAlertType(AlertTypeEnum.BLACK.getCode());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (progressTime >= 10) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.RED.getCode());
|
||||
} else if (progressTime >= 8) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.ORANGE.getCode());
|
||||
} else if (progressTime >= 5) {
|
||||
superviseVo.setAlertType(AlertTypeEnum.YELLOW.getCode());
|
||||
} 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()) {
|
||||
Integer code = entry.getKey();
|
||||
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()) {
|
||||
Integer code = entry.getKey();
|
||||
switch (AlarmTypeEnum.getAlarmTypeEnumByCode(code)) {
|
||||
@@ -504,8 +533,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
}
|
||||
}
|
||||
}
|
||||
thsSuperviseVoPage.setRecords(Collections.singletonList(thsSuperviseVo));
|
||||
return thsSuperviseVoPage;
|
||||
return thsSuperviseVo;
|
||||
}
|
||||
|
||||
|
||||
@@ -515,7 +543,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
if (ticketTypeEnum == null) {
|
||||
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)) {
|
||||
Map<String, String> filePathMap = new HashedMap();
|
||||
switch (ticketTypeEnum) {
|
||||
@@ -536,6 +564,259 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
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文件
|
||||
*
|
||||
@@ -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) {
|
||||
try {
|
||||
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"));
|
||||
//改为自己的名称
|
||||
String fileName = thsSupervise.getName() + ".zip";
|
||||
@@ -563,7 +844,7 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
// 用于将数据压缩成Zip文件格式
|
||||
ZipOutputStream zos = new ZipOutputStream(csum);
|
||||
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.setMonitorIds(Collections.singletonList(runLog.getLineIndex()));
|
||||
HttpResult<List<PmsMonitorDTO>> monitorInfoListByCond = monitorClient.getMonitorInfoListByCond(pmsMonitorParam);
|
||||
@@ -605,96 +886,106 @@ public class ThsSuperviseServiceImpl extends ServiceImpl<ThsSuperviseMapper, Ths
|
||||
/**
|
||||
* 判断监测数据是否超标
|
||||
*
|
||||
* @param limitRate
|
||||
* @param steady
|
||||
* @param rStatLimitRateDPO
|
||||
* @param dictTargetList
|
||||
*/
|
||||
// private Map<String, Object> verifyLimit(LimitRate limitRate, SourceSteadyIndicator steady) {
|
||||
// if (limitRate != null) {
|
||||
// List<String> steadyIndicator = steady.getSteadyIndicator();
|
||||
// Map<String, Object> limitBoolMap = new HashedMap();
|
||||
// List<String> descriptionList = new ArrayList<>();
|
||||
// steadyIndicator.forEach(id -> {
|
||||
// HttpResult<DictData> dicDataById = dicDataFeignClient.getDicDataById(id);
|
||||
// if (CommonResponseEnum.SUCCESS.getCode().equals(dicDataById.getCode()) && dicDataById.getData() != null) {
|
||||
// SteadyIndicatorEnum steadyIndicatorEnum = SteadyIndicatorEnum.getSteadyIndicatorEnumByCode(dicDataById.getData().getCode());
|
||||
// if (null != steadyIndicatorEnum) {
|
||||
// switch (steadyIndicatorEnum) {
|
||||
// case Negative_Voltage://负序电压不平衡度
|
||||
// if (limitRate.getUbalanceOvertime() > 0) {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Negative_Voltage.getCode(), true);
|
||||
// descriptionList.add(SteadyIndicatorEnum.Negative_Voltage.getMessage().concat(limitRate.getUbalanceOvertime() + "次"));
|
||||
// } else {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Negative_Voltage.getCode(), false);
|
||||
// }
|
||||
// break;
|
||||
// case Interhar_Voltage://间谐波电压
|
||||
// Integer interharVoltageOvertime = this.maxOverTime(limitRate, InterharVoltage.class);
|
||||
// if (interharVoltageOvertime > 0) {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), true);
|
||||
// descriptionList.add(SteadyIndicatorEnum.Interhar_Voltage.getMessage().concat(interharVoltageOvertime + "次"));
|
||||
// } else {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), false);
|
||||
// }
|
||||
// break;
|
||||
// case Neg_Current://负序电流
|
||||
// if (limitRate.getINegOvertime() > 0) {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), true);
|
||||
// descriptionList.add(SteadyIndicatorEnum.Neg_Current.getMessage().concat(limitRate.getINegOvertime() + "次"));
|
||||
// } else {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), false);
|
||||
// }
|
||||
// break;
|
||||
// case Fre_Deviation://频率偏差
|
||||
// if (limitRate.getFreqDevOvertime() > 0) {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), true);
|
||||
// descriptionList.add(SteadyIndicatorEnum.Fre_Deviation.getMessage().concat(limitRate.getFreqDevOvertime() + "次"));
|
||||
// } else {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), false);
|
||||
// }
|
||||
// break;
|
||||
// case Voltage_Dev://电压偏差
|
||||
// if (limitRate.getVoltageDevOvertime() > 0) {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), true);
|
||||
// descriptionList.add(SteadyIndicatorEnum.Voltage_Dev.getMessage().concat(limitRate.getVoltageDevOvertime() + "次"));
|
||||
// } else {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), false);
|
||||
// }
|
||||
// break;
|
||||
// case Har_Current://谐波电流
|
||||
// Integer harCurrentOvertime = this.maxOverTime(limitRate, HarCurrent.class);
|
||||
// if (harCurrentOvertime > 0) {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Har_Current.getCode(), true);
|
||||
// descriptionList.add(SteadyIndicatorEnum.Har_Current.getMessage().concat(harCurrentOvertime + "次"));
|
||||
// } else {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Har_Current.getCode(), false);
|
||||
// }
|
||||
// break;
|
||||
// case Voltage_Fluc://电压波动与闪变
|
||||
// if (limitRate.getFlickerOvertime() > 0) {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), true);
|
||||
// descriptionList.add(SteadyIndicatorEnum.Voltage_Fluc.getMessage().concat(limitRate.getFlickerOvertime() + "次"));
|
||||
// } else {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), false);
|
||||
// }
|
||||
// break;
|
||||
// case Har_Voltage://谐波电压
|
||||
// Integer harVoltageOvertime = this.maxOverTime(limitRate, HarVoltage.class);
|
||||
// if (harVoltageOvertime > 0) {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), true);
|
||||
// descriptionList.add(SteadyIndicatorEnum.Har_Voltage.getMessage().concat(harVoltageOvertime + "次"));
|
||||
// } else {
|
||||
// limitBoolMap.put(SteadyIndicatorEnum.Har_Voltage.getCode(), false);
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// limitBoolMap.put(DESCRIPTION, descriptionList);
|
||||
// return limitBoolMap;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
private Map<String, Boolean> verifyLimit(RStatLimitRateDPO rStatLimitRateDPO,List<DictData> dictTargetList,List<String> descriptionList,Integer[] count) {
|
||||
|
||||
|
||||
Map<String, Boolean> limitBoolMap = new HashMap<>();
|
||||
for(DictData dic : dictTargetList){
|
||||
SteadyIndicatorEnum steadyIndicatorEnum = SteadyIndicatorEnum.getSteadyIndicatorEnumByCode(dic.getCode());
|
||||
switch (steadyIndicatorEnum) {
|
||||
case Negative_Voltage://负序电压不平衡度
|
||||
if (rStatLimitRateDPO.getUbalanceOvertime() > 0) {
|
||||
limitBoolMap.put(Negative_Voltage.getCode(), true);
|
||||
descriptionList.add(Negative_Voltage.getMessage().concat(rStatLimitRateDPO.getUbalanceOvertime() + "次"));
|
||||
count[0] = count[0]+rStatLimitRateDPO.getUbalanceOvertime();
|
||||
} else {
|
||||
limitBoolMap.put(Negative_Voltage.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Interhar_Voltage://间谐波电压
|
||||
Integer interharVoltageOvertime = this.maxOverTime(rStatLimitRateDPO, InterharVoltage.class);
|
||||
if (interharVoltageOvertime > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Interhar_Voltage.getMessage().concat(interharVoltageOvertime + "次"));
|
||||
count[0] = count[0]+interharVoltageOvertime;
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Interhar_Voltage.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Neg_Current://负序电流
|
||||
if (rStatLimitRateDPO.getINegOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Neg_Current.getMessage().concat(rStatLimitRateDPO.getINegOvertime() + "次"));
|
||||
count[0] = count[0]+rStatLimitRateDPO.getINegOvertime();
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Neg_Current.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Fre_Deviation://频率偏差
|
||||
if (rStatLimitRateDPO.getFreqDevOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Fre_Deviation.getMessage().concat(rStatLimitRateDPO.getFreqDevOvertime() + "次"));
|
||||
count[0] = count[0]+rStatLimitRateDPO.getFreqDevOvertime();
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Fre_Deviation.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Voltage_Dev://电压偏差
|
||||
if (rStatLimitRateDPO.getVoltageDevOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Voltage_Dev.getMessage().concat(rStatLimitRateDPO.getVoltageDevOvertime() + "次"));
|
||||
count[0] = count[0]+rStatLimitRateDPO.getVoltageDevOvertime();
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Dev.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Har_Current://谐波电流
|
||||
Integer harCurrentOvertime = this.maxOverTime(rStatLimitRateDPO, HarCurrent.class);
|
||||
if (harCurrentOvertime > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Har_Current.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Har_Current.getMessage().concat(harCurrentOvertime + "次"));
|
||||
count[0] = count[0]+harCurrentOvertime;
|
||||
|
||||
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Har_Current.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Voltage_Fluc://电压波动与闪变
|
||||
if (rStatLimitRateDPO.getFlickerOvertime() > 0) {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), true);
|
||||
descriptionList.add(SteadyIndicatorEnum.Voltage_Fluc.getMessage().concat(rStatLimitRateDPO.getFlickerOvertime() + "次"));
|
||||
count[0] = count[0]+rStatLimitRateDPO.getFlickerOvertime();
|
||||
} else {
|
||||
limitBoolMap.put(SteadyIndicatorEnum.Voltage_Fluc.getCode(), false);
|
||||
}
|
||||
break;
|
||||
case Har_Voltage://谐波电压
|
||||
Integer harVoltageOvertime = this.maxOverTime(rStatLimitRateDPO, HarVoltage.class);
|
||||
if (harVoltageOvertime > 0) {
|
||||
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);
|
||||
}
|
||||
break;
|
||||
case Thd_V://畸变
|
||||
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;
|
||||
}
|
||||
|
||||
/***
|
||||
* 获取越限最大值
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.process.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -66,11 +67,12 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
|
||||
@Override
|
||||
public List<ThsWarnStrategy> strategyList(StrategyParam.StrategyPageParam param) {
|
||||
return this.list(new LambdaQueryWrapper<ThsWarnStrategy>()
|
||||
.like(StrUtil.isNotBlank(param.getName()), ThsWarnStrategy::getName, param.getName())
|
||||
.eq(param.getGrade() != null, ThsWarnStrategy::getGrade, param.getGrade())
|
||||
.eq(param.getType() != null, ThsWarnStrategy::getType, param.getType())
|
||||
.ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode())
|
||||
return this.list(new LambdaQueryWrapper<ThsWarnStrategy>()
|
||||
.like(StrUtil.isNotBlank(param.getName()), ThsWarnStrategy::getName, param.getName())
|
||||
.eq(param.getGrade() != null, ThsWarnStrategy::getGrade, param.getGrade())
|
||||
.eq(param.getType() != null, ThsWarnStrategy::getType, param.getType())
|
||||
.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>()
|
||||
.ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode())
|
||||
.eq(ThsWarnStrategy::getName, param.getName())
|
||||
.eq(ThsWarnStrategy::getType,param.getType())
|
||||
.or(param.getBigType()==0,wrapper ->
|
||||
.eq(ThsWarnStrategy::getType, param.getType())
|
||||
.or(param.getBigType() == 0, wrapper ->
|
||||
wrapper.eq(ThsWarnStrategy::getGrade, param.getGrade())
|
||||
.eq(ThsWarnStrategy::getBigType, 0)
|
||||
.eq(ThsWarnStrategy::getType,param.getType())
|
||||
.eq(ThsWarnStrategy::getType, param.getType())
|
||||
.ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode())
|
||||
)
|
||||
);
|
||||
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(ProcessResponseEnum.THERE_IS_ONLY_ONE_STRATEGY);
|
||||
@@ -106,20 +108,37 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean bindStrategy(StrategyParam.BindParam param) {
|
||||
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);
|
||||
ThsWarnStrategy warnStrategy = new ThsWarnStrategy();
|
||||
warnStrategy.setId(param.getId());
|
||||
warnStrategy.setOperation(param.getOperation());
|
||||
return this.updateById(warnStrategy);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,12 +153,12 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
.ne(ThsWarnStrategy::getId, param.getId())
|
||||
.and(wrapper ->
|
||||
wrapper.eq(ThsWarnStrategy::getName, param.getName())
|
||||
.eq(ThsWarnStrategy::getType,param.getType())
|
||||
.eq(ThsWarnStrategy::getType, param.getType())
|
||||
)
|
||||
.or(param.getBigType()==0,wrapper ->
|
||||
wrapper.eq( ThsWarnStrategy::getGrade, param.getGrade())
|
||||
.or(param.getBigType() == 0, wrapper ->
|
||||
wrapper.eq(ThsWarnStrategy::getGrade, param.getGrade())
|
||||
.eq(ThsWarnStrategy::getBigType, 0)
|
||||
.eq(ThsWarnStrategy::getType,param.getType())
|
||||
.eq(ThsWarnStrategy::getType, param.getType())
|
||||
.ne(ThsWarnStrategy::getId, param.getId())
|
||||
.ne(ThsWarnStrategy::getState, DataStateEnum.DELETED.getCode())
|
||||
|
||||
@@ -147,7 +166,7 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
|
||||
);
|
||||
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(ProcessResponseEnum.THERE_IS_ONLY_ONE_STRATEGY);
|
||||
@@ -198,16 +217,16 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
thsDeptAlarmService.remove(lambdaQueryWrapper);
|
||||
|
||||
//信息添加
|
||||
List<ThsDeptAlarm> info=new ArrayList();
|
||||
List<String> alarmIds= param.getAlarmId();
|
||||
List<String> monitorIds= param.getMonitorId();
|
||||
String deptId= param.getDeptId();
|
||||
Integer type= param.getType();
|
||||
List<ThsDeptAlarm> info = new ArrayList();
|
||||
List<String> alarmIds = param.getAlarmId();
|
||||
List<String> monitorIds = param.getMonitorId();
|
||||
String deptId = param.getDeptId();
|
||||
Integer type = param.getType();
|
||||
//便利信息
|
||||
ThsDeptAlarm alarm;
|
||||
for (String s : alarmIds) {
|
||||
for (String monitorId : monitorIds) {
|
||||
alarm=new ThsDeptAlarm();
|
||||
alarm = new ThsDeptAlarm();
|
||||
alarm.setDeptId(deptId);
|
||||
alarm.setType(type);
|
||||
alarm.setAlarmId(s);
|
||||
@@ -220,15 +239,15 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
}
|
||||
|
||||
@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>()
|
||||
.eq(ThsDeptAlarm::getDeptId, org)
|
||||
.eq(ThsDeptAlarm::getType, type)
|
||||
.eq(ThsDeptAlarm::getGrade, grade)
|
||||
.eq(ThsDeptAlarm::getDeptId, org)
|
||||
.eq(ThsDeptAlarm::getType, type)
|
||||
.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());
|
||||
if(CollectionUtil.isNotEmpty(collect)){
|
||||
if (CollectionUtil.isNotEmpty(collect)) {
|
||||
tree.setId(collect.get(0));
|
||||
}
|
||||
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) {
|
||||
Assert.isTrue(StrUtil.isNotBlank(ids), "id为空,不能删除");
|
||||
ThsWarnStrategy byId = this.getById(ids);
|
||||
if(ObjectUtil.isNull(byId)){
|
||||
if (ObjectUtil.isNull(byId)) {
|
||||
throw new BusinessException(ProcessResponseEnum.QUERY_IS_EMPTY);
|
||||
}
|
||||
if(byId.getState() == 1){
|
||||
if (byId.getState() == 1) {
|
||||
throw new BusinessException(ProcessResponseEnum.ENABLED_CANNOT_BE_DELETED);
|
||||
}
|
||||
// thsWarnStrategyAssService.removeById(ids);
|
||||
thsWarnStrategyAssService.removeById(ids);
|
||||
ThsWarnStrategy thsWarnStrategy = new ThsWarnStrategy();
|
||||
thsWarnStrategy.setId(ids);
|
||||
thsWarnStrategy.setState(0);
|
||||
@@ -319,14 +338,14 @@ public class ThsWarnStrategyServiceImpl extends ServiceImpl<ThsWarnStrategyMappe
|
||||
StrategyParam.MonitorTree power = new StrategyParam.MonitorTree();
|
||||
//生成随机数
|
||||
RandomDataGenerator randomDataGenerator = new RandomDataGenerator();
|
||||
power.setId(split[0]+randomDataGenerator.nextInt(1,9));
|
||||
power.setName("变电站名称: "+split[1]);
|
||||
power.setId(split[0] + randomDataGenerator.nextInt(1, 9));
|
||||
power.setName("变电站名称: " + split[1]);
|
||||
//监测点信息
|
||||
List<StrategyParam.Monitor> monitors = new ArrayList();
|
||||
for (PmsMonitorDTO dto : value) {
|
||||
StrategyParam.Monitor childMonitor = new StrategyParam.Monitor();
|
||||
childMonitor.setId(dto.getId());
|
||||
childMonitor.setName("监测点名称: "+dto.getName());
|
||||
childMonitor.setName("监测点名称: " + dto.getName());
|
||||
monitors.add(childMonitor);
|
||||
}
|
||||
power.setChildren(monitors);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
@@ -38,6 +38,8 @@ public class DeptTreeVO extends BaseVO {
|
||||
@ApiModelProperty("排序")
|
||||
private Integer sort;
|
||||
|
||||
private Integer level;
|
||||
|
||||
@ApiModelProperty("子节点详细信息")
|
||||
private List<DeptTreeVO> children;
|
||||
|
||||
|
||||
@@ -39,10 +39,7 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -177,17 +174,27 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
|
||||
@Override
|
||||
public List<DeptTreeVO> existMonitorDeptTree() {
|
||||
List<String> deptIds = commLedgerDeptClient.existMonitorDeptTree().getData();
|
||||
if(CollectionUtil.isEmpty(deptIds)){
|
||||
List<Dept> deptTem = commLedgerDeptClient.existMonitorDeptTree().getData();
|
||||
if(CollectionUtil.isEmpty(deptTem)){
|
||||
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();
|
||||
String deptIndex = RequestUtil.getDeptIndex();
|
||||
List<DeptTreeVO> deptList = this.baseMapper.getDeptTree(deptIndex, deptType);
|
||||
List<DeptTreeVO> finalDeptList = deptList.stream().filter(item->deptIds.contains(item.getId())).collect(Collectors.toList());
|
||||
return finalDeptList.stream()
|
||||
List<DeptTreeVO> finalDeptList = deptList.stream().filter(item->resultDeptId.contains(item.getId())).collect(Collectors.toList());
|
||||
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))
|
||||
.peek(deptFirst -> deptFirst.setChildren(getChildren(deptFirst, finalDeptList)))
|
||||
.peek(deptFirst -> deptFirst.setChildren(getChildren(deptFirst, lastList)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -198,9 +205,7 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
||||
List<DeptAllTreeVO> deptList = this.baseMapper.getAllDeptTree(deptIndex, deptType);
|
||||
return deptList.stream()
|
||||
.filter(deptVO -> deptVO.getId().equals(deptIndex))
|
||||
.peek(deptFirst -> {
|
||||
deptFirst.setChildren(getChildrens(deptFirst, deptList));
|
||||
})
|
||||
.peek(deptFirst -> deptFirst.setChildren(getChildrens(deptFirst, deptList)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user