Showing
1 changed file
with
31 additions
and
2 deletions
@@ -5,9 +5,11 @@ import com.yoho.error.exception.ServiceException; | @@ -5,9 +5,11 @@ import com.yoho.error.exception.ServiceException; | ||
5 | import com.yohobuy.ufo.model.order.common.TabType; | 5 | import com.yohobuy.ufo.model.order.common.TabType; |
6 | import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo; | 6 | import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo; |
7 | import com.yohoufo.common.ApiResponse; | 7 | import com.yohoufo.common.ApiResponse; |
8 | +import com.yohoufo.common.utils.AppVersion; | ||
8 | import com.yohoufo.order.model.response.AppraiseAddressResp; | 9 | import com.yohoufo.order.model.response.AppraiseAddressResp; |
9 | import com.yohoufo.order.service.IExpressInfoService; | 10 | import com.yohoufo.order.service.IExpressInfoService; |
10 | import org.apache.commons.lang3.StringUtils; | 11 | import org.apache.commons.lang3.StringUtils; |
12 | +import org.apache.commons.lang3.math.NumberUtils; | ||
11 | import org.slf4j.Logger; | 13 | import org.slf4j.Logger; |
12 | import org.slf4j.LoggerFactory; | 14 | import org.slf4j.LoggerFactory; |
13 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -17,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController; | @@ -17,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController; | ||
17 | 19 | ||
18 | import java.util.Objects; | 20 | import java.util.Objects; |
19 | 21 | ||
22 | +import static com.yohoufo.order.utils.ServiceExceptions.throwServiceException; | ||
20 | import static com.yohoufo.order.utils.ServiceExceptions.throwServiceExceptionIf; | 23 | import static com.yohoufo.order.utils.ServiceExceptions.throwServiceExceptionIf; |
21 | 24 | ||
22 | /** | 25 | /** |
@@ -44,11 +47,37 @@ public class ExpressInfoController { | @@ -44,11 +47,37 @@ public class ExpressInfoController { | ||
44 | @RequestParam("expressCompanyId") Integer expressCompanyId, | 47 | @RequestParam("expressCompanyId") Integer expressCompanyId, |
45 | @RequestParam("orderCode") Long orderCode, | 48 | @RequestParam("orderCode") Long orderCode, |
46 | @RequestParam("wayBillCode") String wayBillCode, | 49 | @RequestParam("wayBillCode") String wayBillCode, |
47 | - @RequestParam("depotNum") Integer depotNum) { | ||
48 | - expressInfoService.deliverToDepot(uid,expressCompanyId, orderCode, wayBillCode,depotNum); | 50 | + @RequestParam(value = "depotNum", required = false) String depotNum, |
51 | + @RequestParam(value = "app_version") String appVersion) { | ||
52 | + | ||
53 | + Integer depotNumInt = parseDepotNum(depotNum); | ||
54 | + if (Objects.isNull(depotNumInt)) { | ||
55 | + // 大于6.9.3 版本 | ||
56 | + if (AppVersion.of(appVersion).greaterThan(AppVersion.of("6.9.3"))) { | ||
57 | + throwServiceException("请选择有效的鉴定中心"); | ||
58 | + } | ||
59 | + // 小于等于6.9.3版本,提升升级APP | ||
60 | + else { | ||
61 | + throwServiceException(500, "请升级至最新版本"); | ||
62 | + } | ||
63 | + } | ||
64 | + expressInfoService.deliverToDepot(uid, expressCompanyId, orderCode, wayBillCode, depotNumInt); | ||
49 | return new ApiResponse(); | 65 | return new ApiResponse(); |
50 | } | 66 | } |
51 | 67 | ||
68 | + private Integer parseDepotNum(String depotNum) { | ||
69 | + if (StringUtils.isBlank(depotNum)) { | ||
70 | + return null; | ||
71 | + } | ||
72 | + try { | ||
73 | + return Integer.valueOf(depotNum); | ||
74 | + } catch (RuntimeException re) { | ||
75 | + return null; | ||
76 | + } | ||
77 | + } | ||
78 | + | ||
79 | + | ||
80 | + | ||
52 | /** | 81 | /** |
53 | * 查询快递详情 | 82 | * 查询快递详情 |
54 | * | 83 | * |
-
Please register or login to post a comment