操作表示判定方法抽离、注释补充

This commit is contained in:
guojunyun
2025-10-23 17:39:26 +08:00
parent b19cb588c5
commit 8ec9967853

View File

@@ -1372,21 +1372,6 @@ public class ContractServiceImpl implements ContractService {
return result; return result;
} }
private JSONObject sendToErp(ErpContractSaveReqVO erpContractVO) {
JSONObject erpResult = new JSONObject();
HashMap<String, String> result = erpContractService.submitErp(erpContractVO);
if ("E".equals(result.get("flag"))) {
erpResult.putOnce("success", false);
erpResult.putOnce("errMsg", result.get("resStr")+":"+result.get("E_RESP"));
} else {
erpResult.putOnce("success", true);
erpResult.putOnce("data", result);
}
return erpResult;
}
@Override @Override
public Boolean relation(RelationReqVo reqVo) { public Boolean relation(RelationReqVo reqVo) {
SystemRelativityDO saveDO = new SystemRelativityDO(); SystemRelativityDO saveDO = new SystemRelativityDO();
@@ -1593,12 +1578,36 @@ public class ContractServiceImpl implements ContractService {
return true; return true;
} }
private ErpContractSaveReqVO getErpContract(ContractMainDO contractMainDO) { /**
* 合同映射数据提交到erp
*
* @param erpContractVO 合同映射数据
* @return 提交结果
*/
private JSONObject sendToErp(ErpContractSaveReqVO erpContractVO) {
JSONObject erpResult = new JSONObject();
HashMap<String, String> result = erpContractService.submitErp(erpContractVO);
if ("E".equals(result.get("flag"))) {
erpResult.putOnce("success", false);
erpResult.putOnce("errMsg", result.get("resStr")+":"+result.get("E_RESP"));
} else {
erpResult.putOnce("success", true);
erpResult.putOnce("data", result);
}
return erpResult;
}
/**
* 通过009ERP接口查询合同信息判定合同映射表操作标识
*
* @param contractMainDO 合同主信息
* @return 操作标识
*/
private String getOperationId(ContractMainDO contractMainDO){
String operationId = null;
ErpContractSaveReqVO erpContractVO = new ErpContractSaveReqVO();
// 合同主信息表主键:BSE_CTRT_MAIN
erpContractVO.setContractMainId(contractMainDO.getId());
// 操作标识:OPTN_ID
// 1、先调用009ERP接口查询合同信息 // 1、先调用009ERP接口查询合同信息
ErpContractPageReqVO pageReqVO = new ErpContractPageReqVO(); ErpContractPageReqVO pageReqVO = new ErpContractPageReqVO();
// BUKRS 合同签订主体公司代码 收支方向判断如果为“支出”传“ERP甲方公司编码”反之传“ERP乙方公司编码” // BUKRS 合同签订主体公司代码 收支方向判断如果为“支出”传“ERP甲方公司编码”反之传“ERP乙方公司编码”
@@ -1617,19 +1626,38 @@ public class ContractServiceImpl implements ContractService {
pageReqVO.setContractTypeNumber(contractMainDO.getContractPaperNumber()); pageReqVO.setContractTypeNumber(contractMainDO.getContractPaperNumber());
// ZHTMC 合同名称 合同名称:CTRT_NAME // ZHTMC 合同名称 合同名称:CTRT_NAME
pageReqVO.setContractName(contractMainDO.getContractName()); pageReqVO.setContractName(contractMainDO.getContractName());
// 查询
PageResult<ErpContractDO> erpContractPage = erpContractService.getErpContractPage(pageReqVO); PageResult<ErpContractDO> erpContractPage = erpContractService.getErpContractPage(pageReqVO);
if (erpContractPage.getTotal() > 0) { if (erpContractPage.getTotal() > 0) {
// 2、如果009接口返回值中“合同编号”字段存在值并且与传入的相同则OPTN_ID值为“1” // 2、如果009接口返回值中“合同编号”字段存在值并且与传入的相同则OPTN_ID值为“1”
erpContractVO.setOperationId("1"); operationId = "1";
} else { } else {
// 3、如果009接口返回值中“合同编号”字段不存在值根据合同主键查询映射表中是否存在没有删除的数据如果有值为“1”如果没有值为“0” // 3、如果009接口返回值中“合同编号”字段不存在值根据合同主键查询映射表中是否存在没有删除的数据如果有值为“1”如果没有值为“0”
ErpContractDO erpContract = erpContractService.getErpContractByMainId(contractMainDO.getId()); ErpContractDO erpContract = erpContractService.getErpContractByMainId(contractMainDO.getId());
if (erpContract != null) { if (erpContract != null) {
erpContractVO.setOperationId("1"); operationId = "1";
} else { } else {
erpContractVO.setOperationId("0"); operationId = "0";
} }
} }
return operationId;
}
/**
* 生成合同映射数据
*
* @param contractMainDO 合同主信息
* @return 合同映射信息
*/
private ErpContractSaveReqVO getErpContract(ContractMainDO contractMainDO) {
ErpContractSaveReqVO erpContractVO = new ErpContractSaveReqVO();
// 合同主信息表主键:BSE_CTRT_MAIN
erpContractVO.setContractMainId(contractMainDO.getId());
// 操作标识:OPTN_ID
erpContractVO.setOperationId(getOperationId(contractMainDO));
// 合同编号:CTRT_PPR_NUM // 合同编号:CTRT_PPR_NUM
erpContractVO.setContractPaperNumber(contractMainDO.getContractPaperNumber()); erpContractVO.setContractPaperNumber(contractMainDO.getContractPaperNumber());
// 合同名称:CTRT_NAME // 合同名称:CTRT_NAME