refactor(connect): 修改微信连接器用户名获取逻辑
- 在 BaseAuthWeChatPCRequest 和 BaseAuthWeChatRequest 中,将用户名获取方式从 nickname 改为 unionid- 更新 Kuaidi100Plugin 中的物流订单请求逻辑,增加多个电子面单相关参数- 在 StoreLogistics 和 StoreLogisticsCustomerDTO 中添加电子面单客户账户名称字段
This commit is contained in:
@@ -55,7 +55,7 @@ public class BaseAuthWeChatPCRequest extends BaseAuthRequest {
|
||||
|
||||
return ConnectAuthUser.builder()
|
||||
.rawUserInfo(object)
|
||||
.username(object.getString("nickname"))
|
||||
.username(object.getString("unionid"))
|
||||
.nickname(object.getString("nickname"))
|
||||
.avatar(object.getString("headimgurl"))
|
||||
.location(location)
|
||||
|
||||
@@ -57,7 +57,7 @@ public class BaseAuthWeChatRequest extends BaseAuthRequest {
|
||||
|
||||
return ConnectAuthUser.builder()
|
||||
.rawUserInfo(object)
|
||||
.username(object.getString("nickname"))
|
||||
.username(object.getString("unionid"))
|
||||
.nickname(object.getString("nickname"))
|
||||
.avatar(object.getString("headimgurl"))
|
||||
.location(location)
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.kuaidi100.sdk.request.labelV2.OrderReq;
|
||||
import com.kuaidi100.sdk.response.QueryTrackData;
|
||||
import com.kuaidi100.sdk.response.QueryTrackMapResp;
|
||||
import com.kuaidi100.sdk.response.QueryTrackResp;
|
||||
import com.kuaidi100.sdk.response.labelV2.OrderResult;
|
||||
import com.kuaidi100.sdk.response.samecity.OrderResp;
|
||||
import com.kuaidi100.sdk.utils.SignUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -140,25 +141,74 @@ public class Kuaidi100Plugin implements LogisticsPlugin {
|
||||
StoreLogistics storeLogistics = labelOrderDTO.getStoreLogistics();
|
||||
|
||||
|
||||
ManInfo recManInfo = new ManInfo();
|
||||
recManInfo.setName(order.getConsigneeName());
|
||||
recManInfo.setMobile(order.getConsigneeMobile());
|
||||
recManInfo.setPrintAddr(consigneeAddress[0] + consigneeAddress[1] + consigneeAddress[2] + consigneeAddress[3] + order.getConsigneeDetail());
|
||||
|
||||
ManInfo sendManInfo = new ManInfo();
|
||||
sendManInfo.setName(storeDeliverGoodsAddressDTO.getSalesConsignorName());
|
||||
sendManInfo.setMobile(storeDeliverGoodsAddressDTO.getSalesConsignorMobile());
|
||||
sendManInfo.setPrintAddr(consignorAddress[0] + consignorAddress[1] + consignorAddress[2] + consignorAddress[3] + storeDeliverGoodsAddressDTO.getSalesConsignorDetail());
|
||||
|
||||
OrderReq orderReq = new OrderReq();
|
||||
//打印类型,NON:只下单不打印(默认); IMAGE:生成图片短链;HTML:生成html短链; CLOUD:使用快递100云打印机打印,使用CLOUD时siid必填
|
||||
orderReq.setPrintType(PrintType.HTML);
|
||||
//电子面单客户账户或月结账号,需贵司向当地快递公司网点申请(参考电子面单申请指南); 是否必填该属性,请查看参数字典
|
||||
orderReq.setPartnerId(storeLogistics.getCustomerName());
|
||||
//电子面单密码,需贵司向当地快递公司网点申请; 是否必填该属性,请查看参数字典
|
||||
if(storeLogistics.getCustomerPwd()!=null){
|
||||
orderReq.setPartnerKey(storeLogistics.getCustomerPwd());
|
||||
}
|
||||
|
||||
//电子面单密钥,需贵司向当地快递公司网点申请; 是否必填该属性,请查看参数字典
|
||||
if(storeLogistics.getMonthCode()!=null) {
|
||||
orderReq.setPartnerSecret(storeLogistics.getMonthCode());
|
||||
}
|
||||
//电子面单客户账户名称,需贵司向当地快递公司网点申请; 是否必填该属性,请查看参数字典
|
||||
if(storeLogistics.getPartnerName()!=null) {
|
||||
orderReq.setPartnerName(storeLogistics.getPartnerName());
|
||||
}
|
||||
// orderReq.setNet();
|
||||
// 电子面单承载编号,需贵司向当地快递公司网点申请; 是否必填该属性,请查看参数字典
|
||||
if(storeLogistics.getSendSite()!=null) {
|
||||
orderReq.setCode(storeLogistics.getSendSite());
|
||||
}
|
||||
//电子面单承载快递员名,需贵司向当地快递公司网点申请; 是否必填该属性,请查看参数字典
|
||||
if(storeLogistics.getSendStaff()!=null) {
|
||||
orderReq.setCheckMan(storeLogistics.getSendStaff());
|
||||
}
|
||||
|
||||
//快递公司的编码,一律用小写字母,请查看参数字典
|
||||
orderReq.setKuaidicom(logistics.getCode());
|
||||
orderReq.setCount(1);
|
||||
//收件人信息
|
||||
ManInfo manInfo=new ManInfo();
|
||||
//收件人姓名
|
||||
manInfo.setName(order.getConsigneeName());
|
||||
//收件人的手机号,手机号和电话号二者其一必填
|
||||
manInfo.setMobile(order.getConsigneeMobile());
|
||||
//收件人的电话号,手机号和电话号二者其一必填
|
||||
// manInfo.setTel("");
|
||||
//收件人所在完整地址,如广东深圳市南山区科技南十二路金蝶软件园B10
|
||||
manInfo.setPrintAddr(consigneeAddress[0]+consigneeAddress[1]+consigneeAddress[2]+consigneeAddress[3]+order.getConsigneeDetail());
|
||||
orderReq.setRecMan(manInfo);
|
||||
ManInfo sendMan=new ManInfo();
|
||||
// 寄件人信息
|
||||
sendMan.setName(storeDeliverGoodsAddressDTO.getSalesConsignorName());
|
||||
// 寄件人的手机号,手机号和电话号二者其一必填
|
||||
sendMan.setMobile(storeDeliverGoodsAddressDTO.getSalesConsignorMobile());
|
||||
//寄件人的电话号,手机号和电话号二者其一必填
|
||||
// sendMan.setTel("");
|
||||
//寄件人所在的完整地址,如广东深圳市南山区科技南十二路金蝶软件园B10
|
||||
sendMan.setPrintAddr(consignorAddress[0]+consignorAddress[1]+consignorAddress[2]+consignorAddress[3]+storeDeliverGoodsAddressDTO.getSalesConsignorDetail());
|
||||
//寄件人所在公司名称
|
||||
// sendMan.setCompany("");
|
||||
orderReq.setSendMan(sendMan);
|
||||
//物品名称,例:文件
|
||||
String goodsName="";
|
||||
for (OrderItem orderItem : orderItems) {
|
||||
goodsName+=orderItem.getGoodsName() + "',";
|
||||
}
|
||||
|
||||
orderReq.setCargo(goodsName);
|
||||
// 包裹总数量。
|
||||
orderReq.setCount(orderItems.size());
|
||||
//打印设备,通过打印机输出的设备码进行获取,printType为CLOUD时必填
|
||||
// orderReq.setSiid("");
|
||||
|
||||
// orderReq.setSiid(siid);
|
||||
//orderReq.setTempId("60f6c17c7c223700131d8bc3");
|
||||
orderReq.setSendMan(sendManInfo);
|
||||
orderReq.setRecMan(recManInfo);
|
||||
|
||||
orderReq.setPrintType(PrintType.CLOUD);
|
||||
|
||||
String param = new Gson().toJson(orderReq);
|
||||
String t = System.currentTimeMillis() + "";
|
||||
@@ -167,14 +217,19 @@ public class Kuaidi100Plugin implements LogisticsPlugin {
|
||||
printReq.setT(t);
|
||||
printReq.setKey(logisticsSetting.getKuaidi100Key());
|
||||
printReq.setSign(SignUtils.printSign(param, t, logisticsSetting.getKuaidi100Key(), logisticsSetting.getKuaidi100Customer()));
|
||||
printReq.setMethod(ApiInfoConstant.ORDER);
|
||||
printReq.setMethod(ApiInfoConstant.NEW_TEMPLATE_URL);
|
||||
printReq.setParam(param);
|
||||
|
||||
IBaseClient baseClient = new LabelV2();
|
||||
HttpResult result = baseClient.execute(printReq);
|
||||
System.out.println(result.getBody());
|
||||
QueryTrackMapResp queryTrackMapResp = new Gson().fromJson(result.getBody(), QueryTrackMapResp.class);
|
||||
OrderResp orderResp = new Gson().fromJson(result.getBody(), OrderResp.class);
|
||||
|
||||
|
||||
|
||||
OrderResult orderResult = new Gson().fromJson(result.getBody(), OrderResult.class);
|
||||
log.info("电子面单响应:{}", orderResult);
|
||||
System.out.println("快递单号:"+orderResult.getKdComOrderNum());
|
||||
System.out.println("面单短链:"+orderResult.getLabel());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -33,16 +33,16 @@ public class StoreLogistics extends BaseEntity {
|
||||
@NotNull
|
||||
private String logisticsId;
|
||||
|
||||
@ApiModelProperty(value = "客户代码")
|
||||
@ApiModelProperty(value = "电子面单客户账户、月结账号、客户代码")
|
||||
private String customerName;
|
||||
|
||||
@ApiModelProperty(value = "客户密码")
|
||||
@ApiModelProperty(value = "客户密码、电子面单密码")
|
||||
private String customerPwd;
|
||||
|
||||
@ApiModelProperty(value = "密钥")
|
||||
@ApiModelProperty(value = "电子面单密钥")
|
||||
private String monthCode;
|
||||
|
||||
@ApiModelProperty(value = "归属网点/网点编码")
|
||||
@ApiModelProperty(value = "归属网点/网点编码,电子面单承载编号")
|
||||
private String sendSite;
|
||||
|
||||
@ApiModelProperty(value = "收件快递员")
|
||||
@@ -57,6 +57,11 @@ public class StoreLogistics extends BaseEntity {
|
||||
@ApiModelProperty(value = "快递类型")
|
||||
private String expType;
|
||||
|
||||
@ApiModelProperty(value = "电子面单客户账户名称")
|
||||
private String partnerName;
|
||||
|
||||
|
||||
|
||||
public StoreLogistics(StoreLogisticsCustomerDTO storeLogisticsCustomerDTO){
|
||||
this.customerName=storeLogisticsCustomerDTO.getCustomerName();
|
||||
this.customerPwd=storeLogisticsCustomerDTO.getCustomerPwd();
|
||||
@@ -66,6 +71,7 @@ public class StoreLogistics extends BaseEntity {
|
||||
this.faceSheetFlag=storeLogisticsCustomerDTO.isFaceSheetFlag();
|
||||
this.payType = storeLogisticsCustomerDTO.getPayType();
|
||||
this.expType = storeLogisticsCustomerDTO.getExpType();
|
||||
this.partnerName = storeLogisticsCustomerDTO.getPartnerName();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -38,4 +38,7 @@ public class StoreLogisticsCustomerDTO {
|
||||
@ApiModelProperty(value = "快递类型")
|
||||
private String expType;
|
||||
|
||||
@ApiModelProperty(value = "电子面单客户账户名称")
|
||||
private String partnerName;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user