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 logisticsInfo = new HashMap(); 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("logisticsCompany", shopDeliveryInfo.getLogisticsCompany()); logisticsInfo.put("waybillNo", shopDeliveryInfo.getWaybillNo()); logisticsInfo.put("describe",describe); result.setStatus(AjaxResult.STATUS_SUCCESS); result.putInMap("logisticsInfo",logisticsInfo); return result; } }