技术监督管理调整
This commit is contained in:
@@ -72,6 +72,12 @@
|
||||
<artifactId>prepare-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>process-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.njcn.executor.handler;
|
||||
|
||||
import com.njcn.process.api.SupvStatisticReportMFeignClient;
|
||||
import com.xxl.job.core.context.XxlJobHelper;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
* 技术监督计划问题月报统计
|
||||
* @author cdf
|
||||
* @date 2023/6/29
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class SupvStatisticReportJob {
|
||||
|
||||
private final SupvStatisticReportMFeignClient supvStatisticReportMFeignClient;
|
||||
|
||||
@XxlJob("statisticReportJobHandler")
|
||||
public void statisticReportJobHandler() {
|
||||
LocalDate yesterday = LocalDate.now().plusDays(-1);
|
||||
supvStatisticReportMFeignClient.statisticReport(yesterday.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
log.info(LocalDateTime.now()+"技术监督计划问题月报统计调用成功");
|
||||
}
|
||||
}
|
||||
@@ -46,8 +46,8 @@ logging:
|
||||
xxl:
|
||||
job:
|
||||
admin:
|
||||
addresses: http://@service.server.url@:10217/job-admin
|
||||
# addresses: http://192.168.1.29:10217/job-admin
|
||||
# addresses: http://@service.server.url@:10217/job-admin
|
||||
addresses: http://192.168.1.18:10217/job-admin
|
||||
#执行器通讯TOKEN [选填]:非空时启用;
|
||||
accessToken:
|
||||
executor:
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn.process.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.process.api.fallback.SupvStatisticReportMFallbackFactory;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 过程监督月报统计
|
||||
* @author cdf
|
||||
* @date 2023/4/13
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.PROCESS,path = "/supv/report",fallbackFactory = SupvStatisticReportMFallbackFactory.class)
|
||||
public interface SupvStatisticReportMFeignClient {
|
||||
|
||||
@PostMapping("/statisticReport")
|
||||
HttpResult<Boolean> statisticReport(@RequestParam("timeId") String timeId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.njcn.process.api.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.process.api.SupvStatisticReportMFeignClient;
|
||||
import com.njcn.process.utils.ProcessEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/4/13
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SupvStatisticReportMFallbackFactory implements FallbackFactory<SupvStatisticReportMFeignClient> {
|
||||
|
||||
@Override
|
||||
public SupvStatisticReportMFeignClient create(Throwable throwable) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (throwable.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||
exceptionEnum = ProcessEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new SupvStatisticReportMFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> statisticReport(String timeId) {
|
||||
log.error("{}异常,降级处理,异常为:{}", "技术监督月报统计", throwable.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -71,21 +71,18 @@ public class SupvPlanParam extends BaseParam {
|
||||
* 监督对象名称
|
||||
*/
|
||||
@ApiModelProperty(value = "监督对象名称")
|
||||
@NotBlank(message = "监督对象名称不可为空")
|
||||
private String supvObjName;
|
||||
|
||||
/**
|
||||
* 对象类型
|
||||
* 监督对象类型
|
||||
*/
|
||||
@ApiModelProperty(value = "对象类型")
|
||||
@NotBlank(message = "对象类型不可为空")
|
||||
private String supvObjType;
|
||||
|
||||
/**
|
||||
* 对象电压等级
|
||||
* 监督对象电压等级
|
||||
*/
|
||||
@ApiModelProperty(value = "对象电压等级")
|
||||
@NotBlank(message = "对象电压等级不可为空")
|
||||
private String objVoltageLevel;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.process.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
@@ -30,16 +31,29 @@ public class SupvPlan extends BaseEntity {
|
||||
@TableId
|
||||
private String planId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String provinceId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String provinceName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String cityId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String cityName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String countyId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String countyName;
|
||||
|
||||
/**
|
||||
* 计划名称
|
||||
*/
|
||||
private String workPlanName;
|
||||
|
||||
/**
|
||||
* 监督单位
|
||||
*/
|
||||
private String supvOrgId;
|
||||
|
||||
/**
|
||||
* 监督类型
|
||||
*/
|
||||
@@ -50,17 +64,71 @@ public class SupvPlan extends BaseEntity {
|
||||
*/
|
||||
private String supvStage;
|
||||
|
||||
/**
|
||||
* 监督单位
|
||||
*/
|
||||
private String supvOrgId;
|
||||
|
||||
/**
|
||||
* 监督单位
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String supvOrgName;
|
||||
|
||||
/**
|
||||
* 计划监督时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate planSupvDate;
|
||||
|
||||
/**
|
||||
* 计划编制人id
|
||||
*/
|
||||
private String planUserId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String planUserName;
|
||||
|
||||
/**
|
||||
* 计划编制单位id
|
||||
*/
|
||||
private String planOrgId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String planOrgName;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String otherRemark;
|
||||
|
||||
/**
|
||||
* 计划执行开始时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate effectStartTime;
|
||||
|
||||
/**
|
||||
* 计划执行结束时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate effectEndTime;
|
||||
|
||||
|
||||
/**
|
||||
* 实施状态
|
||||
*/
|
||||
private String effectStatus;
|
||||
|
||||
/**
|
||||
* 监督对象名称
|
||||
*/
|
||||
|
||||
private String supvObjName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String supvObjId;
|
||||
|
||||
/**
|
||||
* 对象类型
|
||||
*/
|
||||
@@ -71,6 +139,9 @@ public class SupvPlan extends BaseEntity {
|
||||
*/
|
||||
private String objVoltageLevel;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String objVoltageLevelName;
|
||||
|
||||
/**
|
||||
* 关联电站
|
||||
*/
|
||||
@@ -82,6 +153,12 @@ public class SupvPlan extends BaseEntity {
|
||||
*/
|
||||
private String substationVoltageLevel;
|
||||
|
||||
/**
|
||||
* 关联电站电压等级名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String substationVoltageLevelName;
|
||||
|
||||
|
||||
/**
|
||||
* 监督对象属性
|
||||
@@ -98,17 +175,7 @@ public class SupvPlan extends BaseEntity {
|
||||
*/
|
||||
private Double objCapacity;
|
||||
|
||||
/**
|
||||
* 计划执行开始时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate effectStartTime;
|
||||
|
||||
/**
|
||||
* 计划执行结束时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDate effectEndTime;
|
||||
|
||||
/**
|
||||
* 报告出具时间
|
||||
@@ -122,26 +189,9 @@ public class SupvPlan extends BaseEntity {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime problemOcTime;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String otherRemark;
|
||||
|
||||
/**
|
||||
* 计划编制人id
|
||||
*/
|
||||
private String planUserId;
|
||||
|
||||
/**
|
||||
* 计划编制单位id
|
||||
*/
|
||||
private String planOrgId;
|
||||
|
||||
|
||||
/**
|
||||
* 实施状态
|
||||
*/
|
||||
private String effectStatus;
|
||||
|
||||
|
||||
/**
|
||||
* 0.未上送 1.上送 2.取消上送
|
||||
|
||||
@@ -51,7 +51,7 @@ public class SupvPushGwController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收电能质量技术监督工作计划数据接口
|
||||
* 推送技术监督实施问题
|
||||
* @author cdf
|
||||
* @date 2023/6/28
|
||||
*/
|
||||
@@ -61,25 +61,12 @@ public class SupvPushGwController extends BaseController {
|
||||
@ApiImplicitParam(name = "problemIds",value = "请求体",required = true)
|
||||
public HttpResult<Object> pushQuestion(@RequestBody List<String> problemIds){
|
||||
String methodDescribe = getMethodDescribe("pushQuestion");
|
||||
supvPushGwService.pushPlan(problemIds);
|
||||
supvPushGwService.pushQuestion(problemIds);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 电能质量技术监督实施问题整改数据接口
|
||||
* @author cdf
|
||||
* @date 2023/6/28
|
||||
*/
|
||||
@PostMapping("pushQueRem")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("推送电能质量技术监督实施问题整改数据接口")
|
||||
@ApiImplicitParam(name = "planIds",value = "请求体",required = true)
|
||||
public HttpResult<Object> pushQueRem(@RequestBody List<String> planIds){
|
||||
String methodDescribe = getMethodDescribe("pushQueRem");
|
||||
supvPushGwService.pushPlan(planIds);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,9 @@ import com.njcn.process.pojo.po.SupvPlan;
|
||||
import com.njcn.process.pojo.vo.SupvPlanVO;
|
||||
import com.njcn.process.service.ISupvFileService;
|
||||
import com.njcn.process.service.ISupvPlanService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
@@ -54,6 +57,8 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
|
||||
|
||||
private final DeptFeignClient deptFeignClient;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final SupvFileMapper supvFileMapper;
|
||||
|
||||
private final UserFeignClient userFeignClient;
|
||||
@@ -71,7 +76,6 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
|
||||
supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime()));
|
||||
supvPlan.setIsUploadHead(0);
|
||||
supvPlan.setPlanUserId(RequestUtil.getUserIndex());
|
||||
|
||||
this.save(supvPlan);
|
||||
return true;
|
||||
}
|
||||
@@ -195,6 +199,33 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
|
||||
}
|
||||
|
||||
//判断监督对象类型
|
||||
if(StrUtil.isNotBlank(supvPlanParam.getSupvObjType())){
|
||||
DictData dictData = dicDataFeignClient.getDicDataById(supvPlanParam.getSupvType()).getData();
|
||||
if(dictData.getCode().equals(DicDataEnum.New_Energy.getCode())){
|
||||
if(StrUtil.isBlank(supvPlanParam.getSupvObjType())){
|
||||
throw new BusinessException("监督对象类型不可为空");
|
||||
}
|
||||
if(StrUtil.isBlank(supvPlanParam.getObjType())){
|
||||
throw new BusinessException("监督对象属性名称不可为空");
|
||||
}
|
||||
if(Objects.isNull(supvPlanParam.getObjCapacity())){
|
||||
throw new BusinessException("监督对象协议容量不可为空");
|
||||
}
|
||||
}else if(!dictData.getCode().equals(DicDataEnum.Technical_Super.getCode())){
|
||||
if(StrUtil.isBlank(supvPlanParam.getSupvObjName())){
|
||||
throw new BusinessException("监督对象名称不可为空");
|
||||
}
|
||||
if(StrUtil.isBlank(supvPlanParam.getObjVoltageLevel())){
|
||||
throw new BusinessException("监督对象电压等级不可为空");
|
||||
}
|
||||
|
||||
}else if(!dictData.getCode().equals(DicDataEnum.POWER_QUALITY.getCode())){
|
||||
if(Objects.isNull(supvPlanParam.getObjCapacity())){
|
||||
throw new BusinessException("监督对象协议容量不可为空");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.process.enums.ProcessResponseEnum;
|
||||
import com.njcn.process.mapper.SupvProblemMapper;
|
||||
import com.njcn.process.pojo.param.SupvProblemParam;
|
||||
import com.njcn.process.pojo.po.SupvPlan;
|
||||
import com.njcn.process.pojo.po.SupvProblem;
|
||||
import com.njcn.process.pojo.po.SupvProblem;
|
||||
import com.njcn.process.service.ISupvProblemService;
|
||||
@@ -63,12 +64,17 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
|
||||
|
||||
@Override
|
||||
public boolean delProblem(List<String> problemIds) {
|
||||
LambdaQueryWrapper<SupvProblem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SupvProblem::getIsUploadHead,1).eq(SupvProblem::getProblemId,problemIds);
|
||||
int count = this.count(lambdaQueryWrapper);
|
||||
if(count > 0){
|
||||
throw new BusinessException("请选择未上送国网的删除");
|
||||
}
|
||||
return this.removeByIds(problemIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SupvProblem> pageProblem(SupvProblemParam supvProblemParam) {
|
||||
|
||||
LambdaQueryWrapper<SupvProblem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SupvProblem::getPlanId,supvProblemParam.getPlanId());
|
||||
Page<SupvProblem> page = this.page(new Page<>(PageFactory.getPageNum(supvProblemParam), PageFactory.getPageSize(supvProblemParam)),lambdaQueryWrapper);
|
||||
@@ -76,7 +82,6 @@ public class SupvProblemServiceImpl extends ServiceImpl<SupvProblemMapper, SupvP
|
||||
List<PvTerminalTreeVO> deptList = deptFeignClient.allDeptList().getData();
|
||||
Map<String,PvTerminalTreeVO> mapCode = deptList.stream().collect(Collectors.toMap(PvTerminalTreeVO::getCode, Function.identity()));
|
||||
|
||||
|
||||
for (SupvProblem item : page.getRecords()) {
|
||||
if(mapCode.containsKey(item.getDutyOrgId())) {
|
||||
item.setDutyOrgName(mapCode.get(item.getDutyOrgId()).getName());
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.njcn.process.pojo.po.SupvReportM;
|
||||
import com.njcn.process.service.SupvPushGwService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.Dic;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
@@ -77,43 +78,47 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
Map<String, DictData> mapSupvEffect = supveffectDicList.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
|
||||
|
||||
List<DictData> supvObjTypeDicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.SUPV_OBJ_TYPE.getCode()).getData();
|
||||
Map<String, DictData> mapObjType = supvObjTypeDicList.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
|
||||
Map<String, DictData> mapSubvObjType = supvObjTypeDicList.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
|
||||
|
||||
List<DictData> supvVoltageDicList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();
|
||||
Map<String, DictData> mapVoltage = supvVoltageDicList.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
|
||||
|
||||
|
||||
List<WorkPlanData> workPlanDataList = new ArrayList<>();
|
||||
|
||||
for(SupvPlan supvPlan:supvPlanList){
|
||||
WorkPlanData workPlanData = new WorkPlanData();
|
||||
BeanUtil.copyProperties(supvPlan,workPlanData);
|
||||
|
||||
PvTerminalTreeVO pvTerminalTreeVO = null;
|
||||
if(mapCode.containsKey(supvPlan.getSupvOrgId())) {
|
||||
pvTerminalTreeVO = mapCode.get(supvPlan.getSupvOrgId());
|
||||
workPlanData.setSupvOrgName(pvTerminalTreeVO.getName());
|
||||
supvPlan.setSupvOrgName(pvTerminalTreeVO.getName());
|
||||
int deptLevel = pvTerminalTreeVO.getPids().split(StrUtil.COMMA).length;
|
||||
if(deptLevel == 2){
|
||||
//省
|
||||
workPlanData.setProvinceName(pvTerminalTreeVO.getName());
|
||||
supvPlan.setProvinceName(pvTerminalTreeVO.getName());
|
||||
supvPlan.setProvinceId(pvTerminalTreeVO.getCode());
|
||||
}else if(deptLevel == 3){
|
||||
//市
|
||||
workPlanData.setCityName(pvTerminalTreeVO.getName());
|
||||
supvPlan.setCityName(pvTerminalTreeVO.getName());
|
||||
supvPlan.setCityId(pvTerminalTreeVO.getCode());
|
||||
if(mapList.containsKey(pvTerminalTreeVO.getPid())) {
|
||||
PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid());
|
||||
workPlanData.setProvinceName(pvTerminalTreeOne.getName());
|
||||
supvPlan.setProvinceName(pvTerminalTreeOne.getName());
|
||||
supvPlan.setProvinceId(pvTerminalTreeOne.getCode());
|
||||
}
|
||||
}else if(deptLevel == 4){
|
||||
//县
|
||||
if(mapList.containsKey(pvTerminalTreeVO.getPid())) {
|
||||
workPlanData.setCountyName(pvTerminalTreeVO.getName());
|
||||
supvPlan.setCountyName(pvTerminalTreeVO.getName());
|
||||
supvPlan.setCountyId(pvTerminalTreeVO.getCode());
|
||||
PvTerminalTreeVO pvTerminalTreeOne = mapList.get(pvTerminalTreeVO.getPid());
|
||||
if (Objects.nonNull(pvTerminalTreeOne)) {
|
||||
workPlanData.setCityName(pvTerminalTreeOne.getName());
|
||||
supvPlan.setCityName(pvTerminalTreeOne.getName());
|
||||
supvPlan.setCityId(pvTerminalTreeOne.getCode());
|
||||
if(mapList.containsKey(pvTerminalTreeOne.getPid())) {
|
||||
PvTerminalTreeVO pvTerminalTreeTwo = mapList.get(pvTerminalTreeOne.getPid());
|
||||
if (Objects.nonNull(pvTerminalTreeTwo)) {
|
||||
workPlanData.setProvinceName(pvTerminalTreeTwo.getName());
|
||||
supvPlan.setProvinceName(pvTerminalTreeTwo.getName());
|
||||
supvPlan.setProvinceId(pvTerminalTreeTwo.getCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,40 +128,54 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
|
||||
//处理字典
|
||||
//监督类型编码
|
||||
if(mapType.containsKey(workPlanData.getSupvType())) {
|
||||
workPlanData.setSupvType(String.format("%02d", mapType.get(workPlanData.getSupvType()).getAlgoDescribe()));
|
||||
if(mapType.containsKey(supvPlan.getSupvType())) {
|
||||
supvPlan.setSupvType(String.format("%02d", mapType.get(supvPlan.getSupvType()).getAlgoDescribe()));
|
||||
}
|
||||
|
||||
//监督类型编码
|
||||
if(mapType.containsKey(workPlanData.getSupvStage())) {
|
||||
workPlanData.setSupvStage(String.format("%02d", mapSupvState.get(workPlanData.getSupvType()).getAlgoDescribe()));
|
||||
if(mapSupvState.containsKey(supvPlan.getSupvStage())) {
|
||||
supvPlan.setSupvStage(String.format("%02d", mapSupvState.get(supvPlan.getSupvStage()).getAlgoDescribe()));
|
||||
}
|
||||
|
||||
//监督阶段
|
||||
if(mapType.containsKey(workPlanData.getEffectStatus())) {
|
||||
workPlanData.setEffectStatus(String.format("%02d", mapSupvState.get(workPlanData.getEffectStatus()).getAlgoDescribe()));
|
||||
if(mapSupvEffect.containsKey(supvPlan.getEffectStatus())) {
|
||||
supvPlan.setEffectStatus(String.format("%02d", mapSupvEffect.get(supvPlan.getEffectStatus()).getAlgoDescribe()));
|
||||
}
|
||||
|
||||
//监督对象类型
|
||||
if(mapType.containsKey(workPlanData.getSupvType())) {
|
||||
workPlanData.setSupvType(String.format("%02d", mapSupvState.get(workPlanData.getSupvType()).getAlgoDescribe()));
|
||||
if(mapSubvObjType.containsKey(supvPlan.getSupvType())) {
|
||||
supvPlan.setSupvType(String.format("%02d", mapSubvObjType.get(supvPlan.getSupvType()).getAlgoDescribe()));
|
||||
}
|
||||
|
||||
//电站等级
|
||||
if(mapType.containsKey(workPlanData.getSubstationVoltageLevel())) {
|
||||
workPlanData.setSubstationVoltageLevel(String.format("%02d", mapSupvState.get(workPlanData.getSubstationVoltageLevel()).getAlgoDescribe()));
|
||||
|
||||
if(mapVoltage.containsKey(supvPlan.getSubstationVoltageLevel())) {
|
||||
supvPlan.setSubstationVoltageLevel(String.format("%02d", mapVoltage.get(supvPlan.getSubstationVoltageLevel()).getAlgoDescribe()));
|
||||
}
|
||||
|
||||
if(mapVoltage.containsKey(supvPlan.getObjVoltageLevel())) {
|
||||
DictData dictData = mapVoltage.get(supvPlan.getObjVoltageLevel());
|
||||
supvPlan.setObjVoltageLevel(String.format("%02d", dictData.getAlgoDescribe()));
|
||||
supvPlan.setObjVoltageLevelName(dictData.getName());
|
||||
}
|
||||
|
||||
workPlanDataList.add(workPlanData);
|
||||
}
|
||||
if(workPlanDataList.size()>100){
|
||||
if(supvPlanList.size()>100){
|
||||
throw new BusinessException("一次最多上送100条数据");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//TODO 调用国网接口
|
||||
|
||||
|
||||
for(SupvPlan supvPlan: supvPlanList){
|
||||
SupvPlan supvPlanPO = new SupvPlan();
|
||||
supvPlanPO.setPlanId(supvPlan.getPlanId());
|
||||
supvPlanPO.setIsUploadHead(1);
|
||||
supvPlanMapper.updateById(supvPlanPO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
@@ -178,33 +197,36 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
|
||||
Map<String, DictData> mapRe = reList.stream().collect(Collectors.toMap(DictData::getId,Function.identity()));
|
||||
|
||||
|
||||
List<PlanProblemData> planProblemDataList = new ArrayList<>();
|
||||
for(SupvProblem supvProblem : supvProblemList){
|
||||
PlanProblemData planProblemData = new PlanProblemData();
|
||||
BeanUtil.copyProperties(supvProblem,planProblemData);
|
||||
|
||||
Dept dept = deptFeignClient.getDeptByCode(planProblemData.getDutyOrgId()).getData();
|
||||
planProblemData.setDutyOrgName(dept.getName());
|
||||
Dept dept = deptFeignClient.getDeptByCode(supvProblem.getDutyOrgId()).getData();
|
||||
supvProblem.setDutyOrgName(dept.getName());
|
||||
|
||||
|
||||
if(mapMonitorType.containsKey(planProblemData.getMonitorType())){
|
||||
planProblemData.setMonitorType(String.format("%02d",mapMonitorType.get(planProblemData.getMonitorType()).getAlgoDescribe()));
|
||||
if(mapMonitorType.containsKey(supvProblem.getMonitorType())){
|
||||
supvProblem.setMonitorType(String.format("%02d",mapMonitorType.get(supvProblem.getMonitorType()).getAlgoDescribe()));
|
||||
}
|
||||
if(mapProblemType.containsKey(planProblemData.getProblemType())){
|
||||
planProblemData.setProblemType(String.format("%02d",mapMonitorType.get(planProblemData.getMonitorType()).getAlgoDescribe()));
|
||||
if(mapProblemType.containsKey(supvProblem.getProblemType())){
|
||||
supvProblem.setProblemType(String.format("%02d",mapProblemType.get(supvProblem.getMonitorType()).getAlgoDescribe()));
|
||||
}
|
||||
if(mapRe.containsKey(planProblemData.getRectificationMeasure())){
|
||||
planProblemData.setRectificationMeasure(String.format("%02d",mapMonitorType.get(planProblemData.getRectificationMeasure()).getAlgoDescribe()));
|
||||
if(mapRe.containsKey(supvProblem.getRectificationMeasure())){
|
||||
supvProblem.setRectificationMeasure(String.format("%02d",mapRe.get(supvProblem.getRectificationMeasure()).getAlgoDescribe()));
|
||||
}
|
||||
planProblemDataList.add(planProblemData);
|
||||
}
|
||||
|
||||
if(planProblemDataList.size()>100){
|
||||
if(supvProblemList.size()>100){
|
||||
throw new BusinessException("一次最多上送100条数据");
|
||||
}
|
||||
|
||||
//TODO
|
||||
// 目前一个问题对应一个措施,上送一个问题需要调用问题接口和整改措施接口
|
||||
|
||||
for(SupvProblem supvProblem:supvProblemList){
|
||||
SupvProblem supvProblemPO = new SupvProblem();
|
||||
supvProblemPO.setProblemId(supvProblem.getProblemId());
|
||||
supvProblemPO.setIsUploadHead(1);
|
||||
supvProblemMapper.updateById(supvProblemPO);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ package com.njcn.process.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.date.TimeInterval;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -26,7 +27,10 @@ import com.njcn.user.api.DeptFeignClient;
|
||||
import com.njcn.user.pojo.vo.PvTerminalTreeVO;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import liquibase.pro.packaged.T;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
@@ -49,6 +53,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class SupvReportMServiceImpl extends MppServiceImpl<SupvReportMMapper, SupvReportM> implements ISupvReportMService {
|
||||
|
||||
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||
@@ -58,7 +63,10 @@ public class SupvReportMServiceImpl extends MppServiceImpl<SupvReportMMapper, Su
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
@Override
|
||||
@Async("asyncExecutor")
|
||||
public boolean statisticSuperviseReport(LocalDate timeId) {
|
||||
log.info(LocalDateTime.now()+"_________________________开始执行");
|
||||
TimeInterval timeInterval = new TimeInterval();
|
||||
|
||||
//当月第一天
|
||||
LocalDateTime firstDay = timeId.with(TemporalAdjusters.firstDayOfMonth()).atTime(0,0,0);
|
||||
@@ -128,12 +136,17 @@ public class SupvReportMServiceImpl extends MppServiceImpl<SupvReportMMapper, Su
|
||||
List<ProcessPublicDTO> processPublicDTOQesMingGanYesM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),"01",null);
|
||||
List<ProcessPublicDTO> processPublicDTOQesMingGanYesAll = this.baseMapper.statisticQueReport(null,null,mapStatistic.get(DicDataEnum.POWER_QUALITY.getCode()).getId(),"01",null);
|
||||
|
||||
//电压
|
||||
List<ProcessPublicDTO> processPublicDTODianYaListM = this.baseMapper.statisticPlanReport(firstDay,endTime,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),null);
|
||||
List<ProcessPublicDTO> processPublicDTODianYaListAll = this.baseMapper.statisticPlanReport(null,null,mapStatistic.get(DicDataEnum.Technical_Super.getCode()).getId(),null);
|
||||
|
||||
|
||||
List<SupvReportM> supvReportMBatch = new ArrayList<>();
|
||||
for(DeptGetBase deptGetBase : deptGetBaseList){
|
||||
if(deptGetBase.getDeptLevel() !=2 && deptGetBase.getDeptLevel() !=3 && deptGetBase.getDeptLevel() !=4){
|
||||
continue;
|
||||
}
|
||||
Integer all = 0;
|
||||
SupvReportM supvReportM = new SupvReportM();
|
||||
supvReportM.setStatisticsDate(timeId.with(TemporalAdjusters.firstDayOfMonth()));
|
||||
supvReportM.setStatisticsDept(deptGetBase.getUnitId());
|
||||
@@ -142,11 +155,16 @@ public class SupvReportMServiceImpl extends MppServiceImpl<SupvReportMMapper, Su
|
||||
if(CollUtil.isNotEmpty(childrenDeptList)){
|
||||
supvReportM.setConvertMonthSupvNum(dealData(childrenDeptList,processPublicDTOListM));
|
||||
supvReportM.setConvertYearSupvNum(dealData(childrenDeptList,processPublicDTOListY));
|
||||
supvReportM.setConvertTotalSupvNum(dealData(childrenDeptList,processPublicDTOListAll));
|
||||
|
||||
Integer a = dealData(childrenDeptList,processPublicDTOListAll);
|
||||
supvReportM.setConvertTotalSupvNum(a);
|
||||
all+=a;
|
||||
supvReportM.setEnergyMonthSupvNum(dealData(childrenDeptList,processPublicDTOListNewM));
|
||||
supvReportM.setEnergyYearSupvNum(dealData(childrenDeptList,processPublicDTOListNewY));
|
||||
supvReportM.setEnergyTotalSupvNum(dealData(childrenDeptList,processPublicDTOListNewAll));
|
||||
|
||||
Integer b = dealData(childrenDeptList,processPublicDTOListNewAll);
|
||||
supvReportM.setEnergyTotalSupvNum(b);
|
||||
all+=b;
|
||||
|
||||
supvReportM.setEnergyMonthSupvNewNum(dealData(childrenDeptList,processPublicDTOListNewZM));
|
||||
supvReportM.setEnergyYearSupvNewNum(dealData(childrenDeptList,processPublicDTOListNewZY));
|
||||
@@ -175,7 +193,10 @@ public class SupvReportMServiceImpl extends MppServiceImpl<SupvReportMMapper, Su
|
||||
//敏感用户
|
||||
supvReportM.setSensitiveMonthSupvNum(dealData(childrenDeptList,processPublicDTOMingGanM));
|
||||
supvReportM.setSensitiveYearSupvNum(dealData(childrenDeptList,processPublicDTOMingGanY));
|
||||
supvReportM.setSensitiveTotalSupvNum(dealData(childrenDeptList,processPublicDTOMingGanAll));
|
||||
|
||||
Integer c = dealData(childrenDeptList,processPublicDTOMingGanAll);
|
||||
supvReportM.setSensitiveTotalSupvNum(c);
|
||||
all+=c;
|
||||
|
||||
supvReportM.setSensitiveMonthQuesNum(dealData(childrenDeptList,processPublicDTOQesMingGanM));
|
||||
supvReportM.setSensitiveTotalQuesNum(dealData(childrenDeptList,processPublicDTOQesMingGanAll));
|
||||
@@ -183,8 +204,11 @@ public class SupvReportMServiceImpl extends MppServiceImpl<SupvReportMMapper, Su
|
||||
supvReportM.setSensitiveMonthReformNum(dealData(childrenDeptList,processPublicDTOQesMingGanYesM));
|
||||
supvReportM.setSensitiveTotalReformNum(dealData(childrenDeptList,processPublicDTOQesMingGanYesAll));
|
||||
|
||||
supvReportM.setPowerMonthPlanNum(5);
|
||||
supvReportM.setPowerTotalConductedNum(10);
|
||||
//电压
|
||||
supvReportM.setPowerMonthPlanNum(dealData(childrenDeptList,processPublicDTODianYaListM));
|
||||
Integer d = dealData(childrenDeptList,processPublicDTODianYaListAll);
|
||||
supvReportM.setPowerTotalConductedNum(d);
|
||||
all+=d;
|
||||
|
||||
}
|
||||
|
||||
@@ -224,12 +248,14 @@ public class SupvReportMServiceImpl extends MppServiceImpl<SupvReportMMapper, Su
|
||||
}
|
||||
supvReportM.setStatisticsLevel("5");
|
||||
}
|
||||
supvReportM.setSupvNum(10);
|
||||
supvReportM.setSupvNum(all);
|
||||
supvReportMBatch.add(supvReportM);
|
||||
|
||||
}
|
||||
|
||||
this.saveOrUpdateBatchByMultiId(supvReportMBatch);
|
||||
|
||||
log.info(LocalDateTime.now()+"_________________________执行时长:"+timeInterval.interval());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user