diff --git a/xinnengyuan/ruoyi-admin/src/test/java/org/dromara/test/DemoTest.java b/xinnengyuan/ruoyi-admin/src/test/java/org/dromara/test/DemoTest.java index 2de8ccbd..1da365a8 100644 --- a/xinnengyuan/ruoyi-admin/src/test/java/org/dromara/test/DemoTest.java +++ b/xinnengyuan/ruoyi-admin/src/test/java/org/dromara/test/DemoTest.java @@ -84,9 +84,9 @@ public class DemoTest { Boolean result = progressCategoryService.insertByTemplate(1906557369562726402L, matrixList, null); } - @Test +/* @Test void testDeptProject() { deptService.selectProjectIdById(100L); deptService.selectProjectIdById(1937478258803171329L); - } + }*/ } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/service/impl/BusPurchaseDocServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/service/impl/BusPurchaseDocServiceImpl.java index 5fbc187c..e5a7fba7 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/service/impl/BusPurchaseDocServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/cailiaoshebei/service/impl/BusPurchaseDocServiceImpl.java @@ -122,7 +122,7 @@ public class BusPurchaseDocServiceImpl extends ServiceImpl result = baseMapper.selectVoPage(pageQuery.build(), lqw); result.getRecords().forEach(v -> { BusMrpBase byId = mrpBaseService.getById(v.getMrpBaseId()); - if (byId != null){ + if (byId != null) { v.setPlanCode(byId.getPlanCode()); } }); @@ -378,6 +378,9 @@ public class BusPurchaseDocServiceImpl extends ServiceImpl ids, Boolean isValid) { - if(isValid){ + if (isValid) { //TODO 做一些业务上的校验,判断是否需要校验 } return baseMapper.deleteByIds(ids) > 0; @@ -191,14 +184,14 @@ public class DesCollectServiceImpl extends ServiceImpl { - item.setCollectId(convert.getId()); - item.setProjectId(convert.getProjectId()); - } + item.setCollectId(convert.getId()); + item.setProjectId(convert.getProjectId()); + } ); - collectCatalogueService.batchAddOrUpdate(dto.getCatalogueList(),convert.getProjectId()); + collectCatalogueService.batchAddOrUpdate(dto.getCatalogueList(), convert.getProjectId()); } return b; } @@ -222,14 +215,15 @@ public class DesCollectServiceImpl extends ServiceImpl itemList = collectCatalogueService.list(Wrappers. - lambdaQuery().eq(DesCollectCatalogue::getCollectId, id)); - DesCollectWordDto data = this.getReplacementDto(descCollect, itemList); + List itemList = collectCatalogueService.list( + Wrappers.lambdaQuery().eq(DesCollectCatalogue::getCollectId, id)); + DesCollectWordDto data = this.getReplacementDto(descCollect, itemList); // 生成文件 - try (InputStream is = getClass().getClassLoader().getResourceAsStream(DesDesignConstant.DESIGN_COLLECT_TEMPLATE_PATH)) { + try (InputStream is = getClass().getClassLoader() + .getResourceAsStream(DesDesignConstant.DESIGN_COLLECT_TEMPLATE_PATH)) { if (is == null) { throw new ServiceException("模板文件不存在"); } @@ -256,10 +251,8 @@ public class DesCollectServiceImpl extends ServiceImpl itemList = extractCatalogueService.list(Wrappers. - lambdaQuery().eq(DesExtractCatalogue::getExtractId, id)); + List itemList = extractCatalogueService.list( + Wrappers.lambdaQuery().eq(DesExtractCatalogue::getExtractId, id)); DesCollectWordDto data = this.getReplacementDto(desExtract, itemList); // 生成文件 - try (InputStream is = getClass().getClassLoader().getResourceAsStream(DesDesignConstant.DESIGN_EXTRACT_TEMPLATE_PATH)) { + try (InputStream is = getClass().getClassLoader() + .getResourceAsStream(DesDesignConstant.DESIGN_EXTRACT_TEMPLATE_PATH)) { if (is == null) { throw new ServiceException("模板文件不存在"); } @@ -250,10 +255,8 @@ public class DesExtractServiceImpl extends ServiceImpl fileList(Long id) { List catalogIds = extractCatalogueService.list(Wrappers.lambdaQuery() .eq(DesExtractCatalogue::getExtractId, id)).stream().map(DesExtractCatalogue::getVolumeCatalogId).toList(); - if(catalogIds.isEmpty()){ + if (catalogIds.isEmpty()) { return new ArrayList<>(); } List list = volumeFileService.list(Wrappers.lambdaQuery().in(DesVolumeFile::getVolumeCatalogId, catalogIds)); ArrayList desCollectFileVos = new ArrayList<>(); - for (DesVolumeFile desVolumeFile : list){ + for (DesVolumeFile desVolumeFile : list) { DesCollectFileVo desCollectFileVo = BeanUtil.copyProperties(desVolumeFile, DesCollectFileVo.class); desCollectFileVo.setFileUrl(ossService.getById(desVolumeFile.getFileId()).getUrl()); desCollectFileVos.add(desCollectFileVo); diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressCategoryController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressCategoryController.java index 3802d0ae..69124f44 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressCategoryController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressCategoryController.java @@ -66,6 +66,17 @@ public class PgsProgressCategoryController extends BaseController { return R.ok(list); } + /** + * 根据子项目获取进度类别模版顶级目录列表 + */ + @SaCheckPermission("progress:progressCategory:listTopBySubProjectId") + @GetMapping("/listTopBySubProjectId/{subProjectId}") + public R> listTopBySubProjectId(@NotNull(message = "项目id不能为空") + @PathVariable Long subProjectId) { + List list = pgsProgressCategoryService.getTopListByProjectId(subProjectId); + return R.ok(list); + } + /** * 导出进度类别列表 */ @@ -277,11 +288,4 @@ public class PgsProgressCategoryController extends BaseController { return toAjax(pgsProgressCategoryService.deleteWithValidByIds(List.of(ids), true)); } - /*** - * 分项工程方阵导出 - */ -// @SaCheckPermission("progress:progressCategory:export") -// @Log(title = "分项工程方阵导出", businessType = BusinessType.EXPORT) -// @GetMapping("/export") - } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressCategoryTemplateController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressCategoryTemplateController.java index 5aa4ad1b..18388b7d 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressCategoryTemplateController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/controller/PgsProgressCategoryTemplateController.java @@ -58,6 +58,15 @@ public class PgsProgressCategoryTemplateController extends BaseController { return R.ok(list); } + /** + * 获取系统顶级进度类别模版列表 + */ + @SaCheckPermission("progress:progressCategoryTemplate:listSystemTop") + @GetMapping("/listSystemTop") + public R> listSystemTop() { + return R.ok(pgsProgressCategoryTemplateService.listSystemTop()); + } + /** * 导出进度类别模版列表 */ 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 a9b6c40d..dfd566c8 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 @@ -114,6 +114,11 @@ public class PgsProgressCategory extends BaseEntity { */ private String ancestors; + /** + * 关联结构(1子项目 2方阵) + */ + private String relevancyStructure; + /** * 工作类型 */ 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 ed7b022f..6ef18f90 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 @@ -47,6 +47,11 @@ public class PgsProgressCategoryTemplate implements Serializable { */ private String workType; + /** + * 关联结构(1子项目 2方阵) + */ + private String relevancyStructure; + /** * 项目id(0表示共用) */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryCreatePriceReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryCreatePriceReq.java index 004586b8..1a889410 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryCreatePriceReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryCreatePriceReq.java @@ -1,5 +1,6 @@ package org.dromara.progress.domain.dto.progresscategory; +import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.Data; @@ -18,6 +19,11 @@ public class PgsProgressCategoryCreatePriceReq { @NotNull(message = "类别id不能为空") private Long id; + /** + * 类别名称 + */ + private String name; + /** * 计量单位 */ @@ -33,9 +39,19 @@ public class PgsProgressCategoryCreatePriceReq { */ private BigDecimal constructionPrice; + /** + * 计量方式(0无 1数量 2百分比) + */ + private String unitType; + /** * 总数量 */ private BigDecimal total; + /** + * 备注 + */ + 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 1c389d75..b981677d 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 @@ -60,6 +60,12 @@ public class PgsProgressCategoryCreateReq implements Serializable { @NotNull(message = "综合单价(分包)不能为空") private BigDecimal constructionPrice; + /** + * 关联结构(1子项目 2方阵) + */ + @NotBlank(message = "关联结构不能为空") + private String relevancyStructure; + /** * 总数量 */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryQueryReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryQueryReq.java index e8c7ee3c..f4972464 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryQueryReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategory/PgsProgressCategoryQueryReq.java @@ -19,4 +19,9 @@ public class PgsProgressCategoryQueryReq { */ private Long matrixId; + /** + * 关联结构(1子项目 2方阵) + */ + private String relevancyStructure; + } 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 78599165..38e198bb 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 @@ -38,6 +38,11 @@ public class PgsProgressCategoryUpdateReq { */ private BigDecimal total; + /** + * 关联结构(1子项目 2方阵) + */ + private String relevancyStructure; + /** * 备注 */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategorytemplate/PgsProgressCategoryTemplateQueryReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategorytemplate/PgsProgressCategoryTemplateQueryReq.java index c94f764f..2f09946b 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategorytemplate/PgsProgressCategoryTemplateQueryReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/dto/progresscategorytemplate/PgsProgressCategoryTemplateQueryReq.java @@ -39,4 +39,9 @@ public class PgsProgressCategoryTemplateQueryReq implements Serializable { */ private String constructionType; + /** + * 关联结构(1子项目 2方阵) + */ + private String relevancyStructure; + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/enums/PgsRelevancyStructureEnum.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/enums/PgsRelevancyStructureEnum.java new file mode 100644 index 00000000..b6765b9f --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/enums/PgsRelevancyStructureEnum.java @@ -0,0 +1,24 @@ +package org.dromara.progress.domain.enums; + +import lombok.Getter; + +/** + * @author lilemy + * @date 2025-08-25 18:58 + */ +@Getter +public enum PgsRelevancyStructureEnum { + + SUB_PROJECT("子项目", "1"), + MATRIX("方阵", "2"); + + private final String text; + + private final String value; + + PgsRelevancyStructureEnum(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/PgsProgressCategoryVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/domain/vo/progresscategory/PgsProgressCategoryVo.java index b7fc8bf0..3d656b07 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 @@ -142,6 +142,13 @@ public class PgsProgressCategoryVo implements Serializable { */ private BigDecimal constructionOutputValue; + /** + * 关联结构(1子项目 2方阵) + */ + @ExcelProperty(value = "关联结构", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "1=子项目,2=方阵") + private String relevancyStructure; + /** * 工作类型 */ 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 3ce89911..6384f955 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 @@ -46,6 +46,11 @@ public class PgsProgressCategoryTemplateVo implements Serializable { */ private String workType; + /** + * 关联结构(1子项目 2方阵) + */ + private String relevancyStructure; + /** * 项目id(0表示共用) */ 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 c8c7057d..8e9bd6cd 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 @@ -49,6 +49,14 @@ public interface IPgsProgressCategoryService extends IService getTopListByProjectId(Long subProjectId); + /** * 新增进度类别 * @@ -142,7 +150,7 @@ public interface IPgsProgressCategoryService extends IService> getMatrixIdAndNumber(Long projectId); + List> getMatrixIdAndNumber(Long projectId); PgsProgressCategory convertVoToEntity(PgsProgressCategoryVo vo); diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressCategoryTemplateService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressCategoryTemplateService.java index 09b154b6..b5db9cbe 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressCategoryTemplateService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/IPgsProgressCategoryTemplateService.java @@ -80,6 +80,13 @@ public interface IPgsProgressCategoryTemplateService extends IService listSystemTop(); + /** * 获取进度类别模版视图对象 * 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 f6cfca3f..83e0c950 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 @@ -28,6 +28,7 @@ import org.dromara.progress.domain.dto.progresscategory.PgsProgressCategoryUpdat import org.dromara.progress.domain.enums.PgsCoordinateTypeEnum; import org.dromara.progress.domain.enums.PgsFinishStatusEnum; import org.dromara.progress.domain.enums.PgsProgressUnitTypeEnum; +import org.dromara.progress.domain.enums.PgsRelevancyStructureEnum; import org.dromara.progress.domain.vo.progresscategory.*; import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailDateVo; import org.dromara.progress.domain.vo.progressplandetail.PgsProgressPlanDetailFinishedVo; @@ -167,11 +168,33 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl getTopListByProjectId(Long subProjectId) { + List list = this.lambdaQuery() + .eq(PgsProgressCategory::getProjectId, subProjectId) + .eq(PgsProgressCategory::getParentId, PgsProgressCategoryConstant.TOP_PARENT_ID) + .list(); + if (CollUtil.isEmpty(list)) { + return List.of(); + } + return list.stream() + .map(this::getVo) + .collect(Collectors.toList()); + } + /** * 新增进度类别 * @@ -263,25 +286,39 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl percentageFacilityList = new ArrayList<>(); List newPlanList = new ArrayList<>(); List newPlanDetailList = new ArrayList<>(); + // 获取关联子项目的进度 + List subTemplateList = categoryTemplateList.stream() + .filter(template -> template.getConstructionType().equals(PgsRelevancyStructureEnum.SUB_PROJECT.getValue())) + .toList(); + List matrixTemplateList = categoryTemplateList.stream() + .filter(template -> template.getConstructionType().equals(PgsRelevancyStructureEnum.MATRIX.getValue())) + .toList(); // 每个 matrixId 对应一套新的 ID 映射 for (FacMatrix matrix : matrixList) { // templateId -> newId Map localIdMap = new HashMap<>(); List localList = new ArrayList<>(); - for (PgsProgressCategoryTemplate template : categoryTemplateList) { + for (PgsProgressCategoryTemplate template : matrixTemplateList) { Long newId = IdWorker.getId(); localIdMap.put(template.getId(), newId); PgsProgressCategory newCategory = new PgsProgressCategory(); @@ -632,6 +681,10 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl lqw = new LambdaQueryWrapper<>(); @@ -945,12 +998,12 @@ public class PgsProgressCategoryServiceImpl extends ServiceImpl> getMatrixIdAndNumber(Long projectId){ + public List> getMatrixIdAndNumber(Long projectId) { return baseMapper.getMatrixIdAndNumber(projectId); } @Override - public PgsProgressCategory convertVoToEntity(PgsProgressCategoryVo vo){ + public PgsProgressCategory convertVoToEntity(PgsProgressCategoryVo vo) { if (vo == null) { return null; } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryTemplateServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryTemplateServiceImpl.java index dcff70fd..7e599ab3 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryTemplateServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/progress/service/impl/PgsProgressCategoryTemplateServiceImpl.java @@ -29,6 +29,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.stream.Collectors; /** * 进度类别模版Service业务层处理 @@ -271,6 +272,25 @@ public class PgsProgressCategoryTemplateServiceImpl extends ServiceImpl listSystemTop() { + List list = this.lambdaQuery() + .eq(PgsProgressCategoryTemplate::getProjectId, PgsProgressCategoryConstant.TOP_PARENT_ID) + .eq(PgsProgressCategoryTemplate::getParentId, PgsProgressCategoryConstant.TOP_PARENT_ID) + .list(); + if (CollUtil.isEmpty(list)) { + return List.of(); + } + return list.stream() + .map(this::getVo) + .collect(Collectors.toList()); + } + /** * 获取进度类别模版视图对象 * @@ -309,6 +329,7 @@ public class PgsProgressCategoryTemplateServiceImpl extends ServiceImpl { List selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly); @Select(""" - WITH RECURSIVE dept_tree AS ( - SELECT dept_id, parent_id, project_id, dept_type - FROM sys_dept - WHERE dept_id = #{deptId} + WITH RECURSIVE dept_tree AS ( + SELECT dept_id, parent_id, project_id, dept_type + FROM sys_dept + WHERE dept_id = #{deptId} - UNION ALL + UNION ALL - SELECT d.dept_id, d.parent_id, d.project_id, d.dept_type - FROM sys_dept d - INNER JOIN dept_tree dt ON d.parent_id = dt.dept_id - ) - SELECT DISTINCT project_id - FROM dept_tree - WHERE dept_type = '3' AND project_id IS NOT NULL - """) + SELECT d.dept_id, d.parent_id, d.project_id, d.dept_type + FROM sys_dept d + INNER JOIN dept_tree dt ON d.parent_id = dt.dept_id + ) + SELECT DISTINCT project_id + FROM dept_tree + WHERE dept_type = '4' AND project_id IS NOT NULL + """) List getProjectIdsByDept(@Param("deptId") Long deptId); + @Select(""" + WITH RECURSIVE dept_tree AS ( + -- 第一步:找到传入 deptId 的同级部门(同一个 parent_id) + SELECT d.dept_id, d.parent_id, d.project_id, d.dept_type + FROM sys_dept d + WHERE d.parent_id = (SELECT parent_id FROM sys_dept WHERE dept_id = #{deptId}) + + UNION ALL + + -- 第二步:递归查找这些部门的所有子部门 + SELECT sd.dept_id, sd.parent_id, sd.project_id, sd.dept_type + FROM sys_dept sd + INNER JOIN dept_tree dt ON sd.parent_id = dt.dept_id + ) + SELECT DISTINCT project_id + FROM dept_tree + WHERE dept_type = '4' AND project_id IS NOT NULL + """) + List getProjectIdsByDeptSiblingsAndChildren(@Param("deptId") Long deptId); + + /** * 根据部门ID获取到顶级部门 * diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysDeptService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysDeptService.java index 0d64c1d4..1bf778c0 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysDeptService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysDeptService.java @@ -70,10 +70,11 @@ public interface ISysDeptService { /** * 根据部门ID查询所属项目ID列表 * - * @param deptId 部门id + * @param deptId 部门id + * @param deptType 部门类型 * @return 项目id列表 */ - List selectProjectIdById(Long deptId); + List selectProjectIdById(Long deptId, String deptType); /** diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java index 029141ad..d1fa27f4 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDeptServiceImpl.java @@ -260,11 +260,15 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService { /** * 根据部门ID查询所属项目ID列表 * - * @param deptId 部门id + * @param deptId 部门id + * @param deptType 部门类型 * @return 项目id列表 */ @Override - public List selectProjectIdById(Long deptId) { + public List selectProjectIdById(Long deptId, String deptType) { + if (deptType.equals(SysDeptTypeEnum.SPECIAL.getCode())) { + return baseMapper.getProjectIdsByDeptSiblingsAndChildren(deptId); + } return baseMapper.getProjectIdsByDept(deptId); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java index a4934499..c3b8bd3e 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysUserServiceImpl.java @@ -373,7 +373,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService { } } else { // 关联部门所属项目 - List projectIds = deptService.selectProjectIdById(deptId); + List projectIds = deptService.selectProjectIdById(deptId, deptType); String userType = "1"; if (deptType.equals(SysDeptTypeEnum.COMPANY.getCode()) || deptType.equals(SysDeptTypeEnum.SUB_COMPANY.getCode())) { userType = "2"; @@ -447,7 +447,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService { // 先删除旧关联 userProjectRelevancyService.deleteByUserId(user.getUserId()); // 添加新关联 - List projectIds = deptService.selectProjectIdById(user.getDeptId()); + List projectIds = deptService.selectProjectIdById(user.getDeptId(), deptType); String userType = "1"; if (deptType.equals(SysDeptTypeEnum.COMPANY.getCode()) || deptType.equals(SysDeptTypeEnum.SUB_COMPANY.getCode())) { userType = "2"; @@ -688,6 +688,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService { /** * 获取当前用户所在部门的所有用户 + * * @return */ @Override diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/tender/service/impl/BusBillofquantitiesLimitListServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/tender/service/impl/BusBillofquantitiesLimitListServiceImpl.java index 9b6b278a..af1335ed 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/tender/service/impl/BusBillofquantitiesLimitListServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/tender/service/impl/BusBillofquantitiesLimitListServiceImpl.java @@ -1,29 +1,28 @@ package org.dromara.tender.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import jakarta.validation.constraints.NotNull; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; 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.common.mybatis.core.page.TableDataInfo; import org.dromara.common.utils.excel.ExcelDynamicReader; +import org.dromara.tender.domain.BusBillofquantitiesLimitList; import org.dromara.tender.domain.bo.BusBLimitListVersionsBo; +import org.dromara.tender.domain.bo.BusBillofquantitiesLimitListBo; import org.dromara.tender.domain.bo.TenderAllVersionNumbersReq; import org.dromara.tender.domain.vo.BusBLimitListVersionsVo; +import org.dromara.tender.domain.vo.BusBillofquantitiesLimitListVo; import org.dromara.tender.enums.LimitListTypeEnum; +import org.dromara.tender.mapper.BusBillofquantitiesLimitListMapper; import org.dromara.tender.service.IBusBLimitListVersionsService; +import org.dromara.tender.service.IBusBillofquantitiesLimitListService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.dromara.tender.domain.bo.BusBillofquantitiesLimitListBo; -import org.dromara.tender.domain.vo.BusBillofquantitiesLimitListVo; -import org.dromara.tender.domain.BusBillofquantitiesLimitList; -import org.dromara.tender.mapper.BusBillofquantitiesLimitListMapper; -import org.dromara.tender.service.IBusBillofquantitiesLimitListService; import org.springframework.web.multipart.MultipartFile; import java.math.BigDecimal; @@ -54,7 +53,7 @@ public class BusBillofquantitiesLimitListServiceImpl extends ServiceImpl buildQueryWrapper(BusBillofquantitiesLimitListBo bo) { Map params = bo.getParams(); LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + String versions = bo.getVersions(); + if (StringUtils.isNotBlank(versions) && versions.contains("_")) { + System.out.println("字符串包含 _"); + versions = versions.split("_")[0]; + } // lqw.orderByDesc(BusBillofquantitiesLimitList::getId); lqw.eq(bo.getProjectId() != null, BusBillofquantitiesLimitList::getProjectId, bo.getProjectId()); - lqw.eq(StringUtils.isNotBlank(bo.getVersions()), BusBillofquantitiesLimitList::getVersions, bo.getVersions()); + lqw.eq(StringUtils.isNotBlank(versions), BusBillofquantitiesLimitList::getVersions, versions); lqw.eq(StringUtils.isNotBlank(bo.getSheet()), BusBillofquantitiesLimitList::getSheet, bo.getSheet()); lqw.eq(StringUtils.isNotBlank(bo.getSid()), BusBillofquantitiesLimitList::getSid, bo.getSid()); lqw.eq(StringUtils.isNotBlank(bo.getPid()), BusBillofquantitiesLimitList::getPid, bo.getPid()); @@ -136,7 +140,7 @@ public class BusBillofquantitiesLimitListServiceImpl extends ServiceImpl ids, Boolean isValid) { - if(isValid){ + if (isValid) { //TODO 做一些业务上的校验,判断是否需要校验 } return baseMapper.deleteByIds(ids) > 0; @@ -160,12 +164,12 @@ public class BusBillofquantitiesLimitListServiceImpl extends ServiceImpl listVoList = queryList(bo); //过滤数量和单价为空的数据并计算总价 - listVoList.stream().filter(vo -> vo.getUnitPrice() !=null && vo.getUnitPrice().compareTo(BigDecimal.ZERO) != 0) - .filter(vo ->vo.getQuantity() !=null && vo.getQuantity().compareTo(BigDecimal.ZERO) != 0) + listVoList.stream().filter(vo -> vo.getUnitPrice() != null && vo.getUnitPrice().compareTo(BigDecimal.ZERO) != 0) + .filter(vo -> vo.getQuantity() != null && vo.getQuantity().compareTo(BigDecimal.ZERO) != 0) .forEach(item -> { item.setPrice(item.getUnitPrice().multiply(item.getQuantity()).setScale(2, RoundingMode.HALF_UP)); }); - if (bo.getType().equals(LimitListTypeEnum.SPECIAL.getCode())){ + if (bo.getType().equals(LimitListTypeEnum.SPECIAL.getCode())) { return listVoList; } @@ -204,7 +208,7 @@ public class BusBillofquantitiesLimitListServiceImpl extends ServiceImpl busBillofquantities = new ArrayList(); + List busBillofquantities = new ArrayList(); dataList.stream() .filter(Objects::nonNull) // 过滤掉 null 对象 - .filter(data-> data.getUnitPrice() !=null && data.getUnitPrice().compareTo(BigDecimal.ZERO) != 0)//过滤单价为空的数据 - .filter(data ->data.getQuantity() !=null && data.getQuantity().compareTo(BigDecimal.ZERO) != 0)//过滤数量为空的数据 + .filter(data -> data.getUnitPrice() != null && data.getUnitPrice().compareTo(BigDecimal.ZERO) != 0)//过滤单价为空的数据 + .filter(data -> data.getQuantity() != null && data.getQuantity().compareTo(BigDecimal.ZERO) != 0)//过滤数量为空的数据 .forEach(item -> { - BusBillofquantitiesLimitList limitList = new BusBillofquantitiesLimitList(); - limitList.setId(item.getId()); - limitList.setProjectId(bo.getProjectId()); - limitList.setType(bo.getType()); - limitList.setUnitPrice(item.getUnitPrice()); - busBillofquantities.add(limitList); - }); + BusBillofquantitiesLimitList limitList = new BusBillofquantitiesLimitList(); + limitList.setId(item.getId()); + limitList.setProjectId(bo.getProjectId()); + limitList.setType(bo.getType()); + limitList.setUnitPrice(item.getUnitPrice()); + busBillofquantities.add(limitList); + }); return baseMapper.updateBatchById(busBillofquantities); } @@ -254,7 +258,8 @@ public class BusBillofquantitiesLimitListServiceImpl extends ServiceImpl