合同新增逻辑修改:原币金额-变更后、本币金额-变更后默认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);
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());

View File

@@ -7,6 +7,7 @@ import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractSaveReqVO;
import com.zt.plat.module.erp.dal.dataobject.erp.ErpContractDO;
import jakarta.validation.Valid;
import java.util.HashMap;
import java.util.List;
/**
@@ -77,5 +78,5 @@ public interface ErpContractService {
* @param erpContractVO ERP合同映射数据
* @return ERP合同映射
*/
String submitErp(ErpContractSaveReqVO erpContractVO);
HashMap<String, String> submitErp(ErpContractSaveReqVO erpContractVO);
}

View File

@@ -30,7 +30,6 @@ import java.util.Map;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.erp.enums.ErrorCodeConstants.ERP_CONTRACT_NOT_EXISTS;
import static dm.jdbc.util.DriverUtil.log;
/**
* ERP合同映射 Service 实现类
@@ -227,7 +226,7 @@ public class ErpContractServiceImpl implements ErpContractService {
}
@Override
public String submitErp(ErpContractSaveReqVO erpContractVO) {
public HashMap<String, String> submitErp(ErpContractSaveReqVO erpContractVO) {
// 转换为DO
ErpContractDO erpContract = BeanUtils.toBean(erpContractVO, ErpContractDO.class);
@@ -337,7 +336,7 @@ public class ErpContractServiceImpl implements ErpContractService {
HashMap<String, String> response = erpExternalApi.submitDataToErp(erpSubmitReqDTO);
return response.get("resStr");
return response;
}
/**

View File

@@ -151,6 +151,8 @@ public class ErpConfig {
if (StrUtil.isBlank(E_MSG)) {
E_MSG = jsonResponse.getString("msg");
}
String E_RESP = data.getString("E_RESP");
resMap.put("E_RESP", E_RESP);
resMap.put("resStr", E_MSG);
resMap.put("flag", flag);
}