|
@@ -177,9 +177,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
@@ -177,9 +177,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
177
|
}
|
177
|
}
|
178
|
|
178
|
|
179
|
public PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderReq req) {
|
179
|
public PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderReq req) {
|
180
|
- if(!checkAndBuildParam(req)) {
|
|
|
181
|
- return null;
|
|
|
182
|
- }
|
180
|
+ buildParam(req);
|
183
|
|
181
|
|
184
|
int total = buyerOrderMapper.selectTotalByCondition(req);
|
182
|
int total = buyerOrderMapper.selectTotalByCondition(req);
|
185
|
if(total == 0) {
|
183
|
if(total == 0) {
|
|
@@ -239,7 +237,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
@@ -239,7 +237,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
239
|
List<ExpressCompany> companyList = expressCompanyMapper.selectByIdList(expressCompanyIdList);
|
237
|
List<ExpressCompany> companyList = expressCompanyMapper.selectByIdList(expressCompanyIdList);
|
240
|
companyMap = companyList.stream().collect(Collectors.toMap(ExpressCompany::getId, ExpressCompany::getCompanyName));
|
238
|
companyMap = companyList.stream().collect(Collectors.toMap(ExpressCompany::getId, ExpressCompany::getCompanyName));
|
241
|
}
|
239
|
}
|
242
|
-
|
|
|
243
|
List<BuyerOrderResp> respList = convertToResp(orderList, buyerGoodsMap, sellerOrderMap, sellerGoodsMap,expressRecordMap, platformExpressRecordMap, companyMap,skupProductCodeMap);
|
240
|
List<BuyerOrderResp> respList = convertToResp(orderList, buyerGoodsMap, sellerOrderMap, sellerGoodsMap,expressRecordMap, platformExpressRecordMap, companyMap,skupProductCodeMap);
|
244
|
|
241
|
|
245
|
PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
|
242
|
PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
|
|
@@ -251,6 +248,59 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
@@ -251,6 +248,59 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
251
|
return result;
|
248
|
return result;
|
252
|
}
|
249
|
}
|
253
|
|
250
|
|
|
|
251
|
+ public PageResponseBO<BuyerOrderResp> queryByOrderCodeOrWaybillCode(String queryStr) {
|
|
|
252
|
+ if(StringUtils.isEmpty(queryStr)) {
|
|
|
253
|
+ return null;
|
|
|
254
|
+ }
|
|
|
255
|
+
|
|
|
256
|
+ List<BuyerOrder> orderList = Lists.newArrayList();
|
|
|
257
|
+ //先按订单号来查
|
|
|
258
|
+ BuyerOrder order = buyerOrderMapper.selectByOrderCode(queryStr);
|
|
|
259
|
+ if(null == order){//再按卖家运单号来查
|
|
|
260
|
+ BuyerOrderReq req = new BuyerOrderReq();
|
|
|
261
|
+ req.setSellerWaybillCode(queryStr);
|
|
|
262
|
+ List<BuyerOrder> list = buyerOrderMapper.selectByCondition(req);
|
|
|
263
|
+ if(CollectionUtils.isEmpty(list)){
|
|
|
264
|
+ return null;
|
|
|
265
|
+ }
|
|
|
266
|
+
|
|
|
267
|
+ orderList.addAll(list);
|
|
|
268
|
+ }else{
|
|
|
269
|
+ orderList.add(order);
|
|
|
270
|
+ }
|
|
|
271
|
+
|
|
|
272
|
+ //查询buyer_order_goods
|
|
|
273
|
+ List<String> buyerOrderCodeList = orderList.stream().map(BuyerOrder::getOrderCode).collect(Collectors.toList());
|
|
|
274
|
+ List<BuyerOrderGoods> buyerGoodsList = buyerOrderGoodsMapper.selectByOrderCode(buyerOrderCodeList);
|
|
|
275
|
+ if(CollectionUtils.isEmpty(buyerGoodsList)) {
|
|
|
276
|
+ return null;
|
|
|
277
|
+ }
|
|
|
278
|
+ Map<String, BuyerOrderGoods> buyerGoodsMap = buyerGoodsList.stream().collect(Collectors.toMap(BuyerOrderGoods::getOrderCode, b->b));
|
|
|
279
|
+
|
|
|
280
|
+ //查询seller_order_goods
|
|
|
281
|
+ List<Integer> skupList = buyerGoodsList.stream().map(BuyerOrderGoods::getSkup).collect(Collectors.toList());
|
|
|
282
|
+ List<SellerOrderGoods> sellerGoodsList = sellerOrderGoodsMapper.selectByIds(skupList);
|
|
|
283
|
+ Map<Integer, SellerOrderGoods> sellerGoodsMap = sellerGoodsList.stream().collect(Collectors.toMap(SellerOrderGoods::getId, s->s));
|
|
|
284
|
+
|
|
|
285
|
+ //查询buyer_order_meta
|
|
|
286
|
+ List<BuyerOrderMeta> buyerOrderMetaList = buyerOrderMetaMapper.selectByBatchOrderCodeAndKey(buyerOrderCodeList, BUYER_ORDER_META_KEY_DELIVERY_ADDRESS);
|
|
|
287
|
+ Map<String, BuyerOrderMeta> buyerOrderMetaMap = buyerOrderMetaList.stream().collect(Collectors.toMap(BuyerOrderMeta::getOrderCode, b->b));
|
|
|
288
|
+
|
|
|
289
|
+ //查询卖家快递单号
|
|
|
290
|
+ List<ExpressRecord> expressRecordList =expressRecordMapper.selectByOrderCodeListAndType(buyerOrderCodeList, Lists.newArrayList(EXPRESS_TYPE_SELLER_TO_JUDGE));
|
|
|
291
|
+ Map<String, ExpressRecord> expressRecordMap = expressRecordList.stream().collect(Collectors.toMap(ExpressRecord::getOrderCode, e->e));
|
|
|
292
|
+
|
|
|
293
|
+
|
|
|
294
|
+ List<BuyerOrderResp> respList = convertToRespForQuery(orderList, buyerGoodsMap, sellerGoodsMap,expressRecordMap, buyerOrderMetaMap);
|
|
|
295
|
+
|
|
|
296
|
+ PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
|
|
|
297
|
+ result.setList(respList);
|
|
|
298
|
+ result.setSize(respList.size());
|
|
|
299
|
+ result.setTotal(respList.size());
|
|
|
300
|
+
|
|
|
301
|
+ return result;
|
|
|
302
|
+ }
|
|
|
303
|
+
|
254
|
public JSONObject updateOrderStatus(BuyerOrderReq req) {
|
304
|
public JSONObject updateOrderStatus(BuyerOrderReq req) {
|
255
|
if(null == req.getId() || null == req.getStatus()) {
|
305
|
if(null == req.getId() || null == req.getStatus()) {
|
256
|
return null;
|
306
|
return null;
|
|
@@ -789,6 +839,36 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
@@ -789,6 +839,36 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
789
|
return respList;
|
839
|
return respList;
|
790
|
}
|
840
|
}
|
791
|
|
841
|
|
|
|
842
|
+ private List<BuyerOrderResp> convertToRespForQuery(List<BuyerOrder> orderList, Map<String, BuyerOrderGoods> buyerGoodsMap,
|
|
|
843
|
+ Map<Integer, SellerOrderGoods> sellerGoodsMap, Map<String, ExpressRecord> expressInfoMap,
|
|
|
844
|
+ Map<String, BuyerOrderMeta> buyerOrderMetaMap){
|
|
|
845
|
+ List<BuyerOrderResp> respList = Lists.newArrayList();
|
|
|
846
|
+ for(BuyerOrder item : orderList) {
|
|
|
847
|
+ if(null == buyerGoodsMap.get(item.getOrderCode())) {
|
|
|
848
|
+ continue;
|
|
|
849
|
+ }
|
|
|
850
|
+ Integer skup = buyerGoodsMap.get(item.getOrderCode()).getSkup();
|
|
|
851
|
+ BuyerOrderResp resp = new BuyerOrderResp();
|
|
|
852
|
+ resp.setOrderCode(item.getOrderCode());
|
|
|
853
|
+ resp.setSellerWaybillCode(null == expressInfoMap.get(item.getOrderCode()) ? "" : expressInfoMap.get(item.getOrderCode()).getWaybillCode());
|
|
|
854
|
+ resp.setProductName(sellerGoodsMap.get(skup).getProductName());
|
|
|
855
|
+ resp.setProductImage(ImagesHelper.getImageAbsoluteUrl(sellerGoodsMap.get(skup).getImageUrl(), ImagesConstant.BUCKET_GOODS_IMG));
|
|
|
856
|
+ resp.setColorName(sellerGoodsMap.get(skup).getColorName());
|
|
|
857
|
+ resp.setSizeName(sellerGoodsMap.get(skup).getSizeName());
|
|
|
858
|
+ resp.setGoodsPrice(String.format("%.2f", buyerGoodsMap.get(item.getOrderCode()).getGoodsPrice().doubleValue()));
|
|
|
859
|
+ resp.setAmount(null == item.getAmount() ? null : String.format("%.2f", item.getAmount().doubleValue()));
|
|
|
860
|
+ JSONObject metaValue = JSONObject.parseObject(buyerOrderMetaMap.get(item.getOrderCode()).getMetaValue());
|
|
|
861
|
+ resp.setReceiveName(metaValue.getString("consignee"));
|
|
|
862
|
+ resp.setReceiveMobile(metaValue.getString("mobile"));
|
|
|
863
|
+ String receiveAddressCode = metaValue.getString("areaCode");
|
|
|
864
|
+ resp.setReceiveAddress(getAddressInfo(receiveAddressCode));
|
|
|
865
|
+
|
|
|
866
|
+ respList.add(resp);
|
|
|
867
|
+ }
|
|
|
868
|
+
|
|
|
869
|
+ return respList;
|
|
|
870
|
+ }
|
|
|
871
|
+
|
792
|
private List<Byte> getStatusListByNavStatus(Integer navStatus) {
|
872
|
private List<Byte> getStatusListByNavStatus(Integer navStatus) {
|
793
|
switch(navStatus) {
|
873
|
switch(navStatus) {
|
794
|
case 1: return Lists.newArrayList(Constant.BUYER_ORDER_STATUS_BUYER_NOT_PAY.getByteVal());
|
874
|
case 1: return Lists.newArrayList(Constant.BUYER_ORDER_STATUS_BUYER_NOT_PAY.getByteVal());
|
|
@@ -809,7 +889,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
@@ -809,7 +889,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
809
|
}
|
889
|
}
|
810
|
}
|
890
|
}
|
811
|
|
891
|
|
812
|
- private boolean checkAndBuildParam(BuyerOrderReq req) {
|
892
|
+ private void buildParam(BuyerOrderReq req) {
|
813
|
if(StringUtils.isNotEmpty(req.getStatusStr())) {
|
893
|
if(StringUtils.isNotEmpty(req.getStatusStr())) {
|
814
|
req.setStatusList(convertStatus(req.getStatusStr()));
|
894
|
req.setStatusList(convertStatus(req.getStatusStr()));
|
815
|
}
|
895
|
}
|
|
@@ -818,18 +898,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
@@ -818,18 +898,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
818
|
req.setStatusList(getStatusListByNavStatus(req.getNavStatus()));
|
898
|
req.setStatusList(getStatusListByNavStatus(req.getNavStatus()));
|
819
|
}
|
899
|
}
|
820
|
|
900
|
|
821
|
-// if(StringUtils.isNotEmpty(req.getSellerWaybillCode())) {
|
|
|
822
|
-// List<ExpressRecord> expressRecordList = expressoRecordMapper.selectByWaybillCode(req.getSellerWaybillCode());
|
|
|
823
|
-// if(CollectionUtils.isEmpty(expressRecordList)) {
|
|
|
824
|
-// return false;
|
|
|
825
|
-// }else {
|
|
|
826
|
-// List<String> buyerOrderCodeList = expressRecordList.stream().map(ExpressRecord::getOrderCode).collect(Collectors.toList());
|
|
|
827
|
-// List<BuyerOrderGoods> buyerOrderGoodsList = buyerOrderGoodsMapper.selectByOrderCode(buyerOrderCodeList);
|
|
|
828
|
-// List<Integer> skupList = buyerOrderGoodsList.stream().map(BuyerOrderGoods::getSkup).collect(Collectors.toList());
|
|
|
829
|
-// req.setSkupList(skupList);
|
|
|
830
|
-// }
|
|
|
831
|
-// }
|
|
|
832
|
-
|
|
|
833
|
if(StringUtils.isNotEmpty(req.getMobile())) {
|
901
|
if(StringUtils.isNotEmpty(req.getMobile())) {
|
834
|
Integer uid = getUidByMobile(req.getMobile());
|
902
|
Integer uid = getUidByMobile(req.getMobile());
|
835
|
if(null != uid) {
|
903
|
if(null != uid) {
|
|
@@ -837,8 +905,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
@@ -837,8 +905,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
837
|
}
|
905
|
}
|
838
|
}
|
906
|
}
|
839
|
|
907
|
|
840
|
- return true;
|
|
|
841
|
-
|
|
|
842
|
}
|
908
|
}
|
843
|
|
909
|
|
844
|
private List<Byte> convertStatus(String statusStr){
|
910
|
private List<Byte> convertStatus(String statusStr){
|