信用修改

This commit is contained in:
赵辉
2026-06-23 14:39:05 +08:00
parent a14c7776e8
commit 0ae37ac795
@@ -1581,11 +1581,9 @@ public class UserShipperApplicationService {
com.alibaba.fastjson.JSONObject allResults = new com.alibaba.fastjson.JSONObject();
for (UserShipperEntity userShipperEntity : customerNcCodeList) {
if (StringUtils.isEmpty(userShipperEntity.getCustomerNcCode())) {
continue;
}
UserShipperEntity userShipperEntity1 = userShipperMapper.selectOne(new LambdaQueryWrapper<UserShipperEntity>()
.eq(UserShipperEntity::getCustomerNcCode, userShipperEntity.getCustomerNcCode())
.eq(UserShipperEntity::getUserId, userShipperEntity.getUserId()));
if (userShipperEntity1 == null) {
@@ -1638,11 +1636,35 @@ public class UserShipperApplicationService {
continue;
}
// 从orgCode数组中获取当前组织的ncCustomer字段
String ncCustomer = null;
if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
try {
com.alibaba.fastjson.JSONArray orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(userShipperEntity1.getOrgCode());
for (int i = 0; i < orgCodeArray.size(); i++) {
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i);
Long itemCode = orgItem.getLong("code");
if (orgCode.equals(itemCode)) {
ncCustomer = orgItem.getString("ncCustomer");
break;
}
}
} catch (Exception e) {
log.error("解析orgCode数组获取ncCustomer失败,orgCode={}", orgCode, e);
}
}
if (StringUtils.isEmpty(ncCustomer)) {
log.warn("未找到组织code={}对应的ncCustomer,跳过查询,custcode={}", orgCode, userShipperEntity.getCustomerNcCode());
orgIndex++;
continue;
}
try {
com.alibaba.fastjson.JSONObject queryParam = new com.alibaba.fastjson.JSONObject();
queryParam.put("custcode", userShipperEntity.getCustomerNcCode());
queryParam.put("custcode", ncCustomer); // 使用当前组织的ncCustomer
queryParam.put("orgcode", orgcode);
log.info("调用赊销额度查询接口,custcode={}orgcode={}", userShipperEntity.getCustomerNcCode(), orgcode);
log.info("调用赊销额度查询接口,custcode={}ncCustomer={}orgcode={}", userShipperEntity.getCustomerNcCode(), ncCustomer, orgcode);
String queryResult = HttpRequest.post(queryUrl)
.header("Content-Type", "application/json")
@@ -1653,11 +1675,11 @@ public class UserShipperApplicationService {
.body(queryParam.toJSONString())
.execute()
.body();
log.info("赊销额度查询接口返回,custcode={}orgcode={}result={}", userShipperEntity.getCustomerNcCode(), orgcode, queryResult);
log.info("赊销额度查询接口返回,custcode={}ncCustomer={}orgcode={}result={}", userShipperEntity.getCustomerNcCode(), ncCustomer, orgcode, queryResult);
if (StringUtils.isNotEmpty(queryResult)) {
com.alibaba.fastjson.JSONObject resultJson = com.alibaba.fastjson.JSONObject.parseObject(queryResult);
allResults.put(userShipperEntity.getCustomerNcCode() + "_" + orgcode, resultJson);
allResults.put(ncCustomer + "_" + orgcode, resultJson); // 使用ncCustomer作为key
// 第三步:查询成功,更新货主的额度同步时间(limitTime)
@@ -1904,11 +1926,35 @@ public class UserShipperApplicationService {
continue;
}
// 从orgCode数组中获取当前组织的ncCustomer字段
String ncCustomer = null;
if (StringUtils.isNotEmpty(userShipperEntity1.getOrgCode())) {
try {
com.alibaba.fastjson.JSONArray orgCodeArray = com.alibaba.fastjson.JSONArray.parseArray(userShipperEntity1.getOrgCode());
for (int i = 0; i < orgCodeArray.size(); i++) {
com.alibaba.fastjson.JSONObject orgItem = orgCodeArray.getJSONObject(i);
Long itemCode = orgItem.getLong("code");
if (orgCode.equals(itemCode)) {
ncCustomer = orgItem.getString("ncCustomer");
break;
}
}
} catch (Exception e) {
log.error("解析orgCode数组获取ncCustomer失败,orgCode={}", orgCode, e);
}
}
if (StringUtils.isEmpty(ncCustomer)) {
log.warn("未找到组织code={}对应的ncCustomer,跳过查询,custcode={}", orgCode, userShipperEntity.getCustomerNcCode());
orgIndex++;
continue;
}
try {
com.alibaba.fastjson.JSONObject queryParam = new com.alibaba.fastjson.JSONObject();
queryParam.put("custcode", userShipperEntity.getCustomerNcCode());
queryParam.put("custcode", ncCustomer); // 使用当前组织的ncCustomer
queryParam.put("orgcode", orgcode);
log.info("调用赊销额度查询接口,custcode={}orgcode={}", userShipperEntity.getCustomerNcCode(), orgcode);
log.info("调用赊销额度查询接口,custcode={}ncCustomer={}orgcode={}", userShipperEntity.getCustomerNcCode(), ncCustomer, orgcode);
String queryResult = HttpRequest.post(queryUrl)
.header("Content-Type", "application/json")
@@ -1919,11 +1965,11 @@ public class UserShipperApplicationService {
.body(queryParam.toJSONString())
.execute()
.body();
log.info("赊销额度查询接口返回,custcode={}orgcode={}result={}", userShipperEntity.getCustomerNcCode(), orgcode, queryResult);
log.info("赊销额度查询接口返回,custcode={}ncCustomer={}orgcode={}result={}", userShipperEntity.getCustomerNcCode(), ncCustomer, orgcode, queryResult);
if (StringUtils.isNotEmpty(queryResult)) {
com.alibaba.fastjson.JSONObject resultJson = com.alibaba.fastjson.JSONObject.parseObject(queryResult);
allResults.put(userShipperEntity.getCustomerNcCode() + "_" + orgcode, resultJson);
allResults.put(ncCustomer + "_" + orgcode, resultJson); // 使用ncCustomer作为key
// 第三步:查询成功,更新货主的额度同步时间(limitTime)