diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/facility/domain/vo/matrix/FacMatrixVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/facility/domain/vo/matrix/FacMatrixVo.java index 27389acc..6dda1ad0 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/facility/domain/vo/matrix/FacMatrixVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/facility/domain/vo/matrix/FacMatrixVo.java @@ -8,7 +8,6 @@ import org.dromara.facility.domain.FacMatrix; import java.io.Serial; import java.io.Serializable; -import java.util.List; /** @@ -43,22 +42,10 @@ public class FacMatrixVo implements Serializable { @ExcelProperty(value = "方阵名称") private String matrixName; - /** - * 方阵位置 - */ - @ExcelProperty(value = "方阵位置") - private String positions; - - /** - * 方阵位置 - */ - private List> positionList; - /** * 备注 */ @ExcelProperty(value = "备注") private String remark; - } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/facility/service/IFacPhotovoltaicPanelPartsService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/facility/service/IFacPhotovoltaicPanelPartsService.java index 5a532a43..bbb3cad9 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/facility/service/IFacPhotovoltaicPanelPartsService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/facility/service/IFacPhotovoltaicPanelPartsService.java @@ -73,4 +73,6 @@ public interface IFacPhotovoltaicPanelPartsService { */ Boolean validPartsExistByPhotovoltaicPanel(Long projectId, Collection photovoltaicPanelNames); + + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/facility/service/impl/FacBoxTransformerServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/facility/service/impl/FacBoxTransformerServiceImpl.java index 2517ec3e..01d2fb5f 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/facility/service/impl/FacBoxTransformerServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/facility/service/impl/FacBoxTransformerServiceImpl.java @@ -384,6 +384,7 @@ public class FacBoxTransformerServiceImpl extends ServiceImpl> positionList = new ArrayList<>(); - List arr = JSONUtil.toList(positions, String.class); - for (String s : arr) { - positionList.add(JSONUtil.toList(s, String.class)); - } - matrixVo.setPositionList(positionList); - } return matrixVo; } @@ -486,6 +476,8 @@ public class FacMatrixServiceImpl extends ServiceImpl RELEVANCE_PHOTOVOLTAIC_PANEL_WORK_TYPE = List.of( + "12", + "13", + "14" + ); + /** * 逆变器进度类别名称 */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressPlanDetailController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressPlanDetailController.java index 842d7e00..1e117f20 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressPlanDetailController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressPlanDetailController.java @@ -4,6 +4,7 @@ import cn.dev33.satoken.annotation.SaCheckPermission; import jakarta.annotation.Resource; import jakarta.validation.constraints.NotNull; import org.dromara.common.core.domain.R; +import org.dromara.common.idempotent.annotation.RepeatSubmit; import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.web.core.BaseController; @@ -34,6 +35,7 @@ public class PgsProgressPlanDetailController extends BaseController { * 新增进度计划详情(普通设施) */ @SaCheckPermission("progress:progressPlanDetail:insert") + @RepeatSubmit() @PostMapping("/insert/detail") public R insertFinishedDetail(@Validated @RequestBody PgsProgressPlanDetailFinishedCreateReq req) { return toAjax(pgsProgressPlanDetailService.insertFinishedDetail(req)); @@ -43,6 +45,7 @@ public class PgsProgressPlanDetailController extends BaseController { * 新增进度计划详情(百分比设施) */ @SaCheckPermission("progress:progressPlanDetail:insert") + @RepeatSubmit() @PostMapping("/insert/percentage") public R insertPercentageDetail(@Validated @RequestBody PgsProgressPlanDetailPercentageCreateReq req) { return toAjax(pgsProgressPlanDetailService.insertPercentageDetail(req)); @@ -78,6 +81,7 @@ public class PgsProgressPlanDetailController extends BaseController { * 删除进度计划详情 */ @SaCheckPermission("progress:progressPlanDetail:remove") + @RepeatSubmit() @DeleteMapping("/remove/detail") public R removeDetail(@Validated PgsProgressPlanDetailRemoveReq req) { return toAjax(pgsProgressPlanDetailService.removeDetail(req)); diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/PgsProgressCategory.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/PgsProgressCategory.java index 71549ce5..6dd8b774 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/PgsProgressCategory.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/PgsProgressCategory.java @@ -86,6 +86,11 @@ public class PgsProgressCategory extends BaseEntity { */ private String workType; + /** + * 备注 + */ + private String remark; + /** * 删除时间 */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/PgsProgressCategoryTemplate.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/PgsProgressCategoryTemplate.java index a1a0b4f5..5a01f90c 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/PgsProgressCategoryTemplate.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/PgsProgressCategoryTemplate.java @@ -52,6 +52,11 @@ public class PgsProgressCategoryTemplate implements Serializable { */ private Long projectId; + /** + * 备注 + */ + private String remark; + /** * 创建时间 */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryCreateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryCreateReq.java index d7e56a35..c61b4d0b 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryCreateReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryCreateReq.java @@ -34,4 +34,9 @@ public class PgsProgressCategoryCreateReq { */ private String unitType; + /** + * 备注 + */ + private String remark; + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryUpdateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryUpdateReq.java index d5ac7d23..0de88105 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryUpdateReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryUpdateReq.java @@ -61,4 +61,9 @@ public class PgsProgressCategoryUpdateReq { */ private String status; + /** + * 备注 + */ + private String remark; + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategorytemplate/PgsProgressCategoryTemplateCreateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategorytemplate/PgsProgressCategoryTemplateCreateReq.java index b09dc8d2..1f92bac7 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategorytemplate/PgsProgressCategoryTemplateCreateReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategorytemplate/PgsProgressCategoryTemplateCreateReq.java @@ -35,4 +35,9 @@ public class PgsProgressCategoryTemplateCreateReq implements Serializable { */ private Long projectId; + /** + * 备注 + */ + private String remark; + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategorytemplate/PgsProgressCategoryTemplateUpdateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategorytemplate/PgsProgressCategoryTemplateUpdateReq.java index 37a03810..7d7ed1c5 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategorytemplate/PgsProgressCategoryTemplateUpdateReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategorytemplate/PgsProgressCategoryTemplateUpdateReq.java @@ -35,4 +35,9 @@ public class PgsProgressCategoryTemplateUpdateReq implements Serializable { */ private String unitType; + /** + * 备注 + */ + private String remark; + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progressplandetail/PgsProgressPlanDetailFinishedCreateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progressplandetail/PgsProgressPlanDetailFinishedCreateReq.java index bc4bfc39..a7ce1c4e 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progressplandetail/PgsProgressPlanDetailFinishedCreateReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progressplandetail/PgsProgressPlanDetailFinishedCreateReq.java @@ -21,11 +21,6 @@ public class PgsProgressPlanDetailFinishedCreateReq implements Serializable { */ private Long id; - /** - * 项目id - */ - private Long projectId; - /** * 完成详情id列表 */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/enums/PgsDelayStatusEnum.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/enums/PgsDelayStatusEnum.java new file mode 100644 index 00000000..df2b97b4 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/enums/PgsDelayStatusEnum.java @@ -0,0 +1,24 @@ +package org.dromara.progress.domain.enums; + +import lombok.Getter; + +/** + * @author lcj + * @date 2025/5/29 10:46 + */ +@Getter +public enum PgsDelayStatusEnum { + + UNDELAY("未延期", "0"), + DELAY("已延期", "1"); + + private final String text; + + private final String value; + + PgsDelayStatusEnum(String text, String value) { + this.text = text; + this.value = value; + } + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategory/PgsProgressCategoryLastTimeVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategory/PgsProgressCategoryLastTimeVo.java index 965428a5..2a78cb52 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategory/PgsProgressCategoryLastTimeVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategory/PgsProgressCategoryLastTimeVo.java @@ -1,5 +1,6 @@ package org.dromara.progress.domain.vo.progresscategory; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.io.Serial; @@ -20,8 +21,12 @@ public class PgsProgressCategoryLastTimeVo implements Serializable { /** * 计划结束时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") private Date endDate; + /** + * 剩余数量 + */ private BigDecimal leftNum; } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategory/PgsProgressCategoryVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategory/PgsProgressCategoryVo.java index 0f67262a..a258d060 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategory/PgsProgressCategoryVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategory/PgsProgressCategoryVo.java @@ -112,4 +112,10 @@ public class PgsProgressCategoryVo implements Serializable { @ExcelDictFormat(readConverterExp = "0=未开始,1=进行中,2=已完成") private String status; + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategorytemplate/PgsProgressCategoryTemplateVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategorytemplate/PgsProgressCategoryTemplateVo.java index d09cfb65..de0bc65a 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategorytemplate/PgsProgressCategoryTemplateVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategorytemplate/PgsProgressCategoryTemplateVo.java @@ -57,5 +57,10 @@ public class PgsProgressCategoryTemplateVo implements Serializable { @ExcelProperty(value = "项目id") private Long projectId; + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressCategoryService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressCategoryService.java index d31efb94..0e77e3c1 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressCategoryService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressCategoryService.java @@ -101,4 +101,5 @@ public interface IPgsProgressCategoryService extends IService matrixIds); + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressPlanService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressPlanService.java index c59ff503..af748b4c 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressPlanService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressPlanService.java @@ -94,4 +94,11 @@ public interface IPgsProgressPlanService extends IService { */ void validPlanNumber(Long planNumber, PgsProgressCategory progressCategory); + /** + * 校验计划是否延迟 + * + * @return 是否延迟 + */ + Boolean validProgressPlanIsDelay(); + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryServiceImpl.java index c2225810..81ac3e4b 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryServiceImpl.java @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import jakarta.annotation.Resource; import org.dromara.common.core.constant.HttpStatus; import org.dromara.common.core.exception.ServiceException; +import org.dromara.common.core.utils.DateUtils; import org.dromara.common.core.utils.ObjectUtils; import org.dromara.facility.domain.FacPercentageFacility; import org.dromara.facility.service.IFacPercentageFacilityService; @@ -33,6 +34,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; +import java.time.LocalDate; import java.util.*; import java.util.stream.Collectors; @@ -105,8 +107,12 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl ids, Boolean isValid) { + List categoryTemplateList = this.listByIds(ids); + if (isValid) { + categoryTemplateList.forEach(template->{ + Long projectId = template.getProjectId(); + if (projectId != null && projectId == 0) { + throw new ServiceException("通用模版,无法删除", HttpStatus.CONFLICT); + } + }); + } return this.removeBatchByIds(ids); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressPlanDetailServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressPlanDetailServiceImpl.java index 6728f19c..9a1483f2 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressPlanDetailServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressPlanDetailServiceImpl.java @@ -29,6 +29,7 @@ import org.dromara.progress.domain.PgsProgressPlanDetail; import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailFinishedCreateReq; import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailPercentageCreateReq; import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailRemoveReq; +import org.dromara.progress.domain.enums.PgsFinishStatusEnum; import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFinishedVo; import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailNumVo; import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailUnFinishVo; @@ -36,7 +37,6 @@ import org.dromara.progress.mapper.PgsProgressPlanDetailMapper; import org.dromara.progress.service.IPgsProgressCategoryService; import org.dromara.progress.service.IPgsProgressPlanDetailService; import org.dromara.progress.service.IPgsProgressPlanService; -import org.dromara.project.service.IBusProjectService; import org.dromara.utils.PageConvertUtil; import org.springframework.beans.BeanUtils; import org.springframework.context.annotation.Lazy; @@ -45,10 +45,9 @@ import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.time.LocalDate; -import java.util.Collections; -import java.util.Date; -import java.util.List; +import java.util.*; import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; /** * 进度计划详情Service业务层处理 @@ -76,9 +75,6 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl finishedDetailList = JSONUtil.toList(progressPlanDetail.getFinishedDetail(), PgsProgressPlanDetailFinishedVo.class); + Set idSet = new HashSet<>(finishedDetailIdList); + List matchedNames = finishedDetailList.stream() + .filter(detail -> idSet.contains(detail.getId())) + .map(PgsProgressPlanDetailFinishedVo::getName) + .toList(); + if (CollUtil.isNotEmpty(matchedNames)) { + throw new ServiceException("设施:" + String.join(",", matchedNames) + "已完成,请勿重复提交", HttpStatus.BAD_REQUEST); + } if (PgsProgressCategoryConstant.PHOTOVOLTAIC_PANEL_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) { - handleFacilityFinish( + List finishedVoList = handleFacilityFinish( projectId, progressCategoryId, finishedDetailIdList, @@ -125,11 +124,39 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl photovoltaicPanelList = photovoltaicPanelService.lambdaQuery() + .eq(FacPhotovoltaicPanel::getProjectId, projectId) + .eq(FacPhotovoltaicPanel::getMatrixId, progressCategory.getMatrixId()) + .in(FacPhotovoltaicPanel::getProgressCategoryId, PgsProgressCategoryConstant.RELEVANCE_PHOTOVOLTAIC_PANEL_WORK_TYPE) + .list(); + Map> map = photovoltaicPanelList + .stream().collect(Collectors.groupingBy(FacPhotovoltaicPanel::getProgressCategoryId)); + // 批量更新关联的光伏板信息 + boolean update = photovoltaicPanelService.lambdaUpdate() + .eq(FacPhotovoltaicPanel::getProjectId, projectId) + .in(FacPhotovoltaicPanel::getProgressCategoryId, PgsProgressCategoryConstant.RELEVANCE_PHOTOVOLTAIC_PANEL_WORK_TYPE) + .eq(FacPhotovoltaicPanel::getMatrixId, progressCategory.getMatrixId()) + .set(FacPhotovoltaicPanel::getStatus, FacFinishStatusEnum.FINISH.getValue()) + .set(FacPhotovoltaicPanel::getFinishType, FacFinishTypeEnum.HAND.getValue()) + .set(FacPhotovoltaicPanel::getFinishDate, progressPlanDetail.getDate()) + .update(); + if (!update) { + throw new ServiceException("更新设施信息异常", HttpStatus.ERROR); + } + // todo + for (Map.Entry> entry : map.entrySet()) { + Long key = entry.getKey(); + List value = entry.getValue(); + // 封装计划详情 + } + } } else if (PgsProgressCategoryConstant.INVERTER_PROGRESS_CATEGORY_WORK_TYPE.contains(workType)) { - handleFacilityFinish( + List finishedVoList = handleFacilityFinish( projectId, progressCategoryId, finishedDetailIdList, @@ -142,11 +169,11 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl finishedVoList = handleFacilityFinish( projectId, progressCategoryId, finishedDetailIdList, @@ -159,29 +186,31 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl progressPlan.getPlanNumber()) { @@ -228,16 +263,18 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl 0 && progressCategory.getTotal().compareTo(progressCategory.getCompleted()) == 0) { + progressCategory.setStatus(PgsFinishStatusEnum.INPROGRESS.getValue()); + } progressCategory.setCompleted(progressCategory.getCompleted().subtract(BigDecimal.valueOf(removeTotal))); boolean updateCategory = progressCategoryService.updateById(progressCategory); if (!updateCategory) { @@ -480,7 +517,25 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl(pageNum, pageSize, fullList.size()).setRecords(pageList); } - public void handleFacilityFinish( + /** + * 获取设施封装 + * + * @param projectId 项目ID + * @param progressCategoryId 进度类别ID + * @param finishedDetailIdList 设施完成ID列表 + * @param finishDate 设施完成时间 + * @param service 服务 + * @param getIdFunc 获取ID方法 + * @param getNameFunc 获取名称方法 + * @param getFinishTypeFunc 获取完成类型方法 + * @param getFinishDateFunc 获取完成时间方法 + * @param getProjectIdFunc 获取项目ID方法 + * @param getProgressCategoryIdFunc 获取进度类别ID方法 + * @param getIdColumnFunc 获取ID列方法 + * @param getStatusFunc 获取状态方法 + * @param 设施类型 + */ + public List handleFacilityFinish( Long projectId, Long progressCategoryId, List finishedDetailIdList, @@ -493,8 +548,7 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl getProjectIdFunc, SFunction getProgressCategoryIdFunc, SFunction getIdColumnFunc, - SFunction getStatusFunc, - List finishedDetailList + SFunction getStatusFunc ) { List entityList = service.lambdaQuery() .eq(getProjectIdFunc, projectId) @@ -515,14 +569,13 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl list = entityList.stream().map(entity -> { + return entityList.stream().map(entity -> { PgsProgressPlanDetailFinishedVo vo = new PgsProgressPlanDetailFinishedVo(); vo.setId(getIdFunc.apply(entity)); vo.setName(getNameFunc.apply(entity)); - vo.setFinishType(getFinishTypeFunc.apply(entity)); + vo.setFinishType(FacFinishTypeEnum.HAND.getValue()); return vo; }).toList(); - finishedDetailList.addAll(list); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressPlanServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressPlanServiceImpl.java index 18ec093b..475e4518 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressPlanServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressPlanServiceImpl.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import jakarta.annotation.Resource; +import lombok.extern.slf4j.Slf4j; import org.dromara.common.core.constant.HttpStatus; import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.utils.ObjectUtils; @@ -19,6 +20,7 @@ import org.dromara.progress.domain.PgsProgressPlanDetail; import org.dromara.progress.domain.dto.progressplan.PgsProgressPlanCreateReq; import org.dromara.progress.domain.dto.progressplan.PgsProgressPlanQueryReq; import org.dromara.progress.domain.dto.progressplandetail.PgsProgressPlanDetailCreateDto; +import org.dromara.progress.domain.enums.PgsDelayStatusEnum; import org.dromara.progress.domain.enums.PgsFinishStatusEnum; import org.dromara.progress.domain.vo.progressplan.PgsProgressPlanVo; import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailNumVo; @@ -32,6 +34,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; +import java.time.LocalDate; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -44,6 +47,7 @@ import java.util.stream.Collectors; * @author lcj * @date 2025-05-27 */ +@Slf4j @Service public class PgsProgressPlanServiceImpl extends ServiceImpl implements IPgsProgressPlanService { @@ -322,4 +326,55 @@ public class PgsProgressPlanServiceImpl extends ServiceImpl lqw = new LambdaQueryWrapper<>(); + lqw.lt(PgsProgressPlan::getEndDate, LocalDate.now()); + lqw.apply("finished_number < plan_number "); + lqw.eq(PgsProgressPlan::getDelayNumber, 0); + List delayPlanList = this.list(lqw); + if (CollUtil.isEmpty(delayPlanList)) { + log.info("无新增延期的施工进度"); + return true; + } + Map> delayPlanMap = delayPlanList + .stream().collect(Collectors.groupingBy(PgsProgressPlan::getProgressCategoryId)); + log.warn("延期的施工进度:{}", delayPlanList); + List progressPlanList = new ArrayList<>(); + List categoryIdList = new ArrayList<>(); + for (Map.Entry> entry : delayPlanMap.entrySet()) { + Long key = entry.getKey(); + categoryIdList.add(key); + List value = entry.getValue(); + // 遍历施工进度,更新延期数量 + List delayList = value.stream().map(progressPlan -> { + PgsProgressPlan newProgressPlan = new PgsProgressPlan(); + newProgressPlan.setId(progressPlan.getId()); + newProgressPlan.setDelayNumber(progressPlan.getPlanNumber() - progressPlan.getFinishedNumber()); + return newProgressPlan; + }).toList(); + progressPlanList.addAll(delayList); + } + // 批量更新 + boolean result = this.updateBatchById(progressPlanList); + if (!result) { + throw new ServiceException("更新施工进度失败", HttpStatus.ERROR); + } + boolean update = progressCategoryService.lambdaUpdate() + .in(PgsProgressCategory::getId, categoryIdList) + .set(PgsProgressCategory::getIsDelay, PgsDelayStatusEnum.DELAY.getValue()) + .update(); + if (!update) { + throw new ServiceException("更新进度类别异常", HttpStatus.ERROR); + } + return true; + } } diff --git a/xinnengyuan/script/sql/menuInitValue.sql b/xinnengyuan/script/sql/menuInitValue.sql index de6491dc..ffaf1747 100644 --- a/xinnengyuan/script/sql/menuInitValue.sql +++ b/xinnengyuan/script/sql/menuInitValue.sql @@ -477,3 +477,23 @@ values(1905067946597736454, '黑名单删除', 1905067946597736450, '4', '#', ' insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) values(1905067946597736455, '黑名单导出', 1905067946597736450, '5', '#', '', 1, 0, 'F', '0', '0', 'project:constructionBlacklist:export', '#', 103, 1, sysdate(), null, null, ''); + +-- 菜单 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1927984223038324738, '进度类别模版', '1913133014288699393', '1', 'progressCategoryTemplate', 'progress/progressCategoryTemplate/index', 1, 0, 'C', '0', '0', 'progress:progressCategoryTemplate:list', '#', 103, 1, sysdate(), null, null, '进度类别模版菜单'); + +-- 按钮 SQL +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1927984223038324739, '进度类别模版查询', 1927984223038324738, '1', '#', '', 1, 0, 'F', '0', '0', 'progress:progressCategoryTemplate:query', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1927984223038324740, '进度类别模版新增', 1927984223038324738, '2', '#', '', 1, 0, 'F', '0', '0', 'progress:progressCategoryTemplate:add', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1927984223038324741, '进度类别模版修改', 1927984223038324738, '3', '#', '', 1, 0, 'F', '0', '0', 'progress:progressCategoryTemplate:edit', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1927984223038324742, '进度类别模版删除', 1927984223038324738, '4', '#', '', 1, 0, 'F', '0', '0', 'progress:progressCategoryTemplate:remove', '#', 103, 1, sysdate(), null, null, ''); + +insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark) +values(1927984223038324743, '进度类别模版导出', 1927984223038324738, '5', '#', '', 1, 0, 'F', '0', '0', 'progress:progressCategoryTemplate:export', '#', 103, 1, sysdate(), null, null, '');