|
@@ -5,6 +5,12 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import com.kmall.api.annotation.IgnoreAuth;
|
|
|
import com.kmall.api.annotation.LoginUser;
|
|
|
+import com.kmall.common.utils.RRException;
|
|
|
+import com.kmall.manager.manager.express.sf.entity.RouteEntity;
|
|
|
+import com.kmall.manager.manager.express.sf.entity.RouteResponseEntity;
|
|
|
+import com.kmall.manager.manager.express.sf.entity.SfRouteServiceResponseEntity;
|
|
|
+import com.kmall.manager.manager.express.sf.properties.SFPropertiesBuilder;
|
|
|
+import com.kmall.manager.manager.express.sf.properties.SFUtil;
|
|
|
import com.kmall.manager.manager.print.ticket.PrintTicketPropertiesBuilder;
|
|
|
import com.kmall.manager.manager.wechat.WechatUtil;
|
|
|
import com.kmall.common.constant.Dict;
|
|
@@ -50,6 +56,9 @@ public class ApiOrderController extends ApiBaseAction {
|
|
|
private ApiOrderRefundService apiOrderRefundService;
|
|
|
@Autowired
|
|
|
private ApiStoreService apiStoreService;
|
|
|
+ @Autowired
|
|
|
+ private ApiThirdMerchExpressService apiThirdMerchExpressService;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
*/
|
|
@@ -150,17 +159,48 @@ public class ApiOrderController extends ApiBaseAction {
|
|
|
mapList.add(map);
|
|
|
}else{
|
|
|
if (!StringUtils.isEmpty(orderInfo.getShipping_code()) && !StringUtils.isEmpty(orderInfo.getShipping_no()) &&entity.getShipmentStartTime()!=null) {
|
|
|
- JSONObject Traces = apiKdniaoService.getOrderTracesByJson(orderInfo.getShipping_code(), orderInfo.getShipping_no());
|
|
|
- if (Traces != null) {
|
|
|
- mapList = (List<Map>) Traces.get("Traces");
|
|
|
- String State = (String) Traces.get("State"); //物流状态:2-在途中,3-签收,4-问题件
|
|
|
- if (Dict.logisticsStatus.item_0.getItem().equalsIgnoreCase(State)) {
|
|
|
- Map noDataMap = Maps.newHashMap();
|
|
|
- noDataMap.put("AcceptTime", "");
|
|
|
- noDataMap.put("AcceptStation", Traces.get("Reason"));
|
|
|
- mapList.add(noDataMap);
|
|
|
+ if(orderInfo.getShipping_code().equalsIgnoreCase("SF")){
|
|
|
+ StoreVo storeVo = apiStoreService.queryObject(orderInfo.getStore_id());
|
|
|
+ if(storeVo == null){
|
|
|
+ return toResponsObject(400, "查询顺丰订单异常,订单的门店信息不存在", null);
|
|
|
+ }
|
|
|
+ ThirdMerchExpressVo thirdMerchExpressVo = apiThirdMerchExpressService.getThirdMerchExpressByThirdCode(storeVo.getThirdPartyMerchCode());
|
|
|
+ if(thirdMerchExpressVo == null){
|
|
|
+ return toResponsObject(400, "查询顺丰订单异常,缺失商户快递账号信息", null);
|
|
|
+ }
|
|
|
+ SfRouteServiceResponseEntity sfRouteServiceResponseEntity = SFUtil.routeService(orderInfo.getShipping_no(),
|
|
|
+ thirdMerchExpressVo.getExpressAccount(), thirdMerchExpressVo.getExpressPwd(),
|
|
|
+ SFPropertiesBuilder.instance().getUrl());
|
|
|
+ if(sfRouteServiceResponseEntity.getHead().equalsIgnoreCase("OK")){
|
|
|
+ if(sfRouteServiceResponseEntity.getBody() != null && sfRouteServiceResponseEntity.getBody().getRouteResponse() != null){
|
|
|
+ RouteResponseEntity routeResponseEntity = sfRouteServiceResponseEntity.getBody().getRouteResponse().get(0);
|
|
|
+ if(routeResponseEntity != null){
|
|
|
+ List<RouteEntity> entityList = routeResponseEntity.getRouteResponse();
|
|
|
+ for (RouteEntity route : entityList) {
|
|
|
+ Map noDataMap = Maps.newHashMap();
|
|
|
+ noDataMap.put("AcceptTime", route.getAccept_time());
|
|
|
+ noDataMap.put("AcceptStation", route.getAccept_address() + route.getRemark());
|
|
|
+ mapList.add(noDataMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ return toResponsObject(400, "查询顺丰订单异常,"+sfRouteServiceResponseEntity.getErrors(), null);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ JSONObject Traces = apiKdniaoService.getOrderTracesByJson(orderInfo.getShipping_code(), orderInfo.getShipping_no());
|
|
|
+ if (Traces != null) {
|
|
|
+ mapList = (List<Map>) Traces.get("Traces");
|
|
|
+ String State = (String) Traces.get("State"); //物流状态:2-在途中,3-签收,4-问题件
|
|
|
+ if (Dict.logisticsStatus.item_0.getItem().equalsIgnoreCase(State)) {
|
|
|
+ Map noDataMap = Maps.newHashMap();
|
|
|
+ noDataMap.put("AcceptTime", "");
|
|
|
+ noDataMap.put("AcceptStation", Traces.get("Reason"));
|
|
|
+ mapList.add(noDataMap);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
if (Dict.isSend.item_1.getItem().equalsIgnoreCase(entity.getIsCustomsSend()) && entity.getShipmentStartTime() != null) {
|
|
@@ -336,26 +376,59 @@ public class ApiOrderController extends ApiBaseAction {
|
|
|
wuliuList.add(vo);
|
|
|
}else {
|
|
|
if (!StringUtils.isEmpty(orderInfo.getShipping_code()) && !StringUtils.isEmpty(orderInfo.getShipping_no()) && entity.getShipmentStartTime() != null) {
|
|
|
- // 快递
|
|
|
- JSONObject Traces = apiKdniaoService.getOrderTracesByJson(orderInfo.getShipping_code(), orderInfo.getShipping_no());
|
|
|
- List<Map> mapList = (List<Map>) Traces.get("Traces");
|
|
|
- if(mapList!=null&&mapList.size()>0) {
|
|
|
- for (int i = 0; i < mapList.size(); i++) {
|
|
|
- WuliuVo vo = new WuliuVo();
|
|
|
- vo.setAcceptTime((String) mapList.get(i).get("AcceptTime"));
|
|
|
- vo.setAcceptStation((String) mapList.get(i).get("AcceptStation"));
|
|
|
- wuliuList.add(vo);
|
|
|
+ if(orderInfo.getShipping_code().equalsIgnoreCase("SF")){
|
|
|
+ StoreVo storeVo = apiStoreService.queryObject(orderInfo.getStore_id());
|
|
|
+ if(storeVo == null){
|
|
|
+ return toResponsObject(400, "查询顺丰订单异常,订单的门店信息不存在", null);
|
|
|
}
|
|
|
+ ThirdMerchExpressVo thirdMerchExpressVo = apiThirdMerchExpressService.getThirdMerchExpressByThirdCode(storeVo.getThirdPartyMerchCode());
|
|
|
+ if(thirdMerchExpressVo == null){
|
|
|
+ return toResponsObject(400, "查询顺丰订单异常,缺失商户快递账号信息", null);
|
|
|
+ }
|
|
|
+ SfRouteServiceResponseEntity sfRouteServiceResponseEntity = SFUtil.routeService(orderInfo.getShipping_no(),
|
|
|
+ thirdMerchExpressVo.getExpressAccount(), thirdMerchExpressVo.getExpressPwd(),
|
|
|
+ SFPropertiesBuilder.instance().getUrl());
|
|
|
+// SfRouteServiceResponseEntity sfRouteServiceResponseEntity = SFUtil.routeService("444072971585",
|
|
|
+// SFPropertiesBuilder.instance().getAccount(), SFPropertiesBuilder.instance().getPassword(),
|
|
|
+// SFPropertiesBuilder.instance().getUrl());
|
|
|
+ if(sfRouteServiceResponseEntity.getHead().equalsIgnoreCase("OK")){
|
|
|
+ if(sfRouteServiceResponseEntity.getBody() != null && sfRouteServiceResponseEntity.getBody().getRouteResponse() != null){
|
|
|
+ RouteResponseEntity routeResponseEntity = sfRouteServiceResponseEntity.getBody().getRouteResponse().get(0);
|
|
|
+ if(routeResponseEntity != null){
|
|
|
+ List<RouteEntity> entityList = routeResponseEntity.getRouteResponse();
|
|
|
+ for (RouteEntity route : entityList) {
|
|
|
+ WuliuVo vo = new WuliuVo();
|
|
|
+ vo.setAcceptTime(route.getAccept_time());
|
|
|
+ vo.setAcceptStation(route.getAccept_address() + route.getRemark());
|
|
|
+ wuliuList.add(vo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ return toResponsObject(400, "查询顺丰订单异常,"+sfRouteServiceResponseEntity.getErrors(), null);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ // 快递
|
|
|
+ JSONObject Traces = apiKdniaoService.getOrderTracesByJson(orderInfo.getShipping_code(), orderInfo.getShipping_no());
|
|
|
+ List<Map> mapList = (List<Map>) Traces.get("Traces");
|
|
|
+ if(mapList!=null&&mapList.size()>0) {
|
|
|
+ for (int i = 0; i < mapList.size(); i++) {
|
|
|
+ WuliuVo vo = new WuliuVo();
|
|
|
+ vo.setAcceptTime((String) mapList.get(i).get("AcceptTime"));
|
|
|
+ vo.setAcceptStation((String) mapList.get(i).get("AcceptStation"));
|
|
|
+ wuliuList.add(vo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String State = (String) Traces.get("State"); //物流状态:2-在途中,3-签收,4-问题件
|
|
|
+ String Reason = (String) Traces.get("Reason");
|
|
|
+ if (Dict.logisticsStatus.item_0.getItem().equalsIgnoreCase(State)) {
|
|
|
+ WuliuVo wuliuVo = new WuliuVo();
|
|
|
+ wuliuVo.setAcceptStation(Reason);
|
|
|
+ wuliuList.add(wuliuVo);
|
|
|
+ }
|
|
|
+ map.put("State", Traces.get("State")); //物流状态:2-在途中,3-签收,4-问题件
|
|
|
+ map.put("Reason", Traces.get("Reason"));
|
|
|
}
|
|
|
- String State = (String) Traces.get("State"); //物流状态:2-在途中,3-签收,4-问题件
|
|
|
- String Reason = (String) Traces.get("Reason");
|
|
|
- if (Dict.logisticsStatus.item_0.getItem().equalsIgnoreCase(State)) {
|
|
|
- WuliuVo wuliuVo = new WuliuVo();
|
|
|
- wuliuVo.setAcceptStation(Reason);
|
|
|
- wuliuList.add(wuliuVo);
|
|
|
- }
|
|
|
- map.put("State", Traces.get("State")); //物流状态:2-在途中,3-签收,4-问题件
|
|
|
- map.put("Reason", Traces.get("Reason"));
|
|
|
}
|
|
|
}
|
|
|
if (Dict.isSend.item_1.getItem().equalsIgnoreCase(entity.getIsCustomsSend()) && entity.getShipmentStartTime() != null) {
|