Authored by caoyan

质检

@@ -183,7 +183,7 @@ @@ -183,7 +183,7 @@
183 </if> 183 </if>
184 where 1=1 184 where 1=1
185 <include refid="Query_Order_Sql" /> 185 <include refid="Query_Order_Sql" />
186 - order by a.create_time desc 186 + order by a.update_time desc
187 <if test="buyerOrderReq.start!=null and buyerOrderReq.size != null"> 187 <if test="buyerOrderReq.start!=null and buyerOrderReq.size != null">
188 limit #{buyerOrderReq.start},#{buyerOrderReq.size} 188 limit #{buyerOrderReq.start},#{buyerOrderReq.size}
189 </if> 189 </if>
@@ -25,6 +25,7 @@ import com.yohobuy.ufo.model.order.resp.BuyerOrderResp; @@ -25,6 +25,7 @@ import com.yohobuy.ufo.model.order.resp.BuyerOrderResp;
25 import com.yohobuy.ufo.model.order.resp.ExpressInfoResp; 25 import com.yohobuy.ufo.model.order.resp.ExpressInfoResp;
26 import com.yohobuy.ufo.model.order.resp.OrderDetailResp; 26 import com.yohobuy.ufo.model.order.resp.OrderDetailResp;
27 import com.yohobuy.ufo.model.order.resp.OrderOperateRecordResp; 27 import com.yohobuy.ufo.model.order.resp.OrderOperateRecordResp;
  28 +import com.yohobuy.ufo.model.order.resp.QcOrderDetailResp;
28 29
29 @RestController 30 @RestController
30 @RequestMapping(value = "/buyerOrder") 31 @RequestMapping(value = "/buyerOrder")
@@ -417,4 +418,11 @@ public class BuyerOrderController { @@ -417,4 +418,11 @@ public class BuyerOrderController {
417 return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build(); 418 return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
418 } 419 }
419 420
  421 + @RequestMapping(value = "/getQcOrderDetail")
  422 + public ApiResponse getQcOrderDetail(BuyerOrderReq req) {
  423 + LOGGER.info("getQcOrderDetail in. param is {}", req);
  424 + QcOrderDetailResp result = buyerOrderService.getQcOrderDetail(req.getOrderCode());
  425 + return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
  426 + }
  427 +
420 } 428 }
@@ -10,6 +10,7 @@ import com.yohobuy.ufo.model.order.resp.BuyerOrderResp; @@ -10,6 +10,7 @@ import com.yohobuy.ufo.model.order.resp.BuyerOrderResp;
10 import com.yohobuy.ufo.model.order.resp.ExpressInfoResp; 10 import com.yohobuy.ufo.model.order.resp.ExpressInfoResp;
11 import com.yohobuy.ufo.model.order.resp.OrderDetailResp; 11 import com.yohobuy.ufo.model.order.resp.OrderDetailResp;
12 import com.yohobuy.ufo.model.order.resp.OrderOperateRecordResp; 12 import com.yohobuy.ufo.model.order.resp.OrderOperateRecordResp;
  13 +import com.yohobuy.ufo.model.order.resp.QcOrderDetailResp;
13 14
14 /** 15 /**
15 * @author caoyan 16 * @author caoyan
@@ -93,4 +94,6 @@ public interface IBuyerOrderService { @@ -93,4 +94,6 @@ public interface IBuyerOrderService {
93 Map<String, Integer> getCountForQc(BuyerOrderReq req); 94 Map<String, Integer> getCountForQc(BuyerOrderReq req);
94 95
95 PageResponseBO<BuyerOrderResp> queryOrderListByStatusForQc(BuyerOrderReq req); 96 PageResponseBO<BuyerOrderResp> queryOrderListByStatusForQc(BuyerOrderReq req);
  97 +
  98 + QcOrderDetailResp getQcOrderDetail(String orderCode);
96 } 99 }
@@ -76,11 +76,13 @@ import com.yohobuy.ufo.model.order.common.EnumExpressType; @@ -76,11 +76,13 @@ import com.yohobuy.ufo.model.order.common.EnumExpressType;
76 import com.yohobuy.ufo.model.order.common.EnumQualityCheckStatus; 76 import com.yohobuy.ufo.model.order.common.EnumQualityCheckStatus;
77 import com.yohobuy.ufo.model.order.common.EnumQualityCheckType; 77 import com.yohobuy.ufo.model.order.common.EnumQualityCheckType;
78 import com.yohobuy.ufo.model.order.common.OperateTypeEnum; 78 import com.yohobuy.ufo.model.order.common.OperateTypeEnum;
  79 +import com.yohobuy.ufo.model.order.constants.QNliveConstants;
79 import com.yohobuy.ufo.model.order.req.BuyerOrderMetaUpdateReq; 80 import com.yohobuy.ufo.model.order.req.BuyerOrderMetaUpdateReq;
80 import com.yohobuy.ufo.model.order.resp.BuyerOrderResp; 81 import com.yohobuy.ufo.model.order.resp.BuyerOrderResp;
81 import com.yohobuy.ufo.model.order.resp.ExpressInfoResp; 82 import com.yohobuy.ufo.model.order.resp.ExpressInfoResp;
82 import com.yohobuy.ufo.model.order.resp.OrderDetailResp; 83 import com.yohobuy.ufo.model.order.resp.OrderDetailResp;
83 import com.yohobuy.ufo.model.order.resp.OrderOperateRecordResp; 84 import com.yohobuy.ufo.model.order.resp.OrderOperateRecordResp;
  85 +import com.yohobuy.ufo.model.order.resp.QcOrderDetailResp;
84 86
85 /** 87 /**
86 * @author caoyan 88 * @author caoyan
@@ -255,8 +257,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -255,8 +257,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
255 257
256 Map<String, Integer> resultMap = Maps.newHashMap(); 258 Map<String, Integer> resultMap = Maps.newHashMap();
257 int receivedNum = buyerOrderMapper.selectCountByStatusAndDepotNo(receivedList, req.getDepotNo(),null); 259 int receivedNum = buyerOrderMapper.selectCountByStatusAndDepotNo(receivedList, req.getDepotNo(),null);
258 - int processingNum = buyerOrderMapper.selectCountByStatusAndDepotNo(processingList, req.getDepotNo(),null);  
259 - int alreadyDeliverNum = buyerOrderMapper.selectCountByStatusAndDepotNo(alreadyDeliverList, req.getDepotNo(),null); 260 + int processingNum = buyerOrderMapper.selectCountByStatusAndDepotNo(processingList, req.getDepotNo(), "haveNotExpress");
  261 + int alreadyDeliverNum = buyerOrderMapper.selectCountByStatusAndDepotNo(alreadyDeliverList, req.getDepotNo(), "haveExpress");
260 int problemNum = buyerOrderMapper.selectCountByStatusAndDepotNo(problemList, req.getDepotNo(),null); 262 int problemNum = buyerOrderMapper.selectCountByStatusAndDepotNo(problemList, req.getDepotNo(),null);
261 263
262 resultMap.put("receivedNum", receivedNum); 264 resultMap.put("receivedNum", receivedNum);
@@ -268,24 +270,31 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -268,24 +270,31 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
268 } 270 }
269 271
270 private Map<String, Integer> queryOrderNumByStatus(String queryStr, Integer depotNo){ 272 private Map<String, Integer> queryOrderNumByStatus(String queryStr, Integer depotNo){
271 - List<BuyerOrder> orderList = queryOrderByQueryStr(queryStr, depotNo);  
272 int receivedNum = 0; 273 int receivedNum = 0;
273 int processingNum = 0; 274 int processingNum = 0;
274 int alreadyDeliverNum = 0; 275 int alreadyDeliverNum = 0;
275 int problemNum = 0; 276 int problemNum = 0;
276 //遍历按状态统计数量 277 //遍历按状态统计数量
277 Map<String, Integer> resultMap = Maps.newHashMap(); 278 Map<String, Integer> resultMap = Maps.newHashMap();
  279 +
  280 + List<BuyerOrder> orderList = queryOrderByQueryStr(queryStr, depotNo, null);
  281 + if(CollectionUtils.isNotEmpty(orderList)) {
  282 + List<String> orderCodeList = orderList.stream().map(BuyerOrder::getOrderCode).collect(Collectors.toList());
  283 + List<ExpressRecord> expressList = expressRecordMapper.selectByOrderCodeListAndType(orderCodeList, Lists.newArrayList(2,3,4));
  284 + List<String> expressOrderCodeList = expressList.stream().map(ExpressRecord::getOrderCode).collect(Collectors.toList());
  285 +
278 for(BuyerOrder item : orderList) { 286 for(BuyerOrder item : orderList) {
279 if(receivedList.contains(item.getStatus())) { 287 if(receivedList.contains(item.getStatus())) {
280 receivedNum += 1; 288 receivedNum += 1;
281 - }else if(processingList.contains(item.getStatus())) { 289 + }else if(processingList.contains(item.getStatus()) && !expressOrderCodeList.contains(item.getOrderCode())) {
282 processingNum += 1; 290 processingNum += 1;
283 - }else if(alreadyDeliverList.contains(item.getStatus())) { 291 + }else if(alreadyDeliverList.contains(item.getStatus()) && expressOrderCodeList.contains(item.getOrderCode())) {
284 alreadyDeliverNum += 1; 292 alreadyDeliverNum += 1;
285 }else if(problemList.contains(item.getStatus())) { 293 }else if(problemList.contains(item.getStatus())) {
286 problemNum += 1; 294 problemNum += 1;
287 } 295 }
288 } 296 }
  297 + }
289 298
290 resultMap.put("receivedNum", receivedNum); 299 resultMap.put("receivedNum", receivedNum);
291 resultMap.put("processingNum", processingNum); 300 resultMap.put("processingNum", processingNum);
@@ -295,17 +304,19 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -295,17 +304,19 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
295 return resultMap; 304 return resultMap;
296 } 305 }
297 306
298 - private List<BuyerOrder> queryOrderByQueryStr(String queryStr, Integer depotNo) { 307 + private List<BuyerOrder> queryOrderByQueryStr(String queryStr, Integer depotNo, Byte status) {
299 //先按订单号来查 308 //先按订单号来查
300 BuyerOrderReq req = new BuyerOrderReq(); 309 BuyerOrderReq req = new BuyerOrderReq();
301 req.setOrderCode(queryStr); 310 req.setOrderCode(queryStr);
302 req.setDepotNo(depotNo); 311 req.setDepotNo(depotNo);
  312 + req.setStatus(status);
303 req.setSize(100); 313 req.setSize(100);
304 List<BuyerOrder> orderList = buyerOrderMapper.selectByCondition(req); 314 List<BuyerOrder> orderList = buyerOrderMapper.selectByCondition(req);
305 if(CollectionUtils.isEmpty(orderList)){//再按卖家运单号来查 315 if(CollectionUtils.isEmpty(orderList)){//再按卖家运单号来查
306 req = new BuyerOrderReq(); 316 req = new BuyerOrderReq();
307 req.setSellerWaybillCode(queryStr); 317 req.setSellerWaybillCode(queryStr);
308 req.setDepotNo(depotNo); 318 req.setDepotNo(depotNo);
  319 + req.setStatus(status);
309 req.setSize(100); 320 req.setSize(100);
310 List<BuyerOrder> list = buyerOrderMapper.selectByCondition(req); 321 List<BuyerOrder> list = buyerOrderMapper.selectByCondition(req);
311 if(CollectionUtils.isEmpty(list)){ 322 if(CollectionUtils.isEmpty(list)){
@@ -501,7 +512,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -501,7 +512,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
501 return null; 512 return null;
502 } 513 }
503 514
504 - List<BuyerOrder> orderList = queryOrderByQueryStr(queryStr, null); 515 + //查询卖家已发货的订单
  516 + List<BuyerOrder> orderList = queryOrderByQueryStr(queryStr, null, Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal());
505 517
506 List<BuyerOrderResp> respList = buildBuyerOrderRespForQc(orderList); 518 List<BuyerOrderResp> respList = buildBuyerOrderRespForQc(orderList);
507 if(CollectionUtils.isEmpty(respList)) { 519 if(CollectionUtils.isEmpty(respList)) {
@@ -519,24 +531,30 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -519,24 +531,30 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
519 531
520 @Override 532 @Override
521 public PageResponseBO<BuyerOrderResp> queryOrderListByStatusForQc(BuyerOrderReq req) { 533 public PageResponseBO<BuyerOrderResp> queryOrderListByStatusForQc(BuyerOrderReq req) {
522 - if(StringUtils.isNotEmpty(req.getQueryStr())) {  
523 - return queryOrderListByStatusAndQueryStr(req.getStatus(), req.getQueryStr(), req.getDepotNo());  
524 - }  
525 -  
526 Byte status = req.getStatus(); 534 Byte status = req.getStatus();
527 List<Byte> checkStatusList = Lists.newArrayList(); 535 List<Byte> checkStatusList = Lists.newArrayList();
  536 + String platformExpressInfoFlag = "";
528 if(status.equals(QC_STATUS_RECEIVED)) { 537 if(status.equals(QC_STATUS_RECEIVED)) {
529 checkStatusList = receivedList; 538 checkStatusList = receivedList;
530 }else if(status.equals(QC_STATUS_PROCESSING)) { 539 }else if(status.equals(QC_STATUS_PROCESSING)) {
531 checkStatusList = processingList; 540 checkStatusList = processingList;
  541 + platformExpressInfoFlag = "haveNotExpress";
532 }else if(status.equals(QC_STATUS_ALREADY_DELIVER)) { 542 }else if(status.equals(QC_STATUS_ALREADY_DELIVER)) {
533 checkStatusList = alreadyDeliverList; 543 checkStatusList = alreadyDeliverList;
  544 + platformExpressInfoFlag = "haveExpress";
534 }else if(status.equals(QC_STATUS_PROBLEM)) { 545 }else if(status.equals(QC_STATUS_PROBLEM)) {
535 checkStatusList = problemList; 546 checkStatusList = problemList;
536 } 547 }
537 548
  549 + if(StringUtils.isNotEmpty(req.getQueryStr())) {
  550 + return queryOrderListByStatusAndQueryStr(req.getQueryStr(), req.getDepotNo(), checkStatusList, platformExpressInfoFlag);
  551 + }
  552 +
  553 +
  554 +
538 req.setStatus(null); 555 req.setStatus(null);
539 req.setStatusList(checkStatusList); 556 req.setStatusList(checkStatusList);
  557 + req.setPlatformExpressInfoFlag(platformExpressInfoFlag);
540 int total = buyerOrderMapper.selectTotalByCondition(req); 558 int total = buyerOrderMapper.selectTotalByCondition(req);
541 if(total == 0) { 559 if(total == 0) {
542 return null; 560 return null;
@@ -562,28 +580,30 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -562,28 +580,30 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
562 return result; 580 return result;
563 } 581 }
564 582
565 - private PageResponseBO<BuyerOrderResp> queryOrderListByStatusAndQueryStr(Byte status, String queryStr, Integer depotNo){  
566 - List<BuyerOrder> preOrderList = queryOrderByQueryStr(queryStr, depotNo);  
567 - if(CollectionUtils.isEmpty(preOrderList)) {  
568 - return null;  
569 - }else {  
570 - List<Byte> checkStatusList = Lists.newArrayList();  
571 - if(status.equals(QC_STATUS_RECEIVED)) {  
572 - checkStatusList = receivedList;  
573 - }else if(status.equals(QC_STATUS_PROCESSING)) {  
574 - checkStatusList = processingList;  
575 - }else if(status.equals(QC_STATUS_ALREADY_DELIVER)) {  
576 - checkStatusList = alreadyDeliverList;  
577 - }else if(status.equals(QC_STATUS_PROBLEM)) {  
578 - checkStatusList = problemList;  
579 - }  
580 -  
581 - List<BuyerOrder> orderList = Lists.newArrayList();  
582 - for(BuyerOrder order : preOrderList) {  
583 - if(checkStatusList.contains(order.getStatus())) {  
584 - orderList.add(order); 583 + private PageResponseBO<BuyerOrderResp> queryOrderListByStatusAndQueryStr(String queryStr, Integer depotNo,
  584 + List<Byte> checkStatusList, String platformExpressInfoFlag){
  585 + //先按订单号来查
  586 + BuyerOrderReq req = new BuyerOrderReq();
  587 + req.setOrderCode(queryStr);
  588 + req.setDepotNo(depotNo);
  589 + req.setStatusList(checkStatusList);
  590 + req.setPlatformExpressInfoFlag(platformExpressInfoFlag);
  591 + req.setSize(100);
  592 + List<BuyerOrder> orderList = buyerOrderMapper.selectByCondition(req);
  593 + if(CollectionUtils.isEmpty(orderList)){//再按卖家运单号来查
  594 + orderList = Lists.newArrayList();
  595 + req = new BuyerOrderReq();
  596 + req.setSellerWaybillCode(queryStr);
  597 + req.setDepotNo(depotNo);
  598 + req.setStatusList(checkStatusList);
  599 + req.setPlatformExpressInfoFlag(platformExpressInfoFlag);
  600 + req.setSize(100);
  601 + List<BuyerOrder> list = buyerOrderMapper.selectByCondition(req);
  602 + if(CollectionUtils.isNotEmpty(list)){
  603 + orderList.addAll(list);
585 } 604 }
586 } 605 }
  606 +
587 if(CollectionUtils.isEmpty(orderList)) { 607 if(CollectionUtils.isEmpty(orderList)) {
588 return null; 608 return null;
589 } 609 }
@@ -601,14 +621,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -601,14 +621,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
601 return result; 621 return result;
602 } 622 }
603 623
604 - } 624 +
  625 +
605 626
606 private List<BuyerOrderResp> buildBuyerOrderRespForQc(List<BuyerOrder> orderList){ 627 private List<BuyerOrderResp> buildBuyerOrderRespForQc(List<BuyerOrder> orderList){
607 //查询buyer_order_goods 628 //查询buyer_order_goods
608 List<String> buyerOrderCodeList = orderList.stream().map(BuyerOrder::getOrderCode).collect(Collectors.toList()); 629 List<String> buyerOrderCodeList = orderList.stream().map(BuyerOrder::getOrderCode).collect(Collectors.toList());
609 List<BuyerOrderGoods> buyerGoodsList = buyerOrderGoodsMapper.selectByOrderCode(buyerOrderCodeList); 630 List<BuyerOrderGoods> buyerGoodsList = buyerOrderGoodsMapper.selectByOrderCode(buyerOrderCodeList);
610 if(CollectionUtils.isEmpty(buyerGoodsList)) { 631 if(CollectionUtils.isEmpty(buyerGoodsList)) {
611 - return null; 632 + return Lists.newArrayList();
612 } 633 }
613 Map<String, BuyerOrderGoods> buyerGoodsMap = buyerGoodsList.stream().collect(Collectors.toMap(BuyerOrderGoods::getOrderCode, b->b)); 634 Map<String, BuyerOrderGoods> buyerGoodsMap = buyerGoodsList.stream().collect(Collectors.toMap(BuyerOrderGoods::getOrderCode, b->b));
614 635
@@ -617,24 +638,16 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -617,24 +638,16 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
617 List<SellerOrderGoods> sellerGoodsList = sellerOrderGoodsMapper.selectByIds(skupList); 638 List<SellerOrderGoods> sellerGoodsList = sellerOrderGoodsMapper.selectByIds(skupList);
618 Map<Integer, SellerOrderGoods> sellerGoodsMap = sellerGoodsList.stream().collect(Collectors.toMap(SellerOrderGoods::getId, s->s)); 639 Map<Integer, SellerOrderGoods> sellerGoodsMap = sellerGoodsList.stream().collect(Collectors.toMap(SellerOrderGoods::getId, s->s));
619 640
620 - //查询buyer_order_meta  
621 - List<BuyerOrderMeta> buyerOrderMetaList = buyerOrderMetaMapper.selectByBatchOrderCodeAndKey(buyerOrderCodeList, BUYER_ORDER_META_KEY_DELIVERY_ADDRESS);  
622 - Map<String, BuyerOrderMeta> buyerOrderMetaMap = buyerOrderMetaList.stream().collect(Collectors.toMap(BuyerOrderMeta::getOrderCode, b->b));  
623 -  
624 //查询卖家快递单号 641 //查询卖家快递单号
625 List<ExpressRecord> expressRecordList =expressRecordMapper.selectByOrderCodeListAndType(buyerOrderCodeList, Lists.newArrayList(EXPRESS_TYPE_SELLER_TO_JUDGE)); 642 List<ExpressRecord> expressRecordList =expressRecordMapper.selectByOrderCodeListAndType(buyerOrderCodeList, Lists.newArrayList(EXPRESS_TYPE_SELLER_TO_JUDGE));
626 Map<String, ExpressRecord> expressRecordMap = expressRecordList.stream().collect(Collectors.toMap(ExpressRecord::getOrderCode, e->e)); 643 Map<String, ExpressRecord> expressRecordMap = expressRecordList.stream().collect(Collectors.toMap(ExpressRecord::getOrderCode, e->e));
627 644
628 - //查询identify_records  
629 - List<IdentifyRecords> identifyRecordList = identifyRecordsMapper.selectByBatchOrderCode(buyerOrderCodeList);  
630 - Map<String, List<IdentifyRecords>> identifyMap = identifyRecordList.stream().collect(Collectors.groupingBy(IdentifyRecords::getOrderCode));  
631 -  
632 //查询product获取货号 645 //查询product获取货号
633 List<Integer> productIdList = sellerGoodsList.stream().map(SellerOrderGoods::getProductId).collect(Collectors.toList()); 646 List<Integer> productIdList = sellerGoodsList.stream().map(SellerOrderGoods::getProductId).collect(Collectors.toList());
634 List<Product> productList = productMapper.selectProductListByIds(productIdList); 647 List<Product> productList = productMapper.selectProductListByIds(productIdList);
635 Map<Integer, String> productIdCodeMap = productList.stream().collect(Collectors.toMap(Product::getId, Product::getProductCode)); 648 Map<Integer, String> productIdCodeMap = productList.stream().collect(Collectors.toMap(Product::getId, Product::getProductCode));
636 649
637 - return convertToRespForQc(orderList, buyerGoodsMap, sellerGoodsMap,expressRecordMap, buyerOrderMetaMap, identifyMap, productIdCodeMap); 650 + return convertToRespForQc(orderList, buyerGoodsMap, sellerGoodsMap,expressRecordMap, productIdCodeMap);
638 651
639 } 652 }
640 653
@@ -1441,6 +1454,109 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -1441,6 +1454,109 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
1441 return resp; 1454 return resp;
1442 } 1455 }
1443 1456
  1457 + @Override
  1458 + public QcOrderDetailResp getQcOrderDetail(String orderCode) {
  1459 + BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
  1460 + if(null == buyerOrder) {
  1461 + return null;
  1462 + }
  1463 + QcOrderDetailResp resp = new QcOrderDetailResp();
  1464 + resp.setOrderCode(buyerOrder.getOrderCode());
  1465 + resp.setStatus(buyerOrder.getStatus());
  1466 + resp.setStatusStr(Constant.convertOrderStatusStr(buyerOrder.getStatus()));
  1467 + resp.setCreateTimeStr(DateUtil.long2DateStr(buyerOrder.getCreateTime().longValue()*1000, "yyyy-MM-dd HH:mm:ss"));
  1468 +
  1469 + //卖家物流单号
  1470 + ExpressRecord sellerExpressRecord = expressRecordMapper.selectByOrderCodeAndType(buyerOrder.getOrderCode(),
  1471 + buyerOrder.getSellerUid(), EXPRESS_TYPE_SELLER_TO_JUDGE);
  1472 + if(null != sellerExpressRecord) {
  1473 + resp.setSellerWaybillCode(sellerExpressRecord.getWaybillCode());
  1474 + }
  1475 +
  1476 + //查询buyer_order_goods
  1477 + List<BuyerOrderGoods> goodsList = buyerOrderGoodsMapper.selectByOrderCode(Lists.newArrayList(buyerOrder.getOrderCode()));
  1478 + if(CollectionUtils.isEmpty(goodsList)) {
  1479 + return resp;
  1480 + }
  1481 +
  1482 + BuyerOrderGoods goods = goodsList.get(0);
  1483 + Integer skup = goods.getSkup();
  1484 + //查询seller_order_goods
  1485 + List<SellerOrderGoods> sellerGoodsList = sellerOrderGoodsMapper.selectByIds(Lists.newArrayList(skup));
  1486 + if(CollectionUtils.isEmpty(sellerGoodsList)) {
  1487 + return resp;
  1488 + }
  1489 +
  1490 + SellerOrderGoods sellerGoods = sellerGoodsList.get(0);
  1491 +
  1492 + //商品信息
  1493 + resp.setProductImage(ImagesHelper.getImageAbsoluteUrl(sellerGoods.getImageUrl(), ImagesConstant.BUCKET_GOODS_IMG));
  1494 + resp.setProductName(sellerGoods.getProductName());
  1495 + resp.setSizeName(sellerGoods.getSizeName());
  1496 + resp.setGoodsPrice(String.format("%.2f", sellerGoods.getGoodsPrice().doubleValue()));
  1497 +
  1498 + Product product = productMapper.selectByPrimaryKey(sellerGoods.getProductId());
  1499 + resp.setProductCode(null == product ? "" : product.getProductCode());
  1500 + resp.setVedioUrl(getVedioUrl(buyerOrder.getOrderCode()));
  1501 +
  1502 + rebuildQcOrderDetailResp(buyerOrder, skup, resp);
  1503 +
  1504 + return resp;
  1505 + }
  1506 +
  1507 + private void rebuildQcOrderDetailResp(BuyerOrder buyerOrder, Integer skup, QcOrderDetailResp resp) {
  1508 + if(buyerOrder.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_JUDGE_PASS.getByteVal()) {
  1509 + //收货信息
  1510 + BuyerOrderMeta buyerMeta = buyerOrderMetaMapper.selectByOrderCodeAndKey(buyerOrder.getOrderCode(), BUYER_ORDER_META_KEY_DELIVERY_ADDRESS);
  1511 + JSONObject metaValue = JSONObject.parseObject(buyerMeta.getMetaValue());
  1512 + resp.setReceiveName(metaValue.getString("consignee"));
  1513 + resp.setReceiveMobile(metaValue.getString("mobile"));
  1514 + resp.setReceiveAddressDetail(metaValue.getString("address"));
  1515 + String receiveAddressCode = metaValue.getString("areaCode");
  1516 + resp.setReceiveAddress(getAddressInfo(receiveAddressCode));
  1517 + }
  1518 +
  1519 + if(buyerOrder.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal()) {
  1520 + //卖家信息
  1521 + resp.setSellerName(getUserNameByUid(buyerOrder.getSellerUid()));
  1522 + SellerOrderMeta sellerMeta = sellerOrderMetaMapper.selectBySkupAndKey(skup, SELLER_ORDER_META_KEY_BACK_DELIVERY_ADDRESS);
  1523 + if(sellerMeta!=null){
  1524 + JSONObject sellerMetaValue = JSONObject.parseObject(sellerMeta.getMetaValue());
  1525 + resp.setSellerRebackAddressDetail(sellerMetaValue.getString("address"));
  1526 + resp.setSellerRebackAddress(getAddressInfo(sellerMetaValue.getString("areaCode")));
  1527 + resp.setSellerRebackMobile(sellerMetaValue.getString("mobile"));
  1528 + }
  1529 + }
  1530 +
  1531 + if(buyerOrder.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_TO_BE_RECEIVED.getByteVal()
  1532 + || buyerOrder.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal()) {
  1533 + //物流信息-平台
  1534 + List<ExpressRecord> platformExpressList =
  1535 + expressRecordMapper.selectByOrderCodeListAndType(Lists.newArrayList(buyerOrder.getOrderCode()), Lists.newArrayList(EXPRESS_TYPE_JUDGE_TO_BUYER, EXPRESS_TYPE_JUDGE_TO_SELLER,EXPRESS_TYPE_RETURN_BACK_TO_SELLER));
  1536 + if(CollectionUtils.isNotEmpty(platformExpressList)) {
  1537 + ExpressRecord judgeExpressRecord =platformExpressList.get(0);
  1538 + resp.setPlatformWaybillCode(judgeExpressRecord.getWaybillCode());
  1539 + }
  1540 + }
  1541 + }
  1542 +
  1543 + private String getVedioUrl(String orderCode) {
  1544 + List<QiniuLiveRecord> liveRecordList = qiniuLiveRecordMapper.selectByOrderCodes(Lists.newArrayList(Long.valueOf(orderCode)));
  1545 + if(CollectionUtils.isNotEmpty(liveRecordList)) {
  1546 + String filename = liveRecordList.get(0).getVedioFileUrl();
  1547 + if (StringUtils.isBlank(filename)) {
  1548 + return "";
  1549 + }
  1550 + if (filename.startsWith("http")) {
  1551 + return filename;
  1552 + }else {
  1553 + return QNliveConstants.LIVE_VIDEO_DOMAIN + QNliveConstants.MP4_FILEKEY_PRE + filename;
  1554 + }
  1555 + }
  1556 +
  1557 + return "";
  1558 + }
  1559 +
1444 public Map<String,Object> queryExpressListAndAddressInfo(String orderCode, String expressType){ 1560 public Map<String,Object> queryExpressListAndAddressInfo(String orderCode, String expressType){
1445 LOGGER.info("queryExpressListAndAddressInfo orderCode is {}, expressTypeStr is {}", orderCode, expressType); 1561 LOGGER.info("queryExpressListAndAddressInfo orderCode is {}, expressTypeStr is {}", orderCode, expressType);
1446 BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode); 1562 BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
@@ -1961,7 +2077,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -1961,7 +2077,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
1961 2077
1962 private List<BuyerOrderResp> convertToRespForQc(List<BuyerOrder> orderList, Map<String, BuyerOrderGoods> buyerGoodsMap, 2078 private List<BuyerOrderResp> convertToRespForQc(List<BuyerOrder> orderList, Map<String, BuyerOrderGoods> buyerGoodsMap,
1963 Map<Integer, SellerOrderGoods> sellerGoodsMap, Map<String, ExpressRecord> expressInfoMap, 2079 Map<Integer, SellerOrderGoods> sellerGoodsMap, Map<String, ExpressRecord> expressInfoMap,
1964 - Map<String, BuyerOrderMeta> buyerOrderMetaMap, Map<String, List<IdentifyRecords>> identifyMap,  
1965 Map<Integer, String> productIdCodeMap){ 2080 Map<Integer, String> productIdCodeMap){
1966 List<BuyerOrderResp> respList = Lists.newArrayList(); 2081 List<BuyerOrderResp> respList = Lists.newArrayList();
1967 for(BuyerOrder item : orderList) { 2082 for(BuyerOrder item : orderList) {
@@ -1974,19 +2089,10 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -1974,19 +2089,10 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
1974 resp.setSellerWaybillCode(null == expressInfoMap.get(item.getOrderCode()) ? "" : expressInfoMap.get(item.getOrderCode()).getWaybillCode()); 2089 resp.setSellerWaybillCode(null == expressInfoMap.get(item.getOrderCode()) ? "" : expressInfoMap.get(item.getOrderCode()).getWaybillCode());
1975 resp.setProductName(sellerGoodsMap.get(skup).getProductName()); 2090 resp.setProductName(sellerGoodsMap.get(skup).getProductName());
1976 resp.setProductImage(ImagesHelper.getImageAbsoluteUrl(sellerGoodsMap.get(skup).getImageUrl(), ImagesConstant.BUCKET_GOODS_IMG)); 2091 resp.setProductImage(ImagesHelper.getImageAbsoluteUrl(sellerGoodsMap.get(skup).getImageUrl(), ImagesConstant.BUCKET_GOODS_IMG));
1977 - resp.setColorName(sellerGoodsMap.get(skup).getColorName());  
1978 - resp.setSizeName(sellerGoodsMap.get(skup).getSizeName());  
1979 - resp.setGoodsPrice(String.format("%.2f", buyerGoodsMap.get(item.getOrderCode()).getGoodsPrice().doubleValue()));  
1980 - resp.setAmount(null == item.getAmount() ? null : String.format("%.2f", item.getAmount().doubleValue()));  
1981 - JSONObject metaValue = JSONObject.parseObject(buyerOrderMetaMap.get(item.getOrderCode()).getMetaValue());  
1982 - resp.setReceiveName(metaValue.getString("consignee"));  
1983 - resp.setReceiveMobile(metaValue.getString("mobile"));  
1984 - String receiveAddressCode = metaValue.getString("areaCode");  
1985 - resp.setReceiveAddress(getAddressInfo(receiveAddressCode));  
1986 - resp.setNfcStatus(CollectionUtils.isEmpty(identifyMap.get(item.getOrderCode())) ? 0 : 1);//0:未写入,1:已写入  
1987 Integer productId = sellerGoodsMap.get(skup).getProductId(); 2092 Integer productId = sellerGoodsMap.get(skup).getProductId();
1988 resp.setProductCode(productIdCodeMap.get(productId)); 2093 resp.setProductCode(productIdCodeMap.get(productId));
1989 - resp.setStatusStr(Constant.convertOrderStatusStr(item.getStatus())); 2094 + resp.setSizeName(sellerGoodsMap.get(skup).getSizeName());
  2095 + resp.setGoodsPrice(String.format("%.2f", buyerGoodsMap.get(item.getOrderCode()).getGoodsPrice().doubleValue()));
1990 2096
1991 respList.add(resp); 2097 respList.add(resp);
1992 } 2098 }