ソースを参照

改为定时器 同步项目归集

tags/24080901
PoffyZhang 1年前
コミット
bb8e47bd12
5個のファイルの変更266行の追加233行の削除
  1. +110
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java
  2. +34
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java
  3. +85
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java
  4. +37
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/utils/DateUtil.java
  5. +0
    -229
      syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/task/SynDataTask.java

+ 110
- 0
pmapi/src/main/java/com/ningdatech/pmapi/gov/convert/ProjectConvert.java ファイルの表示

@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
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 java.util.Collections;
import java.util.List;
@@ -35,6 +36,17 @@ public class ProjectConvert {
return req;
}

public static ProjectPushReq convert(GovBizProjectDetailVO vo) {
ProjectPushReq req = new ProjectPushReq();
req.setBaseinfo(convertBaseVo(vo.getBaseinfo(),BizProjectContant.EFFECTIVE_CODE));
req.setApply(convertApplyVo(vo.getApply()));
req.setApprove(convertApproveVo(vo.getApprove()));
req.setCimplement(convertCimplementVo(vo.getCimplement()));
req.setMimplement(convertMimplementVo(vo.getMimplement()));
req.setProcures(convertProcuresVo(vo.getProcures()));
return req;
}

private static List<ProjectProcureReq> convertProcures(List<GovBizProjectProcureDTO> procures) {
if(CollUtil.isEmpty(procures)){
return Collections.emptyList();
@@ -52,16 +64,43 @@ public class ProjectConvert {
return req;
}

private static List<ProjectProcureReq> convertProcuresVo(List<GovBizProjectProcureVO> procures) {
if(CollUtil.isEmpty(procures)){
return Collections.emptyList();
}

List<ProjectProcureReq> req = procures.stream()
.map(p -> {
ProjectProcureReq r = BeanUtil.copyProperties(p, ProjectProcureReq.class);
if(Objects.nonNull(p.getId())){
r.setTongID(p.getId().intValue());
}
return r;
})
.collect(Collectors.toList());
return req;
}

private static ProjectMimplementReq convertMimplement(GovBizProjectMimplementDTO mimplement) {
ProjectMimplementReq req = BeanUtil.copyProperties(mimplement,ProjectMimplementReq.class);
return req;
}

private static ProjectMimplementReq convertMimplementVo(GovBizProjectMimplementVO mimplement) {
ProjectMimplementReq req = BeanUtil.copyProperties(mimplement,ProjectMimplementReq.class);
return req;
}

public static ProjectCimplementReq convertCimplement(GovBizProjectCimplementDTO cimplement) {
ProjectCimplementReq req = BeanUtil.copyProperties(cimplement,ProjectCimplementReq.class);
return req;
}

public static ProjectCimplementReq convertCimplementVo(GovBizProjectCimplementVO cimplement) {
ProjectCimplementReq req = BeanUtil.copyProperties(cimplement,ProjectCimplementReq.class);
return req;
}

public static ProjectApproveReq convertApprove(GovBizProjectApproveDTO approve) {
ProjectApproveReq req = new ProjectApproveReq();
if(Objects.isNull(approve)){
@@ -87,6 +126,31 @@ public class ProjectConvert {
return req;
}

public static ProjectApproveReq convertApproveVo(GovBizProjectApproveVO approve) {
ProjectApproveReq req = new ProjectApproveReq();
if(Objects.isNull(approve)){
return req;
}
req.setBaseProjId(approve.getBaseProjId());
req.setBaseProjName(approve.getBaseProjName());
req.setOp(approve.getOp());
req.setApprovalFile(approve.getApprovalFile());
req.setBaseReviewCommentsFile(approve.getBaseReviewCommentsFile());
req.setPreliminaryDesignFile(approve.getPreliminaryDesignFile());
req.setAreaCode(approve.getAreaCode());
req.setBaseDevelopCode(approve.getBaseDevelopCode());
req.setBaseExpertTotalMoney(String.valueOf(approve.getBaseExpertTotalMoney()));
req.setBaseExpertYearMoney(String.valueOf(approve.getBaseExpertYearMoney()));
req.setReleaseYearMoney(String.valueOf(approve.getReleaseYearMoney()));
req.setBaseInitialReviewTotalMoney(String.valueOf(approve.getBaseInitialReviewTotalMoney()));
req.setBaseReviewOpinion(approve.getBaseReviewOpinion());
req.setBaseReviewResults(approve.getBaseReviewResults());
req.setEqualProtectionLevel(approve.getEqualProtectionLevel());
req.setPreliminaryDesignScheme(approve.getPreliminaryDesignScheme());
req.setSetProjCodeFinan(approve.getSetProjCodeFinan());
return req;
}

public static ProjectApplyReq convertApply(GovBizProjectApplyDTO apply) {
ProjectApplyReq req = new ProjectApplyReq();
if(Objects.isNull(apply)){
@@ -127,9 +191,55 @@ public class ProjectConvert {
return req;
}

public static ProjectApplyReq convertApplyVo(GovBizProjectApplyVO apply) {
ProjectApplyReq req = new ProjectApplyReq();
if(Objects.isNull(apply)){
return req;
}
req.setOp(apply.getOp());
req.setBaseProjId(apply.getBaseProjId());
req.setBaseProjName(apply.getBaseProjName());
req.setAreaCode(apply.getAreaCode());
req.setBaseAccountAppName(apply.getBaseAccountAppName());
req.setBaseBasisEstablish(apply.getBaseBasisEstablish());
req.setBaseCoreBusiness(apply.getBaseCoreBusiness());
req.setBaseCoreBusinessCode(apply.getBaseCoreBusinessCode());
req.setBaseBrainName(apply.getBaseBrainName());
req.setBaseDevelopCode(apply.getBaseDevelopCode());
req.setBaseLowestLevel(apply.getBaseLowestLevel());
req.setBaseHistorProjId(apply.getBaseHistorProjId());
req.setBaseHistorProjName(apply.getBaseHistorProjName());
req.setBaseOperatMaintenFile(apply.getBaseOperatMaintenFile());
req.setBaseProjApplyFile(apply.getBaseProjApplyFile());
req.setBaseProjBasisFile(apply.getBaseProjBasisFile());
req.setBaseProjOtherFile(apply.getBaseProjOtherFile());
req.setBaseResearchReportFile(apply.getBaseResearchReportFile());
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.setBaseProjSetYear(apply.getBaseProjSetYear());
req.setBaseProjSys(apply.getBaseProjSys());
req.setBaseProjSysCode(apply.getBaseDevelopCode());
req.setBaseProjDeclAmount(String.valueOf(apply.getBaseProjDeclAmount()));
req.setBaseProjTotalAmount(String.valueOf(apply.getBaseProjTotalAmount()));
req.setBaseBasisAmountOri(apply.getBaseBasisAmountOri());
req.setBaseProjAmountOri(apply.getBaseProjAmountOri());
req.setBaseProjRemark(apply.getBaseProjRemark());
req.setBeseExpectedResults(apply.getBeseExpectedResults());
return req;
}

public static ProjectBaseInfoReq convertBase(GovBizProjectBaseinfoDTO baseinfo,String isEffective) {
ProjectBaseInfoReq req = BeanUtil.copyProperties(baseinfo,ProjectBaseInfoReq.class);
req.setIsEffective(isEffective);
return req;
}

public static ProjectBaseInfoReq convertBaseVo(GovBizProjectBaseinfoVO baseinfo,String isEffective) {
ProjectBaseInfoReq req = BeanUtil.copyProperties(baseinfo,ProjectBaseInfoReq.class);
req.setIsEffective(isEffective);
return req;
}
}

+ 34
- 4
pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java ファイルの表示

@@ -102,6 +102,8 @@ public class GovProjectCollectionManage {
.like(StringUtils.isNotBlank(req.getBuildOrg()),GovBizProjectBaseinfo::getBaseBuildDeprt,req.getBuildOrg())
.eq(StringUtils.isNotBlank(req.getAreaCode()),GovBizProjectBaseinfo::getAreaCode,req.getAreaCode())
.eq(StringUtils.isNotBlank(req.getRegionCode()),GovBizProjectBaseinfo::getAreaCode,req.getRegionCode())
.gt(Objects.nonNull(req.getCreateOnMin()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMin())
.le(Objects.nonNull(req.getCreateOnMax()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMax())
.orderByDesc(GovBizProjectBaseinfo::getBizTime);
baseinfoService.page(page,wrapper);

@@ -141,6 +143,18 @@ public class GovProjectCollectionManage {
return PageVo.of(res,page.getTotal());
}

public Long count(ProjectListReq req) {
LambdaQueryWrapper<GovBizProjectBaseinfo> wrapper = Wrappers.lambdaQuery(GovBizProjectBaseinfo.class)
.like(StringUtils.isNotBlank(req.getProjectName()),GovBizProjectBaseinfo::getBaseProjName,req.getProjectName())
.like(StringUtils.isNotBlank(req.getBuildOrg()),GovBizProjectBaseinfo::getBaseBuildDeprt,req.getBuildOrg())
.eq(StringUtils.isNotBlank(req.getAreaCode()),GovBizProjectBaseinfo::getAreaCode,req.getAreaCode())
.eq(StringUtils.isNotBlank(req.getRegionCode()),GovBizProjectBaseinfo::getAreaCode,req.getRegionCode())
.gt(Objects.nonNull(req.getCreateOnMin()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMin())
.le(Objects.nonNull(req.getCreateOnMax()),GovBizProjectBaseinfo::getTongTime,req.getCreateOnMax())
.orderByDesc(GovBizProjectBaseinfo::getBizTime);
return baseinfoService.count(wrapper);
}

/**
* 项目归集详情
* @param projId
@@ -369,8 +383,8 @@ public class GovProjectCollectionManage {
}
}

//7. 推送数据
pushProject(saveDTO);
//7. 推送数据(改为定时推送了)
// pushProject(saveDTO);

return BizConst.SAVE_SUCCESS;
}
@@ -398,7 +412,7 @@ public class GovProjectCollectionManage {
.eq(GovBizProjectMimplement::getBaseProjId,projId));
procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getBaseProjId,projId));
notEffectiveProject(BeanUtil.copyProperties(baseinfo,GovBizProjectBaseinfoDTO.class));
// notEffectiveProject(BeanUtil.copyProperties(baseinfo,GovBizProjectBaseinfoDTO.class));
return BizConst.OP_SUCCESS;
}

@@ -413,7 +427,7 @@ public class GovProjectCollectionManage {
* 推送项目
* @param saveDTO
*/
private void pushProject(GovBizProjectSaveDTO saveDTO) {
public void pushProject(GovBizProjectSaveDTO saveDTO) {
String url = pushUrl;
ProjectPushReq req = ProjectConvert.convert(saveDTO);
try{
@@ -429,6 +443,22 @@ public class GovProjectCollectionManage {
log.info("推送失败,{}",e.getMessage());
}
}
public void pushProjectVo(GovBizProjectDetailVO vo) {
String url = pushUrl;
ProjectPushReq req = ProjectConvert.convert(vo);
try{
log.info("推送消息体 {} ,{},{}",vo.getBaseProjId(),url, JSON.toJSONString(req));
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
headers.setContentType(type);
headers.add("Accept", MediaType.APPLICATION_JSON.toString());
HttpEntity<ProjectPushReq> formEntity = new HttpEntity<ProjectPushReq>(req, headers);
ResponseEntity<String> response = restTemplate.postForEntity(url, formEntity, String.class);
log.info("推送结果 {} :{}",vo.getBaseProjId(),response);
}catch (Exception e){
log.info("推送失败,{}",e.getMessage());
}
}

/**
* 把项目置为无效


+ 85
- 0
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/SynProjectCollectionTask.java ファイルの表示

@@ -0,0 +1,85 @@
package com.ningdatech.pmapi.scheduler.task;

import cn.hutool.core.date.StopWatch;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.gov.manage.GovProjectCollectionManage;
import com.ningdatech.pmapi.gov.model.vo.GovBizProjectDetailVO;
import com.ningdatech.pmapi.gov.model.vo.GovBizProjectListVO;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.scheduler.utils.DateUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.net.InetAddress;
import java.net.UnknownHostException;

/**
* @author ZPF
* @since 2023/08/31 18:16
*/
@Component
@Slf4j
@RequiredArgsConstructor
public class SynProjectCollectionTask {

@Value("${task.switch.is-open}")
private boolean flag;

@Value("${task.host}")
public String HOST;

@Value("${spring.profiles.active}")
public String active;

@Autowired
private GovProjectCollectionManage collectionManage;

private final Integer PAGE_NUMBER = 1;
private final Integer TASK_HOUR = 1;

/**
* 前置机每天晚上10点自动清空,第二天早上6点获取数据
* 定时同步前置机数据 每天1点开始执行一次
*
*/
@Scheduled(cron = "0 5 16 * * ?")
public void doTask() throws UnknownHostException {
if (!flag || !HOST.equals(InetAddress.getLocalHost().getHostName())) {
log.info("定时器没开启或者host不对! {} {}:{}",
flag,HOST,InetAddress.getLocalHost().getHostName());
}
if(BizConst.PRE.equals(active)){
log.info("预发环境不用同步!");
return;
}
log.info("数据同步任务开始");
StopWatch stopWatch = new StopWatch();
stopWatch.start();

//取昨天1点 到今天1点的 项目归集
ProjectListReq req = new ProjectListReq();
req.setCreateOnMax(DateUtil.convertDateToLocal(DateUtil.getTodayTime(TASK_HOUR)));
req.setCreateOnMin(DateUtil.convertDateToLocal(DateUtil.getTodayTime(TASK_HOUR)).plusDays(-1));
Long count = collectionManage.count(req);
if(count == 0L){
log.info("本次同步无数据");
return;
}
req.setPageNumber(PAGE_NUMBER);
req.setPageSize(count.intValue());
PageVo<GovBizProjectListVO> projectCollectionPage = collectionManage.list(req);

log.info("projectCollections size :{}",projectCollectionPage.getTotal());

for(GovBizProjectListVO vo : projectCollectionPage.getRecords()){
GovBizProjectDetailVO projectDetail = collectionManage.detail(vo.getBaseProjId());
collectionManage.pushProjectVo(projectDetail);
}
stopWatch.stop();
log.info("数据同步任务结束====={}s",stopWatch.getTotalTimeSeconds());
}
}

+ 37
- 0
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/utils/DateUtil.java ファイルの表示

@@ -0,0 +1,37 @@
package com.ningdatech.pmapi.scheduler.utils;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Calendar;
import java.util.Date;
import java.util.Objects;

/**
* @Classname DateUtil
* @Description
* @Date 2023/8/31 15:36
* @Author PoffyZhang
*/
public class DateUtil {

public static Date getTodayTime(int hour){
// 获取当前日期时间
Calendar calendar = Calendar.getInstance();

// 将时间设置为凌晨
calendar.set(Calendar.HOUR_OF_DAY, hour);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);

// 获取凌晨时间
Date date = calendar.getTime();
return date;
}

public static LocalDateTime convertDateToLocal(Date date){
if(Objects.isNull(date)){
return null;
}
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
}
}

+ 0
- 229
syn-data-task/src/main/java/com/ningdatech/syndataapi/scheduler/task/SynDataTask.java ファイルの表示

@@ -1,229 +0,0 @@
package com.ningdatech.syndataapi.scheduler.task;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.List;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSON;
import com.ningdatech.syndataapi.scheduler.model.entity.*;
import com.ningdatech.syndataapi.scheduler.service.*;

import cn.hutool.core.collection.CollUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
* @author CMM
* @since 2023/08/22 18:16
*/
@Component
@Slf4j
@RequiredArgsConstructor
public class SynDataTask {

private final IProjectApplyService projectApplyService;

private final IProjectApproveService projectApproveService;

private final IProjectBaseInfoService projectBaseInfoService;

private final IProjectCimplementService projectCimplementService;

private final IProjectMimplementService projectMimplementService;

private final IProjectProcureService projectProcureService;

@Value("${task.switch.is-open}")
private boolean flag;

@Value("${task.host}")
public String HOST;

// 测试数据
private static final String PROJECT_BASE_INFO_TEST_DATA = "{\n" +
" \"baseProjId\":\"33112322013096900000\",\n" +
" \"baseProjName\":\"遂昌县大数据和金融发展中心天工系统\",\n" +
" \"baseAreaName\":\"遂昌县\",\n" +
" \"baseAreaCode\":\"331123000\",\n" +
" \"baseProjIsConfidentiality\":\"01\",\n" +
" \"baseProjType\":\"01\",\n" +
" \"baseConstructionType\":\"01\",\n" +
" \"baseProjSetProg\":\"05\",\n" +
" \"baseProvManDeprt\":\"遂昌县大数据和金融发展中心\",\n" +
" \"baseProvManDeprtDing\":\"GO_9a7dce7fbaf54787998fa004f1b7c0e1\",\n" +
" \"baseManDeprt\":\"遂昌县大数据和金融发展中心\",\n" +
" \"baseManDeprtDing\":\"GO_9a7dce7fbaf54787998fa004f1b7c0e1\",\n" +
" \"baseManDepartUsci\":\"12332527MB1D48606A\",\n" +
" \"baseBuildDeprt\":\"遂昌县大数据和金融发展中心\",\n" +
" \"baseBuildDeprtDing\":\"GO_9a7dce7fbaf54787998fa004f1b7c0e1\",\n" +
" \"baseBuildDepartUsci\":\"12332527MB1D48606A\",\n" +
" \"baseProjPrincipal\":\"蒋国海\",\n" +
" \"baseProjPrincipalCall\":\"13884366607\",\n" +
" \"baseProjContacts\":\"毛以林\",\n" +
" \"baseProjContactsCall\":\"13857049999\"\n" +
"}";


private static final String PROJECT_APPLY_TEST_DATA = "{\n" +
" \"baseProjId\":\"33112322013096900000\",\n" +
" \"baseProjName\":\"遂昌县大数据和金融发展中心天工系统\",\n" +
" \"baseDevelopCode\":\"否\",\n" +
" \"setProjCodeFinan\":\"331123220130969000000\",\n" +
" \"baseHistorProjName\":\"无\",\n" +
" \"baseHistorProjId\":\"000000\",\n" +
" \"baseAccountAppName\":\"遂昌县大数据和金融发展中心天工系统\",\n" +
" \"baseBrainName\":\"遂昌县大数据和金融发展中心天工系统\",\n" +
" \"baseProjStartTime\":\"2023—03—08\",\n" +
" \"baseProjEndTime\":\"2023—12—08\",\n" +
" \"baseProjDuration\":\"9月\",\n" +
" \"baseProjSetYear\":\"2023\",\n" +
" \"baseProjAmountOri\":\"02\",\n" +
" \"baseBasisAmountOri\":\"\",\n" +
" \"baseProjTotalAmount\":\"300\",\n" +
" \"baseProjDeclAmount\":\"300\",\n" +
" \"baseProjConsClass\":\"c\",\n" +
" \"baseLowestLevel\":\"c\",\n" +
" \"baseProjBasis\":\"01:02:03\",\n" +
" \"baseBasisEstablish\":\"丽水市中共遂昌县委组织部新时代挺进师战斗力指数应用解决了县级干部考评普遍存在考评指标模糊、展示界面缺乏、考核过程不规范、考评流程繁杂等问题,采用C/S架构,即客户端/服务器架构,包含五维考评、挂帅争先、村级红黑榜、天工考评、交办工作等考评模块,面向领导干部、乡干部、村干部等三类人员,实现了链条、全过程追溯每个班子、每名干部实绩的功能。\",\n" +
" \"baseProjBasisFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseProjIntro\":\"丽水市中共遂昌县委组织部新时代挺进师战斗力指数应用解决了县级干部考评普遍存在考评指标模糊、展示界面缺乏、考核过程不规范、考评流程繁杂等问题,采用C/S架构,即客户端/服务器架构,包含五维考评、挂帅争先、村级红黑榜、天工考评、交办工作等考评模块,面向领导干部、乡干部、村干部等三类人员,实现了链条、全过程追溯每个班子、每名干部实绩的功能。\",\n" +
" \"beseExpectedResults\":\"省项管系统项目的主要内容为项目全生命周期管理,业务对象为全省电子政务项目,预期成效指标有 项目数据归集覆盖11个地市和90个区县和项目信息完整率达98%以上\",\n" +
" \"baseResearchReportFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseProjApplyFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseOperatMaintenFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseProjOtherFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseProjRemark\":\"丽水市中共遂昌县委组织部新时代挺进师战斗力指数应用解决了县级干部考评普遍存在考评指标模糊、展示界面缺乏、考核过程不规范、考评流程繁杂等问题,采用C/S架构,即客户端/服务器架构,包含五维考评、挂帅争先、村级红黑榜、天工考评、交办工作等考评模块,面向领导干部、乡干部、村干部等三类人员,实现了链条、全过程追溯每个班子、每名干部实绩的功能。\"\n" +
"}";

private static final String PROJECT_APPROVE_TEST_DATA = "{\n" +
" \"baseProjId\":\"33112322013096900000\",\n" +
" \"baseProjName\":\"遂昌县大数据和金融发展中心天工系统\",\n" +
" \"baseDevelopCode\":\"否\",\n" +
" \"setProjCodeFinan\":\"331123220130969000000\",\n" +
" \"baseReviewResults\":\"01\",\n" +
" \"baseReviewOpinion\":\"通过\",\n" +
" \"baseReviewCommentsFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseExpertTotalMoney\":\"300\",\n" +
" \"baseExpertYearMoney\":\"300\",\n" +
" \"approvalFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseInitialReviewTotalMoney\":\"300\",\n" +
" \"baseProjReplyAmount\":\"300\",\n" +
" \"equalProtectionLevel\":\"03\",\n" +
" \"preliminaryDesignScheme\":\"否\",\n" +
" \"preliminaryDesignFile\":\"否\",\n" +
" \"releaseYearMoney\":\"300\"\n" +
"}";

private static final String PROJECT_PROCURE_TEST_DATA = "{\n" +
" \"baseProjId\":\"33112322013096900000\",\n" +
" \"baseProjName\":\"遂昌县大数据和金融发展中心天工系统\",\n" +
" \"setProjCodeFinan\":\"331123220130969000000\",\n" +
" \"baseBidCode\":\"33112322013096900000—01\",\n" +
" \"baseBidName\":\"标段一\",\n" +
" \"baseProjPurchaseWay\":\"01\",\n" +
" \"basePurchaseCode\":\"否\",\n" +
" \"purchaseFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"basePurchasingAgencies\":\"测试代理机构\",\n" +
" \"baseUnifiedCreditCode\":\"91330108MA2H2JUB3G\",\n" +
" \"baseWinningBidTime\":\"2022—03—08\",\n" +
" \"baseProjPurchaseAmount\":\"300\",\n" +
" \"biddingFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseConsDeprt\":\"测试供应商\",\n" +
" \"baseConsDeprtUsci\":\"91330108MA2H2JUB3G\",\n" +
" \"purchaseContract\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"basePaymentTime\":\"2023—03—08\",\n" +
" \"paymentProgress\":\"300\"\n" +
"}";

private static final String PROJECT_CIMPLEMENT_TEST_DATA = "{\n" +
" \"baseBidCode\":\"33112322013096900000—01\",\n" +
" \"baseBidName\":\"标段一\",\n" +
" \"baseProjId\":\"33112322013096900000\",\n" +
" \"baseProjName\":\"遂昌县大数据和金融发展中心天工系统\",\n" +
" \"baseDevelopCode\":\"否\",\n" +
" \"baseProjSysCode\":\"\",\n" +
" \"baseInitialOpinionFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseInforLevelFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"basePasswAssessFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseThirdAcceptFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseCheckFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseFinanlAuditFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseUserConsFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseEstaSummFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseIrsTestRunFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseSummReportFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseLogAggregation\":\"2\",\n" +
" \"baseBusinessMetrics\":\"核心业务1+实际成效指标1+100\",\n" +
" \"baseFinalExpertOpinionFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseEngineerPostpoFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseChangeFormFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseChanFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"areaCode\":\"331100\"\n" +
"}";

private static final String PROJECT_MIMPLEMENT_TEST_DATA = "{\n" +
" \"baseBidCode\":\"33112322013096900000—01\",\n" +
" \"baseBidName\":\"标段一\",\n" +
" \"baseProjId\":\"33112322013096900000\",\n" +
" \"baseProjName\":\"遂昌县大数据和金融发展中心天工系统\",\n" +
" \"baseDevelopCode\":\"否\",\n" +
" \"baseProjSysCode\":\"\",\n" +
" \"baseInforLevelFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"basePasswAssessFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseThirdAcceptFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseUserConsFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseEstaSummFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseOperatMaintenSummFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseLogAggregation\":\"1\",\n" +
" \"baseBusinessMetrics\":\"核心业务1+实际成效指标1+100\",\n" +
" \"baseFinalExpertOpinionFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseEngineerPostpoFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseEngineerAlterFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"baseChanFile\":\"http://60.188.225.145/pm/file/download?fileId=951\",\n" +
" \"areaCode\":\"331100\"\n" +
"}";



/**
* 前置机每天晚上10点自动清空,第二天早上6点获取数据
* 定时同步前置机数据 每天1点开始执行一次
*
*/
@Scheduled(cron = "0 0 1 * * ?")
public void doTask() throws UnknownHostException {
if (flag && HOST.equals(InetAddress.getLocalHost().getHostName())) {
log.info("数据同步任务开始");
// 测试数据只有一条,这里只插入一条

// 项目基本信息
ProjectBaseInfo projectBaseInfo = JSON.parseObject(PROJECT_BASE_INFO_TEST_DATA, ProjectBaseInfo.class);
projectBaseInfoService.save(projectBaseInfo);

// 项目申报信息
ProjectApply projectApply = JSON.parseObject(PROJECT_APPLY_TEST_DATA, ProjectApply.class);
projectApplyService.save(projectApply);

// 项目立项评审信息
ProjectApprove projectApprove = JSON.parseObject(PROJECT_APPROVE_TEST_DATA, ProjectApprove.class);
projectApproveService.save(projectApprove);

// 项目采购信息
ProjectProcure projectProcure = JSON.parseObject(PROJECT_PROCURE_TEST_DATA, ProjectProcure.class);
projectProcureService.save(projectProcure);

// 建设项目实施信息
ProjectCimplement projectCimplement = JSON.parseObject(PROJECT_CIMPLEMENT_TEST_DATA, ProjectCimplement.class);
projectCimplementService.save(projectCimplement);

// 运维项目实施信息
ProjectMimplement projectMimplement = JSON.parseObject(PROJECT_MIMPLEMENT_TEST_DATA, ProjectMimplement.class);
projectMimplementService.save(projectMimplement);
log.info("数据同步任务结束");
}
}
}

読み込み中…
キャンセル
保存