Sfoglia il codice sorgente

组织更新

tags/24080901
PoffyZhang 1 anno fa
parent
commit
c14b3a54eb
4 ha cambiato i file con 65 aggiunte e 32 eliminazioni
  1. +5
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java
  2. +46
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java
  3. +13
    -7
      pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java
  4. +1
    -24
      pmapi/src/main/java/com/ningdatech/pmapi/wps/manage/WpsConvertManage.java

+ 5
- 0
pmapi/src/main/java/com/ningdatech/pmapi/ding/controller/DingInfoPullController.java Vedi File

@@ -84,6 +84,11 @@ public class DingInfoPullController {
organizationBatchGetTask.batchGetOrganizationTask();
}

@GetMapping("/organization/{orgCode}")
public void organizationGetSubs(@PathVariable String orgCode) {
organizationBatchGetTask.organizationGetSubs(orgCode);
}

@GetMapping("/employeeByRegionCode/{regionCode}")
public void employeeBatchGetByRegionCode(@PathVariable String regionCode) {
employeeBatchGetTask.batchGetEmployeeTaskByRegionCode(regionCode);


+ 46
- 1
pmapi/src/main/java/com/ningdatech/pmapi/ding/task/OrganizationBatchGetTask.java Vedi File

@@ -8,6 +8,7 @@ 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.common.constant.BizConst;
import com.ningdatech.pmapi.ding.model.DingOrgInfoTreeDTO;
import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
@@ -21,6 +22,7 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -103,6 +105,50 @@ public class OrganizationBatchGetTask {
}
}

/**
* 更新 其 子单位
* @param orgCode
*/
public void organizationGetSubs(String orgCode) {
log.info("----拉取浙政钉组织子单位开始---,顶级code:" + orgCode);
DingOrganization topOrg = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getOrganizationCode, orgCode)
.last(BizConst.LIMIT_1));
// 顶级组织code
List<String> topOrgCodes = Lists.newArrayList(orgCode);
GenericResult<List<DingOrgInfoDTO>> listGenericResult = zwddClient.listOrganizationsByCodes(topOrgCodes);
log.info("listGenericResult: {}" + JSON.toJSONString(listGenericResult));
List<DingOrgInfoDTO> dingOrgInfoDtos = listGenericResult.getData();

for(DingOrgInfoDTO dingOrgInfo : dingOrgInfoDtos){
DingOrganization old = iDingOrganizationService.getOne(Wrappers.lambdaQuery(DingOrganization.class)
.eq(DingOrganization::getOrganizationCode, dingOrgInfo.getOrganizationCode())
.last(BizConst.LIMIT_1));
if(Objects.nonNull(old)){
log.info("该单位已经存在 :{}",old.getOrganizationName());
continue;
}

DingOrganization organization = new DingOrganization();
organization.setOrganizationCode(dingOrgInfo.getOrganizationCode());
organization.setOrganizationName(dingOrgInfo.getOrganizationName());
//和顶级单位一个区域
organization.setDivisionCode(topOrg.getDivisionCode());
organization.setParentCode(dingOrgInfo.getParentCode());
organization.setTypeName(dingOrgInfo.getTypeName());
organization.setAddress(dingOrgInfo.getAddress());
organization.setBusinessStripCodes(dingOrgInfo.getBusinessStripCodes());
organization.setDisplayOrder(dingOrgInfo.getDisplayOrder());
organization.setGmtCreate(LocalDateTime.now());
organization.setInstitutionLevelCode(dingOrgInfo.getInstitutionLevelCode());
organization.setParentName(dingOrgInfo.getParentName());
iDingOrganizationService.save(organization);
}

log.info("----拉取浙政钉组织子单位结束---,顶级code:" + orgCode);

}

private void buildSaveRecordList(List<DingOrgInfoTreeDTO> treeDTOList, List<DingOrganization> saveRecordList) {
if (CollectionUtils.isEmpty(treeDTOList)) {
return;
@@ -167,7 +213,6 @@ public class OrganizationBatchGetTask {
}
}
}

}



+ 13
- 7
pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java Vedi File

@@ -796,14 +796,20 @@ public class GovProjectCollectionManage {
private void uploadFileToProvincialOss(GovBizProjectApplyDTO apply,
GovBizProjectApply oldApply,GovBizProjectApply saveApply) {
if(checkFieldHas(apply.getBaseProjBasisFile(),oldApply,"baseProjBasisFile")){
JSONArray fileArray = JSON.parseArray(apply.getBaseProjBasisFile());
String[] baseProjBasisFileArr = apply.getBaseProjBasisFile().split(";");
StringJoiner sj = new StringJoiner(";");
fileArray.forEach(j -> {
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(j));
byte[] btyes = wpsConvertManage.downloadToPdfStream(jsonObject.getLong("id"));
String oss = ProvincialManage.uploadToOss(btyes, jsonObject.getString("originalFileName"));
sj.add(oss);
});
for(String baseProjBasisFile : baseProjBasisFileArr){
JSONArray fileArray = JSON.parseArray(baseProjBasisFile);
fileArray.forEach(j -> {
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(j));
byte[] btyes = wpsConvertManage.downloadToPdfStream(jsonObject.getLong("id"));
String suffix = jsonObject.getString("suffix");
String originalFileName = jsonObject.getString("originalFileName");
String pdfName = originalFileName.replace(StrPool.DOT + suffix, ".pdf");
String oss = ProvincialManage.uploadToOss(btyes, pdfName);
sj.add(oss);
});
}
saveApply.setBaseProjBasisFilePdf(sj.toString());
}
projectApplyService.updateById(saveApply);


+ 1
- 24
pmapi/src/main/java/com/ningdatech/pmapi/wps/manage/WpsConvertManage.java Vedi File

@@ -13,15 +13,12 @@ import com.suwell.ofd.custom.agent.AtomAgent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;

@@ -44,13 +41,11 @@ public class WpsConvertManage {
@Value("${spring.profiles.active}")
private String active;

// HTTPAgent ha = new HTTPAgent("http://127.0.0.1:8090");
//2、定义方法实现 多个文件合并转为1个pdf文件
public String offs2Pdf() {
AtomAgent ha = new AtomAgent("http://10.53.157.47");
AtomAgent ha = new AtomAgent(WpsContant.WPS_CONVERT_URL_ONLINE);

try {

//2-1、传参文件对象转换输出PDF文件
//1)、定义集合,存储待转换的原文件
List<File> fileList =new ArrayList<File>();
@@ -58,25 +53,10 @@ public class WpsConvertManage {
OutputStream out = null;
//3)、添加原文件到集合
fileList.add(new File("/temp/111.xlsx"));
// fileList.add(new File("D:/cs.doc"));
// fileList.add(new File("D:/a.pdf"));
// fileList.add(new File("D:\\555.ofd"));
//4)、赋值转换后的pdf文件输出流
out=new FileOutputStream(new File("/temp/offices2_pdf.pdf"));
//5)、调用方法,执行将多个文件转为pdf文件
ha.OFDToPDF(fileList, out);

//2-2、传参文件流转换输出PDF文件(与2-1二选一即可)
//1)、定义集合,存储待转换的原文件(支持传文件流)
// Param[] params = new Param[] {
// new Param(PackEntry.wrap(new FileInputStream("D:\\temp\\111.ofd")), "ofd"),
// new Param(PackEntry.wrap(new FileInputStream("D:\\2.ofd")), "ofd"),
// new Param(PackEntry.wrap(new FileInputStream("D:\\T3.txt")), "txt")
// };
//2)、赋值转换后的pdf文件输出流
// out=new FileOutputStream(new File("D:/convert/offices_pdf.pdf"));
//3)、调用方法,执行将多个文件转为pdf文件
// ha.OFDToPDF(params,out);
return "转换成功";
} catch (Exception e) {
log.error(e.getMessage());
@@ -164,8 +144,6 @@ public class WpsConvertManage {
AtomAgent ha = new AtomAgent(WpsContant.WPS_CONVERT_URL_ONLINE);
try (OSSObject ossObject = oss.getObject(file.getBucket(), file.getPath());
InputStream stream = ossObject.getObjectContent();) {
String fileName = null;
byte[] bytes = new byte[4096];
int read;
//测试环境 转不了PDF 请求不了 WPS转换服务器
if(BizConst.DEV.equals(active)){
@@ -188,7 +166,6 @@ public class WpsConvertManage {
//5)、调用方法,执行将多个文件转为pdf文件
ha.OFDToPDF(fileList, out);
FileInputStream fileInputStream = new FileInputStream(pdfFile);
fileName = URLEncoder.encode(WpsContant.PDF_NAME, CharsetUtil.UTF_8);
for(File f : fileList){
//用完就删
f.deleteOnExit();


Loading…
Annulla
Salva