@@ -1,11 +1,20 @@ | |||||
package com.ningdatech.pmapi.ding.task; | 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.pmapi.organization.service.IGovBusinessStripService; | ||||
import com.ningdatech.zwdd.client.ZwddClient; | 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.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.Transactional; | ||||
import java.util.List; | |||||
import java.util.stream.Collectors; | |||||
/** | /** | ||||
* @author liuxinxin | * @author liuxinxin | ||||
* @date 2023/3/8 下午2:55 | * @date 2023/3/8 下午2:55 | ||||
@@ -21,11 +30,63 @@ public class GovBusinessStripsTask { | |||||
@Autowired | @Autowired | ||||
private ZwddClient zwddClient; | private ZwddClient zwddClient; | ||||
@Autowired | |||||
private IGovBusinessStripService iGovBusinessStripService; | private IGovBusinessStripService iGovBusinessStripService; | ||||
@Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
public void batchGetGovBusinessStripsTask() { | public void batchGetGovBusinessStripsTask() { | ||||
PageSubGovBusinessStripsQuery pageSubGovBusinessStripsQuery = new PageSubGovBusinessStripsQuery(); | |||||
pageSubGovBusinessStripsQuery.setPageNo(1); | |||||
pageSubGovBusinessStripsQuery.setPageSize(100); | |||||
GenericResult<Page<SubGovBusinessStripsDTO>> pageGenericResult = zwddClient.pageSubGovBusinessStrips(pageSubGovBusinessStripsQuery); | |||||
Page<SubGovBusinessStripsDTO> data = pageGenericResult.getData(); | |||||
List<SubGovBusinessStripsDTO> govBusinessStripsDTOList = data.getData(); | |||||
List<GovBusinessStrip> 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<Page<SubGovBusinessStripsDTO>> pageGenericResult = zwddClient.pageSubGovBusinessStrips(pageSubGovBusinessStripsQuery); | |||||
Page<SubGovBusinessStripsDTO> data = pageGenericResult.getData(); | |||||
List<SubGovBusinessStripsDTO> govBusinessStripsDTOList = data.getData(); | |||||
if (CollectionUtil.isNotEmpty(govBusinessStripsDTOList)) { | |||||
List<GovBusinessStrip> 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<GovBusinessStrip> govBusinessStripList) { | |||||
if (CollectionUtil.isNotEmpty(govBusinessStripList)) { | |||||
iGovBusinessStripService.saveBatch(govBusinessStripList); | |||||
} | |||||
} | |||||
} | } |
@@ -4,6 +4,7 @@ package com.ningdatech.pmapi.ding.task; | |||||
import cn.hutool.core.collection.CollUtil; | import cn.hutool.core.collection.CollUtil; | ||||
import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | ||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.ningdatech.basic.model.GenericResult; | import com.ningdatech.basic.model.GenericResult; | ||||
import com.ningdatech.pmapi.ding.model.DingOrgInfoTreeDTO; | import com.ningdatech.pmapi.ding.model.DingOrgInfoTreeDTO; | ||||
@@ -48,7 +49,7 @@ public class OrganizationBatchGetTask { | |||||
// List<DingOrganization> allList = iDingOrganizationService.list(); | // List<DingOrganization> allList = iDingOrganizationService.list(); | ||||
// List<String> currentAllOrganizationCodeList = allList.stream().map(DingOrganization::getOrganizationCode).collect(Collectors.toList()); | // List<String> 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 | // 获取顶级组织code | ||||
GenericResult<DingScopesV2DTO> scopesV2Result = zwddClient.getScopesV2(); | GenericResult<DingScopesV2DTO> scopesV2Result = zwddClient.getScopesV2(); | ||||
DingScopesV2DTO scopesV2 = scopesV2Result.getData(); | DingScopesV2DTO scopesV2 = scopesV2Result.getData(); | ||||
@@ -109,6 +110,8 @@ public class OrganizationBatchGetTask { | |||||
saveRecord.setDisplayOrder(dingOrgInfoDTO.getDisplayOrder()); | saveRecord.setDisplayOrder(dingOrgInfoDTO.getDisplayOrder()); | ||||
// saveRecord.setEnabled("1"); | // saveRecord.setEnabled("1"); | ||||
saveRecord.setParentCode(dingOrgInfoDTO.getParentCode()); | saveRecord.setParentCode(dingOrgInfoDTO.getParentCode()); | ||||
saveRecord.setTypeCode(dingOrgInfoDTO.getTypeCode()); | |||||
saveRecord.setTypeName(dingOrgInfoDTO.getTypeName()); | |||||
saveRecord.setOrganizationCode(dingOrgInfoDTO.getOrganizationCode()); | saveRecord.setOrganizationCode(dingOrgInfoDTO.getOrganizationCode()); | ||||
// saveRecord.setSubCount((long) dingOrgInfoTreeDTO.getChildCodes().size()); | // saveRecord.setSubCount((long) dingOrgInfoTreeDTO.getChildCodes().size()); | ||||
saveRecord.setOrganizationName(dingOrgInfoDTO.getOrganizationName()); | saveRecord.setOrganizationName(dingOrgInfoDTO.getOrganizationName()); | ||||
@@ -50,6 +50,7 @@ public class OrganizationManage { | |||||
public PageVo<ResOrganizationListVO> organizationList(ReqOrganizationListPO reqOrganizationListPO) { | public PageVo<ResOrganizationListVO> organizationList(ReqOrganizationListPO reqOrganizationListPO) { | ||||
String orgName = reqOrganizationListPO.getOrgName(); | String orgName = reqOrganizationListPO.getOrgName(); | ||||
Boolean onlyUnit = reqOrganizationListPO.getOnlyUnit(); | |||||
String regionId = reqOrganizationListPO.getRegionId(); | String regionId = reqOrganizationListPO.getRegionId(); | ||||
Page<DingOrganization> page = iDingOrganizationService | Page<DingOrganization> page = iDingOrganizationService | ||||
@@ -57,8 +58,8 @@ public class OrganizationManage { | |||||
, Wrappers.lambdaQuery(DingOrganization.class) | , Wrappers.lambdaQuery(DingOrganization.class) | ||||
.like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName) | .like(StringUtils.isNotBlank(orgName), DingOrganization::getOrganizationName, orgName) | ||||
.eq(StringUtils.isNotBlank(regionId), DingOrganization::getDivisionCode, regionId) | .eq(StringUtils.isNotBlank(regionId), DingOrganization::getDivisionCode, regionId) | ||||
.notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION") | |||||
.orderByAsc(DingOrganization::getId) | .orderByAsc(DingOrganization::getId) | ||||
); | ); | ||||
long total = page.getTotal(); | long total = page.getTotal(); | ||||
@@ -134,6 +135,7 @@ public class OrganizationManage { | |||||
String organizationCode = request.getOrganizationCode(); | String organizationCode = request.getOrganizationCode(); | ||||
String organizationName = request.getOrganizationName(); | String organizationName = request.getOrganizationName(); | ||||
String employeeName = request.getEmployeeName(); | String employeeName = request.getEmployeeName(); | ||||
Boolean onlyUnit = request.getOnlyUnit(); | |||||
// 用户搜索为特殊逻辑 | // 用户搜索为特殊逻辑 | ||||
if (StringUtils.isNotBlank(employeeName)) { | if (StringUtils.isNotBlank(employeeName)) { | ||||
@@ -144,7 +146,8 @@ public class OrganizationManage { | |||||
List<String> organizationCodeList = new ArrayList<>(); | List<String> organizationCodeList = new ArrayList<>(); | ||||
if (StringUtils.isNotBlank(organizationName)) { | if (StringUtils.isNotBlank(organizationName)) { | ||||
dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) | 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) { | if (dingOrganizationList.size() == 0) { | ||||
return new ArrayList<>(); | return new ArrayList<>(); | ||||
} | } | ||||
@@ -156,7 +159,8 @@ public class OrganizationManage { | |||||
if (CollectionUtil.isEmpty(dingOrganizationList)) { | if (CollectionUtil.isEmpty(dingOrganizationList)) { | ||||
dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) | dingOrganizationList = iDingOrganizationService.list(Wrappers.lambdaQuery(DingOrganization.class) | ||||
.in(DingOrganization::getOrganizationCode, organizationCodeList)); | .in(DingOrganization::getOrganizationCode, organizationCodeList) | ||||
.notIn(onlyUnit, DingOrganization::getTypeCode, "GOV_INTERNAL_INSTITUTION")); | |||||
} | } | ||||
List<KeyTreeVO> orgKeyTreeVOList = dingOrganizationList.stream().map(r -> { | List<KeyTreeVO> orgKeyTreeVOList = dingOrganizationList.stream().map(r -> { | ||||
@@ -32,7 +32,7 @@ public class DingOrganization implements Serializable { | |||||
private Long displayOrder; | private Long displayOrder; | ||||
private Long typeName; | private String typeName; | ||||
private Integer leaf; | private Integer leaf; | ||||
@@ -28,4 +28,7 @@ public class ReqOrganizationListPO extends PagePo { | |||||
@ApiModelProperty("是否为上级条线主管单位") | @ApiModelProperty("是否为上级条线主管单位") | ||||
private Boolean isSuperiorLineCompetentUnit; | private Boolean isSuperiorLineCompetentUnit; | ||||
@ApiModelProperty("是否只筛选单位") | |||||
private Boolean onlyUnit = false; | |||||
} | } |
@@ -24,4 +24,7 @@ public class ReqSynthesizePO { | |||||
@ApiModelProperty("筛选人员姓名") | @ApiModelProperty("筛选人员姓名") | ||||
private String employeeName; | private String employeeName; | ||||
@ApiModelProperty("是否只筛选单位") | |||||
private Boolean onlyUnit = false; | |||||
} | } |
@@ -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.ProvincialApplicationDTO; | ||||
import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO; | import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.assertj.core.util.Lists; | import org.assertj.core.util.Lists; | ||||
import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
@@ -58,7 +59,7 @@ public class ApplicationConverter { | |||||
.superUnit(projectInfo.getSuperOrg()) | .superUnit(projectInfo.getSuperOrg()) | ||||
.superUnitCode(projectInfo.getSuperOrgCode()) | .superUnitCode(projectInfo.getSuperOrgCode()) | ||||
.projectEstimateFile(convertFile(projectInfo.getCalculationTotalInvestmentFile(),fileService)) | .projectEstimateFile(convertFile(projectInfo.getCalculationTotalInvestmentFile(),fileService)) | ||||
.unitThreePlan(projectInfo.getMainResponsibilitiesApplicantFile()) | .unitThreePlan(convertFile(projectInfo.getMainResponsibilitiesApplicantFile(),fileService)) | ||||
.otherFile(convertFile(projectInfo.getPreliminaryPlanFile(),fileService)) | .otherFile(convertFile(projectInfo.getPreliminaryPlanFile(),fileService)) | ||||
.projectRemark(projectInfo.getProjectRemarks()) | .projectRemark(projectInfo.getProjectRemarks()) | ||||
.includeApplication(projectInfo.getIncludeApplication()) | .includeApplication(projectInfo.getIncludeApplication()) | ||||
@@ -137,6 +138,7 @@ public class ApplicationConverter { | |||||
.isS2(projectApplication.getIsAccountAppName()) | .isS2(projectApplication.getIsAccountAppName()) | ||||
.accountAppName(projectApplication.getAccountAppName()) | .accountAppName(projectApplication.getAccountAppName()) | ||||
.applicationEstimateFile(convertFile(projectApplication.getApplicationEstimateFile(),fileService)) | .applicationEstimateFile(convertFile(projectApplication.getApplicationEstimateFile(),fileService)) | ||||
.cooperativeUnit(projectApplication.getBizCooperateInfo()) | |||||
.build(); | .build(); | ||||
} | } | ||||
@@ -149,6 +151,7 @@ public class ApplicationConverter { | |||||
String fileName = fileJson.getString("originalFileName"); | String fileName = fileJson.getString("originalFileName"); | ||||
Map<Long, String> fileMap = fileService.findUrlById(Arrays.asList(fileId)); | Map<Long, String> fileMap = fileService.findUrlById(Arrays.asList(fileId)); | ||||
String url = fileMap.get(fileId); | String url = fileMap.get(fileId); | ||||
url = removeExpire(url); | |||||
FileDTO file = new FileDTO(); | FileDTO file = new FileDTO(); | ||||
file.setFileId(String.valueOf(fileId)); | file.setFileId(String.valueOf(fileId)); | ||||
file.setFileName(fileName); | file.setFileName(fileName); | ||||
@@ -162,6 +165,19 @@ public class ApplicationConverter { | |||||
return null; | 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) { | private static String convertBasicFile(String applicationEstimateFile, FileService fileService) { | ||||
try { | try { | ||||
@@ -176,6 +192,7 @@ public class ApplicationConverter { | |||||
String fileName = fJson.getString("originalFileName"); | String fileName = fJson.getString("originalFileName"); | ||||
Map<Long, String> fileMap = fileService.findUrlById(Arrays.asList(fileId)); | Map<Long, String> fileMap = fileService.findUrlById(Arrays.asList(fileId)); | ||||
String url = fileMap.get(fileId); | String url = fileMap.get(fileId); | ||||
url = removeExpire(url); | |||||
FileDTO file = new FileDTO(); | FileDTO file = new FileDTO(); | ||||
file.setFileId(String.valueOf(fileId)); | file.setFileId(String.valueOf(fileId)); | ||||
file.setFileName(fileName); | file.setFileName(fileName); | ||||
@@ -2,6 +2,7 @@ package com.ningdatech.pmapi.organization; | |||||
import com.ningdatech.pmapi.AppTests; | import com.ningdatech.pmapi.AppTests; | ||||
import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask; | import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask; | ||||
import com.ningdatech.pmapi.ding.task.GovBusinessStripsTask; | |||||
import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask; | import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask; | ||||
import com.ningdatech.zwdd.client.ZwddAuthClient; | import com.ningdatech.zwdd.client.ZwddAuthClient; | ||||
import com.ningdatech.zwdd.client.ZwddClient; | import com.ningdatech.zwdd.client.ZwddClient; | ||||
@@ -27,14 +28,22 @@ class OrganizationTest extends AppTests { | |||||
@Autowired | @Autowired | ||||
private EmployeeBatchGetTask employeeBatchGetTask; | private EmployeeBatchGetTask employeeBatchGetTask; | ||||
@Autowired | |||||
private GovBusinessStripsTask govBusinessStripsTask; | |||||
@Test | @Test | ||||
public void testBatchGetOrganization() { | public void testBatchGetOrganization() { | ||||
organizationBatchGetTask.batchGetOrganizationTask(); | organizationBatchGetTask.batchGetOrganizationTask(); | ||||
} | } | ||||
@Test | @Test | ||||
public void testEmployeeBatchGetTask(){ | public void testEmployeeBatchGetTask() { | ||||
employeeBatchGetTask.batchGetEmployeeTask(); | employeeBatchGetTask.batchGetEmployeeTask(); | ||||
} | } | ||||
@Test | |||||
public void testGovBusinessStripsTask() { | |||||
govBusinessStripsTask.batchGetGovBusinessStripsTask(); | |||||
} | |||||
} | } |
@@ -7,6 +7,7 @@ import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | import com.ningdatech.pmapi.projectlib.service.IProjectService; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.apache.commons.codec.binary.Base64; | import org.apache.commons.codec.binary.Base64; | ||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import javax.crypto.Mac; | import javax.crypto.Mac; | ||||
@@ -22,7 +23,7 @@ import java.security.NoSuchAlgorithmException; | |||||
* @Author PoffyZhang | * @Author PoffyZhang | ||||
*/ | */ | ||||
@Slf4j | @Slf4j | ||||
public class Test extends AppTests { | public class Test {//extends AppTests | ||||
@Autowired | @Autowired | ||||
private PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; | private PrequalificationDeclaredProjectManage prequalificationDeclaredProjectManage; | ||||
@@ -51,4 +52,11 @@ public class Test extends AppTests { | |||||
Project project = projectService.getById(340); | Project project = projectService.getById(340); | ||||
prequalificationDeclaredProjectManage.directStartProcess(project,project.getPreStartUserId()); | 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)); | |||||
} | |||||
} | } |