erp修改

This commit is contained in:
qianshijiang
2026-01-09 15:37:07 +08:00
parent 512c998d7d
commit 10d0dd1dc2
5 changed files with 19 additions and 14 deletions

View File

@@ -40,12 +40,12 @@ public class ErpExternalApiImpl implements ErpExternalApi {
@Override
public HashMap<String, String> submitDataToErp(ErpSubmitReqDTO reqDTO) {
public Map<String, String> submitDataToErp(ErpSubmitReqDTO reqDTO) {
return erpConfig.pushDataToErp(reqDTO);
}
@Override
public HashMap<String, Object> queryDataToErp(ErpQueryReqDTO reqDTO) {
public Map<String, Object> queryDataToErp(ErpQueryReqDTO reqDTO) {
String funcnr = reqDTO.getFuncnr();
Map<String, Object> req = reqDTO.getReq();
return erpConfig.fetchDataFromERP(funcnr, req);

View File

@@ -136,7 +136,7 @@ public class ErpBillMainServiceImpl implements ErpBillMainService {
// 抽取重复代码:提交 ERP 并记录日志
private String submitToErp(ErpSubmitReqDTO reqDTO) {
HashMap<String, String> response = erpExternalApi.submitDataToErp(reqDTO);
Map<String, String> response = erpExternalApi.submitDataToErp(reqDTO);
return response.get("resStr");
}

View File

@@ -14,6 +14,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.erp.enums.ErrorCodeConstants.*;
@@ -31,7 +32,7 @@ public class ErpConfig {
/**
* 调用ERP接口获取erp数据
*/
public HashMap<String, Object> fetchDataFromERP(String funcnr, Map<String, Object> req) {
public Map<String, Object> fetchDataFromERP(String funcnr, Map<String, Object> req) {
try {
// 构建完整URL
String url = "http://" + erpAddress + "/api/rfc/get";
@@ -60,7 +61,7 @@ public class ErpConfig {
throw exception(ERP_NOT_EXISTS);
}
HashMap<String, Object> resMap = new HashMap<>();
Map<String, Object> resMap = new ConcurrentHashMap<>();
JSONObject jsonResponse = JSON.parseObject(responseBody);
if (jsonResponse == null) {
throw exception(ERP_NOT_JSON_EXISTS);
@@ -94,7 +95,7 @@ public class ErpConfig {
/**
* 调用ERP接口更新erp数据
*/
public HashMap<String, String> pushDataToErp(ErpSubmitReqDTO reqDTO) {
public Map<String, String> pushDataToErp(ErpSubmitReqDTO reqDTO) {
try {
// 构建完整URL
String url = "http://" + erpAddress + "/api/rfc/post";
@@ -108,15 +109,14 @@ public class ErpConfig {
requestBody.put("bskey", reqDTO.getBskey());
requestBody.put("usrid", reqDTO.getUsrid());
requestBody.put("usrnm", reqDTO.getUsrnm());
//todo 密码另行约定
// requestBody.put("sign", StrUtil.(uuid + sapsys + "密码另行约定"));
// todo 密码另行约定
//requestBody.put("sign", StrUtil.(uuid + sapsys + "密码另行约定"));
if (reqDTO.getReq() != null) {
requestBody.put("req", reqDTO.getReq());
}
// 设置请求头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
// 创建HTTP请求实体
HttpEntity<String> requestEntity = new HttpEntity<>(requestBody.toJSONString(), headers);
@@ -135,7 +135,7 @@ public class ErpConfig {
throw exception(ERP_NOT_JSON_EXISTS);
}
HashMap<String, String> resMap = new HashMap<>();
Map<String, String> resMap = new ConcurrentHashMap<>();
boolean succeed = jsonResponse.getBoolean("succeed");
JSONObject data = jsonResponse.getJSONObject("data");
if (data == null) {