提交修改
This commit is contained in:
parent
0effd73add
commit
bd1aacecd4
@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.heyu.api.data.entity.vv.VvPackageEntity;
|
||||
import com.lz.mybatis.plugin.annotations.IFNullReturnEmpty;
|
||||
import com.lz.mybatis.plugin.annotations.IN;
|
||||
import com.lz.mybatis.plugin.annotations.LIMIT;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -40,4 +41,12 @@ public interface VvPackageDao extends BaseMapper<VvPackageEntity> {
|
||||
|
||||
|
||||
List<VvPackageEntity> selectVvPackageByTrackNumbers(@IFNullReturnEmpty @IN List<String> trackNumber);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@LIMIT
|
||||
VvPackageEntity selectVvPackageByTrackNumber(String trackNumber);
|
||||
|
||||
}
|
||||
@ -146,4 +146,7 @@ public interface VvTradeOrderLineDao extends BaseMapper<VvTradeOrderLineEntity>
|
||||
|
||||
|
||||
List<VvTradeOrderLineEntity> selectVvTradeOrderByTradeOrderIds(@IN List<Long> tradeOrderId);
|
||||
|
||||
|
||||
List<VvTradeOrderLineEntity> selectVvTradeOrderLineByBuyerIdTrackNumber(Long buyerId, String trackNumber);
|
||||
}
|
||||
@ -0,0 +1,215 @@
|
||||
package com.heyu.api.data.dto.vv;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* {
|
||||
* "message": "ok",
|
||||
* "nu": "JT3137200563019",
|
||||
* "ischeck": "1",
|
||||
* "com": "jtexpress",
|
||||
* "status": "200",
|
||||
* "data": [
|
||||
* {
|
||||
* "time": "2025-10-07 15:22:03",
|
||||
* "context": "包裹已签收!(凭取件码)如有问题请电联:菜鸟公共服务站 15007990693/易康 15870077785,投诉电话:0799-6358103",
|
||||
* "ftime": "2025-10-07 15:22:03",
|
||||
* "areaCode": "CN360322000000",
|
||||
* "areaName": "江西,萍乡市,上栗县",
|
||||
* "status": "签收"
|
||||
* },
|
||||
* {
|
||||
* "time": "2025-10-07 10:27:32",
|
||||
* "context": "快件已由兔兔快递员易康(勿找平台,有事呼叫我)15870077785送达菜鸟公共服务站暂存,取件地址:上栗镇庆丰路皇榜花城(乐享)快递超市,请及时取件。代理点电话:15007990693,投诉电话:0799-6358103",
|
||||
* "ftime": "2025-10-07 10:27:32",
|
||||
* "areaCode": "CN360322000000",
|
||||
* "areaName": "江西,萍乡市,上栗县",
|
||||
* "status": "派件"
|
||||
* },
|
||||
* {
|
||||
* "time": "2025-10-07 09:49:36",
|
||||
* "context": "【萍乡市上栗网点】的兔兔快递员:易康(15870077785)正在为您派件(有事先呼我,勿找平台,少一次投诉,多一份感恩!),投诉电话(0799-6358103/18979901271)。【952300为极兔快递员外呼专属号码,请放心接听】",
|
||||
* "ftime": "2025-10-07 09:49:36",
|
||||
* "areaCode": "CN360322101000",
|
||||
* "areaName": "江西,萍乡市,上栗县,上栗镇",
|
||||
* "status": "派件"
|
||||
* },
|
||||
* {
|
||||
* "time": "2025-10-07 09:47:36",
|
||||
* "context": "快件到达【萍乡市上栗网点】(物流问题无需找商家/平台,请联系956025为您解决)",
|
||||
* "ftime": "2025-10-07 09:47:36",
|
||||
* "areaCode": "CN360322000000",
|
||||
* "areaName": "江西,萍乡市,上栗县",
|
||||
* "status": "在途"
|
||||
* },
|
||||
* {
|
||||
* "time": "2025-10-06 23:02:11",
|
||||
* "context": "快件离开【长沙转运中心B1】已发往【萍乡市上栗网点】(物流问题无需找商家/平台,请联系956025为您解决)",
|
||||
* "ftime": "2025-10-06 23:02:11",
|
||||
* "areaCode": "CN430102001000",
|
||||
* "areaName": "湖南,长沙市,芙蓉区,文艺路",
|
||||
* "status": "在途"
|
||||
* },
|
||||
* {
|
||||
* "time": "2025-10-06 22:56:28",
|
||||
* "context": "快件到达【长沙转运中心B1】(物流问题无需找商家/平台,请联系956025为您解决)",
|
||||
* "ftime": "2025-10-06 22:56:28",
|
||||
* "areaCode": "CN430102000000",
|
||||
* "areaName": "湖南,长沙市,芙蓉区",
|
||||
* "status": "在途"
|
||||
* },
|
||||
* {
|
||||
* "time": "2025-10-05 20:43:19",
|
||||
* "context": "快件离开【济南转运中心】已发往【长沙转运中心B1】(物流问题无需找商家/平台,请联系956025为您解决)",
|
||||
* "ftime": "2025-10-05 20:43:19",
|
||||
* "areaCode": "CN370115000000",
|
||||
* "areaName": "山东,济南市,济阳区",
|
||||
* "status": "在途"
|
||||
* },
|
||||
* {
|
||||
* "time": "2025-10-05 20:38:23",
|
||||
* "context": "快件到达【济南转运中心】(物流问题无需找商家/平台,请联系956025为您解决)",
|
||||
* "ftime": "2025-10-05 20:38:23",
|
||||
* "areaCode": "CN370115000000",
|
||||
* "areaName": "山东,济南市,济阳区",
|
||||
* "status": "在途"
|
||||
* },
|
||||
* {
|
||||
* "time": "2025-10-05 15:11:03",
|
||||
* "context": "快件离开【德州经开新区网点】已发往【济南转运中心】(物流问题无需找商家/平台,请联系956025为您解决)",
|
||||
* "ftime": "2025-10-05 15:11:03",
|
||||
* "areaCode": "CN371402000000",
|
||||
* "areaName": "山东,德州市,德城区",
|
||||
* "status": "在途"
|
||||
* },
|
||||
* {
|
||||
* "time": "2025-10-05 15:10:53",
|
||||
* "context": "【德州经开新区网点】的刘磊(19053400422)已取件(物流问题无需找商家/平台,请联系:0534-7024537为您解决)",
|
||||
* "ftime": "2025-10-05 15:10:53",
|
||||
* "areaCode": "CN371402000000",
|
||||
* "areaName": "山东,德州市,德城区",
|
||||
* "status": "揽收"
|
||||
* }
|
||||
* ],
|
||||
* "state": "3",
|
||||
* "condition": "F00",
|
||||
* "routeInfo": {
|
||||
* "from": {
|
||||
* "number": "CN371402000000",
|
||||
* "name": "山东,德州市,德城区"
|
||||
* },
|
||||
* "cur": {
|
||||
* "number": "CN360322000000",
|
||||
* "name": "江西,萍乡市,上栗县"
|
||||
* },
|
||||
* "to": {
|
||||
* "number": "CN360322000000",
|
||||
* "name": "江西,萍乡市,上栗县"
|
||||
* } * },
|
||||
* "isLoop": false,
|
||||
* "courierInfo": {
|
||||
* "deliveryManPhone": "15870077785,15007990693",
|
||||
* "pickupManPhone": "19053400422",
|
||||
* "deliveryManName": "员易康",
|
||||
* "pickupManName": "刘磊" * }
|
||||
* }
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class KuaiDi100DTO {
|
||||
@JsonProperty("message")
|
||||
private String message; // 消息体,请忽略
|
||||
@JsonProperty("nu")
|
||||
private String nu; // 单号
|
||||
@JsonProperty("ischeck")
|
||||
private String ischeck; // 是否签收标记,0未签收,1已签收,请忽略,明细状态请参考state字段
|
||||
@JsonProperty("com")
|
||||
private String com; // 快递公司编码,一律用小写字母
|
||||
@JsonProperty("status")
|
||||
private String status; // 通讯状态,请忽略
|
||||
@JsonProperty("data")
|
||||
private List<DataDTO> data; //
|
||||
@JsonProperty("state")
|
||||
private String state; // 快递单当前状态,默认为0在途,1揽收,2疑难,3签收,4退签,5派件,8清关,14拒签等10个基础物流状态,如需要返回高级物流状态,请参考 resultv2 传值
|
||||
@JsonProperty("condition")
|
||||
private String condition; // 快递单明细状态标记,暂未实现,请忽略
|
||||
@JsonProperty("routeInfo")
|
||||
private RouteInfoDTO routeInfo;
|
||||
@JsonProperty("isLoop")
|
||||
private Boolean isLoop;
|
||||
@JsonProperty("courierInfo")
|
||||
private CourierInfoDTO courierInfo; // 从物流轨迹中提取出的快递员信息,当且仅当入参needCourierInfo=True时会返回
|
||||
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class RouteInfoDTO {
|
||||
@JsonProperty("from")
|
||||
private FromDTO from; // 从哪里发货
|
||||
@JsonProperty("cur")
|
||||
private CurDTO cur; // 当前在哪里
|
||||
@JsonProperty("to")
|
||||
private ToDTO to; // 发货到哪里
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class FromDTO {
|
||||
@JsonProperty("number")
|
||||
private String number; // 地址编码
|
||||
@JsonProperty("name")
|
||||
private String name; // 名称
|
||||
}
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class CurDTO {
|
||||
@JsonProperty("number")
|
||||
private String number;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
}
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class ToDTO {
|
||||
@JsonProperty("number")
|
||||
private String number;
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
}
|
||||
}
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class CourierInfoDTO {
|
||||
@JsonProperty("deliveryManPhone")
|
||||
private String deliveryManPhone; //派件快递员手机号,格式为:"12335467890",如提取出多个手机号,会使用逗号分隔,例如"1234567890,1983782937",提取不到会返回空字符串
|
||||
@JsonProperty("pickupManPhone")
|
||||
private String pickupManPhone; // 揽件快递员姓名,例如:"张三",如提取不到会返回空字符串
|
||||
@JsonProperty("deliveryManName")
|
||||
private String deliveryManName; // 派件快递员姓名,例如:"李四",如提取不到会返回空字符串
|
||||
@JsonProperty("pickupManName")
|
||||
private String pickupManName; // 揽件快递员姓名,例如:"张三",如提取不到会返回空字符串
|
||||
}
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class DataDTO {
|
||||
@JsonProperty("time")
|
||||
private String time; // 时间,原始格式
|
||||
@JsonProperty("context")
|
||||
private String context; //内容
|
||||
@JsonProperty("ftime")
|
||||
private String ftime; // 格式化后时间
|
||||
@JsonProperty("areaCode")
|
||||
private String areaCode; //本数据元对应的行政区域的编码,实时查询接口中提交resultv2=1或者resultv2=4或者resultv2=8标记后才会出现
|
||||
@JsonProperty("areaName")
|
||||
private String areaName; //本数据元对应的行政区域的名称,实时查询接口中提交resultv2=1或者resultv2=4或者resultv2=8标记后才会出现
|
||||
@JsonProperty("status")
|
||||
private String status; // 本数据元对应的物流状态名称或者高级状态名称,实时查询接口中提交resultv2=1或者resultv2=4或者resultv2=8标记后才会出现
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,16 @@
|
||||
package com.heyu.api.data.entity.vv;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.lz.mybatis.plugin.annotations.AS;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.Date;import java.util.Date;
|
||||
/**
|
||||
*包裹表
|
||||
* @author quyixiao
|
||||
* @since 2025-08-23
|
||||
* @since 2025-10-16
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ -32,6 +32,10 @@ private static final long serialVersionUID = 1L;
|
||||
public final static String shipping_from = CLASS_NAME + "shipping_from"; // 发货地址
|
||||
public final static String shipping_to = CLASS_NAME + "shipping_to"; // 收货地址
|
||||
public final static String shipping_amount = CLASS_NAME + "shipping_amount"; // 运费
|
||||
public final static String ischeck_ = CLASS_NAME + "ischeck"; // 是否签收标记,0未签收,1已签收,请忽略,明细状态请参考state字段
|
||||
public final static String com_ = CLASS_NAME + "com"; // 快递公司编码,一律用小写字母
|
||||
public final static String status_ = CLASS_NAME + "status"; // 通讯状态,请忽略
|
||||
public final static String state_ = CLASS_NAME + "state"; // 快递单当前状态,默认为0在途,1揽收,2疑难,3签收,4退签,5派件,8清关,14拒签等10个基础物流状态,如需要返回高级物流状态,请参考 resultv2 传值
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@ -55,6 +59,14 @@ private static final long serialVersionUID = 1L;
|
||||
private String shippingTo;
|
||||
//运费
|
||||
private BigDecimal shippingAmount;
|
||||
// 是否签收标记,0未签收,1已签收,请忽略,明细状态请参考state字段
|
||||
private String ischeck;
|
||||
//快递公司编码,一律用小写字母
|
||||
private String com;
|
||||
//通讯状态,请忽略
|
||||
private String status;
|
||||
//快递单当前状态,默认为0在途,1揽收,2疑难,3签收,4退签,5派件,8清关,14拒签等10个基础物流状态,如需要返回高级物流状态,请参考 resultv2 传值
|
||||
private String state;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -220,6 +232,66 @@ private static final long serialVersionUID = 1L;
|
||||
this.shippingAmount = shippingAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否签收标记,0未签收,1已签收,请忽略,明细状态请参考state字段
|
||||
* @return
|
||||
*/
|
||||
public String getIscheck() {
|
||||
return ischeck;
|
||||
}
|
||||
/**
|
||||
* 是否签收标记,0未签收,1已签收,请忽略,明细状态请参考state字段
|
||||
* @param ischeck
|
||||
*/
|
||||
public void setIscheck(String ischeck) {
|
||||
this.ischeck = ischeck;
|
||||
}
|
||||
|
||||
/**
|
||||
* 快递公司编码,一律用小写字母
|
||||
* @return
|
||||
*/
|
||||
public String getCom() {
|
||||
return com;
|
||||
}
|
||||
/**
|
||||
* 快递公司编码,一律用小写字母
|
||||
* @param com
|
||||
*/
|
||||
public void setCom(String com) {
|
||||
this.com = com;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通讯状态,请忽略
|
||||
* @return
|
||||
*/
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
/**
|
||||
* 通讯状态,请忽略
|
||||
* @param status
|
||||
*/
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 快递单当前状态,默认为0在途,1揽收,2疑难,3签收,4退签,5派件,8清关,14拒签等10个基础物流状态,如需要返回高级物流状态,请参考 resultv2 传值
|
||||
* @return
|
||||
*/
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
/**
|
||||
* 快递单当前状态,默认为0在途,1揽收,2疑难,3签收,4退签,5派件,8清关,14拒签等10个基础物流状态,如需要返回高级物流状态,请参考 resultv2 传值
|
||||
* @param state
|
||||
*/
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VvPackageEntity{" +
|
||||
@ -234,6 +306,10 @@ private static final long serialVersionUID = 1L;
|
||||
",shippingFrom=" + shippingFrom +
|
||||
",shippingTo=" + shippingTo +
|
||||
",shippingAmount=" + shippingAmount +
|
||||
",ischeck=" + ischeck +
|
||||
",com=" + com +
|
||||
",status=" + status +
|
||||
",state=" + state +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -49,7 +49,7 @@ public class MysqlMain_update {
|
||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||
|
||||
|
||||
String a = "vv_reverse_order";
|
||||
String a = "vv_package";
|
||||
for (String s : a.split(",")) {
|
||||
list.add(new TablesBean(s));
|
||||
}
|
||||
|
||||
@ -0,0 +1,23 @@
|
||||
package com.heyu.api.alibaba.request.mm;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class VvAppLogisticsRequest {
|
||||
|
||||
/***
|
||||
* 买家id,当前登录的买家id
|
||||
*/
|
||||
private Long buyerId ;
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* 物流单号
|
||||
*/
|
||||
private String trackNumber;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,51 +1,71 @@
|
||||
package com.heyu.api.kuaidi100;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.heyu.api.data.dto.vv.KuaiDi100DTO;
|
||||
import com.kuaidi100.sdk.api.QueryTrack;
|
||||
import com.kuaidi100.sdk.core.IBaseClient;
|
||||
import com.kuaidi100.sdk.pojo.HttpResult;
|
||||
import com.kuaidi100.sdk.request.QueryTrackParam;
|
||||
import com.kuaidi100.sdk.request.QueryTrackReq;
|
||||
import com.kuaidi100.sdk.utils.SignUtils;
|
||||
import org.junit.Test;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* https://api.kuaidi100.com/document/5f0ffa8f2977d50a94e1023c
|
||||
*/
|
||||
@Slf4j
|
||||
public class KuaiDi100Utils {
|
||||
|
||||
|
||||
public static String key = "DnqfHnzY4501";
|
||||
public static String customer = "9026FB96E97AF02582856DE4D70B27AF";
|
||||
|
||||
String key = "DnqfHnzY4501";
|
||||
String customer = "9026FB96E97AF02582856DE4D70B27AF";
|
||||
|
||||
@Test
|
||||
public void testQueryTrack() throws Exception{
|
||||
|
||||
public static KuaiDi100DTO getLogisticsInfo(String trackNumber) {
|
||||
QueryTrackReq queryTrackReq = new QueryTrackReq();
|
||||
try {
|
||||
|
||||
QueryTrackParam queryTrackParam = new QueryTrackParam();
|
||||
|
||||
queryTrackParam.setCom(LogisticsMapUtils.getCode("极兔速递"));
|
||||
QueryTrackParam queryTrackParam = new QueryTrackParam();
|
||||
|
||||
//queryTrackParam.setCom(LogisticsMapUtils.getCode("极兔速递"));
|
||||
|
||||
queryTrackParam.setNum("JT3137200563019");
|
||||
// 添加此字段表示开通行政区域解析功能。空:关闭(默认); 1:开通行政区域解析功能以及物流轨迹增加物流状态名称; 4: 开通行政解析功能以及物流轨迹增加物流高级状态名称、状态值并且返回出发、目的及当前城市信息; 8:在4的基础上额外返回预计到达时间和预计轨迹信息,支持的快递公司见在途时效预估支持的快递公司
|
||||
|
||||
queryTrackParam.setResultv2("2");
|
||||
|
||||
// 返回格式:0:json格式(默认),1:xml,2:html,3:text
|
||||
queryTrackParam.setShow("0");
|
||||
|
||||
queryTrackParam.setNeedCourierInfo(true);
|
||||
|
||||
queryTrackParam.setNum("JT3137200563019");
|
||||
|
||||
// queryTrackParam.setPhone("17725390266");
|
||||
|
||||
String param = new Gson().toJson(queryTrackParam);
|
||||
String param = new Gson().toJson(queryTrackParam);
|
||||
|
||||
queryTrackReq.setParam(param);
|
||||
queryTrackReq.setCustomer(customer);
|
||||
queryTrackReq.setSign(SignUtils.querySign(param ,key,customer));
|
||||
queryTrackReq.setParam(param);
|
||||
|
||||
IBaseClient baseClient = new QueryTrack();
|
||||
HttpResult httpResult = baseClient.execute(queryTrackReq);
|
||||
String body = httpResult.getBody();
|
||||
System.out.println(body);
|
||||
queryTrackReq.setCustomer(customer);
|
||||
|
||||
|
||||
queryTrackReq.setSign(SignUtils.querySign(param, key, customer));
|
||||
|
||||
IBaseClient baseClient = new QueryTrack();
|
||||
HttpResult httpResult = baseClient.execute(queryTrackReq);
|
||||
String body = httpResult.getBody();
|
||||
|
||||
log.info(" getLogisticsInfo queryTrackParam:{} body:{}", JSON.toJSONString(queryTrackParam), body);
|
||||
|
||||
|
||||
return JSONObject.parseObject(body, KuaiDi100DTO.class);
|
||||
} catch (Exception e) {
|
||||
log.error("getLogisticsInfo error:" + JSON.toJSONString(queryTrackReq), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -17,6 +17,16 @@ public class LogisticsMapUtils {
|
||||
}
|
||||
|
||||
|
||||
public static String getLogisticsCompanyName(String code){
|
||||
for(Map.Entry<String, String> entry : logisticsMap.entrySet()){
|
||||
if(entry.getValue().equals(code)){
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
|
||||
logisticsMap.put("圆通速递","yuantong");
|
||||
|
||||
@ -0,0 +1,71 @@
|
||||
package com.heyu.api.controller.vv;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.heyu.api.alibaba.request.mm.VvAppLogisticsRequest;
|
||||
import com.heyu.api.data.dao.vv.VvPackageDao;
|
||||
import com.heyu.api.data.dao.vv.VvTradeOrderLineDao;
|
||||
import com.heyu.api.data.dto.vv.KuaiDi100DTO;
|
||||
import com.heyu.api.data.entity.vv.VvPackageEntity;
|
||||
import com.heyu.api.data.entity.vv.VvTradeOrderLineEntity;
|
||||
import com.heyu.api.data.utils.R;
|
||||
import com.heyu.api.data.utils.StringUtils;
|
||||
import com.heyu.api.kuaidi100.KuaiDi100Utils;
|
||||
import com.heyu.api.kuaidi100.LogisticsMapUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/app/logistics")
|
||||
public class AppLogisticsController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private VvPackageDao vvPackageDao;
|
||||
|
||||
@Autowired
|
||||
private VvTradeOrderLineDao vvTradeOrderLineDao;
|
||||
|
||||
|
||||
// http://localhost:8888/app/logistics/query
|
||||
@RequestMapping("/query")
|
||||
public R query(@RequestBody VvAppLogisticsRequest request) {
|
||||
|
||||
List<VvTradeOrderLineEntity> vvTradeOrderLineEntity = vvTradeOrderLineDao.selectVvTradeOrderLineByBuyerIdTrackNumber(request.getBuyerId(), request.getTrackNumber());
|
||||
|
||||
if (CollectionUtils.isEmpty(vvTradeOrderLineEntity)) {
|
||||
return R.error("trackNumber不是你的");
|
||||
}
|
||||
|
||||
KuaiDi100DTO kuaiDi100DTO = KuaiDi100Utils.getLogisticsInfo(request.getTrackNumber());
|
||||
VvPackageEntity vvPackageEntity = vvPackageDao.selectVvPackageByTrackNumber(request.getTrackNumber());
|
||||
vvPackageEntity.setIscheck(kuaiDi100DTO.getIscheck());
|
||||
vvPackageEntity.setCom(kuaiDi100DTO.getCom());
|
||||
vvPackageEntity.setStatus(kuaiDi100DTO.getStatus());
|
||||
vvPackageEntity.setState(kuaiDi100DTO.getState());
|
||||
vvPackageEntity.setPackageLogisticsInfo(JSON.toJSONString(kuaiDi100DTO));
|
||||
|
||||
if (StringUtils.isBlank(vvPackageEntity.getLogisticsCompany())
|
||||
&& StringUtils.isNotEmpty(kuaiDi100DTO.getCom())) {
|
||||
|
||||
vvPackageEntity.setLogisticsCompany(LogisticsMapUtils.getLogisticsCompanyName(kuaiDi100DTO.getCom()));
|
||||
}
|
||||
|
||||
if (kuaiDi100DTO.getRouteInfo() != null
|
||||
&& kuaiDi100DTO.getRouteInfo().getFrom() != null
|
||||
) {
|
||||
vvPackageEntity.setShippingFrom(kuaiDi100DTO.getRouteInfo().getFrom().getName());
|
||||
}
|
||||
vvPackageDao.updateVvPackageById(vvPackageEntity);
|
||||
return R.ok().setData(kuaiDi100DTO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user