|
@@ -8,7 +8,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.ozs.base.domain.BaseExpert;
|
|
|
+import com.ozs.base.domain.BaseSupplier;
|
|
|
import com.ozs.base.service.BaseExpertService;
|
|
|
+import com.ozs.base.service.BaseSupplierService;
|
|
|
import com.ozs.common.enums.*;
|
|
|
import com.ozs.common.utils.DateUtils;
|
|
|
import com.ozs.common.utils.RandomUtil;
|
|
@@ -77,9 +79,19 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
@Autowired
|
|
|
private PmBidFailureService pmBidFailureService;
|
|
|
@Autowired
|
|
|
- private PmProjectConstructionService pmProjectConstructionService;
|
|
|
- @Autowired
|
|
|
private PmBidWinningOpeningRefService pmBidWinningOpeningRefService;
|
|
|
+ @Autowired
|
|
|
+ private PmContractInfoService pmContractInfoService;
|
|
|
+ @Autowired
|
|
|
+ private BaseSupplierService baseSupplierService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PmContractUnitRefService pmContractUnitRefService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PmProjectConstructionService pmProjectConstructionService;
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 查询采购需求
|
|
|
*
|
|
@@ -428,6 +440,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public boolean bookBuilding(PmBookBuildingReqVo vo) {
|
|
|
PmDemand pmDemand = this.getById(vo.getDemandId());
|
|
|
String projectType = pmDemand.getProjectType();
|
|
@@ -600,6 +613,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
return moduleName;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
public PmFlowChartResVo getModuleInfo(Long demandId,String moduleName){
|
|
|
PmDemand pmDemand = this.getById(demandId);
|
|
|
String projectType = pmDemand.getProjectType();
|
|
@@ -680,6 +694,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public boolean commit(PmDemandReqVo pmDemandReqVo) {
|
|
|
PmDemand pmDemand = new PmDemand();
|
|
|
pmDemand.setDemandId(pmDemandReqVo.getDemandId());
|
|
@@ -696,6 +711,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public boolean reviewTo(PmDemandReqVo pmDemandReqVo) {
|
|
|
PmDemand pmDemand = new PmDemand();
|
|
|
pmDemand.setDemandId(pmDemandReqVo.getDemandId());
|
|
@@ -716,6 +732,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public boolean reviewReturn(PmDemandReqVo pmDemandReqVo) {
|
|
|
PmDemand pmDemand = new PmDemand();
|
|
|
pmDemand.setDemandId(pmDemandReqVo.getDemandId());
|
|
@@ -734,6 +751,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
* @return 结果
|
|
|
*/
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public boolean releaseTask(PmDemandReqVo pmDemandReqVo) {
|
|
|
PmDemand pmDemand = new PmDemand();
|
|
|
pmDemand.setDemandId(pmDemandReqVo.getDemandId());
|
|
@@ -747,7 +765,8 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
return this.updateById(pmDemand);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public boolean uploadFile(Long redId,Integer fileType, List<SysFileRef> sysFileRefs,String upateBy){
|
|
|
|
|
|
if (!ObjectUtils.isEmpty(sysFileRefs)) {
|
|
@@ -778,6 +797,8 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public boolean insertPmReleaseAnnouncement(PmReleaseAnnouncementReqVo pmReleaseAnnouncementReqVo) throws Exception {
|
|
|
|
|
|
PmReleaseAnnouncement pmReleaseAnnouncement = new PmReleaseAnnouncement();
|
|
@@ -801,6 +822,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean insertExpertBatch(PmBaseExpertFillReqVo pmBaseExpertFillReqVo) throws Exception {
|
|
|
PmDemand pmDemand = this.getById(pmBaseExpertFillReqVo.getDemandId());
|
|
@@ -811,8 +833,12 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
List<PmDemandExpertRef> pmDemandExpertRefList = new ArrayList<>();
|
|
|
Date now = new Date();
|
|
|
for (BaseExpert baseExpert : baseExpertList) {
|
|
|
- if(baseExpert.getStatus().equals(NameListType.WHITE.getCode())){
|
|
|
+ if(NameListType.BLACK.getCode().equals(baseExpert.getStatus())){
|
|
|
throw new Exception("该专家(身份证号:" +baseExpert.getIdNumber() + ")属于黑名单");
|
|
|
+ } else {
|
|
|
+ if(ObjectUtils.isEmpty(baseExpert.getStatus())){
|
|
|
+ baseExpert.setStatus(NameListType.WHITE.getCode());
|
|
|
+ }
|
|
|
}
|
|
|
if(pmDemand.getProjectType().equals(baseExpert.getVarietyPurchase())){
|
|
|
throw new Exception("该专家(身份证号:" +baseExpert.getIdNumber() + ")所属采购品种和项目类型不匹配");
|
|
@@ -845,6 +871,8 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public boolean extractExpertBatch(PmBaseExpertExtractReqVo pmBaseExpertExtractReqVo) throws Exception {
|
|
|
Integer technicalExpertNumber = pmBaseExpertExtractReqVo.getTechnicalExpertNumber();
|
|
|
if(technicalExpertNumber== null){
|
|
@@ -973,13 +1001,24 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ @Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean insertBidOpeningBatch(PmBidOpeningFillReqVo pmBidOpeningFillReqVo) throws Exception {
|
|
|
PmDemand pmDemand = this.getById(pmBidOpeningFillReqVo.getDemandId());
|
|
|
if(ObjectUtils.isEmpty(pmDemand)){
|
|
|
throw new Exception("参数错误");
|
|
|
}
|
|
|
+
|
|
|
+ //从发布公告里获取开标时间
|
|
|
+ LambdaQueryWrapper<PmReleaseAnnouncement> lw = new LambdaQueryWrapper<>();
|
|
|
+ lw.eq(PmReleaseAnnouncement::getDemandId,pmDemand.getDemandId()).orderByDesc(PmReleaseAnnouncement::getReleaseTime)
|
|
|
+ .last(" limit 1 ");
|
|
|
+ PmReleaseAnnouncement pmReleaseAnnouncement = this.pmReleaseAnnouncementService.getOne(lw);
|
|
|
+ if(pmReleaseAnnouncement == null){
|
|
|
+ throw new Exception("发布公告不存在");
|
|
|
+ }
|
|
|
+ Date tenderOpenTime = pmReleaseAnnouncement.getTenderOpenTime();
|
|
|
+
|
|
|
Date now = new Date();
|
|
|
List<PmBidOpening> pmBidOpeningList = pmBidOpeningFillReqVo.getPmBidOpeningList();
|
|
|
for (PmBidOpening pmBidOpening : pmBidOpeningList) {
|
|
@@ -989,9 +1028,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
if(ObjectUtils.isEmpty(pmBidOpening.getScore())){
|
|
|
throw new Exception("分数不能为空");
|
|
|
}
|
|
|
- if(ObjectUtils.isEmpty(pmBidOpening.getOpenBidTime())){
|
|
|
- throw new Exception("开标时间不能为空");
|
|
|
- }
|
|
|
+ pmBidOpening.setOpenBidTime(tenderOpenTime);
|
|
|
pmBidOpening.setDemandId(pmBidOpeningFillReqVo.getDemandId());
|
|
|
pmBidOpening.setCreateBy(pmBidOpeningFillReqVo.getCreateBy());
|
|
|
pmBidOpening.setCreateTime(now);
|
|
@@ -1010,6 +1047,8 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public boolean insertPmBidWinning(PmBidWinningReqVo pmBidWinningReqVo) throws Exception {
|
|
|
List<Long> pmBidOpeningIdList = pmBidWinningReqVo.getPmBidOpeningIdList();
|
|
|
if(ObjectUtils.isEmpty(pmBidOpeningIdList)) {
|
|
@@ -1055,6 +1094,8 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public boolean updatePmBidWinning(PmBidWinningReqVo pmBidWinningReqVo) throws Exception {
|
|
|
List<Long> pmBidOpeningIdList = pmBidWinningReqVo.getPmBidOpeningIdList();
|
|
|
if(ObjectUtils.isEmpty(pmBidOpeningIdList)) {
|
|
@@ -1101,8 +1142,9 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public boolean insertPmBidFailure(PmBidFailureReqVo pmBidFailureReqVo) throws Exception {
|
|
|
-
|
|
|
PmBidFailure pmBidFailure = new PmBidFailure();
|
|
|
BeanUtils.copyProperties(pmBidFailureReqVo,pmBidFailure);
|
|
|
if(pmBidFailureService.save(pmBidFailure)){
|
|
@@ -1112,4 +1154,168 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public boolean insertContractInfo(PmContractInfoReqVo pmContractInfoReqVo) throws Exception {
|
|
|
+ Long demandId = pmContractInfoReqVo.getDemandId();
|
|
|
+ if(ObjectUtils.isEmpty(demandId)){
|
|
|
+ throw new Exception("采购需求ID不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ String contractSignPlaceA = pmContractInfoReqVo.getContractSignPlaceA();
|
|
|
+ if(ObjectUtils.isEmpty(contractSignPlaceA)) {
|
|
|
+ throw new Exception("甲方合同签订地点不能为空");
|
|
|
+ }
|
|
|
+ Date contractSignDateA = pmContractInfoReqVo.getContractSignDateA();
|
|
|
+ if(ObjectUtils.isEmpty(contractSignDateA)) {
|
|
|
+ throw new Exception("甲方合同签订日期不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ PmDemand pmDemand = this.getById(demandId);
|
|
|
+ if(ObjectUtils.isEmpty(pmDemand)){
|
|
|
+ throw new Exception("采购需求ID错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<BaseSupplierReqVo> baseSupplierReqVoList = pmContractInfoReqVo.getBaseSupplierList();
|
|
|
+ if(ObjectUtils.isEmpty(baseSupplierReqVoList)){
|
|
|
+ throw new Exception("乙方信息列表不能为空");
|
|
|
+ }
|
|
|
+ for(BaseSupplierReqVo baseSupplierReqVo : baseSupplierReqVoList) {
|
|
|
+ String contractSignPlaceB = baseSupplierReqVo.getContractSignPlaceB();
|
|
|
+ if(ObjectUtils.isEmpty(contractSignPlaceB)) {
|
|
|
+ throw new Exception("乙方合同签订地点不能为空");
|
|
|
+ }
|
|
|
+ Date contractSignDateB = baseSupplierReqVo.getContractSignDateB();
|
|
|
+ if(ObjectUtils.isEmpty(contractSignDateB)) {
|
|
|
+ throw new Exception("乙方合同签订日期不能为空");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<SysFileRef> sysFileRefs = pmContractInfoReqVo.getSysFileRefs();
|
|
|
+ if(ObjectUtils.isEmpty(sysFileRefs)){
|
|
|
+ throw new Exception("上传附件不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ PmContractInfo pmContractInfo = new PmContractInfo();
|
|
|
+ org.springframework.beans.BeanUtils.copyProperties(pmContractInfoReqVo,pmContractInfo);
|
|
|
+
|
|
|
+ if(pmContractInfoService.save(pmContractInfo)){
|
|
|
+ if (this.uploadFile(pmContractInfo.getId(), SysFileRefEnum.PM_CONTRACT_INFO.getType(),sysFileRefs,pmContractInfoReqVo.getUpdateBy())) {
|
|
|
+ PmContractUnitRef pmContractUnitRefA = new PmContractUnitRef();
|
|
|
+ pmContractUnitRefA.setContractInfoId(pmContractInfo.getId());
|
|
|
+ pmContractUnitRefA.setDemandId(demandId);
|
|
|
+ pmContractUnitRefA.setUnitId(pmDemand.getPurchaseDeptId());
|
|
|
+ pmContractUnitRefA.setContractSignPlace(contractSignPlaceA);
|
|
|
+ pmContractUnitRefA.setContractSignDate(contractSignDateA);
|
|
|
+ pmContractUnitRefA.setUnitType("A");
|
|
|
+ pmContractUnitRefA.setCreateBy(pmContractInfoReqVo.getCreateBy());
|
|
|
+ pmContractUnitRefA.setCreateTime(pmContractInfoReqVo.getCreateTime());
|
|
|
+ pmContractUnitRefA.setUpdateTime(pmContractInfoReqVo.getUpdateTime());
|
|
|
+ pmContractUnitRefA.setUpdateBy(pmContractInfoReqVo.getUpdateBy());
|
|
|
+ if(pmContractUnitRefService.save(pmContractUnitRefA)){
|
|
|
+
|
|
|
+ for(BaseSupplierReqVo baseSupplierReqVo : baseSupplierReqVoList) {
|
|
|
+
|
|
|
+ BaseSupplier baseSupplier = new BaseSupplier();
|
|
|
+ BeanUtils.copyProperties(baseSupplierReqVo,baseSupplier);
|
|
|
+
|
|
|
+ if(ObjectUtils.isEmpty(baseSupplier.getSupplierAdvancePurchase())){
|
|
|
+ baseSupplier.setSupplierAdvancePurchase("0"); //关闭
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ObjectUtils.isEmpty(baseSupplier.getSupplierType())){
|
|
|
+ baseSupplier.setSupplierType(pmDemand.getProjectType());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ObjectUtils.isEmpty(baseSupplier.getSupplierState())){
|
|
|
+ baseSupplier.setSupplierState(NameListType.WHITE.getCode());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ObjectUtils.isEmpty(baseSupplier.getCreated())){
|
|
|
+ baseSupplier.setCreated(pmContractInfoReqVo.getCreateBy());
|
|
|
+ baseSupplier.setCreateTime(pmContractInfoReqVo.getCreateTime());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ObjectUtils.isEmpty(baseSupplier.getUpdated())){
|
|
|
+ baseSupplier.setUpdated(pmContractInfoReqVo.getUpdateBy());
|
|
|
+ baseSupplier.setUpdateTime(pmContractInfoReqVo.getUpdateTime());
|
|
|
+ }
|
|
|
+ if(baseSupplierService.saveOrUpdate(baseSupplier)) {
|
|
|
+ String contractSignPlaceB = baseSupplierReqVo.getContractSignPlaceB();
|
|
|
+ Date contractSignDateB = baseSupplierReqVo.getContractSignDateB();
|
|
|
+
|
|
|
+ PmContractUnitRef pmContractUnitRefB = new PmContractUnitRef();
|
|
|
+ pmContractUnitRefB.setContractInfoId(pmContractInfo.getId());
|
|
|
+ pmContractUnitRefB.setDemandId(demandId);
|
|
|
+ pmContractUnitRefA.setUnitId(baseSupplier.getId().longValue());
|
|
|
+ pmContractUnitRefB.setContractSignPlace(contractSignPlaceB);
|
|
|
+ pmContractUnitRefB.setContractSignDate(contractSignDateB);
|
|
|
+ pmContractUnitRefB.setUnitType("B");
|
|
|
+ pmContractUnitRefB.setCreateBy(pmContractInfoReqVo.getCreateBy());
|
|
|
+ pmContractUnitRefB.setCreateTime(pmContractInfoReqVo.getCreateTime());
|
|
|
+ pmContractUnitRefB.setUpdateTime(pmContractInfoReqVo.getUpdateTime());
|
|
|
+ pmContractUnitRefB.setUpdateBy(pmContractInfoReqVo.getUpdateBy());
|
|
|
+ if(!this.pmContractUnitRefService.save(pmContractUnitRefB)){
|
|
|
+ throw new Exception("保存合同单位关系失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new Exception("保存或更新供应商失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ throw new Exception("保存合同单位关系失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ PmDemand pmDemandUpdate = new PmDemand();
|
|
|
+ pmDemandUpdate.setDemandId(demandId);
|
|
|
+ pmDemandUpdate.setProjectStatus(Long.parseLong(PmProjectStatus.UNDER_CONSTRUCTION.getCode()));
|
|
|
+ pmDemandUpdate.setUpdateTime(pmContractInfoReqVo.getUpdateTime());
|
|
|
+ pmDemandUpdate.setUpdateBy(pmContractInfoReqVo.getUpdateBy());
|
|
|
+ return this.updateById(pmDemandUpdate);
|
|
|
+ } else {
|
|
|
+ throw new Exception("保存附件失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public boolean insertProjectConstruction(PmProjectConstructionReqVo pmProjectConstructionReqVo) throws Exception {
|
|
|
+ Long demandId = pmProjectConstructionReqVo.getDemandId();
|
|
|
+ if(ObjectUtils.isEmpty(demandId)){
|
|
|
+ throw new Exception("采购需求ID不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ PmDemand pmDemand = this.getById(demandId);
|
|
|
+ if(ObjectUtils.isEmpty(pmDemand)){
|
|
|
+ throw new Exception("采购需求ID错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<SysFileRef> sysFileRefs = pmProjectConstructionReqVo.getSysFileRefs();
|
|
|
+ if(ObjectUtils.isEmpty(sysFileRefs)){
|
|
|
+ throw new Exception("上传附件不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ PmProjectConstruction pmProjectConstruction = new PmProjectConstruction();
|
|
|
+ org.springframework.beans.BeanUtils.copyProperties(pmProjectConstructionReqVo,pmProjectConstruction);
|
|
|
+
|
|
|
+ if(pmProjectConstructionService.save(pmProjectConstruction)){
|
|
|
+ if (this.uploadFile(pmProjectConstruction.getId(), SysFileRefEnum.PM_PROJECT_CONSTRUCTION.getType(),sysFileRefs,pmProjectConstructionReqVo.getUpdateBy())) {
|
|
|
+ PmDemand pmDemandUpdate = new PmDemand();
|
|
|
+ pmDemandUpdate.setDemandId(demandId);
|
|
|
+ pmDemandUpdate.setProjectStatus(Long.parseLong(PmProjectStatus.COMPLETION_CONSTRUCTION.getCode()));
|
|
|
+ pmDemandUpdate.setUpdateTime(pmProjectConstructionReqVo.getUpdateTime());
|
|
|
+ pmDemandUpdate.setUpdateBy(pmProjectConstructionReqVo.getUpdateBy());
|
|
|
+ return this.updateById(pmDemandUpdate);
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|