Authored by chenchao

fix appraise address

@@ -16,7 +16,10 @@ import java.util.stream.Collectors; @@ -16,7 +16,10 @@ import java.util.stream.Collectors;
16 16
17 import javax.annotation.Resource; 17 import javax.annotation.Resource;
18 18
  19 +import com.yohobuy.ufo.model.order.common.*;
19 import com.yohoufo.order.service.listener.BuyerOrderChangeEvent; 20 import com.yohoufo.order.service.listener.BuyerOrderChangeEvent;
  21 +import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
  22 +import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
20 import com.yohoufo.order.utils.NamedThreadFactory; 23 import com.yohoufo.order.utils.NamedThreadFactory;
21 import org.apache.commons.collections.CollectionUtils; 24 import org.apache.commons.collections.CollectionUtils;
22 import org.apache.commons.lang3.StringUtils; 25 import org.apache.commons.lang3.StringUtils;
@@ -33,15 +36,6 @@ import com.yoho.error.ServiceError; @@ -33,15 +36,6 @@ import com.yoho.error.ServiceError;
33 import com.yoho.error.exception.ServiceException; 36 import com.yoho.error.exception.ServiceException;
34 import com.yohobuy.ufo.model.order.bo.AppraiseExpressInfoBo; 37 import com.yohobuy.ufo.model.order.bo.AppraiseExpressInfoBo;
35 import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo; 38 import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo;
36 -import com.yohobuy.ufo.model.order.common.EnumExpressDataOperateTransferCode;  
37 -import com.yohobuy.ufo.model.order.common.EnumExpressDataType;  
38 -import com.yohobuy.ufo.model.order.common.EnumExpressType;  
39 -import com.yohobuy.ufo.model.order.common.EnumQualityCheckStatus;  
40 -import com.yohobuy.ufo.model.order.common.EnumQualityCheckType;  
41 -import com.yohobuy.ufo.model.order.common.OperateTypeEnum;  
42 -import com.yohobuy.ufo.model.order.common.OrderStatus;  
43 -import com.yohobuy.ufo.model.order.common.SellerOrderStatus;  
44 -import com.yohobuy.ufo.model.order.common.TabType;  
45 import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum; 39 import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
46 import com.yohobuy.ufo.model.promotion.request.CouponSendMqBean; 40 import com.yohobuy.ufo.model.promotion.request.CouponSendMqBean;
47 import com.yohobuy.ufo.model.promotion.request.CouponSendType; 41 import com.yohobuy.ufo.model.promotion.request.CouponSendType;
@@ -211,6 +205,9 @@ public class AppraiseService { @@ -211,6 +205,9 @@ public class AppraiseService {
211 @Autowired 205 @Autowired
212 private DepositService depositService; 206 private DepositService depositService;
213 207
  208 + @Autowired
  209 + private OrderCodeGenerator orderCodeGenerator;
  210 +
214 /** 211 /**
215 * 触发物流 212 * 触发物流
216 */ 213 */
@@ -855,9 +852,15 @@ public class AppraiseService { @@ -855,9 +852,15 @@ public class AppraiseService {
855 */ 852 */
856 public ApiResponse appraiseFailAndDelivery(AppraiseExpressInfoBo appraiseExpressInfoBo) { 853 public ApiResponse appraiseFailAndDelivery(AppraiseExpressInfoBo appraiseExpressInfoBo) {
857 LOGGER.info("appraiseFail enter , appraiseExpressInfoBo {} ,appraiseNotPassFlag {}", appraiseExpressInfoBo); 854 LOGGER.info("appraiseFail enter , appraiseExpressInfoBo {} ,appraiseNotPassFlag {}", appraiseExpressInfoBo);
  855 + Long orderCode = appraiseExpressInfoBo.getOrderCode();
  856 + CodeMeta codeMeta = orderCodeGenerator.expId(orderCode);
  857 + OrderCodeType orderCodeType = OrderCodeType.getOrderCodeType(codeMeta.getType());
  858 +
  859 +
  860 +
858 OrderStatus expectStatus = OrderStatus.PLATFORM_CHECKING; 861 OrderStatus expectStatus = OrderStatus.PLATFORM_CHECKING;
859 OrderStatus targetStatus = OrderStatus.CHECKING_FAKE; 862 OrderStatus targetStatus = OrderStatus.CHECKING_FAKE;
860 - Long orderCode = appraiseExpressInfoBo.getOrderCode(); 863 +
861 Integer expressCompanyId = appraiseExpressInfoBo.getExpressCompanyId(); 864 Integer expressCompanyId = appraiseExpressInfoBo.getExpressCompanyId();
862 String wayBillCode = appraiseExpressInfoBo.getWayBillCode(); 865 String wayBillCode = appraiseExpressInfoBo.getWayBillCode();
863 Integer depotNum = appraiseExpressInfoBo.getDepotNum(); 866 Integer depotNum = appraiseExpressInfoBo.getDepotNum();
@@ -59,6 +59,7 @@ import javax.annotation.Resource; @@ -59,6 +59,7 @@ import javax.annotation.Resource;
59 import java.util.*; 59 import java.util.*;
60 import java.util.stream.Collectors; 60 import java.util.stream.Collectors;
61 61
  62 +import static com.yohoufo.order.utils.ServiceExceptions.throwServiceException;
62 import static com.yohoufo.order.utils.ServiceExceptions.throwServiceExceptionIf; 63 import static com.yohoufo.order.utils.ServiceExceptions.throwServiceExceptionIf;
63 64
64 /** 65 /**
@@ -132,7 +133,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -132,7 +133,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
132 private AppraiseOrderService appraiseOrderService; 133 private AppraiseOrderService appraiseOrderService;
133 134
134 @Autowired 135 @Autowired
135 - OrderCodeGenerator orderCodeGenerator; 136 + private OrderCodeGenerator orderCodeGenerator;
136 137
137 private static String EXPRESS_MQ_SEND = "third.logistics.logistics_data"; 138 private static String EXPRESS_MQ_SEND = "third.logistics.logistics_data";
138 139
@@ -148,6 +149,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -148,6 +149,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
148 @Autowired 149 @Autowired
149 private ServiceOrderProcessor serviceOrderProcessor; 150 private ServiceOrderProcessor serviceOrderProcessor;
150 151
  152 +
151 private int processBuyerOrder(BuyerOrder buyerOrder, 153 private int processBuyerOrder(BuyerOrder buyerOrder,
152 Integer expressCompanyId, 154 Integer expressCompanyId,
153 Integer expressType, 155 Integer expressType,
@@ -1090,6 +1092,31 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -1090,6 +1092,31 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
1090 @Override 1092 @Override
1091 public AppraiseAddressResp queryAppraiseAddress(Integer uid, Long orderCode, Integer skup) { 1093 public AppraiseAddressResp queryAppraiseAddress(Integer uid, Long orderCode, Integer skup) {
1092 1094
  1095 + CodeMeta codeMeta = orderCodeGenerator.expId(orderCode);
  1096 + OrderCodeType orderCodeType = OrderCodeType.getOrderCodeType(codeMeta.getType());
  1097 + AppraiseAddressResp resp = null;
  1098 + if (OrderCodeType.GOODS_SERVICE.equals(orderCodeType)){
  1099 + AppraiseOrderService.ExistenceNode existenceNode = appraiseOrderService.isAppraiseOrder(orderCode);
  1100 + if (!existenceNode.isExisted()){
  1101 + throwServiceException(400,"订单不存在");
  1102 + }
  1103 + OrderAttributes oa = OrderAttributes.getOrderAttributes(existenceNode.getAppraiseOrder().getAttributes());
  1104 + DepotType depotType = null;
  1105 + switch (oa){
  1106 + case APPRAISE:
  1107 + depotType = DepotType.BJ;
  1108 + break;
  1109 + case DEPOSITE:
  1110 + depotType = DepotType.NJ;
  1111 + break;
  1112 + default:
  1113 + throwServiceException(400, "订单类型错误");
  1114 + }
  1115 + resp = appraiseAddressService.findByDepotType(depotType.getCode());
  1116 + return resp;
  1117 + }
  1118 +
  1119 +
1093 if (isHKLargeSettlementSuper(uid)) { 1120 if (isHKLargeSettlementSuper(uid)) {
1094 return appraiseAddressService.queryHKAppraiseAddress(); 1121 return appraiseAddressService.queryHKAppraiseAddress();
1095 } 1122 }
@@ -1116,7 +1143,6 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -1116,7 +1143,6 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
1116 LOGGER.info("in queryAppraiseAddress get Address {} orderCode {}, skup {}", buyerAddress, orderCode, skup); 1143 LOGGER.info("in queryAppraiseAddress get Address {} orderCode {}, skup {}", buyerAddress, orderCode, skup);
1117 1144
1118 // 根据用户id查询默认地址的省份 1145 // 根据用户id查询默认地址的省份
1119 - AppraiseAddressResp resp = null;  
1120 if (null != buyerAddress) { 1146 if (null != buyerAddress) {
1121 // 根据产品给的哪些用户的省份匹配到对应的鉴定中心地址 1147 // 根据产品给的哪些用户的省份匹配到对应的鉴定中心地址
1122 resp = appraiseAddressService.queryAddressByAreaCode(buyerAddress.getAreaCode()); 1148 resp = appraiseAddressService.queryAddressByAreaCode(buyerAddress.getAreaCode());