1.0.96 合同变更申请上方承办部门、行业/大区去掉,添加业务方向。合同变更后的合同申请流程需要提示,合同激活关联项目排查测试问题。合同变更页面添加按钮能查看原合同信息。

dev
yinq 2 months ago
parent e8bf7e231a
commit e772d53695

@ -110,6 +110,11 @@ public class ErpContractChange extends TenantEntity {
*/ */
private String industryRegion; private String industryRegion;
/**
* business_direction
*/
private String businessDirection;
/** /**
* 1 2 3 4 * 1 2 3 4
*/ */

@ -112,6 +112,11 @@ public class ErpContractInfo extends TenantEntity {
*/ */
private Date twoDate; private Date twoDate;
/**
* IDcrm_customer_info.customer_id
*/
private Long finalCustomerId;
/** /**
* (1 2 3) * (1 2 3)
*/ */

@ -110,6 +110,11 @@ public class ErpContractChangeBo extends BaseEntity {
*/ */
private String industryRegion; private String industryRegion;
/**
*
*/
private String businessDirection;
/** /**
* 1 2 3 4 * 1 2 3 4
*/ */

@ -69,6 +69,11 @@ public class ErpContractChangeSaveBo {
*/ */
private String industryRegion; private String industryRegion;
/**
*
*/
private String businessDirection;
/** /**
* *
*/ */

@ -115,6 +115,11 @@ public class ErpContractInfoBo extends BaseEntity {
*/ */
private Date twoDate; private Date twoDate;
/**
* ID
*/
private Long finalCustomerId;
/** /**
* (1 2 3) * (1 2 3)
*/ */

@ -164,6 +164,16 @@ public class ErpProjectInfoBo extends BaseEntity {
*/ */
private String contractName; private String contractName;
/**
* erp_contract_info.customer_contract_code
*/
private String customerContractCode;
/**
* ID erp_contract_info.final_customer_id
*/
private Long finalCustomerId;
/** /**
* *
*/ */

@ -144,6 +144,13 @@ public class ErpContractChangeVo implements Serializable {
@ExcelProperty(value = "行业/大区") @ExcelProperty(value = "行业/大区")
private String industryRegion; private String industryRegion;
/**
*
*/
@ExcelProperty(value = "业务方向", converter = ExcelDictConvert.class)
@ExcelDictFormat(dictType = "business_direction")
private String businessDirection;
/** /**
* 1 2 3 4 * 1 2 3 4
*/ */

@ -140,6 +140,18 @@ public class ErpContractInfoVo implements Serializable {
@ExcelProperty(value = "乙方签字日期") @ExcelProperty(value = "乙方签字日期")
private Date twoDate; private Date twoDate;
/**
* ID
*/
@ExcelProperty(value = "最终客户ID")
private Long finalCustomerId;
/**
*
*/
@ExcelProperty(value = "最终客户")
private String finalCustomerName;
/** /**
* (1 2 3) * (1 2 3)
*/ */

@ -256,6 +256,16 @@ public class ErpProjectInfoVo implements Serializable {
@ExcelProperty(value = "合同名称") @ExcelProperty(value = "合同名称")
private String contractName; private String contractName;
/**
* erp_contract_info
*/
private String customerContractCode;
/**
* ID erp_contract_info.final_customer_id
*/
private Long finalCustomerId;
/** /**
* *
*/ */

@ -109,8 +109,8 @@ public interface IErpContractChangeService {
ErpContractChangeVo submitContentChange(ErpContractChangeSaveBo bo); ErpContractChangeVo submitContentChange(ErpContractChangeSaveBo bo);
/** /**
* * active_flag 0
* / * /
* *
* @param newContractId ID * @param newContractId ID
*/ */

@ -168,6 +168,7 @@ public class ErpContractChangeServiceImpl implements IErpContractChangeService {
.eq(bo.getUndertakeDeptId() != null, ErpContractChange::getUndertakeDeptId, bo.getUndertakeDeptId()) .eq(bo.getUndertakeDeptId() != null, ErpContractChange::getUndertakeDeptId, bo.getUndertakeDeptId())
.eq(bo.getUndertakeBy() != null, ErpContractChange::getUndertakeBy, bo.getUndertakeBy()) .eq(bo.getUndertakeBy() != null, ErpContractChange::getUndertakeBy, bo.getUndertakeBy())
.eq(StringUtils.isNotBlank(bo.getIndustryRegion()), ErpContractChange::getIndustryRegion, bo.getIndustryRegion()) .eq(StringUtils.isNotBlank(bo.getIndustryRegion()), ErpContractChange::getIndustryRegion, bo.getIndustryRegion())
.eq(StringUtils.isNotBlank(bo.getBusinessDirection()), ErpContractChange::getBusinessDirection, bo.getBusinessDirection())
.eq(StringUtils.isNotBlank(bo.getSealLegalEntity()), ErpContractChange::getSealLegalEntity, bo.getSealLegalEntity()) .eq(StringUtils.isNotBlank(bo.getSealLegalEntity()), ErpContractChange::getSealLegalEntity, bo.getSealLegalEntity())
.eq(StringUtils.isNotBlank(bo.getChangeStatus()), ErpContractChange::getChangeStatus, bo.getChangeStatus()) .eq(StringUtils.isNotBlank(bo.getChangeStatus()), ErpContractChange::getChangeStatus, bo.getChangeStatus())
.eq(StringUtils.isNotBlank(bo.getFlowStatus()), ErpContractChange::getFlowStatus, bo.getFlowStatus()) .eq(StringUtils.isNotBlank(bo.getFlowStatus()), ErpContractChange::getFlowStatus, bo.getFlowStatus())
@ -438,6 +439,7 @@ public class ErpContractChangeServiceImpl implements IErpContractChangeService {
e.setUndertakeDeptId(bo.getUndertakeDeptId()); e.setUndertakeDeptId(bo.getUndertakeDeptId());
e.setUndertakeBy(bo.getUndertakeBy()); e.setUndertakeBy(bo.getUndertakeBy());
e.setIndustryRegion(bo.getIndustryRegion()); e.setIndustryRegion(bo.getIndustryRegion());
e.setBusinessDirection(bo.getBusinessDirection());
e.setSealLegalEntity(bo.getSealLegalEntity()); e.setSealLegalEntity(bo.getSealLegalEntity());
e.setChangeStatus(StringUtils.isNotBlank(bo.getChangeStatus()) ? bo.getChangeStatus() : "1"); e.setChangeStatus(StringUtils.isNotBlank(bo.getChangeStatus()) ? bo.getChangeStatus() : "1");
e.setFlowStatus(bo.getFlowStatus()); e.setFlowStatus(bo.getFlowStatus());
@ -531,7 +533,7 @@ public class ErpContractChangeServiceImpl implements IErpContractChangeService {
} }
/** /**
* * 0
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -568,8 +570,12 @@ public class ErpContractChangeServiceImpl implements IErpContractChangeService {
newLink.setProjectSource(oldLink.getProjectSource()); newLink.setProjectSource(oldLink.getProjectSource());
projectContractsMapper.insert(newLink); projectContractsMapper.insert(newLink);
} }
//原合同更新并逻辑删除 // 原合同:仅将激活标识置为 0保留主表数据不再逻辑删除
contractInfoMapper.deleteById(originalContractId); ErpContractInfo originalInactive = new ErpContractInfo();
originalInactive.setContractId(originalContractId);
originalInactive.setContractStatus(OAStatusEnum.INVALID.getStatus());
originalInactive.setActiveFlag("0");
contractInfoMapper.updateById(originalInactive);
for (ErpProjectContracts oldLink : oldLinks) { for (ErpProjectContracts oldLink : oldLinks) {
projectContractsMapper.deleteById(oldLink.getProjectContractsId()); projectContractsMapper.deleteById(oldLink.getProjectContractsId());
} }
@ -581,39 +587,6 @@ public class ErpContractChangeServiceImpl implements IErpContractChangeService {
); );
} }
/**
* / @TableLogic
*/
private void doWriteBackContent(Long contractChangeId, Long contractId) {
List<ErpContractChangeInfoVo> infoList = changeInfoMapper.selectVoList(
new LambdaQueryWrapper<ErpContractChangeInfo>().eq(ErpContractChangeInfo::getContractChangeId, contractChangeId));
if (!infoList.isEmpty()) {
ErpContractInfo contractInfo = contractInfoMapper.selectById(contractId);
if (contractInfo != null) {
copyChangeInfoToContract(infoList.get(0), contractInfo);
contractInfoMapper.updateById(contractInfo);
}
}
// 逻辑删除原合同下物料(@TableLogic
LambdaQueryWrapper<ErpContractMaterial> materialDel = new LambdaQueryWrapper<ErpContractMaterial>().eq(ErpContractMaterial::getContractId, contractId);
contractMaterialMapper.delete(materialDel);
List<ErpContractChangeMaterial> materials = changeMaterialMapper.selectList(
new LambdaQueryWrapper<ErpContractChangeMaterial>().eq(ErpContractChangeMaterial::getContractChangeId, contractChangeId));
for (ErpContractChangeMaterial m : materials) {
contractMaterialMapper.insert(copyChangeMaterialToContract(m, contractId));
}
// 逻辑删除原合同下付款方式(@TableLogic
LambdaQueryWrapper<ErpContractPaymentMethod> paymentDel = new LambdaQueryWrapper<ErpContractPaymentMethod>().eq(ErpContractPaymentMethod::getContractId, contractId);
contractPaymentMethodMapper.delete(paymentDel);
List<ErpContractChangePaymentMethod> payments = changePaymentMethodMapper.selectList(
new LambdaQueryWrapper<ErpContractChangePaymentMethod>().eq(ErpContractChangePaymentMethod::getContractChangeId, contractChangeId));
for (ErpContractChangePaymentMethod p : payments) {
contractPaymentMethodMapper.insert(copyChangePaymentToContract(p, contractId));
}
}
// ======================= 流程监听 =======================
/** /**
* flowCode=HTBG flowStatus/changeStatus * flowCode=HTBG flowStatus/changeStatus
* <ul> * <ul>
@ -650,50 +623,6 @@ public class ErpContractChangeServiceImpl implements IErpContractChangeService {
}); });
} }
// ======================= 回写时的数据拷贝 =======================
/**
*
*/
private void copyChangeInfoToContract(ErpContractChangeInfoVo snap, ErpContractInfo contract) {
contract.setContractFlag(snap.getContractFlag());
contract.setCustomerContractCode(snap.getCustomerContractCode());
contract.setContractCode(snap.getContractCode());
contract.setContractName(snap.getContractName());
contract.setContractCategory(snap.getContractCategory());
contract.setContractType(snap.getContractType());
contract.setBusinessDirection(snap.getBusinessDirection());
contract.setContractDeptId(snap.getContractDeptId());
contract.setContractDate(snap.getContractDate());
contract.setTotalPrice(snap.getTotalPrice());
contract.setOneCustomerId(snap.getOneCustomerId());
contract.setOneRepresent(snap.getOneRepresent());
contract.setOneDate(snap.getOneDate());
contract.setTwoCustomerId(snap.getTwoCustomerId());
contract.setTwoRepresent(snap.getTwoRepresent());
contract.setTwoDate(snap.getTwoDate());
contract.setContractManagerId(snap.getContractManagerId());
contract.setTemplateId(snap.getTemplateId());
contract.setOssId(snap.getOssId());
contract.setPaymentAccountId(snap.getPaymentAccountId());
contract.setPaymentMethod(snap.getPaymentMethod());
contract.setSignatureAppendix(snap.getSignatureAppendix());
contract.setWarrantyPeriod(snap.getWarrantyPeriod());
contract.setInternalContractCode(snap.getInternalContractCode());
contract.setExternalContractCode(snap.getExternalContractCode());
contract.setOrderContractCode(snap.getOrderContractCode());
contract.setProjectContractCode(snap.getProjectContractCode());
contract.setDeliveryStart(snap.getDeliveryStart() != null ? snap.getDeliveryStart().intValue() : null);
contract.setWarrantyPeriodDescription(snap.getWarrantyPeriodDescription());
contract.setDeliveryLocation(snap.getDeliveryLocation());
contract.setShipMethod(snap.getShipMethod());
contract.setTaxRate(snap.getTaxRate());
contract.setSigningPlace(snap.getSigningPlace());
contract.setMaterialRemark(snap.getMaterialRemark());
contract.setContractTemplateFlag(snap.getContractTemplateFlag());
contract.setCapitalizedAmount(snap.getCapitalizedAmount());
contract.setRemark(snap.getRemark());
}
/** /**
* erp_contract_material * erp_contract_material

@ -26,9 +26,7 @@ import org.dromara.common.tenant.helper.TenantHelper;
import org.dromara.oa.base.domain.bo.BaseRelationMaterialBo; import org.dromara.oa.base.domain.bo.BaseRelationMaterialBo;
import org.dromara.oa.base.domain.vo.BaseRelationMaterialVo; import org.dromara.oa.base.domain.vo.BaseRelationMaterialVo;
import org.dromara.oa.base.service.IBaseRelationMaterialService; import org.dromara.oa.base.service.IBaseRelationMaterialService;
import org.dromara.oa.crm.domain.vo.CrmCustomerInfoVo;
import org.dromara.oa.crm.domain.vo.CrmPaymentAccountVo; import org.dromara.oa.crm.domain.vo.CrmPaymentAccountVo;
import org.dromara.oa.crm.service.ICrmCustomerInfoService;
import org.dromara.oa.crm.service.ICrmPaymentAccountService; import org.dromara.oa.crm.service.ICrmPaymentAccountService;
import org.dromara.oa.erp.domain.ErpContractInfo; import org.dromara.oa.erp.domain.ErpContractInfo;
import org.dromara.oa.erp.domain.ErpContractMaterial; import org.dromara.oa.erp.domain.ErpContractMaterial;
@ -83,8 +81,6 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService {
private final ICrmPaymentAccountService crmPaymentAccountService; private final ICrmPaymentAccountService crmPaymentAccountService;
private final ICrmCustomerInfoService crmCustomerInfoService;
private final RemoteUserService remoteUserService; private final RemoteUserService remoteUserService;
@DubboReference(timeout = 30000) @DubboReference(timeout = 30000)
@ -227,6 +223,7 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService {
.eq(StringUtils.isNotBlank(bo.getContractTemplateFlag()), ErpContractInfo::getContractTemplateFlag, .eq(StringUtils.isNotBlank(bo.getContractTemplateFlag()), ErpContractInfo::getContractTemplateFlag,
bo.getContractTemplateFlag()) bo.getContractTemplateFlag())
.eq("t.del_flag", "0") .eq("t.del_flag", "0")
.eq("t.active_flag", "1")
.orderByDesc(ErpContractInfo::getCreateTime); .orderByDesc(ErpContractInfo::getCreateTime);
return lqw; return lqw;
} }
@ -402,23 +399,6 @@ public class ErpContractInfoServiceImpl implements IErpContractInfoService {
} }
} }
// 校验客户基础信息是否已完善(附件、税号、开户银行、银行账号不能为空)
Long oneCustomerId = entity.getOneCustomerId();
if (oneCustomerId != null) {
CrmCustomerInfoVo customerInfo = crmCustomerInfoService.queryById(oneCustomerId);
if (customerInfo == null) {
throw new ServiceException("合同甲方客户信息不存在,请先在客户管理中维护客户信息");
}
if (StringUtils.isBlank(customerInfo.getOssId())
|| StringUtils.isBlank(customerInfo.getTaxNumber())
|| StringUtils.isBlank(customerInfo.getBankAccountOpening())
|| StringUtils.isBlank(customerInfo.getBankNumber())) {
String customerName = StringUtils.isNotBlank(customerInfo.getCustomerName())
? customerInfo.getCustomerName()
: String.valueOf(oneCustomerId);
throw new ServiceException("客户【" + customerName + "】的附件、税号、开户银行、银行账号不能为空,请先在客户管理中完善!");
}
}
// 物料列表的强制校验 // 物料列表的强制校验
// if (entity.getContractMaterialList() == null || // if (entity.getContractMaterialList() == null ||
// entity.getContractMaterialList().isEmpty()) { // entity.getContractMaterialList().isEmpty()) {

@ -26,6 +26,8 @@ import org.dromara.oa.erp.mapper.ErpProjectInfoMapper;
import org.dromara.oa.erp.mapper.ErpProjectContractsMapper; import org.dromara.oa.erp.mapper.ErpProjectContractsMapper;
import org.dromara.oa.erp.mapper.ErpProjectPlanMapper; import org.dromara.oa.erp.mapper.ErpProjectPlanMapper;
import org.dromara.oa.erp.mapper.ErpProjectPlanStageMapper; import org.dromara.oa.erp.mapper.ErpProjectPlanStageMapper;
import org.dromara.oa.crm.domain.vo.CrmCustomerInfoVo;
import org.dromara.oa.crm.service.ICrmCustomerInfoService;
import org.dromara.oa.erp.service.IErpContractChangeService; import org.dromara.oa.erp.service.IErpContractChangeService;
import org.dromara.oa.erp.service.IErpContractOrderService; import org.dromara.oa.erp.service.IErpContractOrderService;
import org.dromara.oa.erp.service.IErpProjectInfoService; import org.dromara.oa.erp.service.IErpProjectInfoService;
@ -74,6 +76,7 @@ public class ErpContractOrderServiceImpl implements IErpContractOrderService {
private final IErpContractChangeService erpContractChangeService; private final IErpContractChangeService erpContractChangeService;
private final IErpProjectInfoService projectInfoService; private final IErpProjectInfoService projectInfoService;
private final IErpProjectTypeService projectTypeService; private final IErpProjectTypeService projectTypeService;
private final ICrmCustomerInfoService crmCustomerInfoService;
/** 项目申请流程编码(新增项目提交时使用) */ /** 项目申请流程编码(新增项目提交时使用) */
private static final String FLOW_CODE_PROJECT = "xmsq"; private static final String FLOW_CODE_PROJECT = "xmsq";
@ -177,14 +180,24 @@ public class ErpContractOrderServiceImpl implements IErpContractOrderService {
ErpProjectInfo projectInfo = MapstructUtils.convert(bo, ErpProjectInfo.class); ErpProjectInfo projectInfo = MapstructUtils.convert(bo, ErpProjectInfo.class);
validEntityBeforeSave(projectInfo); validEntityBeforeSave(projectInfo);
if (StringUtils.isNotNull(bo.getOssId()) && StringUtils.isNotNull(bo.getContractId())) { // 合同订单保存:将客户合同编号、最终客户
ErpContractInfoVo contractInfoVo = contractInfoMapper.selectVoById(bo.getContractId()); if (bo.getContractId() != null) {
ErpContractInfo contractInfo = new ErpContractInfo(); ErpContractInfo contractPatch = new ErpContractInfo();
contractInfo.setContractId(contractInfoVo.getContractId()); contractPatch.setContractId(bo.getContractId());
contractInfo.setSignatureAppendix(Long.valueOf(bo.getOssId())); contractPatch.setCustomerContractCode(bo.getCustomerContractCode());
contractInfo.setContractDeptId(bo.getDeptId()); contractPatch.setFinalCustomerId(bo.getFinalCustomerId());
contractInfo.setContractStatus(OAStatusEnum.ACTIVATE.getStatus()); // 上传终版合同时:激活合同并校验甲方客户资料
contractInfoMapper.updateById(contractInfo); if (StringUtils.isNotBlank(bo.getOssId())) {
ErpContractInfoVo contractInfoVo = contractInfoMapper.selectVoById(bo.getContractId());
if (contractInfoVo == null) {
throw new ServiceException("合同信息不存在,无法激活订单");
}
validPartyACustomerForOrderActivate(contractInfoVo.getOneCustomerId());
contractPatch.setSignatureAppendix(Convert.toLong(bo.getOssId().trim()));
contractPatch.setContractDeptId(bo.getDeptId());
contractPatch.setContractStatus(OAStatusEnum.ACTIVATE.getStatus());
}
contractInfoMapper.updateById(contractPatch);
} }
if (StringUtils.isNull(bo.getProjectId())) { if (StringUtils.isNull(bo.getProjectId())) {
@ -474,6 +487,30 @@ public class ErpContractOrderServiceImpl implements IErpContractOrderService {
//TODO 做一些数据校验,如唯一约束 //TODO 做一些数据校验,如唯一约束
} }
/**
*
*
* @param oneCustomerId ID
*/
private void validPartyACustomerForOrderActivate(Long oneCustomerId) {
if (oneCustomerId == null) {
return;
}
CrmCustomerInfoVo customerInfo = crmCustomerInfoService.queryById(oneCustomerId);
if (customerInfo == null) {
throw new ServiceException("合同甲方客户信息不存在,请先在客户管理中维护客户信息");
}
if (StringUtils.isBlank(customerInfo.getOssId())
|| StringUtils.isBlank(customerInfo.getTaxNumber())
|| StringUtils.isBlank(customerInfo.getBankAccountOpening())
|| StringUtils.isBlank(customerInfo.getBankNumber())) {
String customerName = StringUtils.isNotBlank(customerInfo.getCustomerName())
? customerInfo.getCustomerName()
: String.valueOf(oneCustomerId);
throw new ServiceException("客户【" + customerName + "】的附件、税号、开户银行、银行账号不能为空,请先在客户管理中完善!");
}
}
/** /**
* (: 稿退) * (: 稿退)
* *

@ -25,6 +25,7 @@
t.undertake_dept_id, t.undertake_dept_id,
t.undertake_by, t.undertake_by,
t.industry_region, t.industry_region,
t.business_direction,
t.seal_legal_entity, t.seal_legal_entity,
t.change_status, t.change_status,
t.flow_status, t.flow_status,

@ -25,6 +25,7 @@
t.two_customer_id, t.two_customer_id,
t.two_represent, t.two_represent,
t.two_date, t.two_date,
t.final_customer_id,
t.contract_status, t.contract_status,
t.flow_status, t.flow_status,
t.template_id, t.template_id,
@ -69,10 +70,12 @@
c2.business_contact twoBusinessContact, c2.business_contact twoBusinessContact,
c2.business_contact_phone twoBusinessContactPhone, c2.business_contact_phone twoBusinessContactPhone,
c2.technical_contact twoTechnicalContact, c2.technical_contact twoTechnicalContact,
c2.technical_contact_phone twoTechnicalContactPhone c2.technical_contact_phone twoTechnicalContactPhone,
c3.customer_name finalCustomerName
from erp_contract_info t from erp_contract_info t
left join crm_customer_info c1 on t.one_customer_id = c1.customer_id left join crm_customer_info c1 on t.one_customer_id = c1.customer_id
left join crm_customer_info c2 on t.two_customer_id = c2.customer_id left join crm_customer_info c2 on t.two_customer_id = c2.customer_id
left join crm_customer_info c3 on t.final_customer_id = c3.customer_id
left join sys_dept d on d.dept_id = t.contract_dept_id left join sys_dept d on d.dept_id = t.contract_dept_id
left join sys_user u on u.user_id = t.contract_manager_id left join sys_user u on u.user_id = t.contract_manager_id
${ew.getCustomSqlSegment} ${ew.getCustomSqlSegment}

@ -49,7 +49,9 @@
u3.nick_name deputyName, u3.nick_name deputyName,
u4.nick_name contractUserName, u4.nick_name contractUserName,
c.contract_code contractCode, c.contract_code contractCode,
c.contract_name contractName c.contract_name contractName,
c.customer_contract_code customerContractCode,
c.final_customer_id finalCustomerId
from erp_project_info t from erp_project_info t
left join erp_project_type t1 on t1.project_type_id = t.project_type_id left join erp_project_type t1 on t1.project_type_id = t.project_type_id
left join erp_project_type t2 on t1.parent_id = t2.project_type_id left join erp_project_type t2 on t1.parent_id = t2.project_type_id

Loading…
Cancel
Save