合同新增逻辑修改:原币金额-变更后、本币金额-变更后默认0

提交erp判断逻辑修改:修改错误返回值解析方式
This commit is contained in:
guojunyun
2025-10-22 16:02:36 +08:00
parent 7b7658bab1
commit 3d396dbb52
4 changed files with 21 additions and 8 deletions

View File

@@ -54,6 +54,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.ByteArrayOutputStream;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
@@ -171,7 +172,11 @@ public class ContractServiceImpl implements ContractService {
// 合同状态保存为草稿
contractMainDO.setStatus(DictEnum.BSE_CTRT_STS_DRAFT.getCode());
// 生成系统合同编号
contractMainDO.setSystemContractNumber(generateSystemContractNumber(reqVO.getCategory()));
contractMainDO.setSystemContractNumber(generateSystemContractNumber(reqVO.getBusinessType()));
// 原币金额-变更后
if (contractMainDO.getChangeCooAmount() == null) contractMainDO.setChangeCooAmount(new BigDecimal(0));
// 本币金额-变更后
if (contractMainDO.getChangeBasicAmount() == null) contractMainDO.setChangeBasicAmount(new BigDecimal(0));
// 保存合同主信息
contractMainMapper.insert(contractMainDO);
@@ -1352,7 +1357,7 @@ public class ContractServiceImpl implements ContractService {
} else {
contractMainDO.setStatus(DictEnum.BSE_CTRT_STS_PUSH_ERROR.getCode());
contractMainDO.setErpStatus(DictEnum.ERP_REQ_STS_RLBK.getCode());
// contractMainDO.setCause(erpResult.getStr("errMsg"));
contractMainDO.setCause(erpResult.getStr("errMsg"));
contractMainMapper.updateById(contractMainDO);
}
} else {
@@ -1366,8 +1371,14 @@ public class ContractServiceImpl implements ContractService {
private JSONObject sendToErp(ErpContractSaveReqVO erpContractVO) {
JSONObject erpResult = new JSONObject();
try {
String result = erpContractService.submitErp(erpContractVO);
erpResult.putOnce("success", true);
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);
}
} catch (Exception e) {
erpResult.putOnce("success", false);
erpResult.putOnce("errMsg", e.getMessage());