|
@@ -635,39 +635,58 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
@@ -635,39 +635,58 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
635
|
}
|
635
|
}
|
636
|
|
636
|
|
637
|
@Override
|
637
|
@Override
|
638
|
- public JSONObject queryOrderForQc(String queryStr) {
|
|
|
639
|
- JSONObject jsonObject = new JSONObject();
|
|
|
640
|
- PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
|
|
|
641
|
- jsonObject.put("orderNums", 0);
|
|
|
642
|
- jsonObject.put("receivedNums", 0);
|
|
|
643
|
- jsonObject.put("canceledNums", 0);
|
|
|
644
|
- jsonObject.put("orderList", result);
|
|
|
645
|
- jsonObject.put("isExistException", 0);
|
638
|
+ public PageResponseBO<BuyerOrderResp> queryOrderForQc(String queryStr) {
|
646
|
if(StringUtils.isEmpty(queryStr)) {
|
639
|
if(StringUtils.isEmpty(queryStr)) {
|
647
|
- return jsonObject;
|
640
|
+ return null;
|
648
|
}
|
641
|
}
|
649
|
|
642
|
|
650
|
//查询卖家已发货的订单
|
643
|
//查询卖家已发货的订单
|
651
|
List<BuyerOrder> orderList = queryOrderByQueryStr(queryStr, null, null);
|
644
|
List<BuyerOrder> orderList = queryOrderByQueryStr(queryStr, null, null);
|
652
|
if(CollectionUtils.isEmpty(orderList)) {
|
645
|
if(CollectionUtils.isEmpty(orderList)) {
|
653
|
- return jsonObject;
|
646
|
+ return null;
|
654
|
}
|
647
|
}
|
655
|
|
648
|
|
656
|
- jsonObject.replace("orderNums", orderList.size());
|
649
|
+ List<BuyerOrderResp> respList = buildBuyerOrderRespForQc(orderList);
|
|
|
650
|
+ if(CollectionUtils.isEmpty(respList)) {
|
|
|
651
|
+ return null;
|
|
|
652
|
+ }
|
|
|
653
|
+
|
|
|
654
|
+ //是否签收
|
|
|
655
|
+ buildIsSignForPackage(respList, queryStr);
|
|
|
656
|
+
|
|
|
657
|
+ PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
|
|
|
658
|
+ result.setPage(1);
|
|
|
659
|
+ result.setList(respList);
|
|
|
660
|
+ result.setSize(respList.size());
|
|
|
661
|
+ result.setTotal(respList.size());
|
657
|
|
662
|
|
658
|
- //包裹是否已签收
|
|
|
659
|
- if(isSignedPackage(queryStr)) {
|
|
|
660
|
- jsonObject.replace("receivedNums", orderList.size());
|
663
|
+ return result;
|
|
|
664
|
+ }
|
|
|
665
|
+
|
|
|
666
|
+ @Override
|
|
|
667
|
+ public JSONObject queryOrderBySellerWaybillCodeForQc(String sellerWaybillCode) {
|
|
|
668
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
669
|
+ PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
|
|
|
670
|
+ jsonObject.put("orderNum", 0);
|
|
|
671
|
+ jsonObject.put("receivedNum", 0);
|
|
|
672
|
+ jsonObject.put("canceledNum", 0);
|
|
|
673
|
+ jsonObject.put("orderList", result);
|
|
|
674
|
+ jsonObject.put("isExceptionPackage", 0);
|
|
|
675
|
+ jsonObject.put("exceptionBtn", 0);
|
|
|
676
|
+ jsonObject.put("receiveBtn", 0);
|
|
|
677
|
+ if(StringUtils.isEmpty(sellerWaybillCode)) {
|
661
|
return jsonObject;
|
678
|
return jsonObject;
|
662
|
}
|
679
|
}
|
663
|
|
680
|
|
664
|
- //是否存在买家在卖家发货后取消的订单
|
|
|
665
|
- int excepitonOrderTotal = getExcepitonOrderTotal(orderList);
|
|
|
666
|
- if(excepitonOrderTotal > 0) {
|
|
|
667
|
- jsonObject.replace("isExistException", 1);
|
|
|
668
|
- jsonObject.replace("canceledNums", excepitonOrderTotal);
|
681
|
+ //查询订单
|
|
|
682
|
+ List<BuyerOrder> orderList = queryOrderByQueryStr(sellerWaybillCode, null, null);
|
|
|
683
|
+ if(CollectionUtils.isEmpty(orderList)) {
|
|
|
684
|
+ return jsonObject;
|
669
|
}
|
685
|
}
|
670
|
|
686
|
|
|
|
687
|
+ //计算附加信息
|
|
|
688
|
+ buildExtraInfo(jsonObject, orderList, sellerWaybillCode);
|
|
|
689
|
+
|
671
|
List<BuyerOrderResp> respList = buildBuyerOrderRespForQc(orderList);
|
690
|
List<BuyerOrderResp> respList = buildBuyerOrderRespForQc(orderList);
|
672
|
if(CollectionUtils.isEmpty(respList)) {
|
691
|
if(CollectionUtils.isEmpty(respList)) {
|
673
|
return jsonObject;
|
692
|
return jsonObject;
|
|
@@ -681,23 +700,37 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
@@ -681,23 +700,37 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
681
|
return jsonObject;
|
700
|
return jsonObject;
|
682
|
}
|
701
|
}
|
683
|
|
702
|
|
684
|
- private int getExcepitonOrderTotal(List<BuyerOrder> orderList) {
|
|
|
685
|
- int total = 0;
|
703
|
+ private void buildExtraInfo(JSONObject jsonObject, List<BuyerOrder> orderList, String sellerWaybillCode){
|
|
|
704
|
+ jsonObject.replace("orderNum", orderList.size());
|
|
|
705
|
+
|
|
|
706
|
+ //是否是异常包裹
|
|
|
707
|
+ AbnormalPackage pkg = abnormalPackageMapper.selectBySellerWaybillCode(sellerWaybillCode);
|
|
|
708
|
+ if(null != pkg){
|
|
|
709
|
+ jsonObject.replace("isExceptionPackage", 1);//是异常包裹
|
|
|
710
|
+ }
|
|
|
711
|
+
|
|
|
712
|
+ //是否存在买家在卖家发货后取消的订单
|
|
|
713
|
+ int canceledNum = 0;
|
|
|
714
|
+ int receivedNum = 0;
|
686
|
for(BuyerOrder order : orderList) {
|
715
|
for(BuyerOrder order : orderList) {
|
687
|
- if(order.getStatus().equals(Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal())) {
|
|
|
688
|
- total += 1;
|
716
|
+ if(order.getStatus().equals(Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal())
|
|
|
717
|
+ || order.getStatus().equals(Constant.CS_CANCEL_BEFORE_DEPOT_RECEIVE.getByteVal())) {
|
|
|
718
|
+ canceledNum += 1;
|
|
|
719
|
+ }else if(!order.getStatus().equals(Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal())){
|
|
|
720
|
+ receivedNum +=1;
|
689
|
}
|
721
|
}
|
690
|
}
|
722
|
}
|
691
|
|
723
|
|
692
|
- return total;
|
724
|
+ if(canceledNum > 0) {
|
|
|
725
|
+ jsonObject.replace("exceptionBtn", jsonObject.getIntValue("isExceptionPackage") == 1 ? 0: 1);//0:按钮不展示 1:按钮展示
|
|
|
726
|
+ jsonObject.replace("canceledNum", canceledNum);
|
|
|
727
|
+ jsonObject.replace("receiveBtn", 0);
|
693
|
}
|
728
|
}
|
694
|
|
729
|
|
695
|
- private boolean isSignedPackage(String sellerWaybillCode){
|
|
|
696
|
- BuyerOrderReq buyerOrderReq = new BuyerOrderReq();
|
|
|
697
|
- buyerOrderReq.setSellerWaybillCode(sellerWaybillCode);
|
|
|
698
|
- List<SignForPackage> sfpList = signForPackageMapper.selectByCondition(buyerOrderReq);
|
|
|
699
|
-
|
|
|
700
|
- return CollectionUtils.isNotEmpty(sfpList);
|
730
|
+ jsonObject.replace("receivedNum", receivedNum);
|
|
|
731
|
+ if(orderList.size() - receivedNum - canceledNum > 0 && canceledNum == 0){
|
|
|
732
|
+ jsonObject.replace("receiveBtn", jsonObject.getIntValue("isExceptionPackage") == 1 ? 0: 1);//0:按钮不展示 1:按钮展示
|
|
|
733
|
+ }
|
701
|
}
|
734
|
}
|
702
|
|
735
|
|
703
|
private void buildIsSignForPackage(List<BuyerOrderResp> respList, String sellerWaybillCode) {
|
736
|
private void buildIsSignForPackage(List<BuyerOrderResp> respList, String sellerWaybillCode) {
|
|
@@ -2505,6 +2538,22 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
@@ -2505,6 +2538,22 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
2505
|
return abnormalPackageMapper.insert(pkg);
|
2538
|
return abnormalPackageMapper.insert(pkg);
|
2506
|
}
|
2539
|
}
|
2507
|
|
2540
|
|
|
|
2541
|
+ @Override
|
|
|
2542
|
+ public PageResponseBO<String> queryAbnormalPackage(BuyerOrderReq req){
|
|
|
2543
|
+ int total = abnormalPackageMapper.selectValidCnt();
|
|
|
2544
|
+ if(total == 0){
|
|
|
2545
|
+ return null;
|
|
|
2546
|
+ }
|
|
|
2547
|
+ List<String> list = abnormalPackageMapper.selectValidSellerWaybillCodeList(req);
|
|
|
2548
|
+ PageResponseBO<String> result=new PageResponseBO<>();
|
|
|
2549
|
+ result.setPage(req.getPage());
|
|
|
2550
|
+ result.setList(list);
|
|
|
2551
|
+ result.setSize(req.getSize());
|
|
|
2552
|
+ result.setTotal(total);
|
|
|
2553
|
+
|
|
|
2554
|
+ return result;
|
|
|
2555
|
+ }
|
|
|
2556
|
+
|
2508
|
private JSONObject updateBuyerReceiveInfo(BuyerOrderReq req, String oldMetaValue, Integer buyerUid) {
|
2557
|
private JSONObject updateBuyerReceiveInfo(BuyerOrderReq req, String oldMetaValue, Integer buyerUid) {
|
2509
|
JSONObject metaValue = JSONObject.parseObject(oldMetaValue);
|
2558
|
JSONObject metaValue = JSONObject.parseObject(oldMetaValue);
|
2510
|
metaValue.replace("consignee", req.getReceiveName());
|
2559
|
metaValue.replace("consignee", req.getReceiveName());
|