Authored by caoyan

鉴定服务

@@ -49,6 +49,9 @@ import com.yoho.error.exception.ServiceException; @@ -49,6 +49,9 @@ import com.yoho.error.exception.ServiceException;
49 import com.yoho.order.dal.AbnormalOrderMapper; 49 import com.yoho.order.dal.AbnormalOrderMapper;
50 import com.yoho.order.dal.AbnormalPackageMapper; 50 import com.yoho.order.dal.AbnormalPackageMapper;
51 import com.yoho.order.dal.AppraiseAddressMapper; 51 import com.yoho.order.dal.AppraiseAddressMapper;
  52 +import com.yoho.order.dal.AppraiseOrderGoodsMapper;
  53 +import com.yoho.order.dal.AppraiseOrderMapper;
  54 +import com.yoho.order.dal.AppraiseOrderStorageMapper;
52 import com.yoho.order.dal.BuyerOrderGoodsMapper; 55 import com.yoho.order.dal.BuyerOrderGoodsMapper;
53 import com.yoho.order.dal.BuyerOrderMapper; 56 import com.yoho.order.dal.BuyerOrderMapper;
54 import com.yoho.order.dal.BuyerOrderMetaMapper; 57 import com.yoho.order.dal.BuyerOrderMetaMapper;
@@ -73,6 +76,10 @@ import com.yoho.order.dal.ZhimaCertMapper; @@ -73,6 +76,10 @@ import com.yoho.order.dal.ZhimaCertMapper;
73 import com.yoho.order.model.AbnormalOrder; 76 import com.yoho.order.model.AbnormalOrder;
74 import com.yoho.order.model.AbnormalPackage; 77 import com.yoho.order.model.AbnormalPackage;
75 import com.yoho.order.model.AppraiseAddress; 78 import com.yoho.order.model.AppraiseAddress;
  79 +import com.yoho.order.model.AppraiseOrder;
  80 +import com.yoho.order.model.AppraiseOrderGoods;
  81 +import com.yoho.order.model.AppraiseOrderReq;
  82 +import com.yoho.order.model.AppraiseOrderStorage;
76 import com.yoho.order.model.BuyerOrder; 83 import com.yoho.order.model.BuyerOrder;
77 import com.yoho.order.model.BuyerOrderFeedback; 84 import com.yoho.order.model.BuyerOrderFeedback;
78 import com.yoho.order.model.BuyerOrderGoods; 85 import com.yoho.order.model.BuyerOrderGoods;
@@ -133,6 +140,7 @@ import com.yoho.ufo.util.MobileHelper; @@ -133,6 +140,7 @@ import com.yoho.ufo.util.MobileHelper;
133 import com.yoho.ufo.util.OrderVideoUrlUtil; 140 import com.yoho.ufo.util.OrderVideoUrlUtil;
134 import com.yohobuy.ufo.model.order.bo.AppraiseExpressInfoBo; 141 import com.yohobuy.ufo.model.order.bo.AppraiseExpressInfoBo;
135 import com.yohobuy.ufo.model.order.bo.DepositDetailBo; 142 import com.yohobuy.ufo.model.order.bo.DepositDetailBo;
  143 +import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
136 import com.yohobuy.ufo.model.order.common.EnumExpressType; 144 import com.yohobuy.ufo.model.order.common.EnumExpressType;
137 import com.yohobuy.ufo.model.order.common.EnumQualityCheckStatus; 145 import com.yohobuy.ufo.model.order.common.EnumQualityCheckStatus;
138 import com.yohobuy.ufo.model.order.common.EnumQualityCheckType; 146 import com.yohobuy.ufo.model.order.common.EnumQualityCheckType;
@@ -281,6 +289,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -281,6 +289,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
281 289
282 @Autowired 290 @Autowired
283 private ClearanceRecordService clearanceRecordService; 291 private ClearanceRecordService clearanceRecordService;
  292 +
  293 + @Autowired
  294 + private AppraiseOrderMapper appraiseOrderMapper;
  295 +
  296 + @Autowired
  297 + private AppraiseOrderGoodsMapper appraiseOrderGoodsMapper;
  298 +
  299 + @Autowired
  300 + private AppraiseOrderStorageMapper appraiseOrderStorageMapper;
284 301
285 private static final String BUYER_ORDER_META_KEY_DELIVERY_ADDRESS = "delivery_address"; 302 private static final String BUYER_ORDER_META_KEY_DELIVERY_ADDRESS = "delivery_address";
286 303
@@ -627,6 +644,33 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -627,6 +644,33 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
627 } 644 }
628 } 645 }
629 646
  647 + private List<AppraiseOrder> queryAppraiseOrderByQueryStr(String queryStr, Integer depotNo, Byte status, String sortRule) {
  648 + //先按订单号来查
  649 + AppraiseOrderReq req = new AppraiseOrderReq();
  650 + req.setOrderCode(queryStr);
  651 + req.setDepotNo(depotNo);
  652 + req.setStatus(status);
  653 + req.setSize(100);
  654 + req.setSortRule(sortRule);
  655 + List<AppraiseOrder> orderList = appraiseOrderMapper.selectByCondition(req);
  656 + if(CollectionUtils.isEmpty(orderList)){//再按卖家运单号来查
  657 + req = new AppraiseOrderReq();
  658 + req.setSellerWaybillCode(queryStr);
  659 + req.setDepotNo(depotNo);
  660 + req.setStatus(status);
  661 + req.setSize(100);
  662 + req.setSortRule(sortRule);
  663 + List<AppraiseOrder> list = appraiseOrderMapper.selectByCondition(req);
  664 + if(CollectionUtils.isEmpty(list)){
  665 + return Lists.newArrayList();
  666 + }
  667 +
  668 + return list;
  669 + }else{
  670 + return orderList;
  671 + }
  672 + }
  673 +
