jyy
2021-03-19 382794b20c47d0f74317b2ac5bb7b6849986166f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package com.matrix.system.shopXcx.api.action;
 
 
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.tools.StringUtils;
import com.matrix.system.common.constance.AppConstance;
import com.matrix.system.shopXcx.bean.ShopDeliveryInfo;
import com.matrix.system.shopXcx.api.service.WxShopLogisticsQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
 
import java.util.*;
 
/**
 * @description 物流信息查询
 * @author pengliang
 * @date 2019-06-16 10:00
 */
@Controller
@RequestMapping(value="/wxapi/ShopLogisticsQuery")
@CrossOrigin(origins = "*", maxAge = 3600)
public class WxShopLogisticsQueryAction {
 
    @Autowired
    private WxShopLogisticsQueryService wxShopLogisticsQueryService;
 
    /**
     * 查询物流信息
     * @param orderId
     * @return
     */
    @RequestMapping(value = "/getLogisticsInformation/{orderId}")
    @ResponseBody
    public AjaxResult getLogisticsInformation(@PathVariable("orderId")Integer orderId){
        ShopDeliveryInfo shopDeliveryInfo = wxShopLogisticsQueryService.selectByorderId(orderId);
        AjaxResult result = wxShopLogisticsQueryService.selectLogisticsInfo(shopDeliveryInfo);
        return  result;
    }
 
 
    /**
     * 根据订单Id,查询最新物流信息
     * @return
     */
    @RequestMapping(value = "/getLogisticsByOrderId/{orderId}")
    @ResponseBody
    public AjaxResult getLogisticsByOrderId(@PathVariable("orderId") Integer orderId){
        ShopDeliveryInfo shopDeliveryInfo = wxShopLogisticsQueryService.selectByorderId(orderId);
        if(null == shopDeliveryInfo){
            return new AjaxResult(AjaxResult.STATUS_FAIL,"未找到发货信息");
        }
        Map<String,String> logisticsInfo = new HashMap<String, String>();
        AjaxResult result = new AjaxResult();
        if(shopDeliveryInfo.getWaybillNo() == null){
            logisticsInfo.put("isShipments",AppConstance.IS_NOT_SHIPMENTS);
            result.setStatus(AjaxResult.STATUS_SUCCESS);
            result.putInMap("logisticsInfo",logisticsInfo);
            return  result;
        }
        wxShopLogisticsQueryService.selectLogisticsInfo(shopDeliveryInfo);
        String describe = wxShopLogisticsQueryService.selectDescribeByOrderId(orderId);
        if(!StringUtils.isNotBlank(describe)){
            describe = "暂无物流信息";
        }
        logisticsInfo.put("isShipments",AppConstance.IS_SHIPMENTS);
        logisticsInfo.put("logisticsStatus",shopDeliveryInfo.getLogisticsStatus()==null?"0":String.valueOf(shopDeliveryInfo.getLogisticsStatus()));
        logisticsInfo.put("describe",describe);
        result.setStatus(AjaxResult.STATUS_SUCCESS);
        result.putInMap("logisticsInfo",logisticsInfo);
        return  result;
    }
 
}