...
|
...
|
@@ -49,6 +49,9 @@ import com.yoho.error.exception.ServiceException; |
|
|
import com.yoho.order.dal.AbnormalOrderMapper;
|
|
|
import com.yoho.order.dal.AbnormalPackageMapper;
|
|
|
import com.yoho.order.dal.AppraiseAddressMapper;
|
|
|
import com.yoho.order.dal.AppraiseOrderGoodsMapper;
|
|
|
import com.yoho.order.dal.AppraiseOrderMapper;
|
|
|
import com.yoho.order.dal.AppraiseOrderStorageMapper;
|
|
|
import com.yoho.order.dal.BuyerOrderGoodsMapper;
|
|
|
import com.yoho.order.dal.BuyerOrderMapper;
|
|
|
import com.yoho.order.dal.BuyerOrderMetaMapper;
|
...
|
...
|
@@ -73,6 +76,10 @@ import com.yoho.order.dal.ZhimaCertMapper; |
|
|
import com.yoho.order.model.AbnormalOrder;
|
|
|
import com.yoho.order.model.AbnormalPackage;
|
|
|
import com.yoho.order.model.AppraiseAddress;
|
|
|
import com.yoho.order.model.AppraiseOrder;
|
|
|
import com.yoho.order.model.AppraiseOrderGoods;
|
|
|
import com.yoho.order.model.AppraiseOrderReq;
|
|
|
import com.yoho.order.model.AppraiseOrderStorage;
|
|
|
import com.yoho.order.model.BuyerOrder;
|
|
|
import com.yoho.order.model.BuyerOrderFeedback;
|
|
|
import com.yoho.order.model.BuyerOrderGoods;
|
...
|
...
|
@@ -133,6 +140,7 @@ import com.yoho.ufo.util.MobileHelper; |
|
|
import com.yoho.ufo.util.OrderVideoUrlUtil;
|
|
|
import com.yohobuy.ufo.model.order.bo.AppraiseExpressInfoBo;
|
|
|
import com.yohobuy.ufo.model.order.bo.DepositDetailBo;
|
|
|
import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus;
|
|
|
import com.yohobuy.ufo.model.order.common.EnumExpressType;
|
|
|
import com.yohobuy.ufo.model.order.common.EnumQualityCheckStatus;
|
|
|
import com.yohobuy.ufo.model.order.common.EnumQualityCheckType;
|
...
|
...
|
@@ -282,6 +290,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon |
|
|
@Autowired
|
|
|
private ClearanceRecordService clearanceRecordService;
|
|
|
|
|
|
@Autowired
|
|
|
private AppraiseOrderMapper appraiseOrderMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private AppraiseOrderGoodsMapper appraiseOrderGoodsMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private AppraiseOrderStorageMapper appraiseOrderStorageMapper;
|
|
|
|
|
|
private static final String BUYER_ORDER_META_KEY_DELIVERY_ADDRESS = "delivery_address";
|
|
|
|
|
|
private static final String BUYER_ORDER_META_KEY_RECALL_ADDRESS = "recall_address";
|
...
|
...
|
@@ -627,6 +644,33 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon |
|
|
}
|
|
|
}
|
|
|
|
|
|
private List<AppraiseOrder> queryAppraiseOrderByQueryStr(String queryStr, Integer depotNo, Byte status, String sortRule) {
|
|
|
//先按订单号来查
|
|
|
AppraiseOrderReq req = new AppraiseOrderReq();
|
|
|
req.setOrderCode(queryStr);
|
|
|
req.setDepotNo(depotNo);
|
|
|
req.setStatus(status);
|
|
|
req.setSize(100);
|
|
|
req.setSortRule(sortRule);
|
|
|
List<AppraiseOrder> orderList = appraiseOrderMapper.selectByCondition(req);
|
|
|
if(CollectionUtils.isEmpty(orderList)){//再按卖家运单号来查
|
|
|
req = new AppraiseOrderReq();
|
|
|
req.setSellerWaybillCode(queryStr);
|
|
|
req.setDepotNo(depotNo);
|
|
|
req.setStatus(status);
|
|
|
req.setSize(100);
|
|
|
req.setSortRule(sortRule);
|
|
|
List<AppraiseOrder> list = appraiseOrderMapper.selectByCondition(req);
|
|
|
if(CollectionUtils.isEmpty(list)){
|
|
|
return Lists.newArrayList();
|
|
|
}
|
|
|
|
|
|
return list;
|
|
|
}else{
|
|
|
return orderList;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public Map<String, Integer> getCountByOrderStatus(){
|
|
|
Map<String, Integer> resultMap = Maps.newHashMap();
|
|
|
resultMap.put("num_0", buyerOrderMapper.selectCountByStatus(null));//全部
|
...
|
...
|
@@ -871,6 +915,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon |
|
|
buildExtraInfo(jsonObject, orderList, sellerWaybillCode);
|
|
|
|
|
|
List<BuyerOrderResp> respList = buildBuyerOrderRespForQc(orderList);
|
|
|
|
|
|
//查询鉴定服务、现货寄存订单
|
|
|
List<AppraiseOrder> appraiseOrderList = queryAppraiseOrderByQueryStr(sellerWaybillCode, null, null, "asc");
|
|
|
if(CollectionUtils.isNotEmpty(appraiseOrderList)) {
|
|
|
List<BuyerOrderResp> list = convertAppraiseToBuyerOrderResp(appraiseOrderList, jsonObject);
|
|
|
respList.addAll(list);
|
|
|
}
|
|
|
if(CollectionUtils.isEmpty(respList)) {
|
|
|
return jsonObject;
|
|
|
}
|
...
|
...
|
@@ -883,6 +934,34 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon |
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
private List<BuyerOrderResp> convertAppraiseToBuyerOrderResp(List<AppraiseOrder> list, JSONObject jsonObject){
|
|
|
List<BuyerOrderResp> respList = Lists.newArrayList();
|
|
|
List<String> orderCodeList = list.stream().map(AppraiseOrder::getOrderCode).collect(Collectors.toList());
|
|
|
List<ExpressRecord> expressList = expressRecordMapper.selectByOrderCodeListAndType(orderCodeList, Lists.newArrayList(EnumExpressType.EXPRESS_TYPE_1.getCode()));
|
|
|
Map<String, ExpressRecord> expressMap = expressList.stream().collect(Collectors.toMap(ExpressRecord::getOrderCode, e->e));
|
|
|
List<AppraiseOrderGoods> goodsList = appraiseOrderGoodsMapper.selectByOrderCodes(orderCodeList);
|
|
|
Map<String, AppraiseOrderGoods> goodsMap = goodsList.stream().collect(Collectors.toMap(AppraiseOrderGoods::getOrderCode, a->a));
|
|
|
List<AppraiseOrderStorage> storageList = appraiseOrderStorageMapper.selectByOrderCodes(orderCodeList);
|
|
|
Map<String, AppraiseOrderStorage> storageMap = storageList.stream().collect(Collectors.toMap(AppraiseOrderStorage::getOrderCode, a->a));
|
|
|
for(AppraiseOrder item : list) {
|
|
|
BuyerOrderResp resp = new BuyerOrderResp();
|
|
|
resp.setOrderCode(item.getOrderCode());
|
|
|
resp.setSellerWaybillCode(expressMap.get(item.getOrderCode()).getWaybillCode());
|
|
|
resp.setStatus(item.getStatus());
|
|
|
resp.setStatusStr(AppraiseOrderStatus.getByCode(item.getStatus().intValue()).getDesc());
|
|
|
resp.setProductImage(goodsMap.get(item.getOrderCode()).getImageUrl());
|
|
|
resp.setProductName(goodsMap.get(item.getOrderCode()).getProductName());
|
|
|
resp.setAttributes(item.getAttributes());
|
|
|
resp.setAttributesStr(OrderConfigConstant.getOrderAttributeStr(item.getAttributes(), RegionEnum.MAINLAND.getCode()));
|
|
|
resp.setProductCode(goodsMap.get(item.getOrderCode()).getProductCode());
|
|
|
resp.setSizeName(storageMap.get(item.getOrderCode()).getSizeName());
|
|
|
|
|
|
respList.add(resp);
|
|
|
}
|
|
|
|
|
|
return respList;
|
|
|
}
|
|
|
|
|
|
private void buildExtraInfo(JSONObject jsonObject, List<BuyerOrder> orderList, String sellerWaybillCode){
|
|
|
jsonObject.replace("orderNum", orderList.size());
|
|
|
|
...
|
...
|
|