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