From b4fa645321c14acdf78189fc01b44c7b740cafa9 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Wed, 19 Apr 2023 18:17:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BA=93=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E8=A1=A8=E5=AF=BC=E5=87=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/common/constant/CommonConst.java | 1 + .../projectlib/manage/AnnualPlanLibManage.java | 109 +++++++++------------ ...2023年数字化项目年度计划编辑表.xls | Bin 31744 -> 31232 bytes 3 files changed, 50 insertions(+), 60 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java index 927e682..3e7e9b0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java @@ -47,6 +47,7 @@ public interface CommonConst { String CONTINUED_CONSTRUCTION = "续建"; String MONTH = "月"; String ZHI = "至"; + String YEAR = "年"; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java index 14c6dcc..5bf8d96 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/AnnualPlanLibManage.java @@ -86,23 +86,10 @@ public class AnnualPlanLibManage { /** * 年度计划查询状态 */ - private static final List ANNUAL_PLAN_LIST_STATUS = Arrays.asList( - IN_THE_ANNUAL_PLAN, - SCHEME_UNDER_REVIEW, - SCHEME_REVIEW_FAILED, - TO_BE_APPROVED, - TO_BE_DECLARED, - PLAN_TO_BE_DECLARED, - PENDING_PREQUALIFICATION_CHOICE, - PROJECT_APPROVED, - TO_BE_PURCHASED, - UNDER_CONSTRUCTION, - TO_BE_FINALLY_INSPECTED, - FINAL_ACCEPTANCE_IS_UNDER_REVIEW, - FINAL_ACCEPTANCE_REVIEW_FAILED, - ARCHIVED - ); - + private static final List ANNUAL_PLAN_LIST_STATUS = + Arrays.asList(IN_THE_ANNUAL_PLAN, SCHEME_UNDER_REVIEW, SCHEME_REVIEW_FAILED, TO_BE_APPROVED, TO_BE_DECLARED, + PLAN_TO_BE_DECLARED, PENDING_PREQUALIFICATION_CHOICE, PROJECT_APPROVED, TO_BE_PURCHASED, UNDER_CONSTRUCTION, + TO_BE_FINALLY_INSPECTED, FINAL_ACCEPTANCE_IS_UNDER_REVIEW, FINAL_ACCEPTANCE_REVIEW_FAILED, ARCHIVED); public PageVo annulPlanLibList(ProjectListReq req) { LambdaQueryWrapper query = ProjectHelper.projectQuery(req); @@ -111,10 +98,10 @@ public class AnnualPlanLibManage { throw new BizException("请传入是否临时增补标志!"); } query.eq(Project::getIsTemporaryAugment, isTemporaryAugment); - query.eq(Project::getNewest,Boolean.TRUE); + query.eq(Project::getNewest, Boolean.TRUE); query.orderByDesc(Project::getAnnualPlanAddTime); query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); - //数据权限 + // 数据权限 buildProjectLibPermission(query); Page page = projectService.page(req.page(), query); long total; @@ -162,15 +149,12 @@ public class AnnualPlanLibManage { public void projectApproved(ProjectApprovedReq req) { Project project = projectService.getById(req.getProjectId()); stateMachine.pass(project); - LambdaUpdateWrapper update = Wrappers.lambdaUpdate(Project.class) - .set(Project::getApprovalAmount, req.getApprovedAmount()) - .set(Project::getApprovedFile, req.getApprovedFileId()) - .set(Project::getBuildCycle, req.getBuildCycle()) + LambdaUpdateWrapper update = + Wrappers.lambdaUpdate(Project.class).set(Project::getApprovalAmount, req.getApprovedAmount()) + .set(Project::getApprovedFile, req.getApprovedFileId()).set(Project::getBuildCycle, req.getBuildCycle()) .set(Project::getApprovedConstructionPlanFile, req.getBuildPlanFileId()) - .set(Project::getApprovalDate, req.getApprovedDate()) - .set(Project::getStatus, project.getStatus()) - .set(Project::getStage, project.getStage()) - .eq(Project::getId, req.getProjectId()); + .set(Project::getApprovalDate, req.getApprovedDate()).set(Project::getStatus, project.getStatus()) + .set(Project::getStage, project.getStage()).eq(Project::getId, req.getProjectId()); projectService.update(update); } @@ -196,7 +180,7 @@ public class AnnualPlanLibManage { param.setIsTemporaryAugment(isTemporaryAugment); param.setStatusList(CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); LambdaQueryWrapper query = ProjectHelper.projectQuery(param); - query.eq(Project::getNewest,Boolean.TRUE); + query.eq(Project::getNewest, Boolean.TRUE); query.orderByDesc(Project::getAnnualPlanAddTime); List projects = projectService.list(query); @@ -204,9 +188,9 @@ public class AnnualPlanLibManage { ProjectLibFlagEnum projectLibFlag = param.getProjectLibFlag(); String fileName = null; - if (ProjectLibFlagEnum.ANNUAL_PLAN.equals(projectLibFlag)){ + if (ProjectLibFlagEnum.ANNUAL_PLAN.equals(projectLibFlag)) { fileName = "年度计划库列表"; - }else if (ProjectLibFlagEnum.ANNUAL_PLAN_SUPPLEMENT.equals(projectLibFlag)){ + } else if (ProjectLibFlagEnum.ANNUAL_PLAN_SUPPLEMENT.equals(projectLibFlag)) { fileName = "年度计划增补库列表"; } excelExportWriter.setFileName(fileName); @@ -239,22 +223,22 @@ public class AnnualPlanLibManage { } switch (currentUserDataScope.get().getRole()) { case NORMAL_MEMBER: - //普通用户 只能看到自己单位去申报的 + // 普通用户 只能看到自己单位去申报的 query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); break; case COMPANY_MANAGER: - //单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 + // 单位管理员 看到自己单位去申报的 + 待预审的主管单位是自己单位的项目 query.eq(Project::getBuildOrgCode, user.getEmpPosUnitCode()); break; case SUPER_ADMIN: - //超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 + // 超级管理员 看到丽水全市的 并且也要判断他 同时是不是单位管理员 break; case REGION_MANAGER: - //区域管理员 看到自己区域的项目 + // 区域管理员 看到自己区域的项目 query.eq(Project::getAreaCode, user.getRegionCode()); break; default: - //没有权限的话 就让它查不到 + // 没有权限的话 就让它查不到 query.eq(Project::getId, "NULL"); break; } @@ -278,16 +262,15 @@ public class AnnualPlanLibManage { throw new BizException(e.getMessage()); } // 筛选出导入的新建项目 - List newList = list.stream() - .filter(d -> CommonConst.NEW_CONSTRUCTION.equals(d.getIsFirst())) - .collect(Collectors.toList()); + List newList = + list.stream().filter(d -> CommonConst.NEW_CONSTRUCTION.equals(d.getIsFirst())).collect(Collectors.toList()); List projectList = newList.stream().map(n -> { Project project = new Project(); assemblyProjectInfo(n, project); // 根据传入标志判断是否临时增补 - if (ProjectLibFlagEnum.ANNUAL_PLAN.equals(importFlag)){ + if (ProjectLibFlagEnum.ANNUAL_PLAN.equals(importFlag)) { project.setIsTemporaryAugment(CommonEnum.NO.getCode()); - }else if (ProjectLibFlagEnum.ANNUAL_PLAN_SUPPLEMENT.equals(importFlag)){ + } else if (ProjectLibFlagEnum.ANNUAL_PLAN_SUPPLEMENT.equals(importFlag)) { project.setIsTemporaryAugment(CommonEnum.YES.getCode()); } project.setCreateBy(userId); @@ -301,8 +284,7 @@ public class AnnualPlanLibManage { // 筛选出导入的续建项目 List continuedList = list.stream() - .filter(d -> CommonConst.CONTINUED_CONSTRUCTION.equals(d.getIsFirst())) - .collect(Collectors.toList()); + .filter(d -> CommonConst.CONTINUED_CONSTRUCTION.equals(d.getIsFirst())).collect(Collectors.toList()); List renewalFundDeclarationList = continuedList.stream().map(c -> { ProjectRenewalFundDeclaration renewalFundDeclaration = new ProjectRenewalFundDeclaration(); BeanUtils.copyProperties(c, renewalFundDeclaration); @@ -324,8 +306,8 @@ public class AnnualPlanLibManage { // 建设依据忽略 project.setIsFirst(CommonConst.NEW_CONSTRUCTION.equals(data.getIsFirst()) ? 1 : 0); String[] dataArr = data.getBuildCycle().split(CommonConst.ZHI); - if (CollectionUtils.isEmpty(Arrays.asList(dataArr))){ - throw new BizException("项目ID为:" + data.getProjectId() + "的建设起止年限格式不正确,请按照xx年xx月至xx年xx月的格式输入!"); + if (CollectionUtils.isEmpty(Arrays.asList(dataArr))) { + throw new BizException("项目ID为:" + data.getProjectId() + "的建设起止年限格式不正确,请按照xx年xx月至xx年xx月的格式输入!"); } project.setBeginTime(dataArr[0].trim()); project.setEndTime(dataArr[1].trim()); @@ -352,10 +334,10 @@ public class AnnualPlanLibManage { Integer isTemporaryAugment = null; String fileName = null; // 设置excel的文件名称和是否增补 - if (ProjectLibFlagEnum.ANNUAL_PLAN.equals(projectLibFlag)){ + if (ProjectLibFlagEnum.ANNUAL_PLAN.equals(projectLibFlag)) { isTemporaryAugment = 0; fileName = "丽水市" + year + "年数字化项目年度计划库编辑表"; - }else if (ProjectLibFlagEnum.ANNUAL_PLAN_SUPPLEMENT.equals(projectLibFlag)){ + } else if (ProjectLibFlagEnum.ANNUAL_PLAN_SUPPLEMENT.equals(projectLibFlag)) { isTemporaryAugment = 1; fileName = "丽水市" + year + "年数字化项目年度计划增补库编辑表"; } @@ -363,30 +345,32 @@ public class AnnualPlanLibManage { query.eq(Project::getIsTemporaryAugment, isTemporaryAugment); query.orderByDesc(Project::getAnnualPlanAddTime); query.in(Project::getStatus, CollUtils.fieldList(ANNUAL_PLAN_LIST_STATUS, ProjectStatusEnum::getCode)); - //数据权限 + // 数据权限 buildProjectLibPermission(query); List projects = projectService.list(query); List list = projects.stream().map(p -> { AnnualLibExportDTO dto = new AnnualLibExportDTO(); BeanUtils.copyProperties(p, dto); - String buildCycle = p.getBuildCycle(); - if (Objects.nonNull(buildCycle)) { - String cycle = buildCycle.replace(StrPool.TILDA, CommonConst.ZHI); - dto.setBuildCycle(cycle); - } + String beginTime = p.getBeginTime(); + String begin = beginTime.replace(StrPool.DASH, CommonConst.YEAR); + begin = begin + CommonConst.MONTH; + String endTime = p.getEndTime(); + String end = endTime.replace(StrPool.DASH, CommonConst.YEAR); + end = end + CommonConst.MONTH; + String buildCycle = begin + CommonConst.ZHI + end; + dto.setBuildCycle(buildCycle); dto.setProjectId(p.getId()); dto.setDeclaredAmount(p.getDeclareAmount()); dto.setBuildUnitName(p.getBuildOrgName()); String buildBasis = p.getBuildBasis(); List fileArray = JSON.parseArray(buildBasis, JSONObject.class); - List nameList = CollUtils.fieldList(fileArray, w -> - w.getString(CommonConst.TITLE) + StrPool.LEFT_BRACKET + - w.getString(CommonConst.BASIS_FILE_NAME) + StrPool.RIGHT_BRACKET); + List nameList = CollUtils.fieldList(fileArray, w -> w.getString(CommonConst.TITLE) + + StrPool.LEFT_BRACKET + w.getString(CommonConst.BASIS_FILE_NAME) + StrPool.RIGHT_BRACKET); String basis = nameList.stream().collect(Collectors.joining(StrPool.COMMA)); dto.setBuildBasis(basis); - if (CommonEnum.YES.getCode().equals(p.getIsFirst())){ + if (CommonEnum.YES.getCode().equals(p.getIsFirst())) { dto.setIsFirst(CommonConst.NEW_CONSTRUCTION); - }else if (CommonEnum.NO.getCode().equals(p.getIsFirst())){ + } else if (CommonEnum.NO.getCode().equals(p.getIsFirst())) { dto.setIsFirst(CommonConst.CONTINUED_CONSTRUCTION); } dto.setFirstQuarter(p.getEngineeringSpeedOne()); @@ -405,10 +389,14 @@ public class AnnualPlanLibManage { // 获取本地目录的年度计划编辑表Excel模板 File directory = new File(""); String templateName = "丽水市" + year + "年数字化项目年度计划编辑表"; - String templatePath = directory.getAbsolutePath() + File.separator + "template" + File.separator + templateName + ".xls"; + String templatePath = + directory.getAbsolutePath() + File.separator + "template" + File.separator + templateName + ".xls"; TemplateExportParams temp = new TemplateExportParams(templatePath); - HashMap map = new HashMap<>(); + temp.setSheetNum(new Integer[] {0, 1}); + temp.setSheetName(new String[] {"实施类(新建)", "实施类(续建)"}); + Map map = new HashMap<>(4); map.put("mapList", list); + map.put("mapList1", null); Workbook workbook = ExcelExportUtil.exportExcel(temp, map); if (workbook == null) { throw new BizException("读取模板失败!"); @@ -416,7 +404,8 @@ public class AnnualPlanLibManage { // 重置响应对象 response.reset(); try { - response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + URLEncoder.encode(Objects.requireNonNull(fileName),"UTF-8") + ".xls"); + response.setHeader("Content-disposition", + "attachment;filename*=utf-8''" + URLEncoder.encode(Objects.requireNonNull(fileName), "UTF-8") + ".xls"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } diff --git a/template/丽水市2023年数字化项目年度计划编辑表.xls b/template/丽水市2023年数字化项目年度计划编辑表.xls index d078e2ab7bd1bfd59b168e64110c5e1dd201ebc9..dccfe42f8187c9f2cbfe2fc72c6d7af56b214370 100644 GIT binary patch delta 1718 zcmZ`)Z)j6j6hHUny`)K-`d;#qo0mVDZZ@@d#O&*Ju0u?1-3k zw=G;cdh*R*SUXOL2ZYHHyf41ZzSs9j(+<7SJzj?&Dj|GFS*ytu`B#y~&&e9>k!@5XV_!sNPS?;=fL4Q#tl343QZw^FM(~fNM{d(Ir}}#2!McnIjhSSWR?= ziOTp%fRlEHjVWTP|uL8uoBzB{XGMRXnWj7V z?2hrYwR44Pd`#ccx~#w>=S`nC)&5(o$(e`qCx$?8SpJ6#&n9G2V?Obm)WT#^KE3*P z6k0p#MNnp3MHC)@50#dO*wy-h!v!3_OD5>vxs%)=-2)BYGW_+{r{)CdZ)k>nG`;Ii zLmQy51`>F4&05`;`qHC%VGD@B*6&(27>6{W|G-wf-1)EmYgc@X`Hs^p~NRZN7*< sjfU{TXvhJufIVYezdKrRU|~FjUyb+RaWQ^m;zvVUs)9y|X*NWUK=%!q?HQ0B|Rp&GNmC^mf|YY46C{)n(y%=IHtMM(=^q z?^zo@V?H5>hw(r2i|n@gtYyrE=j>Lr+9maG`_p!OS!~9H6ksCGiZYY%D{&7Fivi|A zQIeS#caaqFQ7NwYsKQ@aH^Aql@W)&dxd~qI<2zEE$+#fxDdH2>d;-YaGE+1e#4G+d ze&h+T3LJ8WF(pb$n9^yvuR{;1RRHr^TqQ1hs^+S|+@|@^)I~EmHS{jLMd;nR*y}I^(3$V8nlq-<nIPc0(z^AqFJhb{hMdGsneT6n5kjUJ}_vZoMj#SSTqlO8KR zAW1ByF8iyP_V;1Ai^VW14_YiVRt7HxWR{bQ0a?kgAi!~g_#^1YYa=y-VWl|g(9nl8 zGz9Pn52VM4b&{IFv3x9J2}o>0&*o8)B_f0x*UGv%mPc-iEeqzl5+M=cu->y?cjp@F zCNz@ks)YP9cqGVYeTMXO`)$Zsen!quOK}?L0-XiFJD+XId4FOD57?$n(8s2izSNyY(L2 zBCI$wKb)FIOq@#bEB2ar?mAt=}fSabig#|n3FWV5Xua!ob=03N?tAl6X83M z;JBH;WV&cwgA|;BR@NyJKEexc4jcFl_448`!{krHi21{PWX>ikH8-hfYzeD;)Iu$?pCc~z-B zjp5XUT`NQaZ=@8QOUb45$)-y*p9Q!H>W``SO}LbCWD21DznpK>z>%