From f030b825aac447a9f32e97bf0fc3116076a15093 Mon Sep 17 00:00:00 2001 From: zt Date: Fri, 1 Aug 2025 19:06:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 2 + .../dromara/common/core/utils/DateUtils.java | 27 ++ .../OutConstructionValueController.java | 105 +++++ .../OutMonthPlanAuditController.java | 105 +++++ .../controller/OutMonthPlanController.java | 128 ++++++ .../out/controller/OutTableController.java | 230 +++++++++++ .../out/domain/OutConstructionValue.java | 91 +++++ .../org/dromara/out/domain/OutMonthPlan.java | 72 ++++ .../dromara/out/domain/OutMonthPlanAudit.java | 62 +++ .../out/domain/bo/OutConstructionValueBo.java | 94 +++++ .../out/domain/bo/OutMonthPlanAuditBo.java | 67 ++++ .../dromara/out/domain/bo/OutMonthPlanBo.java | 75 ++++ .../org/dromara/out/domain/bo/OutTableBo.java | 14 + .../out/domain/vo/OutConstructionValueVo.java | 161 ++++++++ .../out/domain/vo/OutMonthPlanAuditVo.java | 76 ++++ .../dromara/out/domain/vo/OutMonthPlanVo.java | 88 +++++ .../domain/vo/OutMonthlyConstructionVo.java | 99 +++++ .../mapper/OutConstructionValueMapper.java | 15 + .../out/mapper/OutMonthPlanAuditMapper.java | 15 + .../out/mapper/OutMonthPlanMapper.java | 15 + .../service/IOutConstructionValueService.java | 71 ++++ .../service/IOutMonthPlanAuditService.java | 78 ++++ .../out/service/IOutMonthPlanService.java | 84 ++++ .../impl/OutConstructionValueServiceImpl.java | 254 ++++++++++++ .../impl/OutMonthPlanAuditServiceImpl.java | 145 +++++++ .../service/impl/OutMonthPlanServiceImpl.java | 372 ++++++++++++++++++ .../service/IPgsProgressCategoryService.java | 6 + .../IPgsProgressPlanDetailService.java | 5 + .../impl/PgsProgressCategoryServiceImpl.java | 13 + .../PgsProgressPlanDetailServiceImpl.java | 19 +- .../mapper/out/OutConstructionValueMapper.xml | 7 + .../mapper/out/OutMonthPlanAuditMapper.xml | 7 + .../mapper/out/OutMonthPlanMapper.xml | 7 + 33 files changed, 2607 insertions(+), 2 deletions(-) create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutConstructionValueController.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutMonthPlanAuditController.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutMonthPlanController.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutTableController.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/OutConstructionValue.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/OutMonthPlan.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/OutMonthPlanAudit.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/bo/OutConstructionValueBo.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/bo/OutMonthPlanAuditBo.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/bo/OutMonthPlanBo.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/bo/OutTableBo.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/vo/OutConstructionValueVo.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/vo/OutMonthPlanAuditVo.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/vo/OutMonthPlanVo.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/vo/OutMonthlyConstructionVo.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/mapper/OutConstructionValueMapper.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/mapper/OutMonthPlanAuditMapper.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/mapper/OutMonthPlanMapper.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/IOutConstructionValueService.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/IOutMonthPlanAuditService.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/IOutMonthPlanService.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/impl/OutConstructionValueServiceImpl.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/impl/OutMonthPlanAuditServiceImpl.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/impl/OutMonthPlanServiceImpl.java create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/out/OutConstructionValueMapper.xml create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/out/OutMonthPlanAuditMapper.xml create mode 100644 xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/out/OutMonthPlanMapper.xml diff --git a/xinnengyuan/ruoyi-admin/src/main/resources/application.yml b/xinnengyuan/ruoyi-admin/src/main/resources/application.yml index a033f316..7494affb 100644 --- a/xinnengyuan/ruoyi-admin/src/main/resources/application.yml +++ b/xinnengyuan/ruoyi-admin/src/main/resources/application.yml @@ -255,6 +255,8 @@ springdoc: packages-to-scan: org.dromara.generator - group: 16.app模块 packages-to-scan: org.dromara.app + - group: 17.产值模块 + packages-to-scan: org.dromara.out # knife4j的增强配置,不需要增强可以不配 knife4j: enable: true diff --git a/xinnengyuan/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/DateUtils.java b/xinnengyuan/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/DateUtils.java index 250ed949..737ccd9d 100644 --- a/xinnengyuan/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/DateUtils.java +++ b/xinnengyuan/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/DateUtils.java @@ -148,6 +148,23 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { } } + /** + * 将指定格式的日期时间字符串转换为 LocalDate 对象 + * + * @param format 要解析的日期时间格式,例如"YYYY-MM-DD HH:MM:SS" + * @param ts 要解析的日期时间字符串 + * @return 解析后的 Date 对象 + * @throws RuntimeException 如果解析过程中发生异常 + */ + public static LocalDate parseLocalDateTime(final FormatsType format, final String ts) { + try { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format.getTimeFormat()); + return LocalDate.parse(ts, formatter); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + /** * 将对象转换为日期对象 * @@ -254,6 +271,16 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils { return Date.from(zdt.toInstant()); } + /** + * 将 Date 对象转换为 LocalDate 对象 + * + * @param temporalAccessor 要转换的 Date 对象 + * @return 转换后的 LocalDate 对象 + */ + public static LocalDate toLocalDate(Date temporalAccessor) { + return temporalAccessor.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + } + /** * 校验日期范围 * diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutConstructionValueController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutConstructionValueController.java new file mode 100644 index 00000000..906651b6 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutConstructionValueController.java @@ -0,0 +1,105 @@ +package org.dromara.out.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.out.domain.vo.OutConstructionValueVo; +import org.dromara.out.domain.bo.OutConstructionValueBo; +import org.dromara.out.service.IOutConstructionValueService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 施工产值 + * + * @author Lion Li + * @date 2025-07-30 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/out/constructionValue") +public class OutConstructionValueController extends BaseController { + + private final IOutConstructionValueService outConstructionValueService; + + /** + * 查询施工产值列表 + */ + @SaCheckPermission("out:constructionValue:list") + @GetMapping("/list") + public TableDataInfo list(OutConstructionValueBo bo, PageQuery pageQuery) { + return outConstructionValueService.queryPageList(bo, pageQuery); + } + + /** + * 导出施工产值列表 + */ + @SaCheckPermission("out:constructionValue:export") + @Log(title = "施工产值", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(OutConstructionValueBo bo, HttpServletResponse response) { + List list = outConstructionValueService.queryList(bo); + ExcelUtil.exportExcel(list, "施工产值", OutConstructionValueVo.class, response); + } + + /** + * 获取施工产值详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("out:constructionValue:query") + @GetMapping("/{id}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long id) { + return R.ok(outConstructionValueService.queryById(id)); + } + + /** + * 新增施工产值 + */ + @SaCheckPermission("out:constructionValue:add") + @Log(title = "施工产值", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody OutConstructionValueBo bo) { + return toAjax(outConstructionValueService.insertByBo(bo)); + } + + /** + * 修改施工产值 + */ + @SaCheckPermission("out:constructionValue:edit") + @Log(title = "施工产值", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody OutConstructionValueBo bo) { + return toAjax(outConstructionValueService.updateByBo(bo)); + } + + /** + * 删除施工产值 + * + * @param ids 主键串 + */ + @SaCheckPermission("out:constructionValue:remove") + @Log(title = "施工产值", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] ids) { + return toAjax(outConstructionValueService.deleteWithValidByIds(List.of(ids), true)); + } +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutMonthPlanAuditController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutMonthPlanAuditController.java new file mode 100644 index 00000000..82770fc7 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutMonthPlanAuditController.java @@ -0,0 +1,105 @@ +package org.dromara.out.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.out.domain.vo.OutMonthPlanAuditVo; +import org.dromara.out.domain.bo.OutMonthPlanAuditBo; +import org.dromara.out.service.IOutMonthPlanAuditService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 审核通过月度产值计划 + * + * @author Lion Li + * @date 2025-07-31 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/out/monthPlanAudit") +public class OutMonthPlanAuditController extends BaseController { + + private final IOutMonthPlanAuditService outMonthPlanAuditService; + + /** + * 查询审核通过月度产值计划列表 + */ + @SaCheckPermission("out:monthPlanAudit:list") + @GetMapping("/list") + public TableDataInfo list(OutMonthPlanAuditBo bo, PageQuery pageQuery) { + return outMonthPlanAuditService.queryPageList(bo, pageQuery); + } + + /** + * 导出审核通过月度产值计划列表 + */ + @SaCheckPermission("out:monthPlanAudit:export") + @Log(title = "审核通过月度产值计划", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(OutMonthPlanAuditBo bo, HttpServletResponse response) { + List list = outMonthPlanAuditService.queryList(bo); + ExcelUtil.exportExcel(list, "审核通过月度产值计划", OutMonthPlanAuditVo.class, response); + } + + /** + * 获取审核通过月度产值计划详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("out:monthPlanAudit:query") + @GetMapping("/{id}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long id) { + return R.ok(outMonthPlanAuditService.queryById(id)); + } + + /** + * 新增审核通过月度产值计划 + */ + @SaCheckPermission("out:monthPlanAudit:add") + @Log(title = "审核通过月度产值计划", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody OutMonthPlanAuditBo bo) { + return toAjax(outMonthPlanAuditService.insertByBo(bo)); + } + + /** + * 修改审核通过月度产值计划 + */ + @SaCheckPermission("out:monthPlanAudit:edit") + @Log(title = "审核通过月度产值计划", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody OutMonthPlanAuditBo bo) { + return toAjax(outMonthPlanAuditService.updateByBo(bo)); + } + + /** + * 删除审核通过月度产值计划 + * + * @param ids 主键串 + */ + @SaCheckPermission("out:monthPlanAudit:remove") + @Log(title = "审核通过月度产值计划", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] ids) { + return toAjax(outMonthPlanAuditService.deleteWithValidByIds(List.of(ids), true)); + } +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutMonthPlanController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutMonthPlanController.java new file mode 100644 index 00000000..243cadcc --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutMonthPlanController.java @@ -0,0 +1,128 @@ +package org.dromara.out.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.out.domain.vo.OutMonthPlanVo; +import org.dromara.out.domain.bo.OutMonthPlanBo; +import org.dromara.out.service.IOutMonthPlanService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 月度产值计划 + * + * @author Lion Li + * @date 2025-07-31 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/out/monthPlan") +public class OutMonthPlanController extends BaseController { + + private final IOutMonthPlanService outMonthPlanService; + + /** + * 查询月度产值计划列表 + */ + @SaCheckPermission("out:monthPlan:list") + @GetMapping("/list") + public TableDataInfo list(OutMonthPlanBo bo, PageQuery pageQuery) { + return outMonthPlanService.queryPageList(bo, pageQuery); + } + + /** + * 导出月度产值计划列表 + */ + @SaCheckPermission("out:monthPlan:export") + @Log(title = "月度产值计划", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(OutMonthPlanBo bo, HttpServletResponse response) { + List list = outMonthPlanService.queryList(bo); + ExcelUtil.exportExcel(list, "月度产值计划", OutMonthPlanVo.class, response); + } + + /** + * 获取月度产值计划详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("out:monthPlan:query") + @GetMapping("/{id}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long id) { + return R.ok(outMonthPlanService.queryById(id)); + } + + /** + * 根据项目id和月份和类型获取月度产值计划详细信息 + */ + @SaCheckPermission("out:monthPlan:query") + @GetMapping("/info") + public R getInfoByBo(OutMonthPlanBo bo) { + return R.ok(outMonthPlanService.getInfoByBo(bo)); + } + + /** + * 新增月度产值计划 + */ + @SaCheckPermission("out:monthPlan:add") + @Log(title = "月度产值计划", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody OutMonthPlanBo bo) { + return toAjax(outMonthPlanService.insertByBo(bo)); + } + + /** + * 修改月度产值计划 + */ + @SaCheckPermission("out:monthPlan:edit") + @Log(title = "月度产值计划", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody OutMonthPlanBo bo) { + return toAjax(outMonthPlanService.updateByBo(bo)); + } + + /** + * 删除月度产值计划 + * + * @param ids 主键串 + */ + @SaCheckPermission("out:monthPlan:remove") + @Log(title = "月度产值计划", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] ids) { + return toAjax(outMonthPlanService.deleteWithValidByIds(List.of(ids), true)); + } + + + /** + * 判断月度产值计划是否可以提交 + * + * @param id 主键 + */ + @SaCheckPermission("out:monthPlan:query") + @GetMapping("/isSubmit/{id}") + public R isSubmit(@NotNull(message = "主键不能为空") + @PathVariable Long id) { + return R.ok(outMonthPlanService.isSubmit(id)); + } + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutTableController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutTableController.java new file mode 100644 index 00000000..b76d6ac7 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/controller/OutTableController.java @@ -0,0 +1,230 @@ +package org.dromara.out.controller; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import cn.hutool.http.HttpStatus; +import lombok.RequiredArgsConstructor; +import org.dromara.common.core.enums.BusinessStatusEnum; +import org.dromara.common.core.enums.FormatsType; +import org.dromara.common.core.utils.DateUtils; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.utils.BigDecimalUtil; +import org.dromara.common.web.core.BaseController; +import org.dromara.out.domain.OutConstructionValue; +import org.dromara.out.domain.OutMonthPlanAudit; +import org.dromara.out.domain.bo.OutTableBo; +import org.dromara.out.domain.vo.OutMonthlyConstructionVo; +import org.dromara.out.service.IOutConstructionValueService; +import org.dromara.out.service.IOutMonthPlanAuditService; +import org.dromara.progress.domain.PgsProgressCategory; +import org.dromara.progress.domain.PgsProgressPlanDetail; +import org.dromara.progress.service.IPgsProgressCategoryService; +import org.dromara.progress.service.IPgsProgressPlanDetailService; +import org.dromara.project.domain.BusProject; +import org.dromara.project.domain.dto.project.BusProjectQueryReq; +import org.dromara.project.domain.vo.project.BusProjectVo; +import org.dromara.project.service.IBusProjectService; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.YearMonth; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAdjusters; +import java.util.ArrayList; +import java.util.List; + +/** + * 月度产值计划 + * + * @author Lion Li + * @date 2025-07-30 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/out/table") +public class OutTableController extends BaseController { + + private final IOutConstructionValueService constructionValueService; + + private final IBusProjectService projectService; + + private final IPgsProgressPlanDetailService progressPlanDetailService; + + private final IPgsProgressCategoryService progressCategoryService; + + private final IOutMonthPlanAuditService outMonthPlanAuditService; + + + /** + * 查询公司项目月度施工产值表 + */ + @SaCheckPermission("out:table:list") + @GetMapping("/monthlyConstruct") + public TableDataInfo list(OutTableBo bo, PageQuery pageQuery) { + + //分页查询所有父项目 + BusProjectQueryReq busProjectQueryReq = new BusProjectQueryReq(); + busProjectQueryReq.setPId(0L); + TableDataInfo busProjectVoTableDataInfo = projectService.queryPageList(busProjectQueryReq, pageQuery); + List rows = busProjectVoTableDataInfo.getRows(); + List projectIds = rows.stream().map(BusProjectVo::getId).toList(); + + //查询每个进度(分项工程)的单价和总量 + List pgsProgressCategories = progressCategoryService.queryListByProjectIds(projectIds); + //转为map +// Map pgsProgressCategoryMap = pgsProgressCategories.stream() +// .collect(Collectors.toMap(PgsProgressCategory::getId, category -> category)); + + //查询项目的施工计划产值 + List outMonthPlanAudits = outMonthPlanAuditService.queryListByProjectIds(projectIds); + + + //计算日期 + LocalDate parsedDate = DateUtils.parseLocalDateTime(FormatsType.YYYY_MM, bo.getMonth()); + // 当前月的第一天 + LocalDate firstDay = parsedDate.with(TemporalAdjusters.firstDayOfMonth()); + // 当前月的最后一天 + LocalDate lastDay = parsedDate.with(TemporalAdjusters.lastDayOfMonth()); + // 方法1: 使用 YearMonth 进行比较(推荐) + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); + + YearMonth month = YearMonth.parse(bo.getMonth(), formatter); + + //构建返回数据 + List outMonthlyConstructionVos = new ArrayList<>(); + BigDecimal parseUnit = new BigDecimal("10000"); + + for (BusProjectVo busProjectVo : rows){ + OutMonthlyConstructionVo vo = new OutMonthlyConstructionVo(); + vo.setProjectName(busProjectVo.getProjectName()); + + //1.总产值的计算 2.预计累计产值(截止当前月) 3.月预计产值 + List subProjects = projectService.lambdaQuery().eq(BusProject::getPId, busProjectVo.getId()).list(); + List subProjectIds = subProjects.stream().map(BusProject::getId).toList(); + + //所有分项工程 + List collect = pgsProgressCategories.stream() + .filter(category -> subProjectIds.contains(category.getProjectId())).toList(); + + BigDecimal totalValue = BigDecimal.ZERO; + BigDecimal estimatedTotalValue = BigDecimal.ZERO; + BigDecimal monthlyEstimatedValue = BigDecimal.ZERO; + for (PgsProgressCategory category : collect) { + + List planAudits = outMonthPlanAudits.stream().filter(plan -> plan.getProjectId().equals(category.getProjectId())).toList(); + + for (OutMonthPlanAudit planAudit : planAudits) { + YearMonth planMonth = YearMonth.parse(planAudit.getPlanMonth(), formatter); + // 比较大小 + if (planMonth.isBefore(month)) { + estimatedTotalValue=estimatedTotalValue.add(planAudit.getConstructionValue()); + } else if (month.isAfter(planMonth)) { + + } else { + estimatedTotalValue = estimatedTotalValue.add(planAudit.getConstructionValue()); + monthlyEstimatedValue = planAudit.getConstructionValue(); + } + } + + //计算价格 + if ("1".equals(category.getUnitType())) { + // 数量类型: total * unitPrice + BigDecimal total = category.getTotal() != null ? category.getTotal() : BigDecimal.ZERO; + BigDecimal unitPrice = category.getUnitPrice() != null ? category.getUnitPrice() : BigDecimal.ZERO; + totalValue = totalValue.add(total.multiply(unitPrice)); + + } else if ("2".equals(category.getUnitType())) { + // 百分比类型: 直接使用 unitPrice + totalValue = totalValue.add(category.getUnitPrice() != null ? category.getUnitPrice() : BigDecimal.ZERO); + } + } + //转化单位为万元 + vo.setTotalValue(totalValue.divide(parseUnit)); + vo.setEstimatedAccumulatedValue(estimatedTotalValue.divide(parseUnit)); + vo.setMonthlyEstimatedValue(monthlyEstimatedValue.divide(parseUnit)); + + //查询项目的审核通过的施工详细表 1.累计完成产值 2.完成产值月合计 3.各周完成产值 + List outConstructionValues = constructionValueService.lambdaQuery() + .eq(OutConstructionValue::getProjectId, busProjectVo.getId()) + .eq(OutConstructionValue::getAuditStatus, BusinessStatusEnum.FINISH.getStatus()) + .list(); + + BigDecimal accumulatedCompletionValue = BigDecimal.ZERO; + + BigDecimal firstWeekCompletionValue = BigDecimal.ZERO; + + BigDecimal secondWeekCompletionValue = BigDecimal.ZERO; + + BigDecimal thirdWeekCompletionValue = BigDecimal.ZERO; + + BigDecimal fourthWeekCompletionValue = BigDecimal.ZERO; + + BigDecimal fifthWeekCompletionValue = BigDecimal.ZERO; + + BigDecimal totalCompletionValue = BigDecimal.ZERO; + + + for (OutConstructionValue outConstructionValue : outConstructionValues) { + LocalDate localDate = outConstructionValue.getReportDate(); + BigDecimal outValue = outConstructionValue.getOutValue(); + + totalCompletionValue = totalCompletionValue.add(outValue); + + if (!localDate.isAfter(lastDay) && !localDate.isBefore(firstDay)) { + accumulatedCompletionValue = accumulatedCompletionValue.add(outValue); + + // 计算周数并累加到对应周的产值 + int dayOfMonth = localDate.getDayOfMonth(); + int weekOfMonth = (dayOfMonth - 1) / 7 + 1; + + switch (weekOfMonth) { + case 1: + firstWeekCompletionValue = firstWeekCompletionValue.add(outValue); + break; + case 2: + secondWeekCompletionValue = secondWeekCompletionValue.add(outValue); + break; + case 3: + thirdWeekCompletionValue = thirdWeekCompletionValue.add(outValue); + break; + case 4: + fourthWeekCompletionValue = fourthWeekCompletionValue.add(outValue); + break; + case 5: + fifthWeekCompletionValue = fifthWeekCompletionValue.add(outValue); + break; + } + } + + vo.setAccumulatedCompletionValue(accumulatedCompletionValue.divide(parseUnit)); + vo.setTotalCompletionValue(totalCompletionValue.divide(parseUnit)); + vo.setFirstWeekCompletionValue(firstWeekCompletionValue.divide(parseUnit)); + vo.setSecondWeekCompletionValue(secondWeekCompletionValue.divide(parseUnit)); + vo.setThirdWeekCompletionValue(thirdWeekCompletionValue.divide(parseUnit)); + vo.setFourthWeekCompletionValue(fourthWeekCompletionValue.divide(parseUnit)); + vo.setFifthWeekCompletionValue(fifthWeekCompletionValue.divide(parseUnit)); + + vo.setValueDifference(vo.getTotalCompletionValue().subtract(vo.getMonthlyEstimatedValue())); + vo.setValueDifferenceAccumulation(vo.getAccumulatedCompletionValue().subtract(vo.getEstimatedAccumulatedValue())); + + vo.setTotalCompletionProgress(BigDecimalUtil.toPercentage(accumulatedCompletionValue, totalValue)); + + outMonthlyConstructionVos.add(vo); + } + } + + TableDataInfo rspData = new TableDataInfo<>(); + rspData.setCode(HttpStatus.HTTP_OK); + rspData.setMsg("查询成功"); + rspData.setRows(outMonthlyConstructionVos); + rspData.setTotal(busProjectVoTableDataInfo.getTotal()); + + return rspData; + } + + + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/OutConstructionValue.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/OutConstructionValue.java new file mode 100644 index 00000000..cd1b8d48 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/OutConstructionValue.java @@ -0,0 +1,91 @@ +package org.dromara.out.domain; + +import org.dromara.common.mybatis.core.domain.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.io.Serial; + +/** + * 施工产值对象 out_construction_value + * + * @author Lion Li + * @date 2025-07-30 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("out_construction_value") +public class OutConstructionValue extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @TableId(value = "id") + private Long id; + + /** + * 项目ID + */ + private Long projectId; + + /** + * 方阵id + */ + private Long matrixId; + + /** + * 分项工程id + */ + private Long progressCategoryId; + + /** + * 人工填报数量 + */ + private Integer artificialNum; + + /** + * 无人机识别数量 + */ + private Integer uavNum; + + /** + * 确认数量 + */ + private Integer confirmNum; + + /** + * 计划数量 + */ + private Integer planNum; + + /** + * 产值 + */ + private BigDecimal outValue; + + /** + * 上报日期 + */ + private LocalDate reportDate; + + /** + * 计划日期 + */ + private LocalDate planDate; + + /** + * 审核状态 + */ + private String auditStatus; + + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/OutMonthPlan.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/OutMonthPlan.java new file mode 100644 index 00000000..139479d6 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/OutMonthPlan.java @@ -0,0 +1,72 @@ +package org.dromara.out.domain; + +import org.dromara.common.mybatis.core.domain.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.math.BigDecimal; + +import java.io.Serial; + +/** + * 月度产值计划对象 out_month_plan + * + * @author Lion Li + * @date 2025-07-31 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("out_month_plan") +public class OutMonthPlan extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @TableId(value = "id") + private Long id; + + /** + * 项目ID + */ + private Long projectId; + + /** + * 计划产值 + */ + private BigDecimal planValue; + + /** + * 完成产值 + */ + private BigDecimal completeValue; + + /** + * 差额 + */ + private BigDecimal differenceValue; + + /** + * 计划月份(YYYY-MM) + */ + private String planMonth; + + /** + * 1-设计 2-采购 3-施工 + */ + private String valueType; + + /** + * 计划审核状态 + */ + private String planAuditStatus; + + /** + * 完成审核状态 + */ + private String completeAuditStatus; + + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/OutMonthPlanAudit.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/OutMonthPlanAudit.java new file mode 100644 index 00000000..db0bb484 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/OutMonthPlanAudit.java @@ -0,0 +1,62 @@ +package org.dromara.out.domain; + +import org.dromara.common.mybatis.core.domain.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.math.BigDecimal; + +import java.io.Serial; + +/** + * 审核通过月度产值计划对象 out_month_plan_audit + * + * @author Lion Li + * @date 2025-07-31 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("out_month_plan_audit") +public class OutMonthPlanAudit extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @TableId(value = "id") + private Long id; + + /** + * 项目ID + */ + private Long projectId; + + /** + * 设计产值 + */ + private BigDecimal designValue; + + /** + * 采购产值 + */ + private BigDecimal purchaseValue; + + /** + * 施工产值 + */ + private BigDecimal constructionValue; + + /** + * 总产值 + */ + private BigDecimal totalValue; + + /** + * 计划月份(YYYY-MM) + */ + private String planMonth; + + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/bo/OutConstructionValueBo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/bo/OutConstructionValueBo.java new file mode 100644 index 00000000..8482e2a5 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/bo/OutConstructionValueBo.java @@ -0,0 +1,94 @@ +package org.dromara.out.domain.bo; + +import org.dromara.out.domain.OutConstructionValue; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; + +import java.math.BigDecimal; +import java.time.LocalDate; + +/** + * 施工产值业务对象 out_construction_value + * + * @author Lion Li + * @date 2025-07-31 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = OutConstructionValue.class, reverseConvertGenerate = false) +public class OutConstructionValueBo extends BaseEntity { + + /** + * 主键ID + */ + @NotNull(message = "主键ID不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 项目ID + */ + @NotNull(message = "项目ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long projectId; + + /** + * 方阵id + */ + @NotNull(message = "方阵id不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long matrixId; + + /** + * 分项工程id + */ + private Long progressCategoryId; + + /** + * 人工填报数量 + */ + @NotNull(message = "人工填报数量不能为空", groups = { AddGroup.class, EditGroup.class }) + private Integer artificialNum; + + /** + * 无人机识别数量 + */ + @NotNull(message = "无人机识别数量不能为空", groups = { AddGroup.class, EditGroup.class }) + private Integer uavNum; + + /** + * 计划数量 + */ + private Integer planNum; + + /** + * 确认数量 + */ + @NotNull(message = "确认数量不能为空", groups = { AddGroup.class, EditGroup.class }) + private Integer confirmNum; + + /** + * 产值 + */ + private BigDecimal outValue; + + /** + * 计划日期 + */ + private LocalDate planDate; + + /** + * 上报日期 + */ + @NotNull(message = "上报日期不能为空", groups = { AddGroup.class, EditGroup.class }) + private LocalDate reportDate; + + /** + * 审核状态 + */ + private String auditStatus; + + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/bo/OutMonthPlanAuditBo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/bo/OutMonthPlanAuditBo.java new file mode 100644 index 00000000..1ade5db0 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/bo/OutMonthPlanAuditBo.java @@ -0,0 +1,67 @@ +package org.dromara.out.domain.bo; + +import org.dromara.out.domain.OutMonthPlanAudit; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; +import java.math.BigDecimal; + +/** + * 审核通过月度产值计划业务对象 out_month_plan_audit + * + * @author Lion Li + * @date 2025-07-31 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = OutMonthPlanAudit.class, reverseConvertGenerate = false) +public class OutMonthPlanAuditBo extends BaseEntity { + + /** + * 主键ID + */ + @NotNull(message = "主键ID不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 项目ID + */ + @NotNull(message = "项目ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long projectId; + + /** + * 设计产值 + */ + @NotNull(message = "设计产值不能为空", groups = { AddGroup.class, EditGroup.class }) + private BigDecimal designValue; + + /** + * 采购产值 + */ + @NotNull(message = "采购产值不能为空", groups = { AddGroup.class, EditGroup.class }) + private BigDecimal purchaseValue; + + /** + * 施工产值 + */ + @NotNull(message = "施工产值不能为空", groups = { AddGroup.class, EditGroup.class }) + private BigDecimal constructionValue; + + /** + * 总产值 + */ + @NotNull(message = "总产值不能为空", groups = { AddGroup.class, EditGroup.class }) + private BigDecimal totalValue; + + /** + * 计划月份(YYYY-MM) + */ + @NotBlank(message = "计划月份(YYYY-MM)不能为空", groups = { AddGroup.class, EditGroup.class }) + private String planMonth; + + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/bo/OutMonthPlanBo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/bo/OutMonthPlanBo.java new file mode 100644 index 00000000..c37c744a --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/bo/OutMonthPlanBo.java @@ -0,0 +1,75 @@ +package org.dromara.out.domain.bo; + +import org.dromara.out.domain.OutMonthPlan; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; +import java.math.BigDecimal; + +/** + * 月度产值计划业务对象 out_month_plan + * + * @author Lion Li + * @date 2025-07-31 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = OutMonthPlan.class, reverseConvertGenerate = false) +public class OutMonthPlanBo extends BaseEntity { + + /** + * 主键ID + */ + @NotNull(message = "主键ID不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 项目ID + */ + @NotNull(message = "项目ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long projectId; + + /** + * 计划产值 + */ + @NotNull(message = "计划产值不能为空", groups = { AddGroup.class, EditGroup.class }) + private BigDecimal planValue; + + /** + * 完成产值 + */ + private BigDecimal completeValue; + + /** + * 差额 + */ + private BigDecimal differenceValue; + + /** + * 计划月份(YYYY-MM) + */ + @NotBlank(message = "计划月份(YYYY-MM)不能为空", groups = { AddGroup.class, EditGroup.class }) + private String planMonth; + + /** + * 1-设计 2-采购 3-施工 + */ + @NotBlank(message = "1-设计 2-采购 3-施工不能为空", groups = { AddGroup.class, EditGroup.class }) + private String valueType; + + /** + * 计划审核状态 + */ + private String planAuditStatus; + + /** + * 完成审核状态 + */ + private String completeAuditStatus; + + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/bo/OutTableBo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/bo/OutTableBo.java new file mode 100644 index 00000000..b7dba6c0 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/bo/OutTableBo.java @@ -0,0 +1,14 @@ +package org.dromara.out.domain.bo; + +import jakarta.validation.constraints.NotBlank; +import lombok.Data; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; + +@Data +public class OutTableBo { + + @NotBlank(message = "月份(YYYY-MM)不能为空") + private String month; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/vo/OutConstructionValueVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/vo/OutConstructionValueVo.java new file mode 100644 index 00000000..af986ea0 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/vo/OutConstructionValueVo.java @@ -0,0 +1,161 @@ +package org.dromara.out.domain.vo; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.dromara.common.translation.annotation.Translation; +import org.dromara.common.translation.constant.TransConstant; +import org.dromara.out.domain.OutConstructionValue; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 施工产值视图对象 out_construction_value + * + * @author Lion Li + * @date 2025-07-30 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = OutConstructionValue.class) +public class OutConstructionValueVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @ExcelProperty(value = "主键ID") + private Long id; + + /** + * 项目ID + */ + @ExcelProperty(value = "项目ID") + private Long projectId; + + /** + * 项目名 + */ + @ExcelProperty(value = "项目名") + private String projectName; + + /** + * 子项目ID + */ + @ExcelProperty(value = "子项目ID") + private Long subProjectId; + + /** + * 子项目名 + */ + @ExcelProperty(value = "子项目名") + private String subProjectName; + + /** + * 方阵id + */ + @ExcelProperty(value = "方阵id") + private Long matrixId; + + /** + * 方阵名称 + */ + @ExcelProperty(value = "方阵名称") + private String matrixName; + + /** + * 分部工程id + */ + @ExcelProperty(value = "分部工程id") + private Long categoryId; + + /** + * 分部工程名称 + */ + @ExcelProperty(value = "分部工程名称") + private String categoryName; + + /** + * 分项工程id + */ + @ExcelProperty(value = "分项工程id") + private Long progressCategoryId; + + /** + * 分项工程名称 + */ + @ExcelProperty(value = "分项工程名称") + private String progressCategoryName; + + /** + * 人工填报数量 + */ + @ExcelProperty(value = "人工填报数量") + private Integer artificialNum; + + /** + * 无人机识别数量 + */ + @ExcelProperty(value = "无人机识别数量") + private Integer uavNum; + + /** + * 确认数量 + */ + @ExcelProperty(value = "确认数量") + private Integer confirmNum; + + /** + * 计划数量 + */ + private Integer planNum; + + /** + * 产值 + */ + @ExcelProperty(value = "产值") + private BigDecimal outValue; + + /** + * 上报日期 + */ + @ExcelProperty(value = "上报日期") + private LocalDate reportDate; + + /** + * 计划日期 + */ + private LocalDate planDate; + + /** + * 审核状态 + */ + @ExcelProperty(value = "审核状态") + private String auditStatus; + + /** + * 上报人Id + */ + private Long createBy; + + /** + * 上报人 + */ + @ExcelProperty(value = "审核状态") + @Translation(type = TransConstant.USER_ID_TO_NAME, mapper = "createBy") + private String createByName; + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/vo/OutMonthPlanAuditVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/vo/OutMonthPlanAuditVo.java new file mode 100644 index 00000000..a1d1b910 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/vo/OutMonthPlanAuditVo.java @@ -0,0 +1,76 @@ +package org.dromara.out.domain.vo; + +import java.math.BigDecimal; +import org.dromara.out.domain.OutMonthPlanAudit; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 审核通过月度产值计划视图对象 out_month_plan_audit + * + * @author Lion Li + * @date 2025-07-31 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = OutMonthPlanAudit.class) +public class OutMonthPlanAuditVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @ExcelProperty(value = "主键ID") + private Long id; + + /** + * 项目ID + */ + @ExcelProperty(value = "项目ID") + private Long projectId; + + /** + * 设计产值 + */ + @ExcelProperty(value = "设计产值") + private BigDecimal designValue; + + /** + * 采购产值 + */ + @ExcelProperty(value = "采购产值") + private BigDecimal purchaseValue; + + /** + * 施工产值 + */ + @ExcelProperty(value = "施工产值") + private BigDecimal constructionValue; + + /** + * 总产值 + */ + @ExcelProperty(value = "总产值") + private BigDecimal totalValue; + + /** + * 计划月份(YYYY-MM) + */ + @ExcelProperty(value = "计划月份", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "Y=YYY-MM") + private String planMonth; + + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/vo/OutMonthPlanVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/vo/OutMonthPlanVo.java new file mode 100644 index 00000000..05d75ee6 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/vo/OutMonthPlanVo.java @@ -0,0 +1,88 @@ +package org.dromara.out.domain.vo; + +import java.math.BigDecimal; +import org.dromara.out.domain.OutMonthPlan; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 月度产值计划视图对象 out_month_plan + * + * @author Lion Li + * @date 2025-07-31 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = OutMonthPlan.class) +public class OutMonthPlanVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @ExcelProperty(value = "主键ID") + private Long id; + + /** + * 项目ID + */ + @ExcelProperty(value = "项目ID") + private Long projectId; + + /** + * 计划产值 + */ + @ExcelProperty(value = "计划产值") + private BigDecimal planValue; + + /** + * 完成产值 + */ + @ExcelProperty(value = "完成产值") + private BigDecimal completeValue; + + /** + * 差额 + */ + @ExcelProperty(value = "差额") + private BigDecimal differenceValue; + + /** + * 计划月份(YYYY-MM) + */ + @ExcelProperty(value = "计划月份", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "Y=YYY-MM") + private String planMonth; + + /** + * 1-设计 2-采购 3-施工 + */ + @ExcelProperty(value = "1-设计 2-采购 3-施工") + private String valueType; + + /** + * 计划审核状态 + */ + @ExcelProperty(value = "计划审核状态") + private String planAuditStatus; + + /** + * 完成审核状态 + */ + @ExcelProperty(value = "完成审核状态") + private String completeAuditStatus; + + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/vo/OutMonthlyConstructionVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/vo/OutMonthlyConstructionVo.java new file mode 100644 index 00000000..be1597fc --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/domain/vo/OutMonthlyConstructionVo.java @@ -0,0 +1,99 @@ +package org.dromara.out.domain.vo; + + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +@Data +@ExcelIgnoreUnannotated +public class OutMonthlyConstructionVo { + + /** + * 项目名称 + */ + @ExcelProperty(value = "项目名称") + private String projectName; + + /** + * 总产值(万元) + */ + @ExcelProperty(value = "总产值(万元)") + private BigDecimal totalValue; + + /** + * 月预计产值(万元) + */ + @ExcelProperty(value = "月预计产值(万元)") + private BigDecimal monthlyEstimatedValue; + + /** + * 第一周完成产值(万元) + */ + @ExcelProperty(value = "第一周完成产值(万元)") + private BigDecimal firstWeekCompletionValue; + + /** + * 第二周完成产值(万元) + */ + @ExcelProperty(value = "第二周完成产值(万元)") + private BigDecimal secondWeekCompletionValue; + + /** + * 第三周完成产值(万元) + */ + @ExcelProperty(value = "第三周完成产值(万元)") + private BigDecimal thirdWeekCompletionValue; + + /** + * 第四周完成产值(万元) + */ + @ExcelProperty(value = "第四周完成产值(万元)") + private BigDecimal fourthWeekCompletionValue; + + /** + * 第五周完成产值(万元) + */ + @ExcelProperty(value = "第五周完成产值(万元)") + private BigDecimal fifthWeekCompletionValue; + + /** + * 完成产值月合计(万元) + */ + @ExcelProperty(value = "完成产值月合计(万元)") + private BigDecimal totalCompletionValue; + + /** + * 产值差额(万元) + */ + @ExcelProperty(value = "产值差额(万元)") + private BigDecimal valueDifference; + + /** + * 预计累计产值(万元) + */ + @ExcelProperty(value = "预计累计产值(万元)") + private BigDecimal estimatedAccumulatedValue; + + /** + * 累计完成产值(万元) + */ + @ExcelProperty(value = "累计完成产值(万元)") + private BigDecimal accumulatedCompletionValue; + + /** + * 产值差额累计(万元) + */ + @ExcelProperty(value = "产值差额累计(万元)") + private BigDecimal valueDifferenceAccumulation; + + /** + * 项目完成总进度(百分比)% + */ + @ExcelProperty(value = "项目完成总进度(百分比)%") + private BigDecimal totalCompletionProgress; + + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/mapper/OutConstructionValueMapper.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/mapper/OutConstructionValueMapper.java new file mode 100644 index 00000000..abb23097 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/mapper/OutConstructionValueMapper.java @@ -0,0 +1,15 @@ +package org.dromara.out.mapper; + +import org.dromara.out.domain.OutConstructionValue; +import org.dromara.out.domain.vo.OutConstructionValueVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 施工产值Mapper接口 + * + * @author Lion Li + * @date 2025-07-30 + */ +public interface OutConstructionValueMapper extends BaseMapperPlus { + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/mapper/OutMonthPlanAuditMapper.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/mapper/OutMonthPlanAuditMapper.java new file mode 100644 index 00000000..fda02ecd --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/mapper/OutMonthPlanAuditMapper.java @@ -0,0 +1,15 @@ +package org.dromara.out.mapper; + +import org.dromara.out.domain.OutMonthPlanAudit; +import org.dromara.out.domain.vo.OutMonthPlanAuditVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 审核通过月度产值计划Mapper接口 + * + * @author Lion Li + * @date 2025-07-31 + */ +public interface OutMonthPlanAuditMapper extends BaseMapperPlus { + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/mapper/OutMonthPlanMapper.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/mapper/OutMonthPlanMapper.java new file mode 100644 index 00000000..92511828 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/mapper/OutMonthPlanMapper.java @@ -0,0 +1,15 @@ +package org.dromara.out.mapper; + +import org.dromara.out.domain.OutMonthPlan; +import org.dromara.out.domain.vo.OutMonthPlanVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 月度产值计划Mapper接口 + * + * @author Lion Li + * @date 2025-07-31 + */ +public interface OutMonthPlanMapper extends BaseMapperPlus { + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/IOutConstructionValueService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/IOutConstructionValueService.java new file mode 100644 index 00000000..46d930bf --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/IOutConstructionValueService.java @@ -0,0 +1,71 @@ +package org.dromara.out.service; + +import org.dromara.out.domain.vo.OutConstructionValueVo; +import org.dromara.out.domain.bo.OutConstructionValueBo; +import org.dromara.out.domain.OutConstructionValue; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import com.baomidou.mybatisplus.extension.service.IService; +import java.util.Collection; +import java.util.List; + +/** + * 施工产值Service接口 + * + * @author Lion Li + * @date 2025-07-30 + */ +public interface IOutConstructionValueService extends IService{ + + /** + * 查询施工产值 + * + * @param id 主键 + * @return 施工产值 + */ + OutConstructionValueVo queryById(Long id); + + /** + * 分页查询施工产值列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 施工产值分页列表 + */ + TableDataInfo queryPageList(OutConstructionValueBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的施工产值列表 + * + * @param bo 查询条件 + * @return 施工产值列表 + */ + List queryList(OutConstructionValueBo bo); + + /** + * 新增施工产值 + * + * @param bo 施工产值 + * @return 是否新增成功 + */ + Boolean insertByBo(OutConstructionValueBo bo); + + /** + * 修改施工产值 + * + * @param bo 施工产值 + * @return 是否修改成功 + */ + Boolean updateByBo(OutConstructionValueBo bo); + + /** + * 校验并批量删除施工产值信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/IOutMonthPlanAuditService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/IOutMonthPlanAuditService.java new file mode 100644 index 00000000..c431bae3 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/IOutMonthPlanAuditService.java @@ -0,0 +1,78 @@ +package org.dromara.out.service; + +import org.dromara.out.domain.vo.OutMonthPlanAuditVo; +import org.dromara.out.domain.bo.OutMonthPlanAuditBo; +import org.dromara.out.domain.OutMonthPlanAudit; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.dromara.progress.domain.PgsProgressCategory; + +import java.util.Collection; +import java.util.List; + +/** + * 审核通过月度产值计划Service接口 + * + * @author Lion Li + * @date 2025-07-31 + */ +public interface IOutMonthPlanAuditService extends IService{ + + /** + * 查询审核通过月度产值计划 + * + * @param id 主键 + * @return 审核通过月度产值计划 + */ + OutMonthPlanAuditVo queryById(Long id); + + /** + * 分页查询审核通过月度产值计划列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 审核通过月度产值计划分页列表 + */ + TableDataInfo queryPageList(OutMonthPlanAuditBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的审核通过月度产值计划列表 + * + * @param bo 查询条件 + * @return 审核通过月度产值计划列表 + */ + List queryList(OutMonthPlanAuditBo bo); + + /** + * 新增审核通过月度产值计划 + * + * @param bo 审核通过月度产值计划 + * @return 是否新增成功 + */ + Boolean insertByBo(OutMonthPlanAuditBo bo); + + /** + * 修改审核通过月度产值计划 + * + * @param bo 审核通过月度产值计划 + * @return 是否修改成功 + */ + Boolean updateByBo(OutMonthPlanAuditBo bo); + + /** + * 校验并批量删除审核通过月度产值计划信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + + /** + * 根据父项目id获取列表 + */ + List queryListByProjectIds(List projectIds); +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/IOutMonthPlanService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/IOutMonthPlanService.java new file mode 100644 index 00000000..4fdc9c34 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/IOutMonthPlanService.java @@ -0,0 +1,84 @@ +package org.dromara.out.service; + +import org.dromara.out.domain.vo.OutMonthPlanVo; +import org.dromara.out.domain.bo.OutMonthPlanBo; +import org.dromara.out.domain.OutMonthPlan; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import com.baomidou.mybatisplus.extension.service.IService; +import java.util.Collection; +import java.util.List; + +/** + * 月度产值计划Service接口 + * + * @author Lion Li + * @date 2025-07-31 + */ +public interface IOutMonthPlanService extends IService{ + + /** + * 查询月度产值计划 + * + * @param id 主键 + * @return 月度产值计划 + */ + OutMonthPlanVo queryById(Long id); + + /** + * 分页查询月度产值计划列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 月度产值计划分页列表 + */ + TableDataInfo queryPageList(OutMonthPlanBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的月度产值计划列表 + * + * @param bo 查询条件 + * @return 月度产值计划列表 + */ + List queryList(OutMonthPlanBo bo); + + /** + * 新增月度产值计划 + * + * @param bo 月度产值计划 + * @return 是否新增成功 + */ + Boolean insertByBo(OutMonthPlanBo bo); + + /** + * 修改月度产值计划 + * + * @param bo 月度产值计划 + * @return 是否修改成功 + */ + Boolean updateByBo(OutMonthPlanBo bo); + + /** + * 校验并批量删除月度产值计划信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + /** + * 是否可以提交 + * + * @param id 主键 + * @return 是否提交 + */ + Boolean isSubmit(Long id); + + /** + * 根据条件查询月度产值计划 + */ + OutMonthPlanVo getInfoByBo(OutMonthPlanBo bo); + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/impl/OutConstructionValueServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/impl/OutConstructionValueServiceImpl.java new file mode 100644 index 00000000..abfe66ae --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/impl/OutConstructionValueServiceImpl.java @@ -0,0 +1,254 @@ +package org.dromara.out.service.impl; + +import cn.hutool.core.convert.Convert; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.extern.slf4j.Slf4j; +import org.dromara.common.core.domain.event.ProcessDeleteEvent; +import org.dromara.common.core.domain.event.ProcessEvent; +import org.dromara.common.core.domain.event.ProcessTaskEvent; +import org.dromara.common.core.enums.BusinessStatusEnum; +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.dromara.facility.domain.vo.matrix.FacMatrixVo; +import org.dromara.facility.service.IFacMatrixService; +import org.dromara.progress.domain.PgsProgressCategory; +import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryVo; +import org.dromara.progress.service.IPgsProgressCategoryService; +import org.dromara.project.domain.vo.project.BusProjectVo; +import org.dromara.project.service.IBusProjectService; +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Service; +import org.dromara.out.domain.bo.OutConstructionValueBo; +import org.dromara.out.domain.vo.OutConstructionValueVo; +import org.dromara.out.domain.OutConstructionValue; +import org.dromara.out.mapper.OutConstructionValueMapper; +import org.dromara.out.service.IOutConstructionValueService; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 施工产值Service业务层处理 + * + * @author Lion Li + * @date 2025-07-30 + */ +@RequiredArgsConstructor +@Service +@Slf4j +public class OutConstructionValueServiceImpl extends ServiceImpl implements IOutConstructionValueService { + + private final OutConstructionValueMapper baseMapper; + + private final IBusProjectService busProjectService; + + private final IFacMatrixService facMatrixService; + + private final IPgsProgressCategoryService pgsProgressCategoryService; + + /** + * 查询施工产值 + * + * @param id 主键 + * @return 施工产值 + */ + @Override + public OutConstructionValueVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 分页查询施工产值列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 施工产值分页列表 + */ + @Override + public TableDataInfo queryPageList(OutConstructionValueBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + supplementaryData(result.getRecords()); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的施工产值列表 + * + * @param bo 查询条件 + * @return 施工产值列表 + */ + @Override + public List queryList(OutConstructionValueBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + List outConstructionValueVos = baseMapper.selectVoList(lqw); + supplementaryData(outConstructionValueVos); + return outConstructionValueVos; + } + + private LambdaQueryWrapper buildQueryWrapper(OutConstructionValueBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.orderByAsc(OutConstructionValue::getId); + lqw.eq(bo.getProjectId() != null, OutConstructionValue::getProjectId, bo.getProjectId()); + lqw.eq(bo.getMatrixId() != null, OutConstructionValue::getMatrixId, bo.getMatrixId()); + lqw.eq(bo.getProgressCategoryId() != null, OutConstructionValue::getProgressCategoryId, bo.getProgressCategoryId()); + lqw.eq(bo.getArtificialNum() != null, OutConstructionValue::getArtificialNum, bo.getArtificialNum()); + lqw.eq(bo.getUavNum() != null, OutConstructionValue::getUavNum, bo.getUavNum()); + lqw.eq(bo.getConfirmNum() != null, OutConstructionValue::getConfirmNum, bo.getConfirmNum()); + lqw.eq(bo.getOutValue() != null, OutConstructionValue::getOutValue, bo.getOutValue()); + lqw.eq(bo.getReportDate() != null, OutConstructionValue::getReportDate, bo.getReportDate()); + lqw.eq(StringUtils.isNotBlank(bo.getAuditStatus()), OutConstructionValue::getAuditStatus, bo.getAuditStatus()); + lqw.eq(bo.getCreateBy() != null, OutConstructionValue::getCreateBy, bo.getCreateBy()); + return lqw; + } + + /** + * 新增施工产值 + * + * @param bo 施工产值 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(OutConstructionValueBo bo) { + OutConstructionValue add = MapstructUtils.convert(bo, OutConstructionValue.class); + validEntityBeforeSave(add); + //计算产值 + PgsProgressCategory progressCategory = pgsProgressCategoryService.getById(bo.getProgressCategoryId()); + if(progressCategory != null ){ + if("1".equals(progressCategory.getUnitType())){ + add.setOutValue(progressCategory.getUnitPrice().multiply(BigDecimal.valueOf(bo.getArtificialNum()))); + }else if("2".equals(progressCategory.getUnitType())){ + add.setOutValue(progressCategory.getUnitPrice().multiply(BigDecimal.valueOf(bo.getUavNum()).divide(new BigDecimal("100")))); + } + } + + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 修改施工产值 + * + * @param bo 施工产值 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(OutConstructionValueBo bo) { + OutConstructionValue update = MapstructUtils.convert(bo, OutConstructionValue.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(OutConstructionValue entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 校验并批量删除施工产值信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } + + /** + * 补充数据 + */ + public void supplementaryData(List list){ + for (OutConstructionValueVo vo : list){ + //查询项目 + BusProjectVo busProjectVo = busProjectService.queryById(vo.getProjectId()); + vo.setProjectName(busProjectVo.getProjectName()); + + //查询方阵以及子项目 + FacMatrixVo facMatrixVo = facMatrixService.queryById(vo.getMatrixId()); + vo.setMatrixName(facMatrixVo.getMatrixName()); + + BusProjectVo busProjectVo1 = busProjectService.queryById(facMatrixVo.getProjectId()); + vo.setSubProjectId(busProjectVo1.getId()); + vo.setSubProjectName(busProjectVo1.getProjectName()); + + //查询分部工程以及分项工程 + PgsProgressCategoryVo pgsProgressCategoryVo = pgsProgressCategoryService.queryById(vo.getProgressCategoryId()); + vo.setProgressCategoryName(pgsProgressCategoryVo.getName()); + + PgsProgressCategoryVo pgsProgressCategoryVo1 = pgsProgressCategoryService.queryById(pgsProgressCategoryVo.getPid()); + vo.setCategoryId(pgsProgressCategoryVo1.getId()); + vo.setCategoryName(pgsProgressCategoryVo1.getName()); + } + + } + + + /** + * 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等) + * 正常使用只需#processEvent.flowCode=='leave1' + * 示例为了方便则使用startsWith匹配了全部示例key + * + * @param processEvent 参数 + */ + @EventListener(condition = "#processEvent.flowCode.endsWith('constructionValue')") + public void processHandler(ProcessEvent processEvent) { + log.info("施工产值审核任务执行了{}", processEvent.toString()); + OutConstructionValue byId = this.getById(Convert.toLong(processEvent.getBusinessId())); + byId.setAuditStatus(processEvent.getStatus()); + if (processEvent.getSubmit()) { + byId.setAuditStatus(BusinessStatusEnum.WAITING.getStatus()); + } + this.updateById(byId); + } + + /** + * 执行任务创建监听 + * 示例:也可通过 @EventListener(condition = "#processTaskEvent.flowCode=='leave1'")进行判断 + * 在方法中判断流程节点key + * if ("xxx".equals(processTaskEvent.getNodeCode())) { + * //执行业务逻辑 + * } + * + * @param processTaskEvent 参数 + */ + @EventListener(condition = "#processTaskEvent.flowCode.endsWith('constructionValue')") + public void processTaskHandler(ProcessTaskEvent processTaskEvent) { + log.info("施工产值审核任务创建了{}", processTaskEvent.toString()); + } + + /** + * 监听删除流程事件 + * 正常使用只需#processDeleteEvent.flowCode=='leave1' + * 示例为了方便则使用startsWith匹配了全部示例key + * + * @param processDeleteEvent 参数 + */ + @EventListener(condition = "#processDeleteEvent.flowCode.endsWith('constructionValue')") + public void processDeleteHandler(ProcessDeleteEvent processDeleteEvent) { + log.info("监听删除流程事件,施工产值审核任务执行了{}", processDeleteEvent.toString()); +// OutMonthPlan plan = this.getById(Convert.toLong(processDeleteEvent.getBusinessId())); +// if (ObjectUtil.isNull(plan)) { +// return; +// } +// this.removeById(plan.getId()); + } +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/impl/OutMonthPlanAuditServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/impl/OutMonthPlanAuditServiceImpl.java new file mode 100644 index 00000000..193d3fec --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/impl/OutMonthPlanAuditServiceImpl.java @@ -0,0 +1,145 @@ +package org.dromara.out.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.dromara.out.domain.bo.OutMonthPlanAuditBo; +import org.dromara.out.domain.vo.OutMonthPlanAuditVo; +import org.dromara.out.domain.OutMonthPlanAudit; +import org.dromara.out.mapper.OutMonthPlanAuditMapper; +import org.dromara.out.service.IOutMonthPlanAuditService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 审核通过月度产值计划Service业务层处理 + * + * @author Lion Li + * @date 2025-07-31 + */ +@RequiredArgsConstructor +@Service +public class OutMonthPlanAuditServiceImpl extends ServiceImpl implements IOutMonthPlanAuditService { + + private final OutMonthPlanAuditMapper baseMapper; + + /** + * 查询审核通过月度产值计划 + * + * @param id 主键 + * @return 审核通过月度产值计划 + */ + @Override + public OutMonthPlanAuditVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 分页查询审核通过月度产值计划列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 审核通过月度产值计划分页列表 + */ + @Override + public TableDataInfo queryPageList(OutMonthPlanAuditBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的审核通过月度产值计划列表 + * + * @param bo 查询条件 + * @return 审核通过月度产值计划列表 + */ + @Override + public List queryList(OutMonthPlanAuditBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(OutMonthPlanAuditBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.orderByAsc(OutMonthPlanAudit::getId); + lqw.eq(bo.getProjectId() != null, OutMonthPlanAudit::getProjectId, bo.getProjectId()); + lqw.eq(bo.getDesignValue() != null, OutMonthPlanAudit::getDesignValue, bo.getDesignValue()); + lqw.eq(bo.getPurchaseValue() != null, OutMonthPlanAudit::getPurchaseValue, bo.getPurchaseValue()); + lqw.eq(bo.getConstructionValue() != null, OutMonthPlanAudit::getConstructionValue, bo.getConstructionValue()); + lqw.eq(bo.getTotalValue() != null, OutMonthPlanAudit::getTotalValue, bo.getTotalValue()); + lqw.eq(StringUtils.isNotBlank(bo.getPlanMonth()), OutMonthPlanAudit::getPlanMonth, bo.getPlanMonth()); + return lqw; + } + + /** + * 新增审核通过月度产值计划 + * + * @param bo 审核通过月度产值计划 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(OutMonthPlanAuditBo bo) { + OutMonthPlanAudit add = MapstructUtils.convert(bo, OutMonthPlanAudit.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 修改审核通过月度产值计划 + * + * @param bo 审核通过月度产值计划 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(OutMonthPlanAuditBo bo) { + OutMonthPlanAudit update = MapstructUtils.convert(bo, OutMonthPlanAudit.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(OutMonthPlanAudit entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 校验并批量删除审核通过月度产值计划信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } + + @Override + public List queryListByProjectIds(List projectIds) { + if(projectIds.isEmpty()){ + return List.of(); + } + return baseMapper.selectList(Wrappers.lambdaUpdate() + .in(OutMonthPlanAudit::getProjectId, projectIds)); + } +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/impl/OutMonthPlanServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/impl/OutMonthPlanServiceImpl.java new file mode 100644 index 00000000..032e558e --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/out/service/impl/OutMonthPlanServiceImpl.java @@ -0,0 +1,372 @@ +package org.dromara.out.service.impl; + +import cn.hutool.core.convert.Convert; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.extern.slf4j.Slf4j; +import org.dromara.common.core.domain.event.ProcessDeleteEvent; +import org.dromara.common.core.domain.event.ProcessEvent; +import org.dromara.common.core.domain.event.ProcessTaskEvent; +import org.dromara.common.core.enums.BusinessStatusEnum; +import org.dromara.common.core.enums.FormatsType; +import org.dromara.common.core.exception.ServiceException; +import org.dromara.common.core.utils.DateUtils; +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.dromara.out.domain.OutConstructionValue; +import org.dromara.out.domain.OutMonthPlanAudit; +import org.dromara.out.service.IOutConstructionValueService; +import org.dromara.out.service.IOutMonthPlanAuditService; +import org.jetbrains.annotations.NotNull; +import org.springframework.context.event.EventListener; +import org.springframework.stereotype.Service; +import org.dromara.out.domain.bo.OutMonthPlanBo; +import org.dromara.out.domain.vo.OutMonthPlanVo; +import org.dromara.out.domain.OutMonthPlan; +import org.dromara.out.mapper.OutMonthPlanMapper; +import org.dromara.out.service.IOutMonthPlanService; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.temporal.TemporalAdjusters; +import java.util.List; +import java.util.Map; +import java.util.Collection; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 月度产值计划Service业务层处理 + * + * @author Lion Li + * @date 2025-07-31 + */ +@RequiredArgsConstructor +@Service +@Slf4j +public class OutMonthPlanServiceImpl extends ServiceImpl implements IOutMonthPlanService { + + private final OutMonthPlanMapper baseMapper; + + private final IOutMonthPlanAuditService outMonthPlanAuditService; + + private final IOutConstructionValueService constructionValueService; + /** + * 查询月度产值计划 + * + * @param id 主键 + * @return 月度产值计划 + */ + @Override + public OutMonthPlanVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 分页查询月度产值计划列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 月度产值计划分页列表 + */ + @Override + public TableDataInfo queryPageList(OutMonthPlanBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + List records = result.getRecords(); + //计算完成产值与差额 + calculateCompleteValueAndDifference(records); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的月度产值计划列表 + * + * @param bo 查询条件 + * @return 月度产值计划列表 + */ + @Override + public List queryList(OutMonthPlanBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(OutMonthPlanBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.orderByAsc(OutMonthPlan::getId); + lqw.eq(bo.getProjectId() != null, OutMonthPlan::getProjectId, bo.getProjectId()); + lqw.eq(bo.getPlanValue() != null, OutMonthPlan::getPlanValue, bo.getPlanValue()); + lqw.eq(bo.getCompleteValue() != null, OutMonthPlan::getCompleteValue, bo.getCompleteValue()); + lqw.eq(bo.getDifferenceValue() != null, OutMonthPlan::getDifferenceValue, bo.getDifferenceValue()); + lqw.eq(StringUtils.isNotBlank(bo.getPlanMonth()), OutMonthPlan::getPlanMonth, bo.getPlanMonth()); + lqw.eq(StringUtils.isNotBlank(bo.getValueType()), OutMonthPlan::getValueType, bo.getValueType()); + lqw.eq(StringUtils.isNotBlank(bo.getPlanAuditStatus()), OutMonthPlan::getPlanAuditStatus, bo.getPlanAuditStatus()); + lqw.eq(StringUtils.isNotBlank(bo.getCompleteAuditStatus()), OutMonthPlan::getCompleteAuditStatus, bo.getCompleteAuditStatus()); + return lqw; + } + + /** + * 新增月度产值计划 + * + * @param bo 月度产值计划 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(OutMonthPlanBo bo) { + OutMonthPlan add = MapstructUtils.convert(bo, OutMonthPlan.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 修改月度产值计划 + * + * @param bo 月度产值计划 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(OutMonthPlanBo bo) { + OutMonthPlan update = MapstructUtils.convert(bo, OutMonthPlan.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(OutMonthPlan entity){ + //TODO 做一些数据校验,如唯一约束 + List outMonthPlans = baseMapper.selectList(Wrappers.lambdaQuery() + .eq(OutMonthPlan::getProjectId, entity.getProjectId()) + .eq(OutMonthPlan::getPlanMonth, entity.getPlanMonth()) + .eq(OutMonthPlan::getValueType, entity.getValueType()) + .ne(entity.getId() != null, OutMonthPlan::getId, entity.getId()) + ); + if (!outMonthPlans.isEmpty()) { + throw new ServiceException("该月份已有计划"); + } + } + + /** + * 校验并批量删除月度产值计划信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } + + @Override + public Boolean isSubmit(Long id) { + OutMonthPlan outMonthPlan = baseMapper.selectById(id); + List outMonthPlans = baseMapper.selectList(Wrappers.lambdaQuery() + .eq(OutMonthPlan::getProjectId, outMonthPlan.getProjectId()) + .eq(OutMonthPlan::getPlanMonth, outMonthPlan.getPlanMonth()) + ); + Set collect = outMonthPlans.stream().map(OutMonthPlan::getValueType).collect(Collectors.toSet()); + return collect.contains("1") && collect.contains("2") && collect.contains("3"); + } + + @Override + public OutMonthPlanVo getInfoByBo(OutMonthPlanBo bo) { + LambdaQueryWrapper outMonthPlanLambdaQueryWrapper = buildQueryWrapper(bo); + outMonthPlanLambdaQueryWrapper.last("limit 1"); + return baseMapper.selectVoOne(outMonthPlanLambdaQueryWrapper); + } + + /** + * 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等) + * 正常使用只需#processEvent.flowCode=='leave1' + * 示例为了方便则使用startsWith匹配了全部示例key + * + * @param processEvent 参数 + */ + @EventListener(condition = "#processEvent.flowCode.endsWith('monthPlan')") + public void monthPlanProcessHandler(ProcessEvent processEvent) { + log.info("月度计划产值审核任务执行了{}", processEvent.toString()); + //这里的业务id:项目id_月份 + String str = Convert.toStr(processEvent.getBusinessId()); + String[] split = str.split("_"); + List outMonthPlans = baseMapper.selectList(Wrappers.lambdaQuery() + .eq(OutMonthPlan::getProjectId, split[0]) + .eq(OutMonthPlan::getPlanMonth, split[1]) + ); + outMonthPlans.forEach(outMonthPlan -> { + outMonthPlan.setPlanAuditStatus(processEvent.getStatus()); + if (processEvent.getSubmit()) { + outMonthPlan.setPlanAuditStatus(BusinessStatusEnum.WAITING.getStatus()); + } + }); + if(BusinessStatusEnum.FINISH.getStatus().equals(processEvent.getStatus())){ + OutMonthPlanAudit outMonthPlanAudit = getOutMonthPlanAudit(outMonthPlans); + outMonthPlanAuditService.save(outMonthPlanAudit); + } + updateBatchById(outMonthPlans); + } + + private static @NotNull OutMonthPlanAudit getOutMonthPlanAudit(List outMonthPlans) { + OutMonthPlanAudit outMonthPlanAudit = new OutMonthPlanAudit(); + for (OutMonthPlan outMonthPlan : outMonthPlans) { + outMonthPlanAudit.setProjectId(outMonthPlan.getProjectId()); + outMonthPlanAudit.setPlanMonth(outMonthPlan.getPlanMonth()); + if(outMonthPlan.getValueType().equals("1")){ + outMonthPlanAudit.setDesignValue(outMonthPlan.getPlanValue()); + } + if(outMonthPlan.getValueType().equals("2")){ + outMonthPlanAudit.setPurchaseValue(outMonthPlan.getPlanValue()); + } + if(outMonthPlan.getValueType().equals("3")){ + outMonthPlanAudit.setConstructionValue(outMonthPlan.getPlanValue()); + } + } + outMonthPlanAudit.setTotalValue(outMonthPlanAudit.getDesignValue().add(outMonthPlanAudit.getPurchaseValue()).add(outMonthPlanAudit.getConstructionValue())); + return outMonthPlanAudit; + } + + + + /** + * 计算完成值和差异 + */ + public void calculateCompleteValueAndDifference(List outMonthPlans){ + for (OutMonthPlanVo outMonthPlan : outMonthPlans) { + + //计算日期 + LocalDate parsedDate = DateUtils.parseLocalDateTime(FormatsType.YYYY_MM, outMonthPlan.getPlanMonth()); + // 当前月的第一天 + LocalDate firstDay = parsedDate.with(TemporalAdjusters.firstDayOfMonth()); + // 当前月的最后一天 + LocalDate lastDay = parsedDate.with(TemporalAdjusters.lastDayOfMonth()); + + + if("2".equals(outMonthPlan.getValueType())){ //采购产值 + //todo: 罗成没写完 + + + }else if("3".equals(outMonthPlan.getValueType())){ //施工产值 + //查询项目的审核通过的施工详细表 1.累计完成产值 2.完成产值月合计 3.各周完成产值 + List outConstructionValues = constructionValueService.lambdaQuery() + .eq(OutConstructionValue::getProjectId, outMonthPlan.getProjectId()) + .between(OutConstructionValue::getReportDate, firstDay, lastDay) + .eq(OutConstructionValue::getAuditStatus, BusinessStatusEnum.FINISH.getStatus()) + .list(); + // 计算完成值 + BigDecimal reduce = outConstructionValues.stream().map(OutConstructionValue::getOutValue) + .reduce(BigDecimal.ZERO, BigDecimal::add); + outMonthPlan.setCompleteValue(reduce); + } + // 计算差额(计划值 - 完成值) + if (outMonthPlan.getPlanValue() != null && outMonthPlan.getCompleteValue() != null) { + outMonthPlan.setDifferenceValue(outMonthPlan.getPlanValue().subtract(outMonthPlan.getCompleteValue())); + } + } + } + + /** + * 执行任务创建监听 + * 示例:也可通过 @EventListener(condition = "#processTaskEvent.flowCode=='leave1'")进行判断 + * 在方法中判断流程节点key + * if ("xxx".equals(processTaskEvent.getNodeCode())) { + * //执行业务逻辑 + * } + * + * @param processTaskEvent 参数 + */ + @EventListener(condition = "#processTaskEvent.flowCode.endsWith('monthPlan')") + public void monthPlanProcessTaskHandler(ProcessTaskEvent processTaskEvent) { + log.info("月度计划产值任务创建了{}", processTaskEvent.toString()); + } + + /** + * 监听删除流程事件 + * 正常使用只需#processDeleteEvent.flowCode=='leave1' + * 示例为了方便则使用startsWith匹配了全部示例key + * + * @param processDeleteEvent 参数 + */ + @EventListener(condition = "#processDeleteEvent.flowCode.endsWith('monthPlan')") + public void monthPlanProcessDeleteHandler(ProcessDeleteEvent processDeleteEvent) { + log.info("监听删除流程事件,月度计划产值审核任务执行了{}", processDeleteEvent.toString()); +// OutMonthPlan plan = this.getById(Convert.toLong(processDeleteEvent.getBusinessId())); +// if (ObjectUtil.isNull(plan)) { +// return; +// } +// this.removeById(plan.getId()); + } + + + + + +/** + * 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等) + * 正常使用只需#processEvent.flowCode=='leave1' + * 示例为了方便则使用startsWith匹配了全部示例key + * + * @param processEvent 参数 + */ + @EventListener(condition = "#processEvent.flowCode.endsWith('designCompleteValue')") + public void processHandler(ProcessEvent processEvent) { + log.info("设计完成产值审核任务执行了{}", processEvent.toString()); + //这里的业务id:项目id_月份 + Long id = Convert.toLong(processEvent.getBusinessId()); + OutMonthPlan outMonthPlan = baseMapper.selectById(id); + + outMonthPlan.setCompleteAuditStatus(processEvent.getStatus()); + if (processEvent.getSubmit()) { + outMonthPlan.setCompleteAuditStatus(BusinessStatusEnum.WAITING.getStatus()); + } + baseMapper.updateById(outMonthPlan); + } + + + /** + * 执行任务创建监听 + * 示例:也可通过 @EventListener(condition = "#processTaskEvent.flowCode=='leave1'")进行判断 + * 在方法中判断流程节点key + * if ("xxx".equals(processTaskEvent.getNodeCode())) { + * //执行业务逻辑 + * } + * + * @param processTaskEvent 参数 + */ + @EventListener(condition = "#processTaskEvent.flowCode.endsWith('designCompleteValue')") + public void processTaskHandler(ProcessTaskEvent processTaskEvent) { + log.info("施工产值审核任务创建了{}", processTaskEvent.toString()); + } + + /** + * 监听删除流程事件 + * 正常使用只需#processDeleteEvent.flowCode=='leave1' + * 示例为了方便则使用startsWith匹配了全部示例key + * + * @param processDeleteEvent 参数 + */ + @EventListener(condition = "#processDeleteEvent.flowCode.endsWith('designCompleteValue')") + public void processDeleteHandler(ProcessDeleteEvent processDeleteEvent) { + log.info("监听删除流程事件,施工产值审核任务执行了{}", processDeleteEvent.toString()); +// OutMonthPlan plan = this.getById(Convert.toLong(processDeleteEvent.getBusinessId())); +// if (ObjectUtil.isNull(plan)) { +// return; +// } +// this.removeById(plan.getId()); + } + + +} 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 cb3ea984..fe6082dc 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 @@ -122,4 +122,10 @@ public interface IPgsProgressCategoryService extends IService queryListByProjectIds(List projectIds); + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressPlanDetailService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressPlanDetailService.java index d7d68c77..ea7c507a 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressPlanDetailService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressPlanDetailService.java @@ -108,4 +108,9 @@ public interface IPgsProgressPlanDetailService extends IService getVoPage(Page progressPlanDetailPage); + /** + * 根据项目id查询进度计划详情列表 + */ + List queryListByProjectIds(List projectIds); + } 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 4d3f765d..641978ca 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 @@ -749,4 +749,17 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl queryListByProjectIds(List projectIds) { + + List projects = projectService.lambdaQuery().in(BusProject::getPId, projectIds).list(); + List list = projects.stream().map(BusProject::getId).toList(); + if(CollUtil.isEmpty(list)){ + return new ArrayList<>(); + } + return this.lambdaQuery() + .in(PgsProgressCategory::getProjectId, list) + .list(); + } } 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 681361b2..08ddbeb7 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 @@ -42,6 +42,9 @@ 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.common.utils.PageConvertUtil; +import org.dromara.project.domain.BusProject; +import org.dromara.project.service.IBusProjectService; import org.springframework.beans.BeanUtils; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @@ -81,6 +84,9 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl queryListByProjectIds(List projectIds) { + List list = projectService.lambdaQuery().in(BusProject::getPId, projectIds).list(); + if(CollUtil.isEmpty(list)){ + return List.of(); + } + return this.lambdaQuery() + .in(PgsProgressPlanDetail::getProjectId, list.stream().map(BusProject::getId).toList()) + .list(); + } + /** * 分页 * @@ -655,6 +672,4 @@ public class PgsProgressPlanDetailServiceImpl extends ServiceImpl + + + + diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/out/OutMonthPlanAuditMapper.xml b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/out/OutMonthPlanAuditMapper.xml new file mode 100644 index 00000000..2fbac5dd --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/out/OutMonthPlanAuditMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/out/OutMonthPlanMapper.xml b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/out/OutMonthPlanMapper.xml new file mode 100644 index 00000000..9f1e1e17 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/resources/mapper/out/OutMonthPlanMapper.xml @@ -0,0 +1,7 @@ + + + + +