Procházet zdrojové kódy

采购信息 全量保存

tags/24080901
PoffyZhang před 1 rokem
rodič
revize
b3a7dfa2f9
2 změnil soubory, kde provedl 27 přidání a 35 odebrání
  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 Zobrazit soubor

@@ -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 Zobrazit soubor

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



Načítá se…
Zrušit
Uložit