1.监督计划功能调整

This commit is contained in:
cdf
2024-09-02 16:38:53 +08:00
parent 3377bcf488
commit 69157a138b
7 changed files with 65 additions and 15 deletions

View File

@@ -25,7 +25,7 @@ import java.time.LocalDateTime;
* @since 2023-06-21 * @since 2023-06-21
*/ */
@Data @Data
@TableName("supv_plan") @EqualsAndHashCode(callSuper = true)
public class SupvPlanParam extends BaseParam { public class SupvPlanParam extends BaseParam {
@@ -74,6 +74,12 @@ public class SupvPlanParam extends BaseParam {
@DateTimeStrValid(message = "计划监督时间格式有误") @DateTimeStrValid(message = "计划监督时间格式有误")
private String planSupvDate; private String planSupvDate;
/**
* 监督对象id
*/
@ApiModelProperty(value = "监督对象id")
private String supvObjId;
/** /**
* 监督对象名称 * 监督对象名称
*/ */

View File

@@ -123,7 +123,9 @@ public class SupvPlan extends BaseEntity {
private String supvObjName; private String supvObjName;
@TableField(exist = false) /**
* 监督对象id
*/
private String supvObjId; private String supvObjId;
/** /**

View File

@@ -72,6 +72,12 @@ public class SupvPlanVO {
@JsonFormat(pattern = "yyyy-MM") @JsonFormat(pattern = "yyyy-MM")
private String planSupvDate; private String planSupvDate;
/**
* 监督对象Id
*/
@ApiModelProperty(value = "监督对象Id")
private String supvObjId;
/** /**
* 监督对象名称 * 监督对象名称
*/ */

View File

@@ -36,7 +36,7 @@ public interface ISupvPlanService extends IService<SupvPlan> {
* @author cdf * @author cdf
* @date 2023/6/21 * @date 2023/6/21
*/ */
boolean updatePlan(SupvPlanParam supvPlanParam); boolean updatePlan(SupvPlanParam.UpdateSupvPlanParam supvPlanParam);
/** /**
* 删除技术监督 * 删除技术监督

View File

@@ -7,6 +7,7 @@ import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
@@ -109,7 +110,14 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime())); supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime()));
} }
DictData dictData = dicDataFeignClient.getDicDataById(supvPlanParam.getSupvType()).getData();
if(dictData.getCode().equals(DicDataEnum.Technical_Super.getCode())){
if(StrUtil.isBlank(supvPlanParam.getSupvObjId())){
throw new BusinessException("供电电压质量技术监督类型对象id不可为空");
}
}else {
supvPlan.setSupvObjId(IdUtil.simpleUUID());
}
if(!"01".equals(supvPlan.getEffectStatus())){ if(!"01".equals(supvPlan.getEffectStatus())){
if(Objects.isNull(supvPlan.getEffectStartTime()) ){ if(Objects.isNull(supvPlan.getEffectStartTime()) ){
@@ -123,7 +131,6 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
} }
} }
supvPlan.setIsUploadHead(0); supvPlan.setIsUploadHead(0);
if(StrUtil.isNotBlank(supvPlan.getEffectUserId())){ if(StrUtil.isNotBlank(supvPlan.getEffectUserId())){
List<User> userList = userFeignClient.getUserByIdList(Stream.of(supvPlan.getEffectUserId()).collect(Collectors.toList())).getData(); List<User> userList = userFeignClient.getUserByIdList(Stream.of(supvPlan.getEffectUserId()).collect(Collectors.toList())).getData();
@@ -137,8 +144,10 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean updatePlan(SupvPlanParam supvPlanParam) { public boolean updatePlan(SupvPlanParam.UpdateSupvPlanParam supvPlanParam) {
checkParam(supvPlanParam, true); checkParam(supvPlanParam, true);
SupvPlan byId = this.getById(supvPlanParam.getPlanId());
SupvPlan supvPlan = new SupvPlan(); SupvPlan supvPlan = new SupvPlan();
BeanUtil.copyProperties(supvPlanParam, supvPlan); BeanUtil.copyProperties(supvPlanParam, supvPlan);
supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate())); supvPlan.setPlanSupvDate(PubUtils.localDateFormat(supvPlanParam.getPlanSupvDate()));
@@ -154,6 +163,17 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
if(StrUtil.isNotBlank(supvPlanParam.getReportIssueTime())) { if(StrUtil.isNotBlank(supvPlanParam.getReportIssueTime())) {
supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime())); supvPlan.setReportIssueTime(PubUtils.localDateTimeFormat(supvPlanParam.getReportIssueTime()));
} }
DictData dictData = dicDataFeignClient.getDicDataById(supvPlanParam.getSupvType()).getData();
if(dictData.getCode().equals(DicDataEnum.Technical_Super.getCode())){
if(StrUtil.isBlank(supvPlanParam.getSupvObjId())){
throw new BusinessException("供电电压质量技术监督类型对象id不可为空");
}
}
if(!byId.getSupvType().equals(supvPlanParam.getSupvType())){
supvPlan.setSupvObjId(IdUtil.simpleUUID());
}
if(StrUtil.isNotBlank(supvPlan.getEffectUserId())){ if(StrUtil.isNotBlank(supvPlan.getEffectUserId())){
List<User> userList = userFeignClient.getUserByIdList(Stream.of(supvPlan.getEffectUserId()).collect(Collectors.toList())).getData(); List<User> userList = userFeignClient.getUserByIdList(Stream.of(supvPlan.getEffectUserId()).collect(Collectors.toList())).getData();
if(CollUtil.isNotEmpty(userList)){ if(CollUtil.isNotEmpty(userList)){
@@ -172,7 +192,7 @@ public class SupvPlanServiceImpl extends ServiceImpl<SupvPlanMapper, SupvPlan> i
throw new BusinessException("结束实施时间不可为空!"); throw new BusinessException("结束实施时间不可为空!");
} }
} }
SupvPlan byId = this.getById(supvPlan.getPlanId());
//实施问题 //实施问题
List<SupvPlanHis> list =new ArrayList<>(); List<SupvPlanHis> list =new ArrayList<>();
if(1==byId.getIsUploadHead()){ if(1==byId.getIsUploadHead()){

View File

@@ -239,8 +239,6 @@ public class SupvPushGwServiceImpl implements SupvPushGwService {
pvTerminalTreeVO = mapCode.get(supvPlan.getPlanOrgId()); pvTerminalTreeVO = mapCode.get(supvPlan.getPlanOrgId());
supvPlan.setPlanOrgName(pvTerminalTreeVO.getName()); supvPlan.setPlanOrgName(pvTerminalTreeVO.getName());
} }
supvPlan.setSupvObjId(IdUtil.simpleUUID());
} }
if (supvPlanList.size() > 100) { if (supvPlanList.size() > 100) {
throw new BusinessException("一次最多上送100条数据"); throw new BusinessException("一次最多上送100条数据");

View File

@@ -167,7 +167,7 @@ public class SupvReportMServiceImpl extends MppServiceImpl<SupvReportMMapper, Su
//电容器组月前统计 //电容器组月前统计
List<ProcessPublicDTO> processPublicYearDTOS = this.baseMapper.statisticPlanReportYear(firstYearDay, endYearDay, mapStatistic.get(DicDataEnum.capacitor_bank.getCode()).getId(), null, null); List<ProcessPublicDTO> processPublicYearDTOS = this.baseMapper.statisticPlanReportYear(firstYearDay, endYearDay, mapStatistic.get(DicDataEnum.capacitor_bank.getCode()).getId(), null, null);
List<ProcessPublicDTO> processPublicDTOCapacitorListM = this.baseMapper.statisticPlanReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.capacitor_bank.getCode()).getId(),null,null); List<ProcessPublicDTO> processPublicDTOCapacitorListM = this.baseMapper.statisticPlanReport(firstDay,endTime,mapStatistic.get(DicDataEnum.capacitor_bank.getCode()).getId(),null,null);
List<ProcessPublicDTO> processPublicDTOCapacitorAll = this.baseMapper.statisticPlanReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.capacitor_bank.getCode()).getId(),null,null); List<ProcessPublicDTO> processPublicDTOCapacitorAll = this.baseMapper.statisticPlanReport(firstYearDay,endTime,mapStatistic.get(DicDataEnum.capacitor_bank.getCode()).getId(),null,null);
//电容器组问题数量 //电容器组问题数量
List<ProcessPublicDTO> processPublicDTOCapacitorGanM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.capacitor_bank.getCode()).getId(),null,null); List<ProcessPublicDTO> processPublicDTOCapacitorGanM = this.baseMapper.statisticQueReport(firstDay,endTime,mapStatistic.get(DicDataEnum.capacitor_bank.getCode()).getId(),null,null);
@@ -190,14 +190,18 @@ public class SupvReportMServiceImpl extends MppServiceImpl<SupvReportMMapper, Su
List<SupvReportM> supvReportMBatch = new ArrayList<>(); List<SupvReportM> supvReportMBatch = new ArrayList<>();
Integer dyProvinceCount = 0;
String provinceId ="";
for(DeptGetBase deptGetBase : deptGetBaseList){ for(DeptGetBase deptGetBase : deptGetBaseList){
if(deptGetBase.getUnitName().equals("国家电网公司")){
System.out.println(55);
}
if(deptGetBase.getDeptLevel() !=2 && deptGetBase.getDeptLevel() !=3 && deptGetBase.getDeptLevel() !=4){ if(deptGetBase.getDeptLevel() !=2 && deptGetBase.getDeptLevel() !=3 && deptGetBase.getDeptLevel() !=4){
continue; continue;
} }
if(deptGetBase.getDeptLevel() ==2){
provinceId = deptGetBase.getUnitId();
}
//月累计监督数量 //月累计监督数量
Integer all = 0; Integer all = 0;
Integer yearAll = 0; Integer yearAll = 0;
@@ -256,8 +260,15 @@ public class SupvReportMServiceImpl extends MppServiceImpl<SupvReportMMapper, Su
supvReportM.setSensitiveTotalReformNum(dealData(childrenDeptList,processPublicDTOQesMingGanYesAll)); supvReportM.setSensitiveTotalReformNum(dealData(childrenDeptList,processPublicDTOQesMingGanYesAll));
//电压 //电压
supvReportM.setPowerMonthPlanNum(dealData(childrenDeptList,processPublicDTODianYaListM)); Integer dyMCount = dealData(childrenDeptList,processPublicDTODianYaListM);
supvReportM.setPowerMonthConductedNum(dealData(childrenDeptList,processPublicDTODianYaListAll)); Integer dyYCount = dealData(childrenDeptList,processPublicDTODianYaListAll);
supvReportM.setPowerMonthPlanNum(dyMCount>0?1:0);
supvReportM.setPowerMonthConductedNum(dyYCount>0?1:0);
if(deptGetBase.getDeptLevel() == 3){
dyProvinceCount+=supvReportM.getPowerMonthPlanNum();
}
all+=supvReportM.getPowerMonthConductedNum(); all+=supvReportM.getPowerMonthConductedNum();
Integer dd = dealData(childrenDeptList,processPublicDTODianYaYearPlan); Integer dd = dealData(childrenDeptList,processPublicDTODianYaYearPlan);
yearAll+=dd; yearAll+=dd;
@@ -337,6 +348,13 @@ public class SupvReportMServiceImpl extends MppServiceImpl<SupvReportMMapper, Su
} }
for(SupvReportM supvReportM : supvReportMBatch){
if(supvReportM.getStatisticsDept().equals(provinceId)){
supvReportM.setPowerMonthPlanNum(dyProvinceCount);
supvReportM.setPowerMonthConductedNum(dyProvinceCount);
}
}
this.saveOrUpdateBatchByMultiId(supvReportMBatch); this.saveOrUpdateBatchByMultiId(supvReportMBatch);
log.info(LocalDateTime.now()+"_________________________执行时长"+timeInterval.interval()); log.info(LocalDateTime.now()+"_________________________执行时长"+timeInterval.interval());