@@ -346,32 +346,26 @@ public class GovProjectCollectionManage { | |||||
// 6.保存 采购信息 | // 6.保存 采购信息 | ||||
List<GovBizProjectProcureDTO> procures = saveDTO.getProcures(); | List<GovBizProjectProcureDTO> procures = saveDTO.getProcures(); | ||||
Integer index = 1; | 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. 推送数据 | //7. 推送数据 | ||||
pushProject(saveDTO); | pushProject(saveDTO); | ||||
@@ -1,6 +1,7 @@ | |||||
package com.ningdatech.syndataapi.open.manage; | package com.ningdatech.syndataapi.open.manage; | ||||
import cn.hutool.core.bean.BeanUtil; | import cn.hutool.core.bean.BeanUtil; | ||||
import cn.hutool.core.collection.CollUtil; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.ningdatech.basic.function.VUtils; | import com.ningdatech.basic.function.VUtils; | ||||
import com.ningdatech.syndataapi.common.constant.BizConst; | import com.ningdatech.syndataapi.common.constant.BizConst; | ||||
@@ -129,23 +130,20 @@ public class ProjectReceiveManage { | |||||
// 6.保存 采购信息 | // 6.保存 采购信息 | ||||
List<ProjectProcure> procures = dto.getProcures(); | 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()); | 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; | return BizConst.SAVE_SUCCESS; | ||||
} | } | ||||