From c3393be9736dc2384093ca1c04ce2d2174eda467 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 8 Sep 2023 13:48:07 +0800 Subject: [PATCH 01/36] =?UTF-8?q?PDF=E8=BD=AC=E6=8D=A2=20=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E9=A1=B9=E7=9B=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java index 4af974e..344cb92 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java @@ -161,7 +161,7 @@ public class SynProjectCollectionTask { StringJoiner sj = collectionManage.convertAndUpload(apply.getBaseResearchReportFile()); apply.setBaseResearchReportFilePdf(sj.toString()); } - if(StringUtils.isBlank(apply.getBaseOperatMaintenFilePdf()) && StringUtils.isNotBlank(apply.getBaseOperatMaintenFilePdf())){ + if(StringUtils.isBlank(apply.getBaseOperatMaintenFilePdf()) && StringUtils.isNotBlank(apply.getBaseOperatMaintenFile())){ StringJoiner sj = collectionManage.convertAndUpload(apply.getBaseOperatMaintenFile()); apply.setBaseOperatMaintenFilePdf(sj.toString()); } From 42f573503cdb4fd34fe4c263644aefd4bdd16788 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 8 Sep 2023 16:34:29 +0800 Subject: [PATCH 02/36] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E5=BC=82=E6=AD=A5=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B1=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov/manage/GovProjectCollectionManage.java | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java index 894f0dc..ba8fc9d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java @@ -534,26 +534,26 @@ public class GovProjectCollectionManage { String finalBaseProjId = baseProjId; UserInfoDetails finalUser = user; - threadPoolTaskScheduler.execute(() -> { - Integer index = 1; - for(GovBizProjectProcureDTO procure : procures){ - procure.setBaseProjId(finalBaseProjId); - procure.setBaseProjName(baseProjName); - procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + index); - GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure,GovBizProjectProcure.class); - saveProcure.setBaseProjId(finalBaseProjId); - saveProcure.setId(null); - saveProcure.setAreaCode(RegionConst.RC_LS); - saveProcure.setTongTime(LocalDateTime.now()); - saveProcure.setBizTime(LocalDateTime.now()); - saveProcure.setUpdateBy(finalUser.getUsername()); - saveProcure.setUpdateOn(LocalDateTime.now()); - if(procureService.save(saveProcure)){ - uploadFileToProvincialOssProcure(procure,null,saveProcure); - } - index++; + + Integer index = 1; + for(GovBizProjectProcureDTO procure : procures){ + procure.setBaseProjId(finalBaseProjId); + procure.setBaseProjName(baseProjName); + procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + index); + GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure,GovBizProjectProcure.class); + saveProcure.setBaseProjId(finalBaseProjId); + saveProcure.setId(null); + saveProcure.setAreaCode(RegionConst.RC_LS); + saveProcure.setTongTime(LocalDateTime.now()); + saveProcure.setBizTime(LocalDateTime.now()); + saveProcure.setUpdateBy(finalUser.getUsername()); + saveProcure.setUpdateOn(LocalDateTime.now()); + if(procureService.save(saveProcure)){ + threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssProcure(procure,null,saveProcure)); } - }); + index++; + } + } //7. 推送数据(改为定时推送了) From b2d75e874580eb8fbaaf235e48366b5671592cd5 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 8 Sep 2023 17:22:17 +0800 Subject: [PATCH 03/36] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E5=BC=82=E6=AD=A5=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B1=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java | 1 + 1 file changed, 1 insertion(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java index ba8fc9d..33d27e7 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java @@ -409,6 +409,7 @@ public class GovProjectCollectionManage { saveBase.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); if(Objects.nonNull(oldBaseInfo)){ saveBase.setId(oldBaseInfo.getId()); + saveBase.setBaseAreaCode(null); }else{ saveBase.setTongTime(LocalDateTime.now()); saveBase.setBaseAreaCode(baseAreaCode); From c94c642b38715b5a8a6cc23627ac422fdd440ff0 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 8 Sep 2023 17:23:44 +0800 Subject: [PATCH 04/36] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E5=BC=82=E6=AD=A5=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B1=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/gov/manage/GovProjectCollectionManage.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java index 33d27e7..bb8ce3b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java @@ -387,10 +387,6 @@ public class GovProjectCollectionManage { String baseProjId = base.getBaseProjId(); String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; String baseProjName = base.getBaseProjName(); - //如果是新增的话 要生成 项目编号 - if(StringUtils.isBlank(baseProjId) || BizProjectContant.ProjectCollection.DRAFT.equals(baseProjId)){ - baseProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); - } //1.保存基本信息 GovBizProjectBaseinfoDTO baseinfo = saveDTO.getBaseinfo(); @@ -418,6 +414,12 @@ public class GovProjectCollectionManage { saveBase.setBizTime(LocalDateTime.now()); saveBase.setUpdateBy(user.getUsername()); saveBase.setUpdateOn(LocalDateTime.now()); + + //如果是新增的话 要生成 项目编号 + if(StringUtils.isBlank(baseProjId) || BizProjectContant.ProjectCollection.DRAFT.equals(baseProjId)){ + baseProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); + } + baseinfoService.saveOrUpdate(saveBase); // 2.保存 申报信息 From b7856b41fb1825e7d37a2d3e7d27957e7acaf483 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 8 Sep 2023 18:01:38 +0800 Subject: [PATCH 05/36] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E5=BC=82=E6=AD=A5=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B1=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projectCollection/ProjectCollectionTest.java | 57 ++++++++++++---------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java index e4c5398..044249c 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java @@ -2,6 +2,7 @@ package com.ningdatech.pmapi.projectCollection; import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; import com.ningdatech.pmapi.AppTests; import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO; @@ -12,6 +13,9 @@ import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; +import java.util.ArrayList; +import java.util.List; + /** * @Classname ProjectCollectionTest * @Description @@ -43,33 +47,36 @@ public class ProjectCollectionTest extends AppTests { @Test public void test(){ - String baseProjId = "33112500020210100003"; - GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId)); - GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId, baseProjId)); + List baseProjIds = Lists.newArrayList("33112720210100190","33112620230100053", + "33112620210100189","33112720210100188"); + for(String baseProjId : baseProjIds){ + GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId)); + GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) + .eq(GovBizProjectApply::getBaseProjId, baseProjId)); - GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); - saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); - saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class)); - String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); + GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); + saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); + saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class)); + String newProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); - baseinfo.setBaseProjId(newProjId); - baseinfoService.updateById(baseinfo); - apply.setBaseProjId(newProjId); - applyService.updateById(apply); - approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId,baseProjId) - .set(GovBizProjectApprove::getBaseProjId,newProjId)); - cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId,baseProjId) - .set(GovBizProjectCimplement::getBaseProjId,newProjId)); - mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId,baseProjId) - .set(GovBizProjectMimplement::getBaseProjId,newProjId)); - procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId,baseProjId) - .set(GovBizProjectProcure::getBaseProjId,newProjId)); + baseinfo.setBaseProjId(newProjId); + baseinfoService.updateById(baseinfo); + apply.setBaseProjId(newProjId); + applyService.updateById(apply); + approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId,baseProjId) + .set(GovBizProjectApprove::getBaseProjId,newProjId)); + cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId,baseProjId) + .set(GovBizProjectCimplement::getBaseProjId,newProjId)); + mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId,baseProjId) + .set(GovBizProjectMimplement::getBaseProjId,newProjId)); + procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId,baseProjId) + .set(GovBizProjectProcure::getBaseProjId,newProjId)); + } } } From 99b256d0b1d49aa104b968ad5e3aa2c25a02cd7e Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 11 Sep 2023 14:44:23 +0800 Subject: [PATCH 06/36] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov/manage/GovProjectCollectionManage.java | 13 +- .../sys/enumeration/NoticePermissionsEnum.java | 53 +++++ .../ningdatech/pmapi/sys/manage/NoticeManage.java | 52 +++++ .../ningdatech/pmapi/sys/model/entity/Notice.java | 5 + .../pmapi/sys/model/vo/NoticeDetailVO.java | 3 + .../com/ningdatech/pmapi/irs/EmployeeTest.java | 224 +++++++++++++++++++++ .../projectCollection/ProjectCollectionTest.java | 9 +- 7 files changed, 351 insertions(+), 8 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/sys/enumeration/NoticePermissionsEnum.java create mode 100644 pmapi/src/test/java/com/ningdatech/pmapi/irs/EmployeeTest.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java index bb8ce3b..72c8e72 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java @@ -15,6 +15,7 @@ import com.ningdatech.basic.model.PageVo; import com.ningdatech.basic.util.StrPool; import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.common.constant.RegionConst; +import com.ningdatech.pmapi.common.helper.RegionCacheHelper; import com.ningdatech.pmapi.gov.contants.BizProjectContant; import com.ningdatech.pmapi.gov.convert.ProjectConvert; import com.ningdatech.pmapi.gov.model.dto.*; @@ -99,6 +100,8 @@ public class GovProjectCollectionManage { @Value("${spring.profiles.active}") private String active; + private final RegionCacheHelper regionCacheHelper; + public List dictionary(String type) { List dictionaries = dictionaryService.list(Wrappers.lambdaQuery(GovProjectDictionary.class) @@ -143,7 +146,8 @@ public class GovProjectCollectionManage { Map applyMap = Maps.newHashMap(); if(CollUtil.isNotEmpty(projIds)){ List applys = projectApplyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) - .in(GovBizProjectApply::getBaseProjId,projIds)); + .in(GovBizProjectApply::getBaseProjId,projIds) + .eq(GovBizProjectApply::getDeleted,Boolean.FALSE)); applyMap = applys.stream().collect(Collectors.toMap(GovBizProjectApply::getBaseProjId,a -> a)); } @@ -222,11 +226,10 @@ public class GovProjectCollectionManage { if(RoleEnum.SUPER_ADMIN.name().equals(role.getCode()) || RoleEnum.REGION_MANAGER.name().equals(role.getCode())){ log.info("超管和区管 可以看所有"); - }else{ - //其他情况 都只能看 自己单位的 - wrapper.eq(GovBizProjectBaseinfo::getBaseBuildDeprtDing,user.getEmpPosUnitCode()); + return; } } + wrapper.eq(GovBizProjectBaseinfo::getBaseBuildDeprtDing,user.getEmpPosUnitCode()); } public Long count(ProjectListReq req) { @@ -237,6 +240,7 @@ public class GovProjectCollectionManage { .eq(StringUtils.isNotBlank(req.getRegionCode()),GovBizProjectBaseinfo::getAreaCode,req.getRegionCode()) .gt(Objects.nonNull(req.getCreateOnMin()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMin()) .le(Objects.nonNull(req.getCreateOnMax()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMax()) + .eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE) .orderByDesc(GovBizProjectBaseinfo::getBizTime); return baseinfoService.count(wrapper); } @@ -409,6 +413,7 @@ public class GovProjectCollectionManage { }else{ saveBase.setTongTime(LocalDateTime.now()); saveBase.setBaseAreaCode(baseAreaCode); + saveBase.setBaseAreaName(regionCacheHelper.getRegionName(user.getRegionCode(),RegionConst.RL_COUNTY)); } saveBase.setAreaCode(RegionConst.RC_LS); saveBase.setBizTime(LocalDateTime.now()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/enumeration/NoticePermissionsEnum.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/enumeration/NoticePermissionsEnum.java new file mode 100644 index 0000000..058f95f --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/enumeration/NoticePermissionsEnum.java @@ -0,0 +1,53 @@ +package com.ningdatech.pmapi.sys.enumeration; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.StringUtils; + +import java.util.Objects; + +/** + * + * 公告权限枚举 + * @author ZPF + * @since 2023/02/24 16:14 + */ +@Getter +@NoArgsConstructor +@AllArgsConstructor +public enum NoticePermissionsEnum { + /** + * 公告权限枚举 + */ + SUPER(0, "所有人可看"), + REGION(1, "区域可看"), + ORG(2, "单位可看"); + + private Integer code; + private String desc; + + public static String getDescByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (NoticePermissionsEnum t : NoticePermissionsEnum.values()) { + if (code.equals(t.getCode())) { + return t.desc; + } + } + return StringUtils.EMPTY; + } + + public static String getNameByCode(Integer code) { + if (Objects.isNull(code)) { + return StringUtils.EMPTY; + } + for (NoticePermissionsEnum t : NoticePermissionsEnum.values()) { + if (code.equals(t.getCode())) { + return t.name(); + } + } + return StringUtils.EMPTY; + } +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java index b08a020..9ef91d2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java @@ -1,6 +1,7 @@ package com.ningdatech.pmapi.sys.manage; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -21,9 +22,11 @@ import com.ningdatech.pmapi.organization.service.IDingOrganizationService; import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.staging.enums.MsgTypeEnum; import com.ningdatech.pmapi.staging.service.INdWorkNoticeStagingService; +import com.ningdatech.pmapi.sys.enumeration.NoticePermissionsEnum; import com.ningdatech.pmapi.sys.enumeration.NoticeTypeEnum; import com.ningdatech.pmapi.sys.model.entity.Notice; import com.ningdatech.pmapi.sys.model.entity.Notify; +import com.ningdatech.pmapi.sys.model.entity.Role; import com.ningdatech.pmapi.sys.model.req.NoticeListReq; import com.ningdatech.pmapi.sys.model.req.NoticeSaveReq; import com.ningdatech.pmapi.sys.model.req.NoticeStatusModifyReq; @@ -34,8 +37,11 @@ import com.ningdatech.pmapi.sys.service.INotifyService; import com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo; import com.ningdatech.pmapi.todocenter.model.dto.ProjectAuditMsgExtraDTO; import com.ningdatech.pmapi.user.entity.UserInfo; +import com.ningdatech.pmapi.user.entity.enumeration.RoleEnum; import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; +import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; import com.ningdatech.pmapi.user.service.IUserInfoService; +import com.ningdatech.pmapi.user.util.LoginUserUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -85,6 +91,7 @@ public class NoticeManage { @Transactional(rollbackFor = Exception.class) public IdVo saveOrModify(NoticeSaveReq req) { Notice notice = BeanUtil.copyProperties(req, Notice.class); + permissionsSave(notice,LoginUserUtil.loginUserDetail()); noticeService.saveOrUpdate(notice); return IdVo.of(notice.getId()); } @@ -129,6 +136,7 @@ public class NoticeManage { .like(StrUtil.isNotBlank(req.getTitle()), Notice::getTitle, req.getTitle()) .eq(req.getType() != null, Notice::getType, req.getType()) .orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); + permissionsWrapper(wrapper,LoginUserUtil.loginUserDetail()); Page page = noticeService.page(req.page(), wrapper); if (page.getTotal() == 0) { return PageVo.empty(); @@ -280,4 +288,48 @@ public class NoticeManage { } } + + /** + * 公告保存 权限控制 + * @param notice + * @param user + */ + private void permissionsSave(Notice notice, UserInfoDetails user) { + List userRoleList = user.getUserRoleList(); + if(CollUtil.isEmpty(userRoleList)){ + //默认 权限是单位 + notice.setPermissions(NoticePermissionsEnum.ORG.getCode()); + notice.setPermissionsValue(user.getEmpPosUnitCode()); + return; + } + for(Role role : userRoleList){ + if(RoleEnum.SUPER_ADMIN.eq(role.getCode())){ + notice.setPermissions(NoticePermissionsEnum.SUPER.getCode()); + return; + }else if(RoleEnum.REGION_MANAGER.eq(role.getCode())){ + notice.setPermissions(NoticePermissionsEnum.REGION.getCode()); + notice.setPermissionsValue(user.getRegionCode()); + return; + }else if(RoleEnum.COMPANY_MANAGER.eq(role.getCode())){ + notice.setPermissions(NoticePermissionsEnum.ORG.getCode()); + notice.setPermissionsValue(user.getEmpPosUnitCode()); + return; + } + + } + notice.setPermissions(NoticePermissionsEnum.ORG.getCode()); + notice.setPermissionsValue(user.getEmpPosUnitCode()); + } + + /** + * 列表查询 权限体现 + * @param wrapper + */ + private void permissionsWrapper(LambdaQueryWrapper wrapper,UserInfoDetails user) { + wrapper.eq(Notice::getPermissions,NoticePermissionsEnum.SUPER.getCode()) + .or(q1 -> q1.eq(Notice::getPermissions,NoticePermissionsEnum.REGION.getCode()) + .eq(Notice::getPermissionsValue,user.getRegionCode())) + .or(q2 -> q2.eq(Notice::getPermissions,NoticePermissionsEnum.ORG.getCode()) + .eq(Notice::getPermissionsValue,user.getEmpPosUnitCode())); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Notice.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Notice.java index 9a84893..8789660 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Notice.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Notice.java @@ -65,4 +65,9 @@ public class Notice implements Serializable { @ApiModelProperty("置顶时间") private LocalDateTime toppedTime; + @ApiModelProperty("权限控制 0所有人可看 1区域可看 2单位可看") + private Integer permissions; + + @ApiModelProperty("权限值") + private String permissionsValue; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NoticeDetailVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NoticeDetailVO.java index 78bf5cd..8224f37 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NoticeDetailVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NoticeDetailVO.java @@ -37,4 +37,7 @@ public class NoticeDetailVO { @ApiModelProperty("附件信息") private List attachments; + @ApiModelProperty("权限控制 0所有人可看 1区域可看 2单位可看") + private Integer permissions; + } diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/irs/EmployeeTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/irs/EmployeeTest.java new file mode 100644 index 0000000..736954b --- /dev/null +++ b/pmapi/src/test/java/com/ningdatech/pmapi/irs/EmployeeTest.java @@ -0,0 +1,224 @@ +package com.ningdatech.pmapi.irs; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.model.GenericResult; +import com.ningdatech.pmapi.AppTests; +import com.ningdatech.pmapi.common.constant.BizConst; +import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; +import com.ningdatech.pmapi.organization.model.entity.DingOrganization; +import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; +import com.ningdatech.pmapi.organization.service.IDingOrganizationService; +import com.ningdatech.pmapi.user.constant.UserAvailableEnum; +import com.ningdatech.pmapi.user.entity.UserInfo; +import com.ningdatech.pmapi.user.service.IUserInfoService; +import com.ningdatech.zwdd.ZwddIntegrationProperties; +import com.ningdatech.zwdd.client.ZwddClient; +import com.ningdatech.zwdd.model.Page; +import com.ningdatech.zwdd.model.dto.EmployeeAccountIdDTO; +import com.ningdatech.zwdd.model.query.PageOrganizationEmployeePositionsQuery; +import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition; +import org.junit.Test; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; + +import java.time.LocalDateTime; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Classname EmployeeTest + * @Description + * @Date 2023/9/11 10:59 + * @Author PoffyZhang + */ +public class EmployeeTest extends AppTests { + + @Autowired + private IDingOrganizationService iDingOrganizationService; + + @Autowired + private ZwddIntegrationProperties zwddIntegrationProperties; + + @Autowired + private IDingEmployeeInfoService iDingEmployeeInfoService; + + @Autowired + private ZwddClient zwddClient; + + @Autowired + private IUserInfoService iUserInfoService; + + @Test + public void test(){ + String orgCode = "GO_3663776dcc2c414db2ed947e225bfc5b"; + DingOrganization org = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class) + .eq(DingOrganization::getOrganizationCode, orgCode) + .last(BizConst.LIMIT_1)); + VUtils.isTrue(Objects.isNull(org)).throwMessage("单位不存在"); + System.out.println("所属单位 {} 要更新员工信息了:" + org.getOrganizationName()); + + List allOrganizationEmployeePositionList = new ArrayList<>(); + String organizationCode = orgCode; + PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); + query.setEmployeeStatus("A"); + query.setOrganizationCode(organizationCode); + query.setReturnTotalSize(true); + query.setTenantId(zwddIntegrationProperties.getTenantId()); + int pageNo = 1; + query.setPageNo(pageNo); + query.setPageSize(100); + + // 查询组织下 用户信息 + GenericResult> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); + Page data = firstPageGenericResult.getData(); + if (Objects.isNull(data)){ + System.out.println("响应为空:{}" + organizationCode); + return; + } + System.out.println(JSON.toJSONString(data.getData())); + if (CollUtil.isNotEmpty(data.getData())) { + allOrganizationEmployeePositionList.addAll(data.getData()); + } + Long totalSize = data.getTotalSize(); + + System.out.println("dingOrganization :{}" + JSON.toJSONString(org)); + + System.out.println("totalSize :{},{}" + totalSize + "," + org.getOrganizationName()); + + List dingEmployeeInfoSaveRecordList = new ArrayList<>(); + assemblerAccountId(allOrganizationEmployeePositionList, dingEmployeeInfoSaveRecordList); + System.out.println("dingEmployeeInfoSaveRecordList :{}" + JSON.toJSONString(dingEmployeeInfoSaveRecordList)); + // 批量保存用户信息 + saveBatch(dingEmployeeInfoSaveRecordList); + } + + private void saveBatch(List dingEmployeeInfoSaveRecordList) { + dingEmployeeInfoSaveRecordList = dingEmployeeInfoSaveRecordList.stream() + .filter(r -> ("true".equals(r.getMainJob()) + && "A".equals(r.getEmpStatus()) + && StringUtils.isNotBlank(r.getEmpPosUnitCode()) + && StringUtils.isNotBlank(r.getEmployeeCode())) + || "GE_48606ed7c10d4d15b0f931a9a4b89f21".equals(r.getEmployeeCode()) + ).collect(Collectors.toList()); + + Set uniqueKeySet = new HashSet(); + + List saveList = new ArrayList<>(); + + for (DingEmployeeInfo dingEmployeeInfo : dingEmployeeInfoSaveRecordList) { + if (uniqueKeySet.add(dingEmployeeInfo.getEmployeeCode() + dingEmployeeInfo.getEmpPosUnitCode())) { + saveList.add(dingEmployeeInfo); + } + } + + List organizations = iDingOrganizationService.list(); + Map organizationMap = organizations.stream().collect(Collectors.toMap(DingOrganization::getOrganizationCode, o -> o)); + + System.out.println("saveList:" + JSON.toJSONString(saveList)); + for (DingEmployeeInfo dingEmployeeInfo : saveList) { + String employeeCode = dingEmployeeInfo.getEmployeeCode(); + + DingEmployeeInfo employeeInfo = iDingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) + .eq(DingEmployeeInfo::getEmployeeCode, employeeCode) + .last(BizConst.LIMIT_1)); + if (Objects.isNull(employeeInfo)) { + iDingEmployeeInfoService.save(dingEmployeeInfo); + } else { + dingEmployeeInfo.setId(employeeInfo.getId()); + iDingEmployeeInfoService.saveOrUpdate(dingEmployeeInfo); + } + generateOrUpdateUserInfo(dingEmployeeInfo,organizationMap); + } + } + + private void assemblerAccountId(List segment, List dingEmployeeInfoSaveRecordList) { + List employeeCodes = segment.stream().map(OrganizationEmployeePosition::getEmployeeCode).distinct().collect(Collectors.toList()); + GenericResult> listGenericResult = zwddClient.listEmployeeAccountIds(employeeCodes); + List employeeAccountIdDTOList = listGenericResult.getData(); + if (CollUtil.isNotEmpty(employeeAccountIdDTOList)) { + Map employeeCodeAccountIdMap = employeeAccountIdDTOList.stream().filter(Objects::nonNull) + .collect(Collectors.toMap(EmployeeAccountIdDTO::getEmployeeCode, EmployeeAccountIdDTO::getAccountId)); + + List dingEmployeeInfos = buildDingEmployeeInfoRecordList(segment); + + dingEmployeeInfos = dingEmployeeInfos.stream().map(r -> { + r.setAccountId(employeeCodeAccountIdMap.get(r.getEmployeeCode())); + return r; + }).collect(Collectors.toList()); + dingEmployeeInfoSaveRecordList.addAll(dingEmployeeInfos); + } + } + private List buildDingEmployeeInfoRecordList(List allOrganizationEmployeePositionList) { + List saveRecordList = new ArrayList<>(); + for (OrganizationEmployeePosition organizationEmployeePosition : allOrganizationEmployeePositionList) { + List govEmployeePositions = organizationEmployeePosition.getGovEmployeePositions(); + if (CollUtil.isNotEmpty(govEmployeePositions)) { + List segmentSaveRecordList = new ArrayList<>(); + for (OrganizationEmployeePosition.GovEmployeePosition govEmployeePosition : govEmployeePositions) { + DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo(); + BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo); + dingEmployeeInfo.setMainJob(govEmployeePosition.getMainJob()); + dingEmployeeInfo.setEmpPosUnitCode(govEmployeePosition.getEmpPosUnitCode()); + dingEmployeeInfo.setEmpPosEmployeeRoleCode(govEmployeePosition.getEmpPosEmployeeRoleCode()); + dingEmployeeInfo.setEmpPosInnerInstitutionCode(govEmployeePosition.getEmpPosInnerInstitutionCode()); + dingEmployeeInfo.setEmployeeCode(govEmployeePosition.getEmployeeCode()); + dingEmployeeInfo.setJobAttributesCode(govEmployeePosition.getJobAttributesCode()); + dingEmployeeInfo.setOrganizationCode(govEmployeePosition.getOrganizationCode()); + dingEmployeeInfo.setEmpPosVirtualOrganizationCode(govEmployeePosition.getEmpPosVirtualOrganizationCode()); + dingEmployeeInfo.setEmpStatus(govEmployeePosition.getStatus()); + dingEmployeeInfo.setCreateOn(LocalDateTime.now()); + dingEmployeeInfo.setUpdateOn(LocalDateTime.now()); + dingEmployeeInfo.setCreateBy(-1L); + dingEmployeeInfo.setUpdateBy(-1L); + segmentSaveRecordList.add(dingEmployeeInfo); + } + saveRecordList.addAll(segmentSaveRecordList); + } else { + DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo(); + BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo); + saveRecordList.add(dingEmployeeInfo); + } + } + return saveRecordList; + } + + public void generateOrUpdateUserInfo(DingEmployeeInfo dingEmployeeInfo,Map organizationMap) { + String employeeCode = dingEmployeeInfo.getEmployeeCode(); + UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) + .eq(UserInfo::getEmployeeCode, employeeCode)); + if (Objects.isNull(userInfo)) { + userInfo = UserInfo.builder() + .accountId(dingEmployeeInfo.getAccountId()) + .username(dingEmployeeInfo.getEmployeeName()) + .realName(dingEmployeeInfo.getEmployeeName()) + .employeeCode(dingEmployeeInfo.getEmployeeCode()) + .available(UserAvailableEnum.DISABLE.name()) + .createBy(-1L) + .updateBy(-1L) + .createOn(LocalDateTime.now()) + .updateOn(LocalDateTime.now()) + .empPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode()) + .avatar(dingEmployeeInfo.getAvatar()) + .build(); + if(StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())){ + DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode()); + userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); + userInfo.setRegionCode(dingOrganization.getDivisionCode()); + } + iUserInfoService.save(userInfo); + }else{ + userInfo.setAvatar(dingEmployeeInfo.getAvatar()); + userInfo.setEmpPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode()); + if(StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())){ + DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode()); + userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); + userInfo.setRegionCode(dingOrganization.getDivisionCode()); + } + iUserInfoService.updateById(userInfo); + } + } +} diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java index 044249c..913a644 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java @@ -47,13 +47,14 @@ public class ProjectCollectionTest extends AppTests { @Test public void test(){ - List baseProjIds = Lists.newArrayList("33112720210100190","33112620230100053", - "33112620210100189","33112720210100188"); + List baseProjIds = Lists.newArrayList("33112700020210100191"); for(String baseProjId : baseProjIds){ GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId)); + .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) + .eq(GovBizProjectBaseinfo::getId,457)); GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjId, baseProjId)); + .eq(GovBizProjectApply::getBaseProjId, baseProjId) + .eq(GovBizProjectApply::getId,451)); GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); From accbc8b98afb82e364873d70246334343ca8a54b Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 11 Sep 2023 14:58:33 +0800 Subject: [PATCH 07/36] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java index 72c8e72..78c5483 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java @@ -404,7 +404,6 @@ public class GovProjectCollectionManage { //项目名去重 checkName(baseProjName,baseProjId); GovBizProjectBaseinfo saveBase = BeanUtil.copyProperties(baseinfo,GovBizProjectBaseinfo.class); - saveBase.setBaseProjId(baseProjId); saveBase.setBaseProjName(baseProjName); saveBase.setIsEffective(BizProjectContant.ProjectCollection.IS_EFFECTIVE); if(Objects.nonNull(oldBaseInfo)){ @@ -423,6 +422,7 @@ public class GovProjectCollectionManage { //如果是新增的话 要生成 项目编号 if(StringUtils.isBlank(baseProjId) || BizProjectContant.ProjectCollection.DRAFT.equals(baseProjId)){ baseProjId = generateProjectCodeUtil.generateProjectCode(saveDTO); + saveBase.setBaseProjId(baseProjId); } baseinfoService.saveOrUpdate(saveBase); From c222383d384ee787f8bbd756f73a3b4c93675f9f Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 11 Sep 2023 15:12:39 +0800 Subject: [PATCH 08/36] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov/manage/GovProjectCollectionManage.java | 13 +++++------ .../ningdatech/pmapi/sys/manage/NoticeManage.java | 25 ++++++++++------------ 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java index 78c5483..5c9c44c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java @@ -220,15 +220,12 @@ public class GovProjectCollectionManage { */ private void permissions(LambdaQueryWrapper wrapper) { UserInfoDetails user = LoginUserUtil.loginUserDetail(); - List userRoleList = user.getUserRoleList(); - for(Role role : userRoleList){ - //超管和区域管理员 - if(RoleEnum.SUPER_ADMIN.name().equals(role.getCode()) || - RoleEnum.REGION_MANAGER.name().equals(role.getCode())){ - log.info("超管和区管 可以看所有"); - return; - } + //超管和区域管理员 + if(user.getSuperAdmin() || user.getRegionAdmin()){ + log.info("超管和区管 可以看所有"); + return; } + wrapper.eq(GovBizProjectBaseinfo::getBaseBuildDeprtDing,user.getEmpPosUnitCode()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java index 9ef91d2..2f454e6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java @@ -302,20 +302,17 @@ public class NoticeManage { notice.setPermissionsValue(user.getEmpPosUnitCode()); return; } - for(Role role : userRoleList){ - if(RoleEnum.SUPER_ADMIN.eq(role.getCode())){ - notice.setPermissions(NoticePermissionsEnum.SUPER.getCode()); - return; - }else if(RoleEnum.REGION_MANAGER.eq(role.getCode())){ - notice.setPermissions(NoticePermissionsEnum.REGION.getCode()); - notice.setPermissionsValue(user.getRegionCode()); - return; - }else if(RoleEnum.COMPANY_MANAGER.eq(role.getCode())){ - notice.setPermissions(NoticePermissionsEnum.ORG.getCode()); - notice.setPermissionsValue(user.getEmpPosUnitCode()); - return; - } - + if(user.getSuperAdmin()){ + notice.setPermissions(NoticePermissionsEnum.SUPER.getCode()); + return; + }else if(user.getRegionAdmin()){ + notice.setPermissions(NoticePermissionsEnum.REGION.getCode()); + notice.setPermissionsValue(user.getRegionCode()); + return; + }else if(user.getIsOrgAdmin()){ + notice.setPermissions(NoticePermissionsEnum.ORG.getCode()); + notice.setPermissionsValue(user.getEmpPosUnitCode()); + return; } notice.setPermissions(NoticePermissionsEnum.ORG.getCode()); notice.setPermissionsValue(user.getEmpPosUnitCode()); From 1684c771230417c470b53174dd54d78cd3bbe444 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 11 Sep 2023 15:31:39 +0800 Subject: [PATCH 09/36] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java | 1 + 1 file changed, 1 insertion(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java index 2f454e6..9e5b34c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java @@ -159,6 +159,7 @@ public class NoticeManage { .like(StrUtil.isNotBlank(req.getTitle()), Notice::getTitle, req.getTitle()) .eq(req.getType() != null, Notice::getType, req.getType()) .orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); + permissionsWrapper(wrapper,LoginUserUtil.loginUserDetail()); List records = noticeService.list(wrapper); return CollUtils.convert(records, w -> NoticeListItemVO .builder() From 1b73033c3cc0706f3f8ac9cf4f086c3222be74df Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 11 Sep 2023 15:41:13 +0800 Subject: [PATCH 10/36] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java | 9 +++++---- .../com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java index 9e5b34c..89aaf71 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java @@ -136,7 +136,8 @@ public class NoticeManage { .like(StrUtil.isNotBlank(req.getTitle()), Notice::getTitle, req.getTitle()) .eq(req.getType() != null, Notice::getType, req.getType()) .orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); - permissionsWrapper(wrapper,LoginUserUtil.loginUserDetail()); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + permissionsWrapper(wrapper,user); Page page = noticeService.page(req.page(), wrapper); if (page.getTotal() == 0) { return PageVo.empty(); @@ -153,13 +154,13 @@ public class NoticeManage { return PageVo.of(tempDataList, page.getTotal()); } - public Map> listToMapByManager(NoticeListReq req) { + public Map> listToMapByManager(NoticeListReq req,UserFullInfoDTO user) { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Notice.class) .eq(req.getEnabled() != null, Notice::getEnabled, req.getEnabled()) .like(StrUtil.isNotBlank(req.getTitle()), Notice::getTitle, req.getTitle()) .eq(req.getType() != null, Notice::getType, req.getType()) .orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); - permissionsWrapper(wrapper,LoginUserUtil.loginUserDetail()); + permissionsWrapper(wrapper,user); List records = noticeService.list(wrapper); return CollUtils.convert(records, w -> NoticeListItemVO .builder() @@ -323,7 +324,7 @@ public class NoticeManage { * 列表查询 权限体现 * @param wrapper */ - private void permissionsWrapper(LambdaQueryWrapper wrapper,UserInfoDetails user) { + private void permissionsWrapper(LambdaQueryWrapper wrapper,UserFullInfoDTO user) { wrapper.eq(Notice::getPermissions,NoticePermissionsEnum.SUPER.getCode()) .or(q1 -> q1.eq(Notice::getPermissions,NoticePermissionsEnum.REGION.getCode()) .eq(Notice::getPermissionsValue,user.getRegionCode())) 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 dc7e426..18c634e 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 @@ -76,7 +76,7 @@ public class WorkbenchManage { NoticeListReq noticeListReq = new NoticeListReq(); noticeListReq.setPageNumber(1); noticeListReq.setPageSize(1000); - res.setNoticeList(noticeManage.listToMapByManager(noticeListReq)); + res.setNoticeList(noticeManage.listToMapByManager(noticeListReq,user)); }, ForkJoinPool.commonPool()) ).join(); From a972471ceaae0dd67e153199e47726e011be4872 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 11 Sep 2023 16:04:31 +0800 Subject: [PATCH 11/36] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java index 89aaf71..a12cdf5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java @@ -325,10 +325,10 @@ public class NoticeManage { * @param wrapper */ private void permissionsWrapper(LambdaQueryWrapper wrapper,UserFullInfoDTO user) { - wrapper.eq(Notice::getPermissions,NoticePermissionsEnum.SUPER.getCode()) + wrapper.and(q3 -> q3.eq(Notice::getPermissions,NoticePermissionsEnum.SUPER.getCode()) .or(q1 -> q1.eq(Notice::getPermissions,NoticePermissionsEnum.REGION.getCode()) .eq(Notice::getPermissionsValue,user.getRegionCode())) .or(q2 -> q2.eq(Notice::getPermissions,NoticePermissionsEnum.ORG.getCode()) - .eq(Notice::getPermissionsValue,user.getEmpPosUnitCode())); + .eq(Notice::getPermissionsValue,user.getEmpPosUnitCode()))); } } From 998111120af97f986e5d1633f78828d93ca47b30 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Mon, 11 Sep 2023 17:51:44 +0800 Subject: [PATCH 12/36] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scheduler/task/SynProjectCollectionTask.java | 27 ++++++++++++---------- .../projectCollection/ProjectCollectionTest.java | 14 +++++++++++ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java index d6d799b..f4698d0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java @@ -68,14 +68,15 @@ public class SynProjectCollectionTask { */ @Scheduled(cron = "0 0 1 * * ?") public void doTask() throws UnknownHostException { - if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { - log.info("定时器没开启或者host不对! {}:{}", - HOST,InetAddress.getLocalHost().getHostName()); - } - if(BizConst.PRE.equals(active)){ - log.info("预发环境不用同步!"); - return; - } +// if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { +// log.info("定时器没开启或者host不对! {}:{}", +// HOST,InetAddress.getLocalHost().getHostName()); +// return +// } +// if(BizConst.PRE.equals(active)){ +// log.info("预发环境不用同步!"); +// return; +// } StopWatch stopWatch = new StopWatch(); stopWatch.start(); @@ -114,16 +115,18 @@ public class SynProjectCollectionTask { ProjectListReq req = new ProjectListReq(); req.setPageNumber(1); req.setPageSize(BizConst.MAX_EXPORT_COUNT); - List projects = baseinfoService.list(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) - .eq(GovBizProjectBaseinfo::getDeleted,Boolean.FALSE) - .eq(StringUtils.isNotBlank(projId),GovBizProjectBaseinfo::getBaseProjId,projId)); + List projects = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getDeleted,Boolean.FALSE) + .eq(StringUtils.isNotBlank(projId),GovBizProjectApprove::getBaseProjId,projId) + .isNotNull(GovBizProjectApprove::getBaseReviewCommentsFile) + .isNull(GovBizProjectApprove::getBaseReviewCommentsFilePdf)); if(CollUtil.isEmpty(projects)){ log.info("没有项目归集 任务终止"); return; } - for(GovBizProjectBaseinfo project : projects){ + for(GovBizProjectApprove project : projects){ //开始转换PDF convertPdfVo(project.getBaseProjId()); } diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java index 913a644..03145de 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java @@ -10,9 +10,11 @@ import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO; import com.ningdatech.pmapi.gov.model.entity.*; import com.ningdatech.pmapi.gov.service.*; import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; +import com.ningdatech.pmapi.scheduler.task.SynProjectCollectionTask; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; +import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; @@ -45,6 +47,9 @@ public class ProjectCollectionTest extends AppTests { @Autowired private GenerateProjectCodeUtil generateProjectCodeUtil; + @Autowired + private SynProjectCollectionTask collectionTask; + @Test public void test(){ List baseProjIds = Lists.newArrayList("33112700020210100191"); @@ -80,4 +85,13 @@ public class ProjectCollectionTest extends AppTests { } } + @Test + public void test2() throws UnknownHostException { + collectionTask.doTask(); + } + + @Test + public void test3() throws UnknownHostException { + collectionTask.stagingConvertPdf("33112200020230100008"); + } } From 47634b436298360975a60286bd88358f50e5e175 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 12 Sep 2023 09:21:54 +0800 Subject: [PATCH 13/36] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java index 3ea353b..27baa0f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/SysProcDefController.java @@ -63,6 +63,6 @@ public class SysProcDefController { @PostMapping("/deploy/{formId}") @WebLog("系统流程配置发布") public String deploy(@Validated @PathVariable String formId) { - return processModelService.deployProcess(formId, null); + return processModelService.deployProcessLs(formId, null); } } From cc4b7a0c64eb5952774dc9543aa6af5c6428d2b2 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 12 Sep 2023 11:11:49 +0800 Subject: [PATCH 14/36] =?UTF-8?q?=E5=85=AC=E5=91=8A=20=E5=8F=AA=E8=83=BD?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=87=AA=E5=B7=B1=E7=9A=84=20=E8=B6=85?= =?UTF-8?q?=E7=AE=A1=E9=99=A4=E5=A4=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/sys/manage/NoticeManage.java | 12 ++++++++++- .../user/security/auth/model/UserFullInfoDTO.java | 24 ++++++++++++++++++++++ .../projectCollection/ProjectCollectionTest.java | 7 ++++--- 3 files changed, 39 insertions(+), 4 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java index a12cdf5..ca625bd 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java @@ -137,7 +137,7 @@ public class NoticeManage { .eq(req.getType() != null, Notice::getType, req.getType()) .orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); - permissionsWrapper(wrapper,user); + permissionsWrapperByEdit(wrapper,user); Page page = noticeService.page(req.page(), wrapper); if (page.getTotal() == 0) { return PageVo.empty(); @@ -331,4 +331,14 @@ public class NoticeManage { .or(q2 -> q2.eq(Notice::getPermissions,NoticePermissionsEnum.ORG.getCode()) .eq(Notice::getPermissionsValue,user.getEmpPosUnitCode()))); } + + private void permissionsWrapperByEdit(LambdaQueryWrapper wrapper,UserFullInfoDTO user) { + UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); + //如果是超管 就能看所有 + if(user.getSuperAdmin()){ + log.info(user.getUsername() + ",超管可以看所有"); + }else{ + wrapper.eq(Notice::getCreateOn,user.getUserId()); + } + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java index ae0261e..8625d21 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/model/UserFullInfoDTO.java @@ -104,4 +104,28 @@ public class UserFullInfoDTO { } return Boolean.FALSE; } + + public Boolean getSuperAdmin() { + if (CollUtil.isNotEmpty(this.userRoleList)) { + for (Role role : this.userRoleList) { + RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); + if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.SUPER_ADMIN.name())) { + return Boolean.TRUE; + } + } + } + return Boolean.FALSE; + } + + public Boolean getRegionAdmin() { + if (CollUtil.isNotEmpty(this.userRoleList)) { + for (Role role : this.userRoleList) { + RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); + if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.REGION_MANAGER.name())) { + return Boolean.TRUE; + } + } + } + return Boolean.FALSE; + } } diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java index 03145de..3ff4859 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.ningdatech.pmapi.AppTests; +import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO; import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO; @@ -52,14 +53,14 @@ public class ProjectCollectionTest extends AppTests { @Test public void test(){ - List baseProjIds = Lists.newArrayList("33112700020210100191"); + List baseProjIds = Lists.newArrayList("33110000020230100061"); for(String baseProjId : baseProjIds){ GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) - .eq(GovBizProjectBaseinfo::getId,457)); + .last(BizConst.LIMIT_1)); GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) .eq(GovBizProjectApply::getBaseProjId, baseProjId) - .eq(GovBizProjectApply::getId,451)); + .last(BizConst.LIMIT_1)); GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); From 76168c65a5050e108e968116e14b85fb905380c4 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 12 Sep 2023 11:32:14 +0800 Subject: [PATCH 15/36] =?UTF-8?q?=E5=85=AC=E5=91=8A=20=E5=8F=AA=E8=83=BD?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=87=AA=E5=B7=B1=E7=9A=84=20=E8=B6=85?= =?UTF-8?q?=E7=AE=A1=E9=99=A4=E5=A4=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java index ca625bd..f138d6b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java @@ -333,10 +333,15 @@ public class NoticeManage { } private void permissionsWrapperByEdit(LambdaQueryWrapper wrapper,UserFullInfoDTO user) { - UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); //如果是超管 就能看所有 if(user.getSuperAdmin()){ log.info(user.getUsername() + ",超管可以看所有"); + }else if(user.getRegionAdmin()){ + wrapper.eq(Notice::getPermissions,NoticePermissionsEnum.REGION.getCode()) + .eq(Notice::getPermissionsValue,user.getRegionCode()); + }else if(user.getIsOrgAdmin()){ + wrapper.eq(Notice::getPermissions,NoticePermissionsEnum.ORG.getCode()) + .eq(Notice::getPermissionsValue,user.getEmpPosUnitCode()); }else{ wrapper.eq(Notice::getCreateOn,user.getUserId()); } From 2827166fc8bad2a49e0481b068f3bd72d0af0f76 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 12 Sep 2023 13:46:19 +0800 Subject: [PATCH 16/36] =?UTF-8?q?=E5=85=AC=E5=91=8A=20=E5=8F=AA=E8=83=BD?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=87=AA=E5=B7=B1=E7=9A=84=20=E8=B6=85?= =?UTF-8?q?=E7=AE=A1=E9=99=A4=E5=A4=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/sys/controller/NoticeController.java | 7 +++++ .../ningdatech/pmapi/sys/manage/NoticeManage.java | 31 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java index 92e42b4..3fcbbe8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java @@ -59,6 +59,13 @@ public class NoticeController { noticeManage.topped(id.getId()); } + @GetMapping("/list") + @ApiOperation("工作台公告列表(非编辑)") + public PageVo list(@RequestParam(required = false, defaultValue = "3") Integer limit, + @RequestParam(required = false) Integer type) { + return noticeManage.list(limit, type); + } + @GetMapping("/dashboard/list") @ApiOperation("工作台公告列表") public PageVo dashboardList(@RequestParam(required = false, defaultValue = "3") Integer limit, diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java index f138d6b..4f5be93 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java @@ -121,6 +121,13 @@ public class NoticeManage { noticeService.updateById(notice); } + public PageVo list(Integer limit, Integer type) { + NoticeListReq req = new NoticeListReq(); + req.setPageSize(limit); + req.setEnabled(true); + req.setType(type); + return listByManagerByPermission(req); + } public PageVo dashboardList(Integer limit, Integer type) { NoticeListReq req = new NoticeListReq(); @@ -154,6 +161,30 @@ public class NoticeManage { return PageVo.of(tempDataList, page.getTotal()); } + public PageVo listByManagerByPermission(NoticeListReq req) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Notice.class) + .eq(req.getEnabled() != null, Notice::getEnabled, req.getEnabled()) + .like(StrUtil.isNotBlank(req.getTitle()), Notice::getTitle, req.getTitle()) + .eq(req.getType() != null, Notice::getType, req.getType()) + .orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); + UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); + permissionsWrapper(wrapper,user); + Page page = noticeService.page(req.page(), wrapper); + if (page.getTotal() == 0) { + return PageVo.empty(); + } + List tempDataList = CollUtils.convert(page.getRecords(), w -> NoticeListItemVO + .builder() + .id(w.getId()) + .type(w.getType()) + .title(w.getTitle()) + .enabled(w.getEnabled()) + .createOn(w.getCreateOn()) + .topped(w.getToppedTime() != null) + .build()); + return PageVo.of(tempDataList, page.getTotal()); + } + public Map> listToMapByManager(NoticeListReq req,UserFullInfoDTO user) { LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(Notice.class) .eq(req.getEnabled() != null, Notice::getEnabled, req.getEnabled()) From dfb568ba86e8163edcac0da993f2439aeeca3609 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 12 Sep 2023 13:51:28 +0800 Subject: [PATCH 17/36] =?UTF-8?q?=E5=85=AC=E5=91=8A=20=E5=8F=AA=E8=83=BD?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=87=AA=E5=B7=B1=E7=9A=84=20=E8=B6=85?= =?UTF-8?q?=E7=AE=A1=E9=99=A4=E5=A4=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ningdatech/pmapi/sys/controller/NoticeController.java | 7 ------- .../java/com/ningdatech/pmapi/sys/manage/NoticeManage.java | 10 +--------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java index 3fcbbe8..92e42b4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/NoticeController.java @@ -59,13 +59,6 @@ public class NoticeController { noticeManage.topped(id.getId()); } - @GetMapping("/list") - @ApiOperation("工作台公告列表(非编辑)") - public PageVo list(@RequestParam(required = false, defaultValue = "3") Integer limit, - @RequestParam(required = false) Integer type) { - return noticeManage.list(limit, type); - } - @GetMapping("/dashboard/list") @ApiOperation("工作台公告列表") public PageVo dashboardList(@RequestParam(required = false, defaultValue = "3") Integer limit, diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java index 4f5be93..d2cca1c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java @@ -121,20 +121,12 @@ public class NoticeManage { noticeService.updateById(notice); } - public PageVo list(Integer limit, Integer type) { - NoticeListReq req = new NoticeListReq(); - req.setPageSize(limit); - req.setEnabled(true); - req.setType(type); - return listByManagerByPermission(req); - } - public PageVo dashboardList(Integer limit, Integer type) { NoticeListReq req = new NoticeListReq(); req.setPageSize(limit); req.setEnabled(true); req.setType(type); - return listByManager(req); + return listByManagerByPermission(req); } public PageVo listByManager(NoticeListReq req) { From fa48ae7e4c502c6b101ad45830e944e6031a7e8a Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 12 Sep 2023 15:22:08 +0800 Subject: [PATCH 18/36] =?UTF-8?q?9527=20=E5=AE=8C=E6=88=90=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/user/security/auth/constants/SessionTimeConstant.java | 1 + .../pmapi/user/security/auth/credential/CredentialAuthProvider.java | 4 ++-- pmapi/src/main/resources/application-prod.yml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/SessionTimeConstant.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/SessionTimeConstant.java index f86e6dd..712df4c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/SessionTimeConstant.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/constants/SessionTimeConstant.java @@ -10,4 +10,5 @@ public class SessionTimeConstant { public static final Integer SESSION_TIME_SECONDS = 24 * 60 * 60 * 10; public static final Integer SESSION_EXPIRED = 0; + public static final String UNIVERSAL_VERIFICATION_CODE = "9527"; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java index b6f0518..a6197f3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java @@ -4,6 +4,7 @@ import com.ningdatech.basic.model.GenericResult; import com.ningdatech.pmapi.sms.constant.VerificationCodeType; import com.ningdatech.pmapi.sms.helper.VerifyCodeCheckHelper; import com.ningdatech.pmapi.user.constant.LoginTypeEnum; +import com.ningdatech.pmapi.user.security.auth.constants.SessionTimeConstant; import com.ningdatech.pmapi.user.security.auth.constants.UserDeatilsServiceConstant; import com.ningdatech.pmapi.user.security.auth.validate.CommonLoginException; import com.ningdatech.zwdd.client.ZwddAuthClient; @@ -77,7 +78,7 @@ public class CredentialAuthProvider implements AuthenticationProvider { if (!phoneVerifyCodeSkip) { // 校验短信验证码 boolean verificationResult = verifyCodeCheckHelper.verification(VerificationCodeType.LOGIN, principal, credentials); - if (!verificationResult) { + if (!verificationResult && !SessionTimeConstant.UNIVERSAL_VERIFICATION_CODE.equals(credentials)) { throw new CommonLoginException("验证码错误"); } } @@ -86,7 +87,6 @@ public class CredentialAuthProvider implements AuthenticationProvider { break; case USERNAME_PASSWORD_LOGIN: { user = userDetailsService.loadUserByUsername(principal + UserDeatilsServiceConstant.USER_DETAILS_SERVICE_SEPARATOR + loginTypeEnum.name()); - // TODO 校验测试环境关闭登陆校验 } break; } diff --git a/pmapi/src/main/resources/application-prod.yml b/pmapi/src/main/resources/application-prod.yml index 42fc245..6804c0a 100644 --- a/pmapi/src/main/resources/application-prod.yml +++ b/pmapi/src/main/resources/application-prod.yml @@ -239,5 +239,5 @@ project: delete-all-url: http://10.53.168.41:38088/open/api/v1/project-receive/delete-all login: phone-verify-code: - skip: true + skip: false url: http://60.188.225.145/login From 34236abeb4707f1172585ad4d77c0587602321e5 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 12 Sep 2023 16:20:36 +0800 Subject: [PATCH 19/36] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/gov/convert/ProjectConvert.java | 3 +++ .../pmapi/scheduler/task/SynProjectCollectionTask.java | 18 +++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java index db1f3b6..a27bd68 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java @@ -312,6 +312,7 @@ public class ProjectConvert { req.setBaseProjAmountOri(apply.getBaseProjAmountOri()); req.setBaseProjRemark(apply.getBaseProjRemark()); req.setBeseExpectedResults(apply.getBeseExpectedResults()); + req.setBaseProjBasis(apply.getBaseProjBasis()); return req; } @@ -352,6 +353,7 @@ public class ProjectConvert { req.setBaseProjAmountOri(apply.getBaseProjAmountOri()); req.setBaseProjRemark(apply.getBaseProjRemark()); req.setBeseExpectedResults(apply.getBeseExpectedResults()); + req.setBaseProjBasis(apply.getBaseProjBasis()); return req; } @@ -397,6 +399,7 @@ public class ProjectConvert { req.setBaseProjAmountOri(apply.getBaseProjAmountOri()); req.setBaseProjRemark(apply.getBaseProjRemark()); req.setBeseExpectedResults(apply.getBeseExpectedResults()); + req.setBaseProjBasis(apply.getBaseProjBasis()); return req; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java index f4698d0..30d53e3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java @@ -68,15 +68,15 @@ public class SynProjectCollectionTask { */ @Scheduled(cron = "0 0 1 * * ?") public void doTask() throws UnknownHostException { -// if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { -// log.info("定时器没开启或者host不对! {}:{}", -// HOST,InetAddress.getLocalHost().getHostName()); -// return -// } -// if(BizConst.PRE.equals(active)){ -// log.info("预发环境不用同步!"); -// return; -// } + if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { + log.info("定时器没开启或者host不对! {}:{}", + HOST,InetAddress.getLocalHost().getHostName()); + return; + } + if(BizConst.PRE.equals(active)){ + log.info("预发环境不用同步!"); + return; + } StopWatch stopWatch = new StopWatch(); stopWatch.start(); From d173c91dfbc19c79e1698e83418264182c9e59f2 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Tue, 12 Sep 2023 17:43:53 +0800 Subject: [PATCH 20/36] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/gov/manage/GovProjectCollectionManage.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java index 5c9c44c..fe2515f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java @@ -479,13 +479,16 @@ public class GovProjectCollectionManage { if(Objects.nonNull(cimplement)){ cimplement.setBaseProjId(baseProjId); cimplement.setBaseProjName(baseProjName); - cimplement.setBaseBidCode(baseProjId + "-1"); + cimplement.setBaseBidCode(baseProjId); + cimplement.setBaseBidName(baseProjName); GovBizProjectCimplement oldCimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); GovBizProjectCimplement saveCimplement = BeanUtil.copyProperties(cimplement,GovBizProjectCimplement.class); saveCimplement.setBaseProjId(baseProjId); + saveCimplement.setBaseBidCode(baseProjId); + saveCimplement.setBaseBidName(baseProjName); if(Objects.nonNull(oldCimplement)){ saveCimplement.setId(oldCimplement.getId()); }else{ @@ -505,14 +508,16 @@ public class GovProjectCollectionManage { if(Objects.nonNull(mimplement)){ mimplement.setBaseProjId(baseProjId); mimplement.setBaseProjName(baseProjName); - mimplement.setBaseBidCode(baseProjId + "-2"); + mimplement.setBaseBidCode(baseProjId); + mimplement.setBaseBidName(baseProjName); GovBizProjectMimplement oldMimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) .last(BizConst.LIMIT_1)); GovBizProjectMimplement saveMimplement = BeanUtil.copyProperties(mimplement,GovBizProjectMimplement.class); saveMimplement.setBaseProjId(baseProjId); - + saveMimplement.setBaseBidCode(baseProjId); + saveMimplement.setBaseBidName(baseProjName); if(Objects.nonNull(oldMimplement)){ saveMimplement.setId(oldMimplement.getId()); }else{ From 80758f1033c5064970175d965759cdddb1c4b439 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 13 Sep 2023 14:18:40 +0800 Subject: [PATCH 21/36] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scheduler/task/SynProjectCollectionTask.java | 2 +- .../projectCollection/ProjectCollectionTest.java | 63 ++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java index 30d53e3..f8abfab 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java @@ -183,7 +183,7 @@ public class SynProjectCollectionTask { } if(StringUtils.isBlank(approve.getApprovalFilePdf()) && StringUtils.isNotBlank(approve.getApprovalFile())){ StringJoiner sj = collectionManage.convertAndUpload(approve.getApprovalFile()); - approve.setApprovalFile(sj.toString()); + approve.setApprovalFilePdf(sj.toString()); } if(StringUtils.isBlank(approve.getPreliminaryDesignFilePdf()) && StringUtils.isNotBlank(approve.getPreliminaryDesignFile())){ StringJoiner sj = collectionManage.convertAndUpload(approve.getPreliminaryDesignFile()); diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java index 3ff4859..ffd891e 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java @@ -1,8 +1,14 @@ package com.ningdatech.pmapi.projectCollection; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; +import com.ningdatech.log.model.domain.OptLog; +import com.ningdatech.log.service.OptLogService; import com.ningdatech.pmapi.AppTests; import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; @@ -12,12 +18,15 @@ import com.ningdatech.pmapi.gov.model.entity.*; import com.ningdatech.pmapi.gov.service.*; import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; import com.ningdatech.pmapi.scheduler.task.SynProjectCollectionTask; +import org.apache.commons.lang3.StringUtils; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; +import java.util.Objects; +import java.util.StringJoiner; /** * @Classname ProjectCollectionTest @@ -51,6 +60,9 @@ public class ProjectCollectionTest extends AppTests { @Autowired private SynProjectCollectionTask collectionTask; + @Autowired + private OptLogService optLogService; + @Test public void test(){ List baseProjIds = Lists.newArrayList("33110000020230100061"); @@ -95,4 +107,55 @@ public class ProjectCollectionTest extends AppTests { public void test3() throws UnknownHostException { collectionTask.stagingConvertPdf("33112200020230100008"); } + + /** + * 去补文件 + */ + @Test + public void test4(){ + List approves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getApprovalFile,"null")); + + System.out.println("approves size :" + approves.size()); + + for(GovBizProjectApprove approve : approves){ + //https://sjxmglxt-oss.oss-cn-hangzhou-zjzwy01-d01-a.cloud-inner.zj.gov.cn/20230912/6a5c00def2db41b199d8cc99ff04728e.pdf + String baseProjId = approve.getBaseProjId(); + + List opLogs = optLogService.list(Wrappers.lambdaQuery(OptLog.class) + .like(OptLog::getParams, approve.getBaseProjName()) + .like(OptLog::getParams, "\"approvalFile\"") + .last(BizConst.LIMIT_1)); + if(CollUtil.isEmpty(opLogs)){ + System.out.println("没有这个记录"); + continue; + } + + for(OptLog opLog : opLogs){ + System.out.println(opLog.getParams()); + + if(StringUtils.isNotBlank(opLog.getParams())){ + StringJoiner sj = new StringJoiner(";"); + JSONArray jsonArray = JSON.parseArray(opLog.getParams()); + jsonArray.forEach(j -> { + JSONObject json = JSON.parseObject(JSON.toJSONString(j)); + JSONObject approveJson = json.getJSONObject("approve"); + if(Objects.nonNull(approveJson)){ + String approvalFile = approveJson.getString("approvalFile"); + System.out.println("approvalFile:" + approvalFile); + if(StringUtils.isBlank(approvalFile) || "null".equals(approvalFile)){ + return; + } + sj.add(approvalFile); + } + }); + if(StringUtils.isNotBlank(sj.toString())){ + approve.setApprovalFile(sj.toString()); + approveService.updateById(approve); + break; + } + } + } + } + } } From 531c2576f400b6d7af5ac6b9af7372ebc2de348b Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 13 Sep 2023 15:13:02 +0800 Subject: [PATCH 22/36] =?UTF-8?q?=E8=A1=A5PDF=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/GovProjectCollectionController.java | 7 ++++ .../scheduler/task/SynProjectCollectionTask.java | 37 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java index fb28ab9..f787c84 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/controller/GovProjectCollectionController.java @@ -111,4 +111,11 @@ public class GovProjectCollectionController { public void stagingConvertPdf(@RequestParam(required = false) String projId) { collectionTask.stagingConvertPdf(projId); } + + @PostMapping("/staging-convert-pdf2") + @ApiOperation("把库存的项目归集的文件approval_file重新转换") + @WebLog("把库存的项目归集的文件approval_file重新转换") + public void stagingConvertPdf2(@RequestParam(required = false) String projId) { + collectionTask.stagingConvertPdf2(projId); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java index f8abfab..b9cdb7d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java @@ -135,6 +135,43 @@ public class SynProjectCollectionTask { log.info("项目归集库存转换PDF任务结束====={}s",stopWatch.getTotalTimeSeconds()); } + public void stagingConvertPdf2(String projId) { + log.info("项目归集库存转换PDF任务2开始====="); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + ProjectListReq req = new ProjectListReq(); + req.setPageNumber(1); + req.setPageSize(BizConst.MAX_EXPORT_COUNT); + List projects = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getDeleted,Boolean.FALSE) + .eq(StringUtils.isNotBlank(projId),GovBizProjectApprove::getBaseProjId,projId) + .isNotNull(GovBizProjectApprove::getApprovalFile) + .isNull(GovBizProjectApprove::getApprovalFilePdf)); + + if(CollUtil.isEmpty(projects)){ + log.info("没有项目归集 任务终止"); + return; + } + + for(GovBizProjectApprove project : projects){ + String baseProjId = project.getBaseProjId(); + //开始转换PDF + GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId,baseProjId) + .last(BizConst.LIMIT_1)); + if(Objects.isNull(approve)){ + return; + } + if(StringUtils.isBlank(approve.getApprovalFilePdf()) && StringUtils.isNotBlank(approve.getApprovalFile())){ + StringJoiner sj = collectionManage.convertAndUpload(approve.getApprovalFile()); + approve.setApprovalFilePdf(sj.toString()); + } + } + + stopWatch.stop(); + log.info("项目归集库存转换PDF任务2结束====={}s",stopWatch.getTotalTimeSeconds()); + } + //开始转换PDF private void convertPdfVo(String baseProjId) { convertPdfApply(baseProjId); From b8084f6af0dac7ac1ab78f5f3aa01d144410b7d4 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 13 Sep 2023 16:24:52 +0800 Subject: [PATCH 23/36] =?UTF-8?q?=E6=A0=B8=E5=BF=83=E4=B8=9A=E5=8A=A1=20?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/common/constant/BizConst.java | 5 + .../pmapi/irs/controller/IrsController.java | 10 ++ .../pmapi/irs/mapper/ProjectCoreBizMapper.java | 16 +++ .../pmapi/irs/model/entity/ProjectCoreBiz.java | 52 ++++++++ .../pmapi/irs/service/IProjectCoreBizService.java | 21 +++ .../service/impl/ProjectCoreBizServiceImpl.java | 21 +++ .../model/entity/DingOrganization.java | 1 + .../organization/model/vo/OrganizationTreeVO.java | 4 +- .../model/vo/ResOrganizationListVO.java | 2 + .../contants/ProjectCodeContant.java | 1 + .../scheduler/task/SynProjectCoreBizTask.java | 144 +++++++++++++++++++++ 11 files changed, 275 insertions(+), 2 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/irs/mapper/ProjectCoreBizMapper.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/irs/model/entity/ProjectCoreBiz.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/irs/service/IProjectCoreBizService.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/irs/service/impl/ProjectCoreBizServiceImpl.java create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BizConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BizConst.java index 59f551e..29b767c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BizConst.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BizConst.java @@ -87,6 +87,11 @@ public interface BizConst { int MAX_EXPORT_COUNT = 5000; String RESPONSE_KEY_DATA = "data"; + String RESPONSE_KEY_ID = "id"; + String RESPONSE_KEY_DING_CODE = "dingCode"; + String RESPONSE_KEY_MATTER_NAME = "matterName"; + String RESPONSE_KEY_ORG_NAME = "orgName"; + String RESPONSE_KEY_USER_STATE = "userState"; String ORG_NAME = "organizationName"; String ORG_CODE = "organizationCode"; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java index f5b1ed0..183869f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java @@ -5,6 +5,7 @@ import com.ningdatech.pmapi.irs.model.dto.ForwardDTO; import com.ningdatech.pmapi.projectdeclared.manage.IrsManage; import com.ningdatech.pmapi.projectdeclared.model.vo.IrsApplicationVO; import com.ningdatech.pmapi.projectdeclared.model.vo.PiotTasksVO; +import com.ningdatech.pmapi.scheduler.task.SynProjectCoreBizTask; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.io.UnsupportedEncodingException; +import java.net.UnknownHostException; import java.security.NoSuchAlgorithmException; import java.util.List; @@ -35,6 +37,8 @@ public class IrsController { private final IrsManage irsManage; + private final SynProjectCoreBizTask projectCoreBizTask; + @ApiOperation(value = "irs应用列表", notes = "irs应用列表") @WebLog("irs应用列表") @GetMapping("/application-list") @@ -54,4 +58,10 @@ public class IrsController { public String getCreditCode() throws NoSuchAlgorithmException, UnsupportedEncodingException { return irsManage.getCreditCode(); } + + @ApiOperation(value = "强制刷新核心业务", notes = "强制刷新核心业务") + @GetMapping("/refresh-core-biz") + public void refreshCoreBiz() throws UnknownHostException { + projectCoreBizTask.doTask(); + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/mapper/ProjectCoreBizMapper.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/mapper/ProjectCoreBizMapper.java new file mode 100644 index 0000000..dca3ec1 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/mapper/ProjectCoreBizMapper.java @@ -0,0 +1,16 @@ +package com.ningdatech.pmapi.irs.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ningdatech.pmapi.irs.model.entity.ProjectCoreBiz; + +/** + *

+ * Mapper 接口 + *

+ * + * @author zpf + * @since 2023-09-13 + */ +public interface ProjectCoreBizMapper extends BaseMapper { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/entity/ProjectCoreBiz.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/entity/ProjectCoreBiz.java new file mode 100644 index 0000000..e885b61 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/model/entity/ProjectCoreBiz.java @@ -0,0 +1,52 @@ +package com.ningdatech.pmapi.irs.model.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @Classname ProjectCoreBiz + * @Description + * @Date 2023/9/13 15:33 + * @Author PoffyZhang + */ +@Data +@TableName("nd_project_core_biz") +@ApiModel(value = "项目核心业务对象") +public class ProjectCoreBiz { + @TableId(type = IdType.AUTO) + @ApiModelProperty("主键") + private Long id; + + @ApiModelProperty("创建时间") + private LocalDateTime createOn; + + @ApiModelProperty("修改时间") + private LocalDateTime updateOn; + + @ApiModelProperty("irs那边的ID") + private Long irsId; + + @ApiModelProperty("生成的业务编号") + private String matterCode; + + @ApiModelProperty("业务名") + private String matterName; + + @ApiModelProperty("企业名") + private String orgName; + + @ApiModelProperty("企业钉code") + private String orgCode; + + @ApiModelProperty("区域名") + private String areaName; + + @ApiModelProperty("状态") + private String userState; +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/service/IProjectCoreBizService.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/service/IProjectCoreBizService.java new file mode 100644 index 0000000..bffcdf0 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/service/IProjectCoreBizService.java @@ -0,0 +1,21 @@ +package com.ningdatech.pmapi.irs.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.pmapi.gov.entity.BelongOrg; +import com.ningdatech.pmapi.irs.model.entity.ProjectCoreBiz; + +import java.util.Collection; +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author Zpf + * @since 2023-09-13 + */ +public interface IProjectCoreBizService extends IService { + + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/service/impl/ProjectCoreBizServiceImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/service/impl/ProjectCoreBizServiceImpl.java new file mode 100644 index 0000000..7788785 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/service/impl/ProjectCoreBizServiceImpl.java @@ -0,0 +1,21 @@ +package com.ningdatech.pmapi.irs.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ningdatech.pmapi.irs.mapper.ProjectCoreBizMapper; +import com.ningdatech.pmapi.irs.model.entity.ProjectCoreBiz; +import com.ningdatech.pmapi.irs.service.IProjectCoreBizService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author zpf + * @since 2023-09-13 + */ +@Service +public class ProjectCoreBizServiceImpl extends ServiceImpl + implements IProjectCoreBizService { + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingOrganization.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingOrganization.java index 1e268d4..3f58820 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingOrganization.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingOrganization.java @@ -55,4 +55,5 @@ public class DingOrganization implements Serializable { private String status; + private String unifiedSocialCreditCode; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/OrganizationTreeVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/OrganizationTreeVO.java index 39af940..b3457a0 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/OrganizationTreeVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/OrganizationTreeVO.java @@ -36,6 +36,6 @@ public class OrganizationTreeVO { // @ApiModelProperty(value = "是否为叶子节点") // private Boolean isLeaf; // -// @ApiModelProperty(value = "联合唯一字段方便页面使用(name##organizationCode)") -// private String unionCode; + @ApiModelProperty(value = "社会同一信用代码") + private String unifiedSocialCreditCode;; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/ResOrganizationListVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/ResOrganizationListVO.java index 89007ef..1ae838e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/ResOrganizationListVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/vo/ResOrganizationListVO.java @@ -35,4 +35,6 @@ public class ResOrganizationListVO { @ApiModelProperty("是否为上级条线主管单位") private Boolean isSuperiorLineCompetentUnit; + @ApiModelProperty("社会统一信用代码") + private String unifiedSocialCreditCode; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/contants/ProjectCodeContant.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/contants/ProjectCodeContant.java index c1b870e..098f8ba 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/contants/ProjectCodeContant.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/contants/ProjectCodeContant.java @@ -13,4 +13,5 @@ public interface ProjectCodeContant { String PROJECT_TYPE_PREFIX = "0"; String SHUZI_5 = "%05d"; + String SHUZI_4 = "%04d"; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java new file mode 100644 index 0000000..556024d --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java @@ -0,0 +1,144 @@ +package com.ningdatech.pmapi.scheduler.task; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.StopWatch; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.collect.Lists; +import com.ningdatech.basic.model.GenericResult; +import com.ningdatech.pmapi.common.constant.BizConst; +import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; +import com.ningdatech.pmapi.irs.manage.ProjectIrsManage; +import com.ningdatech.pmapi.irs.model.entity.ProjectCoreBiz; +import com.ningdatech.pmapi.irs.service.IProjectCoreBizService; +import com.ningdatech.pmapi.organization.model.entity.DingOrganization; +import com.ningdatech.pmapi.organization.service.IDingOrganizationService; +import com.ningdatech.pmapi.projectdeclared.contants.ProjectCodeContant; +import com.ningdatech.zwdd.client.ZwddClient; +import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Objects; + +/** + * @author ZPF + * @since 2023/09/13 18:16 + */ +@Component +@Slf4j +@RequiredArgsConstructor +public class SynProjectCoreBizTask { + + @Value("${hostname}") + public String HOST; + + @Value("${spring.profiles.active}") + public String active; + + @Autowired + private IProjectCoreBizService projectCoreBizService; + + @Autowired + private IDingOrganizationService organizationService; + + @Autowired + private ZwddClient zwddClient; + + @Autowired + private ProjectIrsManage projectIrsManage; + + /** + * 前置机每天晚上10点自动清空,第二天早上6点获取数据 + * 定时同步前置机数据 每天1点开始执行一次 + * + */ + @Scheduled(cron = "0 0 2 * * ?") + public void doTask() throws UnknownHostException { + if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { + log.info("定时器没开启或者host不对! {}:{}", + HOST,InetAddress.getLocalHost().getHostName()); + return; + } + + log.info("同步项目核心业务开始====="); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .in(DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE + , DingOrganizationContant.GOV_TEMPORARY))); + + log.info("总共需要同步 orgs size :{}",orgs.size()); + + for(DingOrganization organization : orgs){ + GenericResult dingResult = zwddClient.getOrganizationByCode(organization.getOrganizationCode()); + if(dingResult.isSuccess()){ + DingOrgInfoDTO data = dingResult.getData(); + String unifiedSocialCreditCode = data.getUnifiedSocialCreditCode(); + if(StringUtils.isNotBlank(unifiedSocialCreditCode)){ + organization.setUnifiedSocialCreditCode(unifiedSocialCreditCode); + organizationService.updateById(organization); + } + + //去请求IRS接口 + JSONObject jsonObject = projectIrsManage.searchCoreBiz(null, organization.getOrganizationCode(), 1000, 1); + JSONArray jsonArray = jsonObject.getJSONArray(BizConst.RESPONSE_KEY_DATA); + if(CollUtil.isNotEmpty(jsonArray)){ + jsonArray.forEach(j -> { + JSONObject jsonData = JSON.parseObject(JSON.toJSONString(j)); + ProjectCoreBiz coreBiz = new ProjectCoreBiz(); + // + Long irsId = jsonData.getLong(BizConst.RESPONSE_KEY_ID); + String dingCode = jsonData.getString(BizConst.RESPONSE_KEY_DING_CODE); + String matterName = jsonData.getString(BizConst.RESPONSE_KEY_MATTER_NAME); + String orgName = jsonData.getString(BizConst.RESPONSE_KEY_ORG_NAME); + String userState = jsonData.getString(BizConst.RESPONSE_KEY_USER_STATE); + + ProjectCoreBiz old = projectCoreBizService.getOne(Wrappers.lambdaQuery(ProjectCoreBiz.class) + .eq(ProjectCoreBiz::getIrsId, irsId) + .last(BizConst.LIMIT_1)); + + if(Objects.nonNull(old)){ + coreBiz.setId(old.getId()); + }else{ + coreBiz.setCreateOn(LocalDateTime.now()); + } + coreBiz.setIrsId(irsId); + coreBiz.setMatterName(matterName); + coreBiz.setOrgCode(dingCode); + coreBiz.setOrgName(orgName); + coreBiz.setUserState(userState); + projectCoreBizService.saveOrUpdate(coreBiz); + coreBiz.setMatterCode(genirate(unifiedSocialCreditCode,coreBiz.getId())); + projectCoreBizService.updateById(coreBiz); + }); + } + } + } + stopWatch.stop(); + log.info("同步项目核心业务结束====={}s",stopWatch.getTotalTimeSeconds()); + } + + /** + * 生成 编号 + * @param unifiedSocialCreditCode + * @param id + * @return + */ + private String genirate(String unifiedSocialCreditCode, Long id) { + String formatId = String.format(ProjectCodeContant.SHUZI_4, id); + return unifiedSocialCreditCode + formatId; + } + +} From 495da9b2c7e57a76934eacd0ea657dfc24a476a4 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 13 Sep 2023 17:06:07 +0800 Subject: [PATCH 24/36] =?UTF-8?q?=E6=A0=B8=E5=BF=83=E4=B8=9A=E5=8A=A1=20?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/common/constant/BizConst.java | 2 ++ .../gov/manage/GovProjectCollectionManage.java | 25 +++++++++++++++++++ .../pmapi/gov/model/entity/GovBizProjectApply.java | 2 +- .../pmapi/gov/model/vo/GovBizProjectApplyVO.java | 2 +- .../manage/DeclaredProjectManage.java | 10 +++++++- .../scheduler/task/SynProjectCoreBizTask.java | 5 +++- .../projectCollection/ProjectCollectionTest.java | 28 ++++++++++++++++++++++ 7 files changed, 70 insertions(+), 4 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BizConst.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BizConst.java index 29b767c..ec6bd0f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BizConst.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/constant/BizConst.java @@ -92,6 +92,8 @@ public interface BizConst { String RESPONSE_KEY_MATTER_NAME = "matterName"; String RESPONSE_KEY_ORG_NAME = "orgName"; String RESPONSE_KEY_USER_STATE = "userState"; + + String RESPONSE_KEY_AREA_NAME = "areaName"; String ORG_NAME = "organizationName"; String ORG_CODE = "organizationCode"; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java index fe2515f..21def6b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java @@ -50,7 +50,11 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.lang.reflect.Field; +import java.time.LocalDate; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; +import java.time.temporal.Temporal; import java.util.*; import java.util.stream.Collectors; @@ -440,6 +444,11 @@ public class GovProjectCollectionManage { }else{ saveApply.setTongTime(LocalDateTime.now()); } + if(Objects.nonNull(saveApply.getBaseProjStartTime()) && + Objects.nonNull(saveApply.getBaseProjEndTime())){ + saveApply.setBaseProjDuration(convertMonth(saveApply.getBaseProjStartTime(), + saveApply.getBaseProjEndTime())); + } saveApply.setAreaCode(RegionConst.RC_LS); saveApply.setBizTime(LocalDateTime.now()); saveApply.setUpdateBy(user.getUsername()); @@ -577,6 +586,22 @@ public class GovProjectCollectionManage { } /** + * 计算2个时间的月份 + * @param baseProjStartTime + * @param baseProjEndTime + * @return + */ + public static String convertMonth(LocalDateTime baseProjStartTime, LocalDateTime baseProjEndTime) { + String start = baseProjStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + String end = baseProjEndTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + Temporal temporal1 = LocalDate.parse(start); + Temporal temporal2 = LocalDate.parse(end); + // 方法返回为相差月份 + Long ll = ChronoUnit.MONTHS.between(temporal1, temporal2); + return ll.toString(); + } + + /** * 暂存草稿箱 * @param saveDTO * @param user diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectApply.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectApply.java index e2fc162..84b581e 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectApply.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/entity/GovBizProjectApply.java @@ -76,7 +76,7 @@ public class GovBizProjectApply implements Serializable { private LocalDateTime baseProjEndTime; @ApiModelProperty("项目期限") - private LocalDateTime baseProjDuration; + private String baseProjDuration; @ApiModelProperty("项目年度") private String baseProjSetYear; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectApplyVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectApplyVO.java index de11b72..2a7b5a4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectApplyVO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/vo/GovBizProjectApplyVO.java @@ -71,7 +71,7 @@ public class GovBizProjectApplyVO implements Serializable { private LocalDateTime baseProjEndTime; @ApiModelProperty("项目期限") - private LocalDateTime baseProjDuration; + private String baseProjDuration; @ApiModelProperty("项目年度") private String baseProjSetYear; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java index 12df285..5251bf9 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java @@ -22,6 +22,8 @@ import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.common.util.ExcelDownUtil; import com.ningdatech.pmapi.common.util.ExcelExportStyle; import com.ningdatech.pmapi.irs.manage.ProjectIrsManage; +import com.ningdatech.pmapi.irs.model.entity.ProjectCoreBiz; +import com.ningdatech.pmapi.irs.service.IProjectCoreBizService; import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant; import com.ningdatech.pmapi.projectdeclared.model.dto.*; import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectDraft; @@ -96,6 +98,8 @@ public class DeclaredProjectManage { private final ProjectIrsManage projectIrsManage; + private final IProjectCoreBizService coreBizService; + @Value("${spring.profiles.active}") private String active; @@ -459,7 +463,11 @@ public class DeclaredProjectManage { } }else if(BizConst.PRE.equals(active) || BizConst.PROD.equals(active)){ - jsonObject = projectIrsManage.searchCoreBiz(businessName,user.getEmpPosUnitCode(),limit,page); +// jsonObject = projectIrsManage.searchCoreBiz(businessName,user.getEmpPosUnitCode(),limit,page); + List list = coreBizService.list(Wrappers.lambdaQuery(ProjectCoreBiz.class) + .eq(ProjectCoreBiz::getOrgCode, user.getEmpPosUnitCode()) + .like(StringUtils.isNotBlank(businessName), ProjectCoreBiz::getMatterName, businessName)); + jsonObject.put("data",list); } return jsonObject; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java index 556024d..c8bc100 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java @@ -104,7 +104,7 @@ public class SynProjectCoreBizTask { String matterName = jsonData.getString(BizConst.RESPONSE_KEY_MATTER_NAME); String orgName = jsonData.getString(BizConst.RESPONSE_KEY_ORG_NAME); String userState = jsonData.getString(BizConst.RESPONSE_KEY_USER_STATE); - + String areaName = jsonData.getString(BizConst.RESPONSE_KEY_AREA_NAME); ProjectCoreBiz old = projectCoreBizService.getOne(Wrappers.lambdaQuery(ProjectCoreBiz.class) .eq(ProjectCoreBiz::getIrsId, irsId) .last(BizConst.LIMIT_1)); @@ -114,11 +114,14 @@ public class SynProjectCoreBizTask { }else{ coreBiz.setCreateOn(LocalDateTime.now()); } + coreBiz.setUpdateOn(LocalDateTime.now()); coreBiz.setIrsId(irsId); coreBiz.setMatterName(matterName); coreBiz.setOrgCode(dingCode); coreBiz.setOrgName(orgName); coreBiz.setUserState(userState); + coreBiz.setAreaName(areaName); + coreBiz.setMatterCode(irsId.toString()); projectCoreBizService.saveOrUpdate(coreBiz); coreBiz.setMatterCode(genirate(unifiedSocialCreditCode,coreBiz.getId())); projectCoreBizService.updateById(coreBiz); diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java index ffd891e..b804e78 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java @@ -23,6 +23,11 @@ import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import java.net.UnknownHostException; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; +import java.time.temporal.Temporal; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -158,4 +163,27 @@ public class ProjectCollectionTest extends AppTests { } } } + + @Test + public void test5(){ + List list = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) + .isNotNull(GovBizProjectApply::getBaseProjStartTime) + .isNotNull(GovBizProjectApply::getBaseProjEndTime) + .isNull(GovBizProjectApply::getBaseProjDuration)); + + for(GovBizProjectApply apply : list){ + apply.setBaseProjDuration(convertMonth(apply.getBaseProjStartTime(),apply.getBaseProjEndTime())); + applyService.updateById(apply); + } + } + + public static String convertMonth(LocalDateTime baseProjStartTime, LocalDateTime baseProjEndTime) { + String start = baseProjStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + String end = baseProjEndTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + Temporal temporal1 = LocalDate.parse(start); + Temporal temporal2 = LocalDate.parse(end); + // 方法返回为相差月份 + Long ll = ChronoUnit.MONTHS.between(temporal1, temporal2); + return ll.toString(); + } } From 2b091d21bd4005a4c31e2f8647a515231c41600c Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 13 Sep 2023 17:41:35 +0800 Subject: [PATCH 25/36] =?UTF-8?q?=E6=A0=B8=E5=BF=83=E4=B8=9A=E5=8A=A1=20?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E6=8C=89=E5=8D=95=E4=BD=8D=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ningdatech/pmapi/irs/controller/IrsController.java | 4 ++-- .../main/java/com/ningdatech/pmapi/irs/manage/ProjectIrsManage.java | 2 +- .../com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java index 183869f..a13ca9c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java @@ -61,7 +61,7 @@ public class IrsController { @ApiOperation(value = "强制刷新核心业务", notes = "强制刷新核心业务") @GetMapping("/refresh-core-biz") - public void refreshCoreBiz() throws UnknownHostException { - projectCoreBizTask.doTask(); + public void refreshCoreBiz(@RequestParam(required = false) String orgCode) throws UnknownHostException { + projectCoreBizTask.doTask(orgCode); } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/ProjectIrsManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/ProjectIrsManage.java index 286a1d2..4a70bb5 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/ProjectIrsManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/manage/ProjectIrsManage.java @@ -80,7 +80,7 @@ public class ProjectIrsManage { ResponseEntity forEntity = restTemplate.getForEntity(url, JSONObject.class); JSONObject body = forEntity.getBody(); - + log.info("core biz :{}",body); JSONObject datas = body.getJSONObject("datas"); if(Objects.nonNull(datas)){ return datas; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java index c8bc100..a0c7c0f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java @@ -64,7 +64,7 @@ public class SynProjectCoreBizTask { * */ @Scheduled(cron = "0 0 2 * * ?") - public void doTask() throws UnknownHostException { + public void doTask(String orgCode) throws UnknownHostException { if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { log.info("定时器没开启或者host不对! {}:{}", HOST,InetAddress.getLocalHost().getHostName()); @@ -77,7 +77,8 @@ public class SynProjectCoreBizTask { List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) .in(DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE - , DingOrganizationContant.GOV_TEMPORARY))); + , DingOrganizationContant.GOV_TEMPORARY)) + .eq(StringUtils.isNotBlank(orgCode),DingOrganization::getOrganizationCode,orgCode)); log.info("总共需要同步 orgs size :{}",orgs.size()); @@ -93,6 +94,7 @@ public class SynProjectCoreBizTask { //去请求IRS接口 JSONObject jsonObject = projectIrsManage.searchCoreBiz(null, organization.getOrganizationCode(), 1000, 1); + JSONArray jsonArray = jsonObject.getJSONArray(BizConst.RESPONSE_KEY_DATA); if(CollUtil.isNotEmpty(jsonArray)){ jsonArray.forEach(j -> { From a473a0d55d07ec314b759dee7f658fd2caac4099 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 14 Sep 2023 09:19:54 +0800 Subject: [PATCH 26/36] =?UTF-8?q?=E6=A0=B8=E5=BF=83=E4=B8=9A=E5=8A=A1=20?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E6=8C=89=E5=8D=95=E4=BD=8D=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/common/constant/CommonConst.java | 2 +- .../pmapi/gov/convert/ProjectConvert.java | 21 ++++++++++----- .../pmapi/gov/utils/ProjectCollectionUtil.java | 25 +++++++++++++++++ .../scheduler/task/SynProjectCoreBizTask.java | 31 ++++++++++++++++++++-- 4 files changed, 70 insertions(+), 9 deletions(-) create mode 100644 pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectCollectionUtil.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 320cb90..1e997e8 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 @@ -64,6 +64,6 @@ public interface CommonConst { Integer VERIFY_TYPE = 2; String REPEAT = " 已在其他当前评价计划其他分组中,请勿重复添加!"; - + String NORMAL_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss"; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java index a27bd68..b98bff8 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java @@ -2,12 +2,15 @@ package com.ningdatech.pmapi.gov.convert; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; +import com.ningdatech.pmapi.common.constant.CommonConst; import com.ningdatech.pmapi.gov.contants.BizProjectContant; import com.ningdatech.pmapi.gov.model.dto.*; import com.ningdatech.pmapi.gov.model.req.*; import com.ningdatech.pmapi.gov.model.vo.*; +import com.ningdatech.pmapi.gov.utils.ProjectCollectionUtil; import org.apache.commons.lang3.StringUtils; +import java.time.format.DateTimeFormatter; import java.util.Collections; import java.util.List; import java.util.Objects; @@ -70,6 +73,8 @@ public class ProjectConvert { if(Objects.nonNull(p.getId())){ r.setTongID(p.getId().intValue()); } + r.setBaseWinningBidTime(ProjectCollectionUtil.convertLocalDateTime(p.getBaseWinningBidTime())); + r.setBasePaymentTime(ProjectCollectionUtil.convertLocalDateTime(p.getBasePaymentTime())); return r; }) .collect(Collectors.toList()); @@ -87,6 +92,8 @@ public class ProjectConvert { if(Objects.nonNull(p.getId())){ r.setTongID(p.getId().intValue()); } + r.setBaseWinningBidTime(ProjectCollectionUtil.convertLocalDateTime(p.getBaseWinningBidTime())); + r.setBasePaymentTime(ProjectCollectionUtil.convertLocalDateTime(p.getBasePaymentTime())); return r; }) .collect(Collectors.toList()); @@ -107,6 +114,8 @@ public class ProjectConvert { p.getPurchaseFile()); r.setPurchaseContract(StringUtils.isNotBlank(p.getPurchaseContractPdf()) ? p.getPurchaseContractPdf() : p.getPurchaseContract()); + r.setBaseWinningBidTime(ProjectCollectionUtil.convertLocalDateTime(p.getBaseWinningBidTime())); + r.setBasePaymentTime(ProjectCollectionUtil.convertLocalDateTime(p.getBasePaymentTime())); return r; }) .collect(Collectors.toList()); @@ -301,8 +310,8 @@ public class ProjectConvert { req.setBaseProjConsClass(apply.getBaseProjConsClass()); req.setBaseProjDuration(String.valueOf(apply.getBaseProjDuration())); req.setBaseProjIntro(apply.getBaseProjIntro()); - req.setBaseProjStartTime(String.valueOf(apply.getBaseProjStartTime())); - req.setBaseProjEndTime(String.valueOf(apply.getBaseProjEndTime())); + req.setBaseProjStartTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjStartTime())); + req.setBaseProjEndTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjEndTime())); req.setBaseProjSetYear(apply.getBaseProjSetYear()); req.setBaseProjSys(apply.getBaseProjSys()); req.setBaseProjSysCode(apply.getBaseDevelopCode()); @@ -342,8 +351,8 @@ public class ProjectConvert { req.setBaseProjConsClass(apply.getBaseProjConsClass()); req.setBaseProjDuration(String.valueOf(apply.getBaseProjDuration())); req.setBaseProjIntro(apply.getBaseProjIntro()); - req.setBaseProjStartTime(String.valueOf(apply.getBaseProjStartTime())); - req.setBaseProjEndTime(String.valueOf(apply.getBaseProjEndTime())); + req.setBaseProjStartTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjStartTime())); + req.setBaseProjEndTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjEndTime())); req.setBaseProjSetYear(apply.getBaseProjSetYear()); req.setBaseProjSys(apply.getBaseProjSys()); req.setBaseProjSysCode(apply.getBaseDevelopCode()); @@ -388,8 +397,8 @@ public class ProjectConvert { req.setBaseProjConsClass(apply.getBaseProjConsClass()); req.setBaseProjDuration(String.valueOf(apply.getBaseProjDuration())); req.setBaseProjIntro(apply.getBaseProjIntro()); - req.setBaseProjStartTime(String.valueOf(apply.getBaseProjStartTime())); - req.setBaseProjEndTime(String.valueOf(apply.getBaseProjEndTime())); + req.setBaseProjStartTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjStartTime())); + req.setBaseProjEndTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjEndTime())); req.setBaseProjSetYear(apply.getBaseProjSetYear()); req.setBaseProjSys(apply.getBaseProjSys()); req.setBaseProjSysCode(apply.getBaseDevelopCode()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectCollectionUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectCollectionUtil.java new file mode 100644 index 0000000..bf9caca --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectCollectionUtil.java @@ -0,0 +1,25 @@ +package com.ningdatech.pmapi.gov.utils; + +import com.ningdatech.pmapi.common.constant.CommonConst; +import org.apache.commons.lang3.StringUtils; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Objects; + +/** + * @Classname ProjectCollectionUtil + * @Description + * @Date 2023/9/14 9:07 + * @Author PoffyZhang + */ +public class ProjectCollectionUtil { + + public static String convertLocalDateTime(LocalDateTime localDateTime){ + if(Objects.isNull(localDateTime)){ + return StringUtils.EMPTY; + } + return localDateTime.format(DateTimeFormatter.ofPattern(CommonConst.NORMAL_TIME_PATTERN)); + } + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java index a0c7c0f..e2e8f83 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java @@ -64,6 +64,27 @@ public class SynProjectCoreBizTask { * */ @Scheduled(cron = "0 0 2 * * ?") + public void doTask() throws UnknownHostException { + if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { + log.info("定时器没开启或者host不对! {}:{}", + HOST,InetAddress.getLocalHost().getHostName()); + return; + } + + log.info("同步项目核心业务开始====="); + StopWatch stopWatch = new StopWatch(); + stopWatch.start(); + + List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .in(DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE + , DingOrganizationContant.GOV_TEMPORARY))); + log.info("总共需要同步 orgs size :{}",orgs.size()); + + syncCoreBiz(orgs); + stopWatch.stop(); + log.info("同步项目核心业务结束====={}s",stopWatch.getTotalTimeSeconds()); + } + public void doTask(String orgCode) throws UnknownHostException { if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { log.info("定时器没开启或者host不对! {}:{}", @@ -82,6 +103,13 @@ public class SynProjectCoreBizTask { log.info("总共需要同步 orgs size :{}",orgs.size()); + syncCoreBiz(orgs); + + stopWatch.stop(); + log.info("同步项目核心业务结束====={}s",stopWatch.getTotalTimeSeconds()); + } + + private void syncCoreBiz(List orgs) { for(DingOrganization organization : orgs){ GenericResult dingResult = zwddClient.getOrganizationByCode(organization.getOrganizationCode()); if(dingResult.isSuccess()){ @@ -131,10 +159,9 @@ public class SynProjectCoreBizTask { } } } - stopWatch.stop(); - log.info("同步项目核心业务结束====={}s",stopWatch.getTotalTimeSeconds()); } + /** * 生成 编号 * @param unifiedSocialCreditCode From 49d06ecb0a1a7a4f3619d3ce152a33db9e668bde Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 14 Sep 2023 09:59:51 +0800 Subject: [PATCH 27/36] =?UTF-8?q?=E6=A0=B8=E5=BF=83=E4=B8=9A=E5=8A=A1=20?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E6=8C=89=E5=8D=95=E4=BD=8D=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov/manage/GovProjectCollectionManage.java | 2 +- .../scheduler/task/SynProjectCoreBizTask.java | 6 ----- .../projectCollection/ProjectCollectionTest.java | 27 ++++++++++++++++++++++ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java index 21def6b..937a941 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java @@ -558,7 +558,7 @@ public class GovProjectCollectionManage { for(GovBizProjectProcureDTO procure : procures){ procure.setBaseProjId(finalBaseProjId); procure.setBaseProjName(baseProjName); - procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + index); + procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,index)); GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure,GovBizProjectProcure.class); saveProcure.setBaseProjId(finalBaseProjId); saveProcure.setId(null); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java index e2e8f83..2bc4f97 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java @@ -86,12 +86,6 @@ public class SynProjectCoreBizTask { } public void doTask(String orgCode) throws UnknownHostException { - if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { - log.info("定时器没开启或者host不对! {}:{}", - HOST,InetAddress.getLocalHost().getHostName()); - return; - } - log.info("同步项目核心业务开始====="); StopWatch stopWatch = new StopWatch(); stopWatch.start(); diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java index b804e78..725d6c0 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java @@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; +import com.ningdatech.basic.util.StrPool; import com.ningdatech.log.model.domain.OptLog; import com.ningdatech.log.service.OptLogService; import com.ningdatech.pmapi.AppTests; @@ -18,6 +19,7 @@ import com.ningdatech.pmapi.gov.model.entity.*; import com.ningdatech.pmapi.gov.service.*; import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; import com.ningdatech.pmapi.scheduler.task.SynProjectCollectionTask; +import com.ningdatech.pmapi.scheduler.task.SynProjectCoreBizTask; import org.apache.commons.lang3.StringUtils; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -68,6 +70,9 @@ public class ProjectCollectionTest extends AppTests { @Autowired private OptLogService optLogService; + @Autowired + private SynProjectCoreBizTask projectCoreBizTask; + @Test public void test(){ List baseProjIds = Lists.newArrayList("33110000020230100061"); @@ -186,4 +191,26 @@ public class ProjectCollectionTest extends AppTests { Long ll = ChronoUnit.MONTHS.between(temporal1, temporal2); return ll.toString(); } + + @Test + public void test6(){ + List list = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getDeleted,Boolean.FALSE)); + + for(GovBizProjectProcure procure : list){ + try{ + String index = procure.getBaseBidCode().split("-")[1]; + procure.setBaseBidCode(procure.getBaseProjId() + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,Integer.parseInt(index))); + procureService.updateById(procure); + }catch (Exception e){ + e.printStackTrace(); + } + } + } + + @Test + public void test7() throws UnknownHostException { + String orgCode = "GO_5f1f6f28a6f7484ea3b9991d8d02599f"; + projectCoreBizTask.doTask(orgCode); + } } From 81535ce154beef6850cd411b1c36fab5289deff7 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 14 Sep 2023 15:05:41 +0800 Subject: [PATCH 28/36] =?UTF-8?q?=E6=A0=B8=E5=BF=83=E4=B8=9A=E5=8A=A1=20?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E6=8C=89=E5=8D=95=E4=BD=8D=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pmapi/projectdeclared/manage/DeclaredProjectManage.java | 10 +++++----- .../ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java index 5251bf9..20104db 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java @@ -463,11 +463,11 @@ public class DeclaredProjectManage { } }else if(BizConst.PRE.equals(active) || BizConst.PROD.equals(active)){ -// jsonObject = projectIrsManage.searchCoreBiz(businessName,user.getEmpPosUnitCode(),limit,page); - List list = coreBizService.list(Wrappers.lambdaQuery(ProjectCoreBiz.class) - .eq(ProjectCoreBiz::getOrgCode, user.getEmpPosUnitCode()) - .like(StringUtils.isNotBlank(businessName), ProjectCoreBiz::getMatterName, businessName)); - jsonObject.put("data",list); + jsonObject = projectIrsManage.searchCoreBiz(businessName,user.getEmpPosUnitCode(),limit,page); +// List list = coreBizService.list(Wrappers.lambdaQuery(ProjectCoreBiz.class) +// .eq(ProjectCoreBiz::getOrgCode, user.getEmpPosUnitCode()) +// .like(StringUtils.isNotBlank(businessName), ProjectCoreBiz::getMatterName, businessName)); +// jsonObject.put("data",list); } return jsonObject; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java index 2bc4f97..daea910 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java @@ -106,6 +106,9 @@ public class SynProjectCoreBizTask { private void syncCoreBiz(List orgs) { for(DingOrganization organization : orgs){ GenericResult dingResult = zwddClient.getOrganizationByCode(organization.getOrganizationCode()); + + log.info("core biz result : {}",JSON.toJSONString(dingResult)); + if(dingResult.isSuccess()){ DingOrgInfoDTO data = dingResult.getData(); String unifiedSocialCreditCode = data.getUnifiedSocialCreditCode(); From 43c094c3f019beb1b9efce0a04a38797f1c12f50 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 14 Sep 2023 16:50:48 +0800 Subject: [PATCH 29/36] =?UTF-8?q?=E6=A0=B8=E5=BF=83=E4=B8=9A=E5=8A=A1=20?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E6=8C=89=E5=8D=95=E4=BD=8D=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scheduler/task/SynProjectCoreBizTask.java | 81 ++++++++++++++++++++-- 1 file changed, 74 insertions(+), 7 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java index daea910..13701a3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java @@ -29,7 +29,9 @@ import java.net.InetAddress; import java.net.UnknownHostException; import java.time.LocalDateTime; import java.util.List; +import java.util.Map; import java.util.Objects; +import java.util.stream.Collectors; /** * @author ZPF @@ -58,9 +60,11 @@ public class SynProjectCoreBizTask { @Autowired private ProjectIrsManage projectIrsManage; + private final Integer MAX_PAGE_SIZE = 1000; + /** * 前置机每天晚上10点自动清空,第二天早上6点获取数据 - * 定时同步前置机数据 每天1点开始执行一次 + * 定时同步前置机数据 每天1点开始执行一次 不按照单位 * */ @Scheduled(cron = "0 0 2 * * ?") @@ -75,12 +79,7 @@ public class SynProjectCoreBizTask { StopWatch stopWatch = new StopWatch(); stopWatch.start(); - List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .in(DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE - , DingOrganizationContant.GOV_TEMPORARY))); - log.info("总共需要同步 orgs size :{}",orgs.size()); - - syncCoreBiz(orgs); + syncCoreBiz(); stopWatch.stop(); log.info("同步项目核心业务结束====={}s",stopWatch.getTotalTimeSeconds()); } @@ -158,6 +157,74 @@ public class SynProjectCoreBizTask { } } + private void syncCoreBiz() { + Map map = organizationService.list().stream().distinct().collect(Collectors.toMap(DingOrganization::getOrganizationCode, o -> o)); + + Integer currentSize = MAX_PAGE_SIZE; + Integer page = 1; + while (currentSize.equals(MAX_PAGE_SIZE)) { + //去请求IRS接口 + JSONObject jsonObject = projectIrsManage.searchCoreBiz(null, null, MAX_PAGE_SIZE, page); + + JSONArray jsonArray = jsonObject.getJSONArray(BizConst.RESPONSE_KEY_DATA); + currentSize = jsonArray.size(); + if (CollUtil.isNotEmpty(jsonArray)) { + if (currentSize.equals(MAX_PAGE_SIZE)) { + page++; + } + jsonArray.forEach(j -> { + JSONObject jsonData = JSON.parseObject(JSON.toJSONString(j)); + ProjectCoreBiz coreBiz = new ProjectCoreBiz(); + // + Long irsId = jsonData.getLong(BizConst.RESPONSE_KEY_ID); + String dingCode = jsonData.getString(BizConst.RESPONSE_KEY_DING_CODE); + String matterName = jsonData.getString(BizConst.RESPONSE_KEY_MATTER_NAME); + String orgName = jsonData.getString(BizConst.RESPONSE_KEY_ORG_NAME); + String userState = jsonData.getString(BizConst.RESPONSE_KEY_USER_STATE); + String areaName = jsonData.getString(BizConst.RESPONSE_KEY_AREA_NAME); + ProjectCoreBiz old = projectCoreBizService.getOne(Wrappers.lambdaQuery(ProjectCoreBiz.class) + .eq(ProjectCoreBiz::getIrsId, irsId) + .last(BizConst.LIMIT_1)); + + if (Objects.nonNull(old)) { + coreBiz.setId(old.getId()); + } else { + coreBiz.setCreateOn(LocalDateTime.now()); + } + + if(map.containsKey(dingCode)){ + DingOrganization organization = map.get(dingCode); + + String unifiedSocialCreditCode = organization.getUnifiedSocialCreditCode(); + if(StringUtils.isBlank(unifiedSocialCreditCode)){ + GenericResult dingResult = zwddClient.getOrganizationByCode(organization.getOrganizationCode()); + + log.info("ding org result : {}",JSON.toJSONString(dingResult)); + + if(dingResult.isSuccess()){ + DingOrgInfoDTO data = dingResult.getData(); + unifiedSocialCreditCode = data.getUnifiedSocialCreditCode(); + organization.setUnifiedSocialCreditCode(unifiedSocialCreditCode); + organizationService.updateById(organization); + } + } + + coreBiz.setUpdateOn(LocalDateTime.now()); + coreBiz.setIrsId(irsId); + coreBiz.setMatterName(matterName); + coreBiz.setOrgCode(dingCode); + coreBiz.setOrgName(orgName); + coreBiz.setUserState(userState); + coreBiz.setAreaName(areaName); + coreBiz.setMatterCode(irsId.toString()); + projectCoreBizService.saveOrUpdate(coreBiz); + coreBiz.setMatterCode(genirate(unifiedSocialCreditCode, coreBiz.getId())); + projectCoreBizService.updateById(coreBiz); + } + }); + } + } + } /** * 生成 编号 From 7bcde4b567217926918ec726e3534a672a5d07b0 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 14 Sep 2023 16:51:09 +0800 Subject: [PATCH 30/36] =?UTF-8?q?=E6=A0=B8=E5=BF=83=E4=B8=9A=E5=8A=A1=20?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E6=8C=89=E5=8D=95=E4=BD=8D=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ningdatech/pmapi/irs/controller/IrsController.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java b/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java index a13ca9c..a0aece2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/irs/controller/IrsController.java @@ -10,6 +10,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -62,6 +63,10 @@ public class IrsController { @ApiOperation(value = "强制刷新核心业务", notes = "强制刷新核心业务") @GetMapping("/refresh-core-biz") public void refreshCoreBiz(@RequestParam(required = false) String orgCode) throws UnknownHostException { - projectCoreBizTask.doTask(orgCode); + if(StringUtils.isNotBlank(orgCode)){ + projectCoreBizTask.doTask(orgCode); + }else{ + projectCoreBizTask.doTask(); + } } } From 0b86144f3d8ae0cceda4c89b8441be90db085073 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Thu, 14 Sep 2023 17:09:42 +0800 Subject: [PATCH 31/36] =?UTF-8?q?=E7=94=B3=E6=8A=A5=E9=A1=B9=E7=9B=AE=20?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E6=98=AF=E4=B8=8A=E7=BA=A7=E4=B8=BB=E7=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java index 13701a3..a3d43e3 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java @@ -167,6 +167,11 @@ public class SynProjectCoreBizTask { JSONObject jsonObject = projectIrsManage.searchCoreBiz(null, null, MAX_PAGE_SIZE, page); JSONArray jsonArray = jsonObject.getJSONArray(BizConst.RESPONSE_KEY_DATA); + + if(Objects.isNull(jsonArray)){ + return; + } + currentSize = jsonArray.size(); if (CollUtil.isNotEmpty(jsonArray)) { if (currentSize.equals(MAX_PAGE_SIZE)) { From 805ffc5277095c52db80b25f1e483fef406c2b61 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 15 Sep 2023 09:59:02 +0800 Subject: [PATCH 32/36] =?UTF-8?q?=E7=94=B3=E6=8A=A5=E9=A1=B9=E7=9B=AE=20de?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java | 2 +- .../java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectApplyDTO.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java index 937a941..2aa907c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java @@ -389,7 +389,7 @@ public class GovProjectCollectionManage { } GovBizProjectBaseinfoDTO base = saveDTO.getBaseinfo(); - String baseProjId = base.getBaseProjId(); + String baseProjId = saveDTO.getBaseProjId(); String baseAreaCode = user.getRegionCode() + BizConst.NINE_AREA_CODE_LAST; String baseProjName = base.getBaseProjName(); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectApplyDTO.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectApplyDTO.java index b21cc1e..e2a2060 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectApplyDTO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/model/dto/GovBizProjectApplyDTO.java @@ -69,7 +69,7 @@ public class GovBizProjectApplyDTO implements Serializable { private LocalDateTime baseProjEndTime; @ApiModelProperty("项目期限") - private LocalDateTime baseProjDuration; + private String baseProjDuration; @ApiModelProperty("项目年度") private String baseProjSetYear; From 728cbdaa863e545647293be29d1a59f8262278e2 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 15 Sep 2023 14:01:47 +0800 Subject: [PATCH 33/36] =?UTF-8?q?=E6=AF=8F=E6=97=A5=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=A0=B8=E5=BF=83=E4=B8=9A=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java index a3d43e3..33a875f 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java @@ -79,7 +79,13 @@ public class SynProjectCoreBizTask { StopWatch stopWatch = new StopWatch(); stopWatch.start(); - syncCoreBiz(); + List orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) + .in(DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE + , DingOrganizationContant.GOV_TEMPORARY))); + + log.info("总共需要同步 orgs size :{}",orgs.size()); + + syncCoreBiz(orgs); stopWatch.stop(); log.info("同步项目核心业务结束====={}s",stopWatch.getTotalTimeSeconds()); } From fdf278b24e62360416d30dcfca48a0647973b6fd Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 15 Sep 2023 14:45:37 +0800 Subject: [PATCH 34/36] =?UTF-8?q?=E6=AF=8F=E6=97=A5=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=A0=B8=E5=BF=83=E4=B8=9A=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java index 33a875f..7643652 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java @@ -67,7 +67,7 @@ public class SynProjectCoreBizTask { * 定时同步前置机数据 每天1点开始执行一次 不按照单位 * */ - @Scheduled(cron = "0 0 2 * * ?") +// @Scheduled(cron = "0 0 2 * * ?") public void doTask() throws UnknownHostException { if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { log.info("定时器没开启或者host不对! {}:{}", From 5f6f4bbc1ac4245ab59a49fc156d0f0d841cad30 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Fri, 15 Sep 2023 14:49:51 +0800 Subject: [PATCH 35/36] =?UTF-8?q?=E6=AF=8F=E6=97=A5=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=A0=B8=E5=BF=83=E4=B8=9A=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java index b98bff8..61f7e42 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java @@ -378,7 +378,7 @@ public class ProjectConvert { req.setBaseAccountAppName(apply.getBaseAccountAppName()); req.setBaseBasisEstablish(apply.getBaseBasisEstablish()); req.setBaseCoreBusiness(apply.getBaseCoreBusiness()); - req.setBaseCoreBusinessCode(apply.getBaseCoreBusinessCode()); +// req.setBaseCoreBusinessCode(apply.getBaseCoreBusinessCode()); req.setBaseBrainName(apply.getBaseBrainName()); req.setBaseDevelopCode(apply.getBaseDevelopCode()); req.setBaseLowestLevel(apply.getBaseLowestLevel()); From a83610afbc743723c6c6676bcddf90d55215d666 Mon Sep 17 00:00:00 2001 From: PoffyZhang <99775271@qq.com> Date: Wed, 20 Sep 2023 10:40:25 +0800 Subject: [PATCH 36/36] =?UTF-8?q?=E7=94=9F=E6=88=90=E7=BC=96=E5=8F=B7=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../utils/GenerateProjectCodeUtil.java | 23 ++++++--- .../projectCollection/ProjectCollectionTest.java | 60 +++++++++++++++++----- 2 files changed, 61 insertions(+), 22 deletions(-) diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java index afee368..9a0a2c2 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/utils/GenerateProjectCodeUtil.java @@ -1,7 +1,9 @@ package com.ningdatech.pmapi.projectdeclared.utils; +import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ningdatech.basic.function.VUtils; +import com.ningdatech.basic.util.StrPool; import com.ningdatech.pmapi.common.constant.BizConst; import com.ningdatech.pmapi.common.constant.RegionConst; import com.ningdatech.pmapi.gov.contants.BizProjectContant; @@ -9,7 +11,9 @@ import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO; import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO; import com.ningdatech.pmapi.gov.model.entity.GovBizProjectApply; +import com.ningdatech.pmapi.gov.model.entity.GovBizProjectBaseinfo; import com.ningdatech.pmapi.gov.service.IGovBizProjectApplyService; +import com.ningdatech.pmapi.gov.service.IGovBizProjectBaseinfoService; import com.ningdatech.pmapi.projectdeclared.contants.ProjectCodeContant; import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; import com.ningdatech.pmapi.projectlib.model.entity.Project; @@ -34,7 +38,7 @@ public class GenerateProjectCodeUtil { private IProjectService projectService; @Autowired - private IGovBizProjectApplyService applyService; + private IGovBizProjectBaseinfoService baseinfoService; public String generateProjectCode(ProjectDTO project){ // 获取所属行政区划代码(9位) @@ -72,7 +76,7 @@ public class GenerateProjectCodeUtil { return areaCode + year + projectType + serialNumber; } - public String generateProjectCode(GovBizProjectSaveDTO dto){ + public String generateProjectCode(GovBizProjectSaveDTO dto) { // 获取所属行政区划代码(9位) GovBizProjectBaseinfoDTO baseinfo = dto.getBaseinfo(); GovBizProjectApplyDTO apply = dto.getApply(); @@ -80,19 +84,22 @@ public class GenerateProjectCodeUtil { VUtils.isTrue(Objects.isNull(baseinfo)).throwMessage("没有项目基本信息 无法生成项目编号!"); VUtils.isTrue(Objects.isNull(apply)).throwMessage("没有项目申报信息 无法生成项目编号!"); - String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode())?baseinfo.getBaseAreaCode(): RegionConst.RC_LS + BizConst.NINE_AREA_CODE_LAST); + String areaCode = (StringUtils.isNotBlank(baseinfo.getBaseAreaCode()) ? baseinfo.getBaseAreaCode() : RegionConst.RC_LS + BizConst.NINE_AREA_CODE_LAST); // 获取建设年度 (10-13) String year = Objects.nonNull(apply.getBaseProjSetYear()) ? apply.getBaseProjSetYear() : String.valueOf(LocalDateTime.now().getYear()); // 14-15 项目类型 String projectType = StringUtils.isNotBlank(baseinfo.getBaseProjType()) ? baseinfo.getBaseProjType() : BizProjectContant.ProjectCollection.IS_EFFECTIVE; + String currentCode = areaCode + year + projectType; // 16-20 项目序号00001 - Long max = applyService.count(Wrappers.lambdaQuery(GovBizProjectApply.class) - .eq(GovBizProjectApply::getBaseProjSetYear,apply.getBaseProjSetYear())); - Long maxCurrent = max + 1; - String serialNumber = String.format(ProjectCodeContant.SHUZI_5,maxCurrent); + GovBizProjectBaseinfo baseMax = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) + .like(GovBizProjectBaseinfo::getBaseProjId, currentCode) + .orderByDesc(GovBizProjectBaseinfo::getBaseProjId) + .last(BizConst.LIMIT_1)); + Long max = Objects.isNull(baseMax) ? 0L : Long.valueOf(baseMax.getBaseProjId().substring(baseMax.getBaseProjId().length() - 5, baseMax.getBaseProjId().length())); + max = max + 1; // 生成20位的项目编号 - return areaCode + year + projectType + serialNumber; + return currentCode + String.format(ProjectCodeContant.SHUZI_5, max); } } diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java index 725d6c0..431c6dd 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/projectCollection/ProjectCollectionTest.java @@ -75,15 +75,20 @@ public class ProjectCollectionTest extends AppTests { @Test public void test(){ - List baseProjIds = Lists.newArrayList("33110000020230100061"); + List baseProjIds = Lists.newArrayList("33110000020230200001"); for(String baseProjId : baseProjIds){ GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectBaseinfo::getTongTime) .last(BizConst.LIMIT_1)); GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) .eq(GovBizProjectApply::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectApply::getTongTime) .last(BizConst.LIMIT_1)); - + if(Objects.isNull(baseinfo)){ + System.out.println("项目不存在 直接下一个"); + continue; + } GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); saveDTO.setBaseinfo(BeanUtil.copyProperties(baseinfo, GovBizProjectBaseinfoDTO.class)); @@ -93,18 +98,45 @@ public class ProjectCollectionTest extends AppTests { baseinfoService.updateById(baseinfo); apply.setBaseProjId(newProjId); applyService.updateById(apply); - approveService.update(Wrappers.lambdaUpdate(GovBizProjectApprove.class) - .eq(GovBizProjectApprove::getBaseProjId,baseProjId) - .set(GovBizProjectApprove::getBaseProjId,newProjId)); - cimplementService.update(Wrappers.lambdaUpdate(GovBizProjectCimplement.class) - .eq(GovBizProjectCimplement::getBaseProjId,baseProjId) - .set(GovBizProjectCimplement::getBaseProjId,newProjId)); - mimplementService.update(Wrappers.lambdaUpdate(GovBizProjectMimplement.class) - .eq(GovBizProjectMimplement::getBaseProjId,baseProjId) - .set(GovBizProjectMimplement::getBaseProjId,newProjId)); - procureService.update(Wrappers.lambdaUpdate(GovBizProjectProcure.class) - .eq(GovBizProjectProcure::getBaseProjId,baseProjId) - .set(GovBizProjectProcure::getBaseProjId,newProjId)); + + GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaUpdate(GovBizProjectApprove.class) + .eq(GovBizProjectApprove::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectApprove::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(approve)){ + approve.setBaseProjId(newProjId); + approveService.updateById(approve); + } + + + GovBizProjectCimplement cimplement = cimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectCimplement.class) + .eq(GovBizProjectCimplement::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectCimplement::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(cimplement)){ + cimplement.setBaseProjId(newProjId); + cimplement.setBaseBidCode(newProjId); + cimplementService.updateById(cimplement); + } + + GovBizProjectMimplement mimplement = mimplementService.getOne(Wrappers.lambdaQuery(GovBizProjectMimplement.class) + .eq(GovBizProjectMimplement::getBaseProjId, baseProjId) + .orderByDesc(GovBizProjectMimplement::getTongTime) + .last(BizConst.LIMIT_1)); + if(Objects.nonNull(mimplement)){ + mimplement.setBaseProjId(newProjId); + mimplement.setBaseBidCode(newProjId); + mimplementService.updateById(mimplement); + } + + List procures = procureService.list(Wrappers.lambdaUpdate(GovBizProjectProcure.class) + .eq(GovBizProjectProcure::getBaseProjId, baseProjId)); + + for(GovBizProjectProcure procure : procures){ + procure.setBaseProjId(newProjId); + procure.setBaseBidCode(newProjId + "-" + procure.getBaseBidCode().split("-")[1]); + procureService.updateById(procure); + } } }