Authored by LUOXC

refactor

@@ -15,6 +15,10 @@ import org.springframework.web.bind.annotation.RequestMapping; @@ -15,6 +15,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
15 import org.springframework.web.bind.annotation.RequestParam; 15 import org.springframework.web.bind.annotation.RequestParam;
16 import org.springframework.web.bind.annotation.RestController; 16 import org.springframework.web.bind.annotation.RestController;
17 17
  18 +import java.util.Objects;
  19 +
  20 +import static com.yohoufo.order.utils.ServiceExceptions.throwServiceExceptionIf;
  21 +
18 /** 22 /**
19 * @author kun.wang 23 * @author kun.wang
20 * @date 2018/9/25 24 * @date 2018/9/25
@@ -88,13 +92,13 @@ public class ExpressInfoController { @@ -88,13 +92,13 @@ public class ExpressInfoController {
88 @RequestMapping(params = "method=ufo.order.appraiseAddress") 92 @RequestMapping(params = "method=ufo.order.appraiseAddress")
89 public ApiResponse queryAppraiseAddress(@RequestParam("uid") Integer uid, 93 public ApiResponse queryAppraiseAddress(@RequestParam("uid") Integer uid,
90 @RequestParam(value="skup", required=false)Integer skup, 94 @RequestParam(value="skup", required=false)Integer skup,
  95 + // from version 6.9.3
91 @RequestParam(value="orderCode", required=false)Long orderCode) { 96 @RequestParam(value="orderCode", required=false)Long orderCode) {
92 LOG.info("method=ufo.order.appraiseAddress in, uid is {}, skup is {} orderCode {}", uid, skup, orderCode); 97 LOG.info("method=ufo.order.appraiseAddress in, uid is {}, skup is {} orderCode {}", uid, skup, orderCode);
93 -  
94 - if (null == uid) { 98 + if (Objects.isNull(uid)) {
95 throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY); 99 throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY);
96 } 100 }
97 - 101 + throwServiceExceptionIf(Objects.isNull(orderCode),500,"请升级至最新版本");
98 AppraiseAddressResp appraiseAddressResp = expressInfoService.queryAppraiseAddress(uid, orderCode, skup); 102 AppraiseAddressResp appraiseAddressResp = expressInfoService.queryAppraiseAddress(uid, orderCode, skup);
99 return new ApiResponse.ApiResponseBuilder().code(200).data(appraiseAddressResp).build(); 103 return new ApiResponse.ApiResponseBuilder().code(200).data(appraiseAddressResp).build();
100 } 104 }
@@ -10,6 +10,7 @@ import com.yohoufo.dal.order.model.ExpressRecord; @@ -10,6 +10,7 @@ import com.yohoufo.dal.order.model.ExpressRecord;
10 import com.yohoufo.order.common.ActionStatusHold; 10 import com.yohoufo.order.common.ActionStatusHold;
11 import com.yohoufo.order.model.OperateTransferExpressInfo; 11 import com.yohoufo.order.model.OperateTransferExpressInfo;
12 import com.yohoufo.order.model.response.AppraiseAddressResp; 12 import com.yohoufo.order.model.response.AppraiseAddressResp;
  13 +import lombok.NonNull;
13 14
14 import java.util.ArrayList; 15 import java.util.ArrayList;
15 import java.util.Arrays; 16 import java.util.Arrays;
@@ -109,7 +110,7 @@ public interface IExpressInfoService { @@ -109,7 +110,7 @@ public interface IExpressInfoService {
109 * @param uid 110 * @param uid
110 * @return 111 * @return
111 */ 112 */
112 - AppraiseAddressResp queryAppraiseAddress(Integer uid, Long orderCode, Integer skup); 113 + AppraiseAddressResp queryAppraiseAddress(@NonNull Integer uid, @NonNull Long orderCode, Integer skup);
113 114
114 115
115 AppraiseAddressResp forceNoticeAppraiseAddress(Integer uid, Long orderCode); 116 AppraiseAddressResp forceNoticeAppraiseAddress(Integer uid, Long orderCode);
@@ -48,6 +48,7 @@ import com.yohoufo.order.service.seller.setting.SellerWrapper; @@ -48,6 +48,7 @@ import com.yohoufo.order.service.seller.setting.SellerWrapper;
48 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; 48 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
49 import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta; 49 import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
50 import com.yohoufo.order.utils.BuyerOrderUtils; 50 import com.yohoufo.order.utils.BuyerOrderUtils;
  51 +import lombok.NonNull;
51 import org.apache.commons.collections.CollectionUtils; 52 import org.apache.commons.collections.CollectionUtils;
52 import org.apache.commons.lang3.StringUtils; 53 import org.apache.commons.lang3.StringUtils;
53 import org.slf4j.Logger; 54 import org.slf4j.Logger;
@@ -1331,14 +1332,12 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -1331,14 +1332,12 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
1331 * 根据用户默认地址的省份定位到鉴定中心的地址返回 * 1332 * 根据用户默认地址的省份定位到鉴定中心的地址返回 *
1332 * 1333 *
1333 * @param uid 1334 * @param uid
1334 - * @param orderCode from version 6.9.3 1335 + * @param orderCode
1335 * @param skup 1336 * @param skup
1336 * @return 1337 * @return
1337 */ 1338 */
1338 @Override 1339 @Override
1339 - public AppraiseAddressResp queryAppraiseAddress(Integer uid, Long orderCode, Integer skup) {  
1340 -  
1341 - throwServiceExceptionIf(Objects.isNull(orderCode),"请升级到最新版本"); 1340 + public AppraiseAddressResp queryAppraiseAddress(@NonNull Integer uid, @NonNull Long orderCode, Integer skup) {
1342 1341
1343 CodeMeta codeMeta = orderCodeGenerator.expId(orderCode); 1342 CodeMeta codeMeta = orderCodeGenerator.expId(orderCode);
1344 OrderCodeType orderCodeType = OrderCodeType.getOrderCodeType(codeMeta.getType()); 1343 OrderCodeType orderCodeType = OrderCodeType.getOrderCodeType(codeMeta.getType());