diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/GovBusinessStripsTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/GovBusinessStripsTask.java index 69050ee..8cadfb4 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/GovBusinessStripsTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/GovBusinessStripsTask.java @@ -1,11 +1,20 @@ package com.ningdatech.pmapi.ding.task; +import cn.hutool.core.collection.CollectionUtil; +import com.ningdatech.basic.model.GenericResult; +import com.ningdatech.pmapi.organization.entity.GovBusinessStrip; import com.ningdatech.pmapi.organization.service.IGovBusinessStripService; import com.ningdatech.zwdd.client.ZwddClient; +import com.ningdatech.zwdd.model.Page; +import com.ningdatech.zwdd.model.dto.SubGovBusinessStripsDTO; +import com.ningdatech.zwdd.model.query.PageSubGovBusinessStripsQuery; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import java.util.List; +import java.util.stream.Collectors; + /** * @author liuxinxin * @date 2023/3/8 下午2:55 @@ -21,11 +30,63 @@ public class GovBusinessStripsTask { @Autowired private ZwddClient zwddClient; + @Autowired private IGovBusinessStripService iGovBusinessStripService; @Transactional(rollbackFor = Exception.class) public void batchGetGovBusinessStripsTask() { + PageSubGovBusinessStripsQuery pageSubGovBusinessStripsQuery = new PageSubGovBusinessStripsQuery(); + pageSubGovBusinessStripsQuery.setPageNo(1); + pageSubGovBusinessStripsQuery.setPageSize(100); + GenericResult> pageGenericResult = zwddClient.pageSubGovBusinessStrips(pageSubGovBusinessStripsQuery); + Page data = pageGenericResult.getData(); + List govBusinessStripsDTOList = data.getData(); + + List govBusinessStripList = govBusinessStripsDTOList.stream().map(r -> { + GovBusinessStrip govBusinessStrip = new GovBusinessStrip(); + govBusinessStrip.setBusinessStripCode(r.getCode()); + govBusinessStrip.setBusinessStripName(r.getName()); + return govBusinessStrip; + }).collect(Collectors.toList()); + + saveBatch(govBusinessStripList); + + for (SubGovBusinessStripsDTO subGovBusinessStripsDTO : govBusinessStripsDTOList) { + saveSub(subGovBusinessStripsDTO); + } + + } + + + public void saveSub(SubGovBusinessStripsDTO parentGovBusinessStripsDTO) { + String parentCode = parentGovBusinessStripsDTO.getCode(); + String parentName = parentGovBusinessStripsDTO.getName(); + PageSubGovBusinessStripsQuery pageSubGovBusinessStripsQuery = new PageSubGovBusinessStripsQuery(); + pageSubGovBusinessStripsQuery.setPageNo(1); + pageSubGovBusinessStripsQuery.setPageSize(100); + pageSubGovBusinessStripsQuery.setBusinessStripCode(parentCode); + GenericResult> pageGenericResult = zwddClient.pageSubGovBusinessStrips(pageSubGovBusinessStripsQuery); + Page data = pageGenericResult.getData(); + List govBusinessStripsDTOList = data.getData(); + + if (CollectionUtil.isNotEmpty(govBusinessStripsDTOList)) { + List govBusinessStripList = govBusinessStripsDTOList.stream().map(r -> { + GovBusinessStrip govBusinessStrip = new GovBusinessStrip(); + govBusinessStrip.setBusinessStripCode(r.getCode()); + govBusinessStrip.setBusinessStripName(r.getName()); + govBusinessStrip.setParentCode(parentCode); + govBusinessStrip.setParentName(parentName); + return govBusinessStrip; + }).collect(Collectors.toList()); + saveBatch(govBusinessStripList); + } } + + public void saveBatch(List govBusinessStripList) { + if (CollectionUtil.isNotEmpty(govBusinessStripList)) { + iGovBusinessStripService.saveBatch(govBusinessStripList); + } + } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java index 067ace3..8475d6c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java @@ -4,6 +4,7 @@ package com.ningdatech.pmapi.ding.task; import cn.hutool.core.collection.CollUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.collect.Lists; import com.ningdatech.basic.model.GenericResult; import com.ningdatech.pmapi.ding.model.DingOrgInfoTreeDTO; @@ -48,7 +49,7 @@ public class OrganizationBatchGetTask { // List allList = iDingOrganizationService.list(); // List currentAllOrganizationCodeList = allList.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toList()); // 全量删除 - // iDingOrganizationService.remove(Wrappers.lambdaQuery(DingOrganization.class).isNotNull(DingOrganization::getId)); + iDingOrganizationService.remove(Wrappers.lambdaQuery(DingOrganization.class).isNotNull(DingOrganization::getId)); // 获取顶级组织code GenericResult scopesV2Result = zwddClient.getScopesV2(); DingScopesV2DTO scopesV2 = scopesV2Result.getData(); @@ -109,6 +110,8 @@ public class OrganizationBatchGetTask { saveRecord.setDisplayOrder(dingOrgInfoDTO.getDisplayOrder()); // saveRecord.setEnabled("1"); saveRecord.setParentCode(dingOrgInfoDTO.getParentCode()); + saveRecord.setTypeCode(dingOrgInfoDTO.getTypeCode()); + saveRecord.setTypeName(dingOrgInfoDTO.getTypeName()); saveRecord.setOrganizationCode(dingOrgInfoDTO.getOrganizationCode()); // saveRecord.setSubCount((long) dingOrgInfoTreeDTO.getChildCodes().size()); saveRecord.setOrganizationName(dingOrgInfoDTO.getOrganizationName()); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java index 97222af..77a692b 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java @@ -50,6 +50,7 @@ public class OrganizationManage { public PageVo organizationList(ReqOrganizationListPO reqOrganizationListPO) { String orgName = reqOrganizationListPO.getOrgName(); + Boolean onlyUnit = reqOrganizationListPO.getOnlyUnit(); String regionId = reqOrganizationListPO.getRegionId(); Page page = iDingOrganizationService @@ -57,8 +58,8 @@ public class OrganizationManage { , Wrappers.lambdaQuery(DingOrganization.class) .like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName) .eq(StringUtils.isNotBlank(regionId), DingOrganization::getDivisionCode, regionId) + .notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION") .orderByAsc(DingOrganization::getId) - ); long total = page.getTotal(); @@ -134,6 +135,7 @@ public class OrganizationManage { String organizationCode = request.getOrganizationCode(); String organizationName = request.getOrganizationName(); String employeeName = request.getEmployeeName(); + Boolean onlyUnit = request.getOnlyUnit(); // 用户搜索为特殊逻辑 if (StringUtils.isNotBlank(employeeName)) { @@ -144,7 +146,8 @@ public class OrganizationManage { List organizationCodeList = new ArrayList<>(); if (StringUtils.isNotBlank(organizationName)) { dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .like(DingOrganization::getOrganizationName, organizationName)); + .like(DingOrganization::getOrganizationName, organizationName) + .notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION")); if (dingOrganizationList.size() == 0) { return new ArrayList<>(); } @@ -156,7 +159,8 @@ public class OrganizationManage { if (CollectionUtil.isEmpty(dingOrganizationList)) { dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) - .in(DingOrganization::getOrganizationCode, organizationCodeList)); + .in(DingOrganization::getOrganizationCode, organizationCodeList) + .notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION")); } List orgKeyTreeVOList = dingOrganizationList.stream().map(r -> { 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 72866e5..ceb448b 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 @@ -32,7 +32,7 @@ public class DingOrganization implements Serializable { private Long displayOrder; - private Long typeName; + private String typeName; private Integer leaf; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqOrganizationListPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqOrganizationListPO.java index b0a4e43..ba58783 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqOrganizationListPO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqOrganizationListPO.java @@ -28,4 +28,7 @@ public class ReqOrganizationListPO extends PagePo { @ApiModelProperty("是否为上级条线主管单位") private Boolean isSuperiorLineCompetentUnit; + @ApiModelProperty("是否只筛选单位") + private Boolean onlyUnit = false; + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java index 7bd77fe..f9c32fa 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java @@ -24,4 +24,7 @@ public class ReqSynthesizePO { @ApiModelProperty("筛选人员姓名") private String employeeName; + + @ApiModelProperty("是否只筛选单位") + private Boolean onlyUnit = false; } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/converter/ApplicationConverter.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/converter/ApplicationConverter.java index 3db3167..c76c37c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/converter/ApplicationConverter.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/converter/ApplicationConverter.java @@ -11,6 +11,7 @@ import com.ningdatech.pmapi.provincial.model.dto.FileDTO; import com.ningdatech.pmapi.provincial.model.dto.ProvincialApplicationDTO; import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.assertj.core.util.Lists; import java.math.BigDecimal; @@ -58,7 +59,7 @@ public class ApplicationConverter { .superUnit(projectInfo.getSuperOrg()) .superUnitCode(projectInfo.getSuperOrgCode()) .projectEstimateFile(convertFile(projectInfo.getCalculationTotalInvestmentFile(),fileService)) - .unitThreePlan(projectInfo.getMainResponsibilitiesApplicantFile()) + .unitThreePlan(convertFile(projectInfo.getMainResponsibilitiesApplicantFile(),fileService)) .otherFile(convertFile(projectInfo.getPreliminaryPlanFile(),fileService)) .projectRemark(projectInfo.getProjectRemarks()) .includeApplication(projectInfo.getIncludeApplication()) @@ -137,6 +138,7 @@ public class ApplicationConverter { .isS2(projectApplication.getIsAccountAppName()) .accountAppName(projectApplication.getAccountAppName()) .applicationEstimateFile(convertFile(projectApplication.getApplicationEstimateFile(),fileService)) + .cooperativeUnit(projectApplication.getBizCooperateInfo()) .build(); } @@ -149,6 +151,7 @@ public class ApplicationConverter { String fileName = fileJson.getString("originalFileName"); Map fileMap = fileService.findUrlById(Arrays.asList(fileId)); String url = fileMap.get(fileId); + url = removeExpire(url); FileDTO file = new FileDTO(); file.setFileId(String.valueOf(fileId)); file.setFileName(fileName); @@ -162,6 +165,19 @@ public class ApplicationConverter { return null; } + /** + * 去除掉 oss链接的超时时间 + * @param url + * @return + */ + private static String removeExpire(String url) { + if(StringUtils.isNotBlank(url)){ + String s = "Expires"; + return url.replaceAll("&?" + s + "=[^&]*&", StringUtils.EMPTY); + } + return StringUtils.EMPTY; + } + //立项依据的文件格式不一样 private static String convertBasicFile(String applicationEstimateFile, FileService fileService) { try { @@ -176,6 +192,7 @@ public class ApplicationConverter { String fileName = fJson.getString("originalFileName"); Map fileMap = fileService.findUrlById(Arrays.asList(fileId)); String url = fileMap.get(fileId); + url = removeExpire(url); FileDTO file = new FileDTO(); file.setFileId(String.valueOf(fileId)); file.setFileName(fileName); diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java b/pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java index 9a0fd88..0fb2cec 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java @@ -2,6 +2,7 @@ package com.ningdatech.pmapi.organization; import com.ningdatech.pmapi.AppTests; import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask; +import com.ningdatech.pmapi.ding.task.GovBusinessStripsTask; import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask; import com.ningdatech.zwdd.client.ZwddAuthClient; import com.ningdatech.zwdd.client.ZwddClient; @@ -27,14 +28,22 @@ class OrganizationTest extends AppTests { @Autowired private EmployeeBatchGetTask employeeBatchGetTask; + @Autowired + private GovBusinessStripsTask govBusinessStripsTask; + @Test public void testBatchGetOrganization() { organizationBatchGetTask.batchGetOrganizationTask(); } @Test - public void testEmployeeBatchGetTask(){ + public void testEmployeeBatchGetTask() { employeeBatchGetTask.batchGetEmployeeTask(); } + @Test + public void testGovBusinessStripsTask() { + govBusinessStripsTask.batchGetGovBusinessStripsTask(); + } + } diff --git a/pmapi/src/test/java/com/ningdatech/pmapi/provincial/Test.java b/pmapi/src/test/java/com/ningdatech/pmapi/provincial/Test.java index a4eba2d..db28189 100644 --- a/pmapi/src/test/java/com/ningdatech/pmapi/provincial/Test.java +++ b/pmapi/src/test/java/com/ningdatech/pmapi/provincial/Test.java @@ -7,6 +7,7 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project; import com.ningdatech.pmapi.projectlib.service.IProjectService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import javax.crypto.Mac; @@ -22,7 +23,7 @@ import java.security.NoSuchAlgorithmException; * @Author PoffyZhang */ @Slf4j -public class Test extends AppTests { +public class Test {//extends AppTests @Autowired private PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; @@ -51,4 +52,11 @@ public class Test extends AppTests { Project project = projectService.getById(340); prequalificationDeclaredProjectManage.directStartProcess(project,project.getPreStartUserId()); } + + @org.junit.Test + public void Test3333(){ + String url = "http://devplat.oss-cn-hangzhou.aliyuncs.com/2023/04/13/5b2e1ef734e14437ba350ef97202c5b7.pdf?Expires=1681367401&OSSAccessKeyId=LTAI4GL7uypycnBjiRn55rMG&Signature=5PbIhpHNZvA2o8xYy8Ujw9Ibhl8%3D"; + String s = "Expires"; + System.out.println(url.replaceAll("&?" + s + "=[^&]*&", StringUtils.EMPTY)); + } }