测试环境

This commit is contained in:
赵辉
2026-06-16 17:38:38 +08:00
parent 544dc74b9e
commit 7f72ba410b
3 changed files with 41 additions and 19 deletions
@@ -74,6 +74,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@@ -1524,7 +1525,7 @@ public class UserShipperApplicationService {
* @return 每个客户编码的查询结果 * @return 每个客户编码的查询结果
*/ */
public AjaxResult querySaleCreditLimit(UserShipperDTO userShipperDTO) { public AjaxResult querySaleCreditLimit(UserShipperDTO userShipperDTO) {
List<String> customerNcCodeList = userShipperDTO.getCustomerNcCodeList(); List<UserShipperEntity> customerNcCodeList = userShipperDTO.getCustomerNcCodeList();
if (CollUtil.isEmpty(customerNcCodeList)) { if (CollUtil.isEmpty(customerNcCodeList)) {
return AjaxResult.error("客户编码列表不能为空"); return AjaxResult.error("客户编码列表不能为空");
} }
@@ -1560,21 +1561,22 @@ public class UserShipperApplicationService {
String queryUrl = "http://10.0.0.212/uapws/rest/api/salecredit/querysalecreditlimit"; String queryUrl = "http://10.0.0.212/uapws/rest/api/salecredit/querysalecreditlimit";
com.alibaba.fastjson.JSONObject allResults = new com.alibaba.fastjson.JSONObject(); com.alibaba.fastjson.JSONObject allResults = new com.alibaba.fastjson.JSONObject();
for (String custcode : customerNcCodeList) { for (UserShipperEntity userShipperEntity : customerNcCodeList) {
if (StringUtils.isEmpty(custcode)) { if (StringUtils.isEmpty(userShipperEntity.getCustomerNcCode())) {
continue; continue;
} }
UserShipperEntity userShipperEntity = userShipperMapper.selectOne(new LambdaQueryWrapper<UserShipperEntity>() UserShipperEntity userShipperEntity1 = userShipperMapper.selectOne(new LambdaQueryWrapper<UserShipperEntity>()
.eq(UserShipperEntity::getCustomerNcCode, custcode)); .eq(UserShipperEntity::getCustomerNcCode, userShipperEntity.getCustomerNcCode())
String orgcode = userShipperMapper.getOrgNcCode(userShipperEntity.getOrganizationId()); .eq(UserShipperEntity::getUserId, userShipperEntity.getUserId()));
String orgcode = userShipperMapper.getOrgNcCode(userShipperEntity1.getOrganizationId());
if (StringUtils.isEmpty(orgcode)) { if (StringUtils.isEmpty(orgcode)) {
return AjaxResult.error("组织NC编码不能为空"); return AjaxResult.error("组织NC编码不能为空");
} }
try { try {
com.alibaba.fastjson.JSONObject queryParam = new com.alibaba.fastjson.JSONObject(); com.alibaba.fastjson.JSONObject queryParam = new com.alibaba.fastjson.JSONObject();
queryParam.put("custcode", custcode); queryParam.put("custcode", userShipperEntity.getCustomerNcCode());
queryParam.put("orgcode", orgcode); queryParam.put("orgcode", orgcode);
log.info("调用赊销额度查询接口,custcode={}orgcode={}", custcode, orgcode); log.info("调用赊销额度查询接口,custcode={}orgcode={}", userShipperEntity.getCustomerNcCode(), orgcode);
String queryResult = HttpRequest.post(queryUrl) String queryResult = HttpRequest.post(queryUrl)
.header("Content-Type", "application/json") .header("Content-Type", "application/json")
@@ -1585,26 +1587,42 @@ public class UserShipperApplicationService {
.body(queryParam.toJSONString()) .body(queryParam.toJSONString())
.execute() .execute()
.body(); .body();
log.info("赊销额度查询接口返回,custcode={}result={}", custcode, queryResult); log.info("赊销额度查询接口返回,custcode={}result={}", userShipperEntity.getCustomerNcCode(), queryResult);
if (StringUtils.isNotEmpty(queryResult)) { if (StringUtils.isNotEmpty(queryResult)) {
com.alibaba.fastjson.JSONObject resultJson = com.alibaba.fastjson.JSONObject.parseObject(queryResult); com.alibaba.fastjson.JSONObject resultJson = com.alibaba.fastjson.JSONObject.parseObject(queryResult);
allResults.put(custcode, resultJson); allResults.put(userShipperEntity.getCustomerNcCode(), resultJson);
// 第三步:查询成功,更新货主的额度同步时间(limitTime) // 第三步:查询成功,更新货主的额度同步时间(limitTime)
if (userShipperEntity != null) { if (userShipperEntity1 != null) {
userShipperEntity.setLimitTime(new Date()); // 根据查询结果同步数据
userShipperMapper.updateById(userShipperEntity); com.alibaba.fastjson.JSONObject dataJson = resultJson.getJSONObject("data");
log.info("更新货主额度同步时间成功,custcode={}shipperId={}", custcode, userShipperEntity.getShipperId()); if (dataJson != null) {
com.alibaba.fastjson.JSONArray limitdatas = dataJson.getJSONArray("limitdatas");
if (limitdatas != null && !limitdatas.isEmpty()) {
com.alibaba.fastjson.JSONObject limitData = limitdatas.getJSONObject(0);
userShipperEntity1.setLimitTime(new Date());
userShipperEntity1.setAuthorizedQuota(limitData.getBigDecimal("nlimitmny"));
userShipperEntity1.setAuthorizedUsedAmount(limitData.getBigDecimal("nengrossmny"));
userShipperEntity1.setSettlementCurrency(limitData.getString("currencycode"));
userShipperEntity1.setCreditAmount(limitData.getBigDecimal("nbalancemny"));
userShipperMapper.updateById(userShipperEntity1);
log.info("更新货主额度同步成功,custcode={}shipperId={}", userShipperEntity1.getCustomerNcCode(), userShipperEntity1.getShipperId());
} else {
log.info("赊销额度查询无limitdatas返回,跳过更新,custcode={}", userShipperEntity1.getCustomerNcCode());
}
} else {
log.info("赊销额度查询无data返回,跳过更新,custcode={}", userShipperEntity1.getCustomerNcCode());
}
} else { } else {
log.warn("未找到对应货主,custcode={}organizationId={}", custcode, userShipperDTO.getOrganizationId()); log.warn("未找到对应货主,custcode={}organizationId={}", userShipperEntity1.getCustomerNcCode(), userShipperDTO.getOrganizationId());
} }
} else { } else {
log.warn("赊销额度查询返回为空,custcode={}", custcode); log.warn("赊销额度查询返回为空,custcode={}", userShipperEntity1.getCustomerNcCode());
} }
} catch (Exception e) { } catch (Exception e) {
log.error("查询赊销额度异常,custcode={}", custcode, e); log.error("查询赊销额度异常,custcode={}", userShipperEntity1.getCustomerNcCode(), e);
} }
} }
return AjaxResult.success(allResults); return AjaxResult.success(allResults);
@@ -282,4 +282,7 @@ public class UserShipperEntity extends BaseVOEntity {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
private Date limitTime; private Date limitTime;
@ApiModelProperty(name = "信用余额")
private BigDecimal creditAmount;
} }
@@ -3,6 +3,7 @@ package com.mhd.user.interfaces.dto.addDTO;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.mhd.common.core.annotation.Excel; import com.mhd.common.core.annotation.Excel;
import com.mhd.common.core.annotation.fieldsetvalue.NeedSetValue; import com.mhd.common.core.annotation.fieldsetvalue.NeedSetValue;
import com.mhd.user.domain.userAggregate.entity.UserShipperEntity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
@@ -198,7 +199,7 @@ public class UserShipperDTO extends UserDTO {
private String customerNcCode; private String customerNcCode;
@ApiModelProperty("客户nc编码列表") @ApiModelProperty("客户nc编码列表")
private List<String> customerNcCodeList; private List<UserShipperEntity> customerNcCodeList;
@ApiModelProperty("组织ID") @ApiModelProperty("组织ID")
private Long organizationId; private Long organizationId;