mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
【代码优化】对customerName内部屏蔽
This commit is contained in:
parent
0f51229954
commit
d4e4207ae9
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.trade.framework.delivery.core.client.dto;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
||||
import lombok.Data;
|
||||
|
||||
@ -13,7 +14,7 @@ public class ExpressTrackQueryReqDTO {
|
||||
|
||||
/**
|
||||
* 快递公司编码
|
||||
*
|
||||
* <p>
|
||||
* 对应 {@link DeliveryExpressDO#getCode()}
|
||||
*/
|
||||
private String expressCode;
|
||||
@ -33,4 +34,21 @@ public class ExpressTrackQueryReqDTO {
|
||||
*/
|
||||
private String customerName;
|
||||
|
||||
public ExpressTrackQueryReqDTO setExpressCode(String expressCode) {
|
||||
this.expressCode = expressCode;
|
||||
updateCustomerName();
|
||||
return this; // 返回实体对象
|
||||
}
|
||||
|
||||
public ExpressTrackQueryReqDTO setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
updateCustomerName();
|
||||
return this; // 返回实体对象
|
||||
}
|
||||
|
||||
private void updateCustomerName() {
|
||||
if ("SF".equals(expressCode) && phone != null && phone.length() >= 4) {
|
||||
this.customerName = phone.substring(phone.length() - 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
|
||||
|
||||
/**
|
||||
* 查询物流轨迹
|
||||
*
|
||||
* <p>
|
||||
* 缓存的目的:考虑及时性要求不高,但是每次调用需要钱
|
||||
*
|
||||
* @param code 快递公司编码
|
||||
@ -217,10 +217,13 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService {
|
||||
@Cacheable(cacheNames = RedisKeyConstants.EXPRESS_TRACK, key = "#code + '-' + #logisticsNo + '-' + #receiverMobile",
|
||||
condition = "#result != null && #result.length() > 0")
|
||||
public List<ExpressTrackRespDTO> getExpressTrackList(String code, String logisticsNo, String receiverMobile) {
|
||||
return expressClientFactory.getDefaultExpressClient().getExpressTrackList(
|
||||
new ExpressTrackQueryReqDTO().setExpressCode(code).setLogisticsNo(logisticsNo)
|
||||
// TODO @卢越:1)为什么 customerName 使用 mobile 哈?2)如果使用 mobile,其实可以考虑通过 phone 计算下
|
||||
.setPhone(receiverMobile).setCustomerName(StrUtil.subSuf(receiverMobile, receiverMobile.length() - 4)));
|
||||
return expressClientFactory.getDefaultExpressClient()
|
||||
.getExpressTrackList(
|
||||
new ExpressTrackQueryReqDTO()
|
||||
.setExpressCode(code)
|
||||
.setLogisticsNo(logisticsNo)
|
||||
.setPhone(receiverMobile)
|
||||
);
|
||||
}
|
||||
|
||||
// =================== Order Item ===================
|
||||
|
Loading…
Reference in New Issue
Block a user