630 public Map<String, Integer> getCountByOrderStatus(){ 674 public Map<String, Integer> getCountByOrderStatus(){
631 Map<String, Integer> resultMap = Maps.newHashMap(); 675 Map<String, Integer> resultMap = Maps.newHashMap();
632 resultMap.put("num_0", buyerOrderMapper.selectCountByStatus(null));//全部 676 resultMap.put("num_0", buyerOrderMapper.selectCountByStatus(null));//全部
@@ -871,6 +915,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -871,6 +915,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
871 buildExtraInfo(jsonObject, orderList, sellerWaybillCode); 915 buildExtraInfo(jsonObject, orderList, sellerWaybillCode);
872 916
873 List<BuyerOrderResp> respList = buildBuyerOrderRespForQc(orderList); 917 List<BuyerOrderResp> respList = buildBuyerOrderRespForQc(orderList);
  918 +
  919 + //查询鉴定服务、现货寄存订单
  920 + List<AppraiseOrder> appraiseOrderList = queryAppraiseOrderByQueryStr(sellerWaybillCode, null, null, "asc");
  921 + if(CollectionUtils.isNotEmpty(appraiseOrderList)) {
  922 + List<BuyerOrderResp> list = convertAppraiseToBuyerOrderResp(appraiseOrderList, jsonObject);
  923 + respList.addAll(list);
  924 + }
874 if(CollectionUtils.isEmpty(respList)) { 925 if(CollectionUtils.isEmpty(respList)) {
875 return jsonObject; 926 return jsonObject;
876 } 927 }
@@ -883,6 +934,34 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -883,6 +934,34 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
883 return jsonObject; 934 return jsonObject;
884 } 935 }
885 936
  937 + private List<BuyerOrderResp> convertAppraiseToBuyerOrderResp(List<AppraiseOrder> list, JSONObject jsonObject){
  938 + List<BuyerOrderResp> respList = Lists.newArrayList();
  939 + List<String> orderCodeList = list.stream().map(AppraiseOrder::getOrderCode).collect(Collectors.toList());
  940 + List<ExpressRecord> expressList = expressRecordMapper.selectByOrderCodeListAndType(orderCodeList, Lists.newArrayList(EnumExpressType.EXPRESS_TYPE_1.getCode()));
  941 + Map<String, ExpressRecord> expressMap = expressList.stream().collect(Collectors.toMap(ExpressRecord::getOrderCode, e->e));
  942 + List<AppraiseOrderGoods> goodsList = appraiseOrderGoodsMapper.selectByOrderCodes(orderCodeList);
  943 + Map<String, AppraiseOrderGoods> goodsMap = goodsList.stream().collect(Collectors.toMap(AppraiseOrderGoods::getOrderCode, a->a));
  944 + List<AppraiseOrderStorage> storageList = appraiseOrderStorageMapper.selectByOrderCodes(orderCodeList);
  945 + Map<String, AppraiseOrderStorage> storageMap = storageList.stream().collect(Collectors.toMap(AppraiseOrderStorage::getOrderCode, a->a));
  946 + for(AppraiseOrder item : list) {
  947 + BuyerOrderResp resp = new BuyerOrderResp();
  948 + resp.setOrderCode(item.getOrderCode());
  949 + resp.setSellerWaybillCode(expressMap.get(item.getOrderCode()).getWaybillCode());
  950 + resp.setStatus(item.getStatus());
  951 + resp.setStatusStr(AppraiseOrderStatus.getByCode(item.getStatus().intValue()).getDesc());
  952 + resp.setProductImage(goodsMap.get(item.getOrderCode()).getImageUrl());
  953 + resp.setProductName(goodsMap.get(item.getOrderCode()).getProductName());
  954 + resp.setAttributes(item.getAttributes());
  955 + resp.setAttributesStr(OrderConfigConstant.getOrderAttributeStr(item.getAttributes(), RegionEnum.MAINLAND.getCode()));
  956 + resp.setProductCode(goodsMap.get(item.getOrderCode()).getProductCode());
  957 + resp.setSizeName(storageMap.get(item.getOrderCode()).getSizeName());
  958 +
  959 + respList.add(resp);
  960 + }
  961 +
  962 + return respList;
  963 + }
  964 +
886 private void buildExtraInfo(JSONObject jsonObject, List<BuyerOrder> orderList, String sellerWaybillCode){ 965 private void buildExtraInfo(JSONObject jsonObject, List<BuyerOrder> orderList, String sellerWaybillCode){
887 jsonObject.replace("orderNum", orderList.size()); 966 jsonObject.replace("orderNum", orderList.size());
888 967