Parcourir la source

核心业务 可以按单位更新数据

tags/24080901
PoffyZhang il y a 1 an
Parent
révision
a473a0d55d
4 fichiers modifiés avec 70 ajouts et 9 suppressions
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java
  2. +15
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java
  3. +25
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectCollectionUtil.java
  4. +29
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConst.java Voir le fichier

@@ -64,6 +64,6 @@ public interface CommonConst {
Integer VERIFY_TYPE = 2;
String REPEAT = " 已在其他当前评价计划其他分组中,请勿重复添加!";

String NORMAL_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";

}

+ 15
- 6
pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java Voir le fichier

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


+ 25
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/utils/ProjectCollectionUtil.java Voir le fichier

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

}

+ 29
- 2
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCoreBizTask.java Voir le fichier

@@ -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<DingOrganization> 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<DingOrganization> orgs) {
for(DingOrganization organization : orgs){
GenericResult<DingOrgInfoDTO> dingResult = zwddClient.getOrganizationByCode(organization.getOrganizationCode());
if(dingResult.isSuccess()){
@@ -131,10 +159,9 @@ public class SynProjectCoreBizTask {
}
}
}
stopWatch.stop();
log.info("同步项目核心业务结束====={}s",stopWatch.getTotalTimeSeconds());
}


/**
* 生成 编号
* @param unifiedSocialCreditCode


Chargement…
Annuler
Enregistrer