From 80954b7ee30797c34588f243e0aeeefe57251dc7 Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Mon, 17 Apr 2023 16:02:09 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BA=93=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=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 | 4 + .../constant/ImportTemplateConstant.java | 31 ++++ .../controller/AnnualPlanController.java | 5 +- .../projectlib/enumeration/ImportTemplateEnum.java | 28 ++++ .../projectlib/manage/AnnualPlanLibManage.java | 174 ++++++++++++++------- .../projectlib/model/dto/AnnualLibImportDTO.java | 12 +- .../pmapi/todocenter/manage/TodoCenterManage.java | 1 + 7 files changed, 191 insertions(+), 64 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/constant/ImportTemplateConstant.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ImportTemplateEnum.java 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 f79e150..7f1dd50 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 @@ -42,6 +42,10 @@ public interface CommonConst { String ITEM_BASED = "依据项:"; String ITEM_BASED_FILE_NAME = "依据文件名:"; String APPENDIX = "文件:"; + String NEW_CONSTRUCTION = "新建"; + String CONTINUED_CONSTRUCTION = "续建"; + String MONTH = "月"; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/constant/ImportTemplateConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/constant/ImportTemplateConstant.java new file mode 100644 index 0000000..2b9f020 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/constant/ImportTemplateConstant.java @@ -0,0 +1,31 @@ +package com.ningdatech.pmapi.projectlib.constant; + +import com.ningdatech.pmapi.projectlib.enumeration.ImportTemplateEnum; + +import java.util.*; + + +/** + *

+ * ImportTemplateEnumConstant + *

+ * + * @author WendyYang + * @since 20:11 2022/11/4 + */ +public class ImportTemplateConstant { + + public static final List ANNUAL_PLAN_COL_LIST = Arrays.asList("序号","项目id","项目名称","建设内容","建设依据","建设性质","建设起止年限(填写到月)", "总投资", "自有资金", "政府投资-本级财政","政府投资-上级补助资金","银行贷款","其他","一季度","二季度","三季度","四季度","建设单位","项目联系人","项目分管领导","备注"); + + private static final Map> IMPORT_TEMPLATE_MAP; + + static { + IMPORT_TEMPLATE_MAP = new HashMap<>(ImportTemplateEnum.values().length); + IMPORT_TEMPLATE_MAP.put(ImportTemplateEnum.ANNUAL_PLAN, ANNUAL_PLAN_COL_LIST); + } + + public static List getTemplateTitle(ImportTemplateEnum template) { + return IMPORT_TEMPLATE_MAP.getOrDefault(template, Collections.emptyList()); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java index be316dd..901d3e4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/controller/AnnualPlanController.java @@ -2,6 +2,7 @@ package com.ningdatech.pmapi.projectlib.controller; import com.ningdatech.basic.model.PageVo; import com.ningdatech.log.annotation.WebLog; +import com.ningdatech.pmapi.projectlib.enumeration.ImportTemplateEnum; import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; import com.ningdatech.pmapi.projectlib.model.req.ProjectApprovedReq; @@ -64,8 +65,8 @@ public class AnnualPlanController { @PostMapping("/importAnnualPlan") @ApiOperation("导入年度计划") @WebLog("导入年度计划") - public void importAnnualPlan(MultipartFile file) { - annualPlanLibManage.importAnnualPlan(file); + public void importAnnualPlan(@RequestParam("template") ImportTemplateEnum template, MultipartFile file) { + annualPlanLibManage.importAnnualPlan(template,file); } @PostMapping("/modify") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ImportTemplateEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ImportTemplateEnum.java new file mode 100644 index 0000000..de78e8f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/enumeration/ImportTemplateEnum.java @@ -0,0 +1,28 @@ +package com.ningdatech.pmapi.projectlib.enumeration; + +import lombok.Getter; + +/** + *

+ * 导入模版枚举 + *

+ * + * @author WendyYang + * @since 2022-11-04 + */ +@Getter +public enum ImportTemplateEnum { + + /** + * 通用导入模版枚举 + */ + + ANNUAL_PLAN("年度计划(增补)库导入"); + + private final String value; + + ImportTemplateEnum(String value) { + this.value = value; + } + +} \ No newline at end of file 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 ab7cb14..371d1df 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 @@ -1,6 +1,9 @@ package com.ningdatech.pmapi.projectlib.manage; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.event.AnalysisEventListener; @@ -13,12 +16,15 @@ import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.CollUtils; import com.ningdatech.basic.util.ValidUtil; import com.ningdatech.pmapi.common.constant.CommonConst; +import com.ningdatech.pmapi.common.enumeration.CommonEnum; import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.datascope.model.DataScopeDTO; import com.ningdatech.pmapi.datascope.utils.DataScopeUtil; +import com.ningdatech.pmapi.projectlib.constant.ImportTemplateConstant; +import com.ningdatech.pmapi.projectlib.enumeration.ImportTemplateEnum; import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; import com.ningdatech.pmapi.projectlib.model.dto.AnnualLibImportDTO; @@ -35,6 +41,7 @@ import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; import com.ningdatech.pmapi.user.util.LoginUserUtil; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -42,6 +49,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.InputStream; +import java.time.LocalDateTime; import java.util.*; import static com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum.*; @@ -162,65 +170,109 @@ public class AnnualPlanLibManage { } @Transactional(rollbackFor = Exception.class) - public void importAnnualPlan(MultipartFile file) { - try (InputStream inputStream = file.getInputStream()) { - EasyExcel.read(inputStream, new AnalysisEventListener() { - - private final List records = new ArrayList<>(); + public void importAnnualPlan(ImportTemplateEnum template, MultipartFile file) { + String contentType = file.getContentType(); + if (!contentType.equals(ExcelUtil.XLS_CONTENT_TYPE) && + !contentType.equals(ExcelUtil.XLSX_CONTENT_TYPE) + ) { + throw BizException.wrap("导入失败,不支持的文件类型,请按照提供的模板导入文件!"); + } + try (InputStream inputStream = file.getInputStream(); + ExcelReader reader = ExcelUtil.getReader(inputStream)) { + Map alias; + List title = ImportTemplateConstant.getTemplateTitle(template); + switch (template) { + case ANNUAL_PLAN: + alias = new HashMap<>(title.size()); + alias.put(title.get(0), "id"); + alias.put(title.get(1), "projectId"); + alias.put(title.get(2), "projectName"); + alias.put(title.get(3), "projectIntroduction"); + alias.put(title.get(4), "buildBasis"); + alias.put(title.get(5), "isFirst"); + alias.put(title.get(6), "buildCycle"); + alias.put(title.get(7), "declaredAmount"); + alias.put(title.get(8), "annualPlanAmount"); + alias.put(title.get(9), "declareHaveAmount"); + alias.put(title.get(10), "declareGovOwnFinanceAmount"); + alias.put(title.get(11), "declareGovSuperiorFinanceAmount"); + alias.put(title.get(12), "declareBankLendingAmount"); + alias.put(title.get(13), "declareOtherAmount"); + alias.put(title.get(14), "firstQuarter"); + alias.put(title.get(15), "secondQuarter"); + alias.put(title.get(16), "thirdQuarter"); + alias.put(title.get(17), "fourthQuarter"); + alias.put(title.get(18), "buildUnitName"); + alias.put(title.get(19), "contactName"); + alias.put(title.get(20), "responsibleMan"); + alias.put(title.get(21), "projectRemarks"); + reader.setHeaderAlias(alias); + importAnnualPlanData(reader.readAll(AnnualLibImportDTO.class)); + break; + default: + throw new BizException("不支持的数据导入类型"); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + } - @Override - public void onException(Exception exception, AnalysisContext context) throws Exception { - super.onException(exception, context); - throw BizException.wrap("导入年度计划解析失败"); - } + private void importAnnualPlanData(List importDataList) { + if (CollectionUtils.isEmpty(importDataList)) { + return; + } + List projectList = new ArrayList<>(); + List projectIds = CollUtils.fieldList(importDataList, AnnualLibImportDTO::getProjectId); + Assert.isTrue(projectIds.size() == importDataList.size(), "项目ID不可重复"); + Long userId = LoginUserUtil.getUserId(); + LocalDateTime now = LocalDateTime.now(); + importDataList.forEach(w -> { + Project project = new Project(); + project.setCreateBy(userId); + project.setCreateOn(now); + project.setUpdateBy(userId); + project.setUpdateOn(now); - @Override - public void invoke(AnnualLibImportDTO data, AnalysisContext context) { - ValidUtil.valid(data); - Project project = new Project(); - project.setId(data.getProjectId()); - project.setProjectName(data.getProjectName()); - project.setProjectRemarks(data.getProjectRemarks()); - project.setEngineeringSpeedOne(data.getEngineeringSpeedOne()); - project.setEngineeringSpeedTwo(data.getEngineeringSpeedTwo()); - project.setEngineeringSpeedThree(data.getEngineeringSpeedThree()); - project.setEngineeringSpeedFour(data.getEngineeringSpeedFour()); - project.setAnnualPlanAmount(data.getAnnualPlanAmount()); - project.setDeclareOtherAmount(data.getDeclareOtherAmount()); - project.setBuildBasis(data.getBuildBasis()); - project.setBuildOrgName(data.getBuildUnitName()); - project.setDeclareBankLendingAmount(data.getDeclareBankLendingAmount()); - project.setDeclareGovOwnFinanceAmount(data.getDeclareGovOwnFinanceAmount()); - project.setDeclareGovSuperiorFinanceAmount(data.getDeclareGovSuperiorFinanceAmount()); - project.setDeclareHaveAmount(data.getDeclareHaveAmount()); - project.setDeclareOtherAmount(data.getDeclareOtherAmount()); - project.setContactName(data.getContactName()); - project.setResponsibleMan(data.getResponsibleMan()); - String[] dataArr = data.getBuildCycle().split("至"); - project.setBeginTime(dataArr[0].trim()); - project.setEndTime(dataArr[1].trim()); - project.setProjectIntroduction(data.getProjectIntroduction()); - project.setIsFirst("新建".equals(data.getIsFirst()) ? 1 : 0); - records.add(project); - } + project.setId(w.getProjectId()); + project.setProjectName(w.getProjectName()); + project.setProjectIntroduction(w.getProjectIntroduction()); + // 建设依据(立项依据忽略) + if (CommonConst.NEW_CONSTRUCTION.equals(w.getIsFirst())){ + project.setIsFirst(CommonEnum.YES.getCode()); + }else if (CommonConst.CONTINUED_CONSTRUCTION.equals(w.getIsFirst())){ + project.setIsFirst(CommonEnum.NO.getCode()); + } + String buildCycle = w.getBuildCycle(); + int index = buildCycle.indexOf(CommonConst.MONTH); + if (-1 == index){ + throw new BizException("项目ID为%s的建设起止年限格式不正确,请按照"); + } + String beginTime = buildCycle.substring(0, index + 1); + project.setBeginTime(beginTime); + String endTime = buildCycle.substring(index + 2); + project.setEndTime(endTime); + project.setDeclareAmount(w.getDeclaredAmount()); + project.setAnnualPlanAmount(w.getAnnualPlanAmount()); + project.setDeclareHaveAmount(w.getDeclareHaveAmount()); + project.setDeclareGovOwnFinanceAmount(w.getDeclareGovOwnFinanceAmount()); + project.setDeclareGovSuperiorFinanceAmount(w.getDeclareGovSuperiorFinanceAmount()); + project.setDeclareBankLendingAmount(w.getDeclareBankLendingAmount()); + project.setDeclareOtherAmount(w.getDeclareOtherAmount()); + project.setEngineeringSpeedOne(w.getFirstQuarter()); + project.setEngineeringSpeedTwo(w.getSecondQuarter()); + project.setEngineeringSpeedThree(w.getThirdQuarter()); + project.setEngineeringSpeedFour(w.getFourthQuarter()); - @Override - public void doAfterAllAnalysed(AnalysisContext context) { - if (records.isEmpty()) { - throw BizException.wrap("导入年度计划为空"); - } - List projectIds = CollUtils.fieldList(records, Project::getId); - long count = projectService.count(Wrappers.lambdaQuery(Project.class) - .in(Project::getId, projectIds)); - if (count != records.size()) { - throw BizException.wrap("请确保所有项目都存在"); - } - projectService.updateBatchById(records); - } - }).sheet(0).doReadSync(); - } catch (IOException e) { - throw BizException.wrap("导入年度计划失败"); - } + project.setBuildOrgName(w.getBuildUnitName()); + project.setContactName(w.getContactName()); + project.setResponsibleMan(w.getResponsibleMan()); + project.setProjectRemarks(w.getProjectRemarks()); + projectList.add(project); + }); + LambdaQueryWrapper delQuery = Wrappers.lambdaQuery(Project.class) + .in(Project::getId, projectIds); + projectService.remove(delQuery); + projectService.saveBatch(projectList); } public void updateAnnualPlan(ProjectDTO req) { @@ -304,4 +356,14 @@ public class AnnualPlanLibManage { } return user; } + + + public static void main(String[] args) { + String a = "2023年3月至2023年11月"; + int index = a.indexOf("-"); + String b = a.substring(0, index + 1); + System.out.println(b); + String c = a.substring(index + 2); + System.out.println(c); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/AnnualLibImportDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/AnnualLibImportDTO.java index fbfa348..69f35a2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/AnnualLibImportDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/AnnualLibImportDTO.java @@ -62,8 +62,8 @@ public class AnnualLibImportDTO { @NotNull(message = "政府投资-本级财政不能为空") private BigDecimal declareGovOwnFinanceAmount; - @ExcelProperty("政府投资-上级补") - @NotNull(message = "政府投资-上级补不能为空") + @ExcelProperty("政府投资-上级补助资金") + @NotNull(message = "政府投资-上级补助资金不能为空") private BigDecimal declareGovSuperiorFinanceAmount; @ExcelProperty("银行贷款") @@ -76,19 +76,19 @@ public class AnnualLibImportDTO { @ExcelProperty("一季度") @NotBlank(message = "一季度不能为空") - private String engineeringSpeedOne; + private String firstQuarter; @ExcelProperty("二季度") @NotBlank(message = "二季度不能为空") - private String engineeringSpeedTwo; + private String secondQuarter; @ExcelProperty("三季度") @NotBlank(message = "三季度不能为空") - private String engineeringSpeedThree; + private String thirdQuarter; @ExcelProperty("四季度") @NotBlank(message = "四季度不能为空") - private String engineeringSpeedFour; + private String fourthQuarter; @ExcelProperty("建设单位") @NotBlank(message = "建设单位不能为空") diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java index 3523916..1c81f09 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java @@ -662,6 +662,7 @@ public class TodoCenterManage { ResToBeProcessedVO res = new ResToBeProcessedVO(); Project project = projectInfoMap.get(d.getInstanceId()); BeanUtils.copyProperties(project, res); + res.setInstCode(d.getInstanceId()); res.setBuildOrg(project.getBuildOrgName()); res.setDeclaredAmount(project.getDeclareAmount()); res.setProjectId(project.getId()); From 570d8b2d89a61a29751ea1f565494b92a1d74e7d Mon Sep 17 00:00:00 2001 From: CMM <2198256324@qq.com> Date: Mon, 17 Apr 2023 16:06:40 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=BA=93=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/projectlib/manage/AnnualPlanLibManage.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) 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 926ae84..9684ec4 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 @@ -245,7 +245,7 @@ public class AnnualPlanLibManage { String buildCycle = w.getBuildCycle(); int index = buildCycle.indexOf(CommonConst.MONTH); if (-1 == index){ - throw new BizException("项目ID为%s的建设起止年限格式不正确,请按照"); + throw new BizException("项目ID为:" + w.getProjectId() + "的建设起止年限格式不正确,请按照xx年xx月至xx年xx月的格式输入!"); } String beginTime = buildCycle.substring(0, index + 1); project.setBeginTime(beginTime); @@ -356,14 +356,4 @@ public class AnnualPlanLibManage { } return user; } - - - public static void main(String[] args) { - String a = "2023年3月至2023年11月"; - int index = a.indexOf("-"); - String b = a.substring(0, index + 1); - System.out.println(b); - String c = a.substring(index + 2); - System.out.println(c); - } } From 19409ae9ba1ce418c6a3d2423d2009a0c62b5af5 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 17 Apr 2023 16:10:37 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E9=A2=84=E5=AE=A1=20debug=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectdeclared/manage/PrequalificationDeclaredProjectManage.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java index 9880632..7414192 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java @@ -112,7 +112,9 @@ public class PrequalificationDeclaredProjectManage { .throwMessage("提交失败 该项目不是 待预审状态(省级部门联审成功)或者未立项阶段"); //使用状态机 进入下一步 看看需不需要走省级审批 放入文件 - projectInfo.setHigherLineSuperOrgReviewComments(projectDto.getHigherLineSuperOrgReviewComments()); + if(StringUtils.isNotBlank(projectDto.getHigherLineSuperOrgReviewComments())){ + projectInfo.setHigherLineSuperOrgReviewComments(projectDto.getHigherLineSuperOrgReviewComments()); + } stateMachineUtils.pass(projectInfo); String instanceId = null; //如果是省级部门 需要联审的(申报金额大于1000万 并且是市级项目) From 07209d1204a4655b46d58c1d8786bb626a3a1c8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?niohe=C2=B7erbao?= Date: Mon, 17 Apr 2023 16:13:35 +0800 Subject: [PATCH 4/7] =?UTF-8?q?fix=20=E7=94=A8=E6=88=B7=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ningdatech/pmapi/user/manage/UserInfoManage.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java index 2556ea8..cc293b3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java @@ -125,10 +125,6 @@ public class UserInfoManage { } private List getCompliantOrgEmpCodeList(String orgName, String orgCode, Long regionId) { - if (Objects.nonNull(regionId) && regionId == 331100L) { - // 丽水默认查全部 - regionId = null; - } if (StringUtils.isBlank(orgName) && StringUtils.isBlank(orgCode) && Objects.isNull(regionId)) { return null; } @@ -434,7 +430,7 @@ public class UserInfoManage { userInfo.setUserName(u.getRealName()); // 根据 单位code获取单位名称 UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(u.getId()); - if(Objects.nonNull(userFullInfo)){ + if (Objects.nonNull(userFullInfo)) { userInfo.setOrgCode(userFullInfo.getEmpPosUnitCode()); userInfo.setOrgName(userFullInfo.getEmpPosUnitName()); } @@ -443,12 +439,12 @@ public class UserInfoManage { } public Map getUserMapByEmployeeCode(Set staterUsers) { - if(CollUtil.isEmpty(staterUsers)){ + if (CollUtil.isEmpty(staterUsers)) { return Collections.emptyMap(); } List userInfos = iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class) - .in(UserInfo::getEmployeeCode,staterUsers)); - if(CollUtil.isEmpty(userInfos)){ + .in(UserInfo::getEmployeeCode, staterUsers)); + if (CollUtil.isEmpty(userInfos)) { return Collections.emptyMap(); } return userInfos.stream().map(u -> { @@ -457,7 +453,7 @@ public class UserInfoManage { userInfo.setUserName(u.getRealName()); // 根据 单位code获取单位名称 UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(u.getId()); - if(Objects.nonNull(userFullInfo)){ + if (Objects.nonNull(userFullInfo)) { userInfo.setOrgCode(userFullInfo.getEmpPosUnitCode()); userInfo.setOrgName(userFullInfo.getEmpPosUnitName()); } @@ -472,7 +468,7 @@ public class UserInfoManage { processInstanceUserDto.setUserName(userInfo.getRealName()); // 根据 单位code获取单位名称 UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userInfo.getId()); - if(Objects.nonNull(userFullInfo)){ + if (Objects.nonNull(userFullInfo)) { processInstanceUserDto.setOrgCode(userFullInfo.getEmpPosUnitCode()); processInstanceUserDto.setOrgName(userFullInfo.getEmpPosUnitName()); } From e69eb0a9457c26df83932180f5803686e3bc4310 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 17 Apr 2023 16:33:15 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E9=A2=84=E5=AE=A1=20debug=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java | 3 +++ .../com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java | 2 ++ .../java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java | 2 ++ 3 files changed, 7 insertions(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java index 06bb9f9..4234cd0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/entity/ProjectDraft.java @@ -299,6 +299,9 @@ public class ProjectDraft implements Serializable { @ApiModelProperty("用户id") private String userId; + @ApiModelProperty("项目申报书") + private String projectApplicationForm; + private Long createBy; private Long updateBy; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java index 848151c..2727ff0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/model/vo/ProjectDraftVO.java @@ -303,6 +303,8 @@ public class ProjectDraftVO implements Serializable { @ApiModelProperty("21位项目编号") private String projectCode; + @ApiModelProperty("项目申报书") + private String projectApplicationForm; private Long createBy; private Long updateBy; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java index 8de53b9..369349d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java @@ -51,6 +51,7 @@ public class WorkbenchManage { public WorkbenchVO getWorkbenchData(Integer year){ WorkbenchVO res = new WorkbenchVO(); + UserInfoDetails user = LoginUserUtil.loginUserDetail(); //1.待办中心数据 TodoCenterStatisticsVO statisticsVO = todoCenterManage.todoCenterStatistics(); @@ -70,6 +71,7 @@ public class WorkbenchManage { projectListReq.setPageNumber(1); projectListReq.setPageSize(5); projectListReq.setProjectYear(year); + projectListReq.setBuildOrgCode(user.getEmpPosUnitCode()); res.setProjects(projectLibManage.projectLibListWithPermission(projectListReq).getRecords().stream().collect(Collectors.toList())); //3.所有公告按类型分 From 92bb8571745844c6c918f0944ad34e57d05dcfb3 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 17 Apr 2023 17:32:57 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E4=B8=AD=E6=96=87=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java | 2 ++ .../main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java | 3 +++ 2 files changed, 5 insertions(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java index cc293b3..7a2d392 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java @@ -416,6 +416,8 @@ public class UserInfoManage { resUserDetailVO.setOrgCode(userFullInfo.getOrganizationCode()); resUserDetailVO.setOrgName(userFullInfo.getOrganizationName()); resUserDetailVO.setRegionCode(userFullInfo.getRegionCode()); + resUserDetailVO.setRegionName(regionCacheHelper.getRegionName(userFullInfo.getRegionCode() + ,RegionConst.RL_COUNTY)); resUserDetailVO.setEmpPosUnitCode(userFullInfo.getEmpPosUnitCode()); resUserDetailVO.setEmpPosUnitName(userFullInfo.getEmpPosUnitName()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java index ba3766a..f5b50e8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/model/vo/ResUserDetailVO.java @@ -4,9 +4,11 @@ import com.ningdatech.pmapi.common.constant.RegionConst; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import org.apache.commons.lang3.StringUtils; import java.time.LocalDateTime; import java.util.List; +import java.util.Objects; /** * @author liuxinxin @@ -40,6 +42,7 @@ public class ResUserDetailVO { @ApiModelProperty("所属区域") private Long regionId; private String regionCode; + private String regionName; @ApiModelProperty("用户任职所在单位code") private String empPosUnitCode; From 20df406586c3d53c085c02eedc0bb22c9ed23320 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 17 Apr 2023 18:02:36 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E5=AE=9E=E4=BE=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ningdatech/pmapi/datascope/provider/DataScopeContext.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/DataScopeContext.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/DataScopeContext.java index 7d55cae..c8e5148 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/DataScopeContext.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/DataScopeContext.java @@ -4,6 +4,7 @@ import com.ningdatech.basic.util.SpringUtils; import com.ningdatech.pmapi.datascope.model.DataScopeDTO; import lombok.RequiredArgsConstructor; +import java.io.Serializable; import java.util.Map; import java.util.Optional; @@ -16,7 +17,7 @@ import java.util.Optional; * @since 2022/1/9 23:28 */ @RequiredArgsConstructor -public class DataScopeContext { +public class DataScopeContext implements Serializable { private static final String WARN_MSG = "请先创建数据权限[%s]的实现类,使其实现 DataScopeProvider";