Browse Source

采购信息 全量保存

master
PoffyZhang 1 year ago
parent
commit
b3a7dfa2f9
2 changed files with 27 additions and 35 deletions
  1. +16
    -22
      pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java
  2. +11
    -13
      syn-data-task/src/main/java/com/ningdatech/syndataapi/open/manage/ProjectReceiveManage.java

+ 16
- 22
pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java View File

@@ -346,32 +346,26 @@ public class GovProjectCollectionManage {
// 6.保存 采购信息
List<GovBizProjectProcureDTO> procures = saveDTO.getProcures();
Integer index = 1;
for(GovBizProjectProcureDTO procure : procures){
procure.setBaseProjId(baseProjId);
procure.setBaseProjName(baseProjName);
procure.setBaseBidCode(baseProjId + StrPool.DASH + index);

GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure,GovBizProjectProcure.class);
saveProcure.setBaseProjId(baseProjId);

if(Objects.nonNull(saveBase.getAreaCode())){
saveProcure.setAreaCode(saveBase.getAreaCode());
}
if(Objects.isNull(procure.getId())){
saveProcure.setTongTime(LocalDateTime.now());
}else{
//如果是修改 那就看下库里是否有
Long id = saveProcure.getId();
GovBizProjectProcure old = procureService.getById(id);
if(Objects.isNull(old)){
saveProcure.setId(null);
if(Objects.nonNull(procures)){
procureService.remove(Wrappers.lambdaQuery(GovBizProjectProcure.class)
.eq(GovBizProjectProcure::getBaseProjId,baseProjId));
for(GovBizProjectProcureDTO procure : procures){
procure.setBaseProjId(baseProjId);
procure.setBaseProjName(baseProjName);
procure.setBaseBidCode(baseProjId + StrPool.DASH + index);

GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure,GovBizProjectProcure.class);
saveProcure.setBaseProjId(baseProjId);
saveProcure.setId(null);
if(Objects.nonNull(saveBase.getAreaCode())){
saveProcure.setAreaCode(saveBase.getAreaCode());
}
saveProcure.setTongTime(LocalDateTime.now());
procureService.save(saveProcure);
index++;
}
procureService.saveOrUpdate(saveProcure);
index++;
}


//7. 推送数据
pushProject(saveDTO);



+ 11
- 13
syn-data-task/src/main/java/com/ningdatech/syndataapi/open/manage/ProjectReceiveManage.java View File

@@ -1,6 +1,7 @@
package com.ningdatech.syndataapi.open.manage;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.syndataapi.common.constant.BizConst;
@@ -129,23 +130,20 @@ public class ProjectReceiveManage {

// 6.保存 采购信息
List<ProjectProcure> procures = dto.getProcures();
for(ProjectProcure procure : procures){
ProjectProcure saveProcure = BeanUtil.copyProperties(procure,ProjectProcure.class);
saveProcure.setBaseProjId(baseProjId);
if(Objects.isNull(saveProcure.getTongID())){
if(Objects.nonNull(procures)){
procureService.remove(Wrappers.lambdaQuery(ProjectProcure.class)
.eq(ProjectProcure::getBaseProjId,baseProjId));
for(ProjectProcure procure : procures){
ProjectProcure saveProcure = BeanUtil.copyProperties(procure,ProjectProcure.class);
saveProcure.setBaseProjId(baseProjId);
saveProcure.setTongID(null);
saveProcure.setTongTime(LocalDateTime.now());
}else{
//如果是修改 那就看下库里是否有
Integer tongId = saveProcure.getTongID();
ProjectProcure old = procureService.getById(tongId);
if(Objects.isNull(old)){
saveProcure.setTongID(null);
}
saveProcure.setBizTime(LocalDateTime.now());
procureService.save(saveProcure);
}
saveProcure.setBizTime(LocalDateTime.now());
procureService.saveOrUpdate(saveProcure);
}


return BizConst.SAVE_SUCCESS;
}



Loading…
Cancel
Save