工作组关联合同

This commit is contained in:
梁琦涛
2021-09-09 17:20:23 +08:00
parent 8e0c7a82c9
commit e99bb50480
@@ -1,6 +1,7 @@
package com.jero.project.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result;
@@ -124,10 +125,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
log.info("工作组成员-添加异常",e);
throw new JeroBootException("工作组成员单位已存在!");
}
// 来款方式为合同,校验合同编号
if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY2)){
payIncomeContractService.checkContractNum(payWorkingGroupSubItem.getContractNum());
}
payWorkingGroupSubItem = setPayWorkingGroupSubItem(payWorkingGroupSubItem);
payWorkingGroupSubItem.setPack(PayProjectCommon.PACKAGING0);
payWorkingGroupSubItem.setInAccount(PayProjectCommon.IN_ACCOUNT0);
@@ -135,6 +133,20 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
payWorkingGroupSubItem.setMail(PayProjectCommon.MAIL0);
payWorkingGroupSubItem.setChargeUse(PayProjectCommon.CHARGE_USE1);
payWorkingGroupSubItemService.save(payWorkingGroupSubItem);
PayIncomeContract payIncomeContract = null;
// 来款方式为合同,校验合同编号
if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY2)){
payIncomeContract = payIncomeContractService.setPayIncomeContractAssociated(payWorkingGroupSubItem.getContractNum(),payWorkingGroupSubItem.getChargeCompanyId(),payWorkingGroupSubItem.getId());
}
// 关联了合同,判断合同是否打包,更新项目打包状态,添加打包
if(!Objects.isNull(payIncomeContract) && Objects.equals(payIncomeContract.getPack(),PayProjectCommon.PACKAGING1)){
LambdaUpdateWrapper<PayWorkingGroupSubItem> update = new LambdaUpdateWrapper<>();
update.eq(PayWorkingGroupSubItem::getId,payWorkingGroupSubItem.getId());
update.set(PayWorkingGroupSubItem::getPack,PayProjectCommon.PACKAGING1);
payWorkingGroupSubItemService.update(update);
// todo 缺少添加打包功能
}
}
@Override
@@ -176,9 +188,24 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
log.info("工作组成员-编辑异常",e);
throw new JeroBootException("工作组成员单位已存在!");
}
// 校验项目是否已关联合同
PayIncomeContract payIncomeContract = payIncomeContractService.checkPayIncomeContractAssociated(payWorkingGroupSubItem.getId());
if(!Objects.isNull(payIncomeContract) && !Objects.equals(payIncomeContract.getContractNum(),payWorkingGroupSubItem.getContractNum())){
throw new JeroBootException("项目已关联合同,合同编号不可修改!");
}
PayIncomeContract payIncomeContractAdd = null;
// 来款方式为合同,校验合同编号
if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY2)){
payIncomeContractService.checkContractNum(payWorkingGroupSubItem.getContractNum());
payIncomeContractAdd = payIncomeContractService.setPayIncomeContractAssociated(payWorkingGroupSubItem.getContractNum(),payWorkingGroupSubItem.getChargeCompanyId(),payWorkingGroupSubItem.getId());
}
// 关联了合同,判断合同是否打包,更新项目打包状态,添加打包
if(!Objects.isNull(payIncomeContractAdd) && Objects.equals(payIncomeContractAdd.getPack(),PayProjectCommon.PACKAGING1)){
LambdaUpdateWrapper<PayWorkingGroupSubItem> update = new LambdaUpdateWrapper<>();
update.eq(PayWorkingGroupSubItem::getId,payWorkingGroupSubItem.getId());
update.set(PayWorkingGroupSubItem::getPack,PayProjectCommon.PACKAGING1);
payWorkingGroupSubItemService.update(update);
// todo 缺少添加打包功能
}
payWorkingGroupSubItem = setPayWorkingGroupSubItem(payWorkingGroupSubItem);
payWorkingGroupSubItem.setChargeUse(PayProjectCommon.CHARGE_USE1);