Browse Source

Merge remote-tracking branch 'origin/master'

tags/24080901
CMM 1 year ago
parent
commit
9b03777574
9 changed files with 116 additions and 8 deletions
  1. +61
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/ding/task/GovBusinessStripsTask.java
  2. +4
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java
  3. +7
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java
  4. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingOrganization.java
  5. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqOrganizationListPO.java
  6. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java
  7. +18
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/converter/ApplicationConverter.java
  8. +10
    -1
      pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java
  9. +9
    -1
      pmapi/src/test/java/com/ningdatech/pmapi/provincial/Test.java

+ 61
- 0
pmapi/src/main/java/com/ningdatech/pmapi/ding/task/GovBusinessStripsTask.java View File

@@ -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<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
- 1
pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java View File

@@ -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<DingOrganization> allList = iDingOrganizationService.list();
// 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
GenericResult<DingScopesV2DTO> 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());


+ 7
- 3
pmapi/src/main/java/com/ningdatech/pmapi/organization/manage/OrganizationManage.java View File

@@ -50,6 +50,7 @@ public class OrganizationManage {

public PageVo<ResOrganizationListVO> organizationList(ReqOrganizationListPO reqOrganizationListPO) {
String orgName = reqOrganizationListPO.getOrgName();
Boolean onlyUnit = reqOrganizationListPO.getOnlyUnit();
String regionId = reqOrganizationListPO.getRegionId();

Page<DingOrganization> 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<String> 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<KeyTreeVO> orgKeyTreeVOList = dingOrganizationList.stream().map(r -> {


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/organization/model/entity/DingOrganization.java View File

@@ -32,7 +32,7 @@ public class DingOrganization implements Serializable {

private Long displayOrder;

private Long typeName;
private String typeName;

private Integer leaf;



+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqOrganizationListPO.java View File

@@ -28,4 +28,7 @@ public class ReqOrganizationListPO extends PagePo {
@ApiModelProperty("是否为上级条线主管单位")
private Boolean isSuperiorLineCompetentUnit;

@ApiModelProperty("是否只筛选单位")
private Boolean onlyUnit = false;

}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/organization/model/po/ReqSynthesizePO.java View File

@@ -24,4 +24,7 @@ public class ReqSynthesizePO {

@ApiModelProperty("筛选人员姓名")
private String employeeName;

@ApiModelProperty("是否只筛选单位")
private Boolean onlyUnit = false;
}

+ 18
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/converter/ApplicationConverter.java View File

@@ -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<Long, String> 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<Long, String> 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);


+ 10
- 1
pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java View File

@@ -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();
}

}

+ 9
- 1
pmapi/src/test/java/com/ningdatech/pmapi/provincial/Test.java View File

@@ -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));
}
}

Loading…
Cancel
Save