|
@@ -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;
|
|
@@ -783,6 +833,36 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
@@ -783,6 +833,36 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
783
|
return respList;
|
833
|
return respList;
|
784
|
}
|
834
|
}
|
785
|
|
835
|
|
|
|
836
|
+ private List<BuyerOrderResp> convertToRespForQuery(List<BuyerOrder> orderList, Map<String, BuyerOrderGoods> buyerGoodsMap,
|
|
|
837
|
+ Map<Integer, SellerOrderGoods> sellerGoodsMap, Map<String, ExpressRecord> expressInfoMap,
|
|
|
838
|
+ Map<String, BuyerOrderMeta> buyerOrderMetaMap){
|
|
|
839
|
+ List<BuyerOrderResp> respList = Lists.newArrayList();
|
|
|
840
|
+ for(BuyerOrder item : orderList) {
|
|
|
841
|
+ if(null == buyerGoodsMap.get(item.getOrderCode())) {
|
|
|
842
|
+ continue;
|
|
|
843
|
+ }
|
|
|
844
|
+ Integer skup = buyerGoodsMap.get(item.getOrderCode()).getSkup();
|
|
|
845
|
+ BuyerOrderResp resp = new BuyerOrderResp();
|
|
|
846
|
+ resp.setOrderCode(item.getOrderCode());
|
|
|
847
|
+ resp.setSellerWaybillCode(null == expressInfoMap.get(item.getOrderCode()) ? "" : expressInfoMap.get(item.getOrderCode()).getWaybillCode());
|
|
|
848
|
+ resp.setProductName(sellerGoodsMap.get(skup).getProductName());
|
|
|
849
|
+ resp.setProductImage(ImagesHelper.getImageAbsoluteUrl(sellerGoodsMap.get(skup).getImageUrl(), ImagesConstant.BUCKET_GOODS_IMG));
|
|
|
850
|
+ resp.setColorName(sellerGoodsMap.get(skup).getColorName());
|
|
|
851
|
+ resp.setSizeName(sellerGoodsMap.get(skup).getSizeName());
|
|
|
852
|
+ resp.setGoodsPrice(String.format("%.2f", buyerGoodsMap.get(item.getOrderCode()).getGoodsPrice().doubleValue()));
|
|
|
853
|
+ resp.setAmount(null == item.getAmount() ? null : String.format("%.2f", item.getAmount().doubleValue()));
|
|
|
854
|
+ JSONObject metaValue = JSONObject.parseObject(buyerOrderMetaMap.get(item.getOrderCode()).getMetaValue());
|
|
|
855
|
+ resp.setReceiveName(metaValue.getString("consignee"));
|
|
|
856
|
+ resp.setReceiveMobile(metaValue.getString("mobile"));
|
|
|
857
|
+ String receiveAddressCode = metaValue.getString("areaCode");
|
|
|
858
|
+ resp.setReceiveAddress(getAddressInfo(receiveAddressCode));
|
|
|
859
|
+
|
|
|
860
|
+ respList.add(resp);
|
|
|
861
|
+ }
|
|
|
862
|
+
|
|
|
863
|
+ return respList;
|
|
|
864
|
+ }
|
|
|
865
|
+
|
786
|
private List<Byte> getStatusListByNavStatus(Integer navStatus) {
|
866
|
private List<Byte> getStatusListByNavStatus(Integer navStatus) {
|
787
|
switch(navStatus) {
|
867
|
switch(navStatus) {
|
788
|
case 1: return Lists.newArrayList(Constant.BUYER_ORDER_STATUS_BUYER_NOT_PAY.getByteVal());
|
868
|
case 1: return Lists.newArrayList(Constant.BUYER_ORDER_STATUS_BUYER_NOT_PAY.getByteVal());
|
|
@@ -803,7 +883,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
@@ -803,7 +883,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
803
|
}
|
883
|
}
|
804
|
}
|
884
|
}
|
805
|
|
885
|
|
806
|
- private boolean checkAndBuildParam(BuyerOrderReq req) {
|
886
|
+ private void buildParam(BuyerOrderReq req) {
|
807
|
if(StringUtils.isNotEmpty(req.getStatusStr())) {
|
887
|
if(StringUtils.isNotEmpty(req.getStatusStr())) {
|
808
|
req.setStatusList(convertStatus(req.getStatusStr()));
|
888
|
req.setStatusList(convertStatus(req.getStatusStr()));
|
809
|
}
|
889
|
}
|
|
@@ -812,18 +892,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
@@ -812,18 +892,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
812
|
req.setStatusList(getStatusListByNavStatus(req.getNavStatus()));
|
892
|
req.setStatusList(getStatusListByNavStatus(req.getNavStatus()));
|
813
|
}
|
893
|
}
|
814
|
|
894
|
|
815
|
-// if(StringUtils.isNotEmpty(req.getSellerWaybillCode())) {
|
|
|
816
|
-// List<ExpressRecord> expressRecordList = expressoRecordMapper.selectByWaybillCode(req.getSellerWaybillCode());
|
|
|
817
|
-// if(CollectionUtils.isEmpty(expressRecordList)) {
|
|
|
818
|
-// return false;
|
|
|
819
|
-// }else {
|
|
|
820
|
-// List<String> buyerOrderCodeList = expressRecordList.stream().map(ExpressRecord::getOrderCode).collect(Collectors.toList());
|
|
|
821
|
-// List<BuyerOrderGoods> buyerOrderGoodsList = buyerOrderGoodsMapper.selectByOrderCode(buyerOrderCodeList);
|
|
|
822
|
-// List<Integer> skupList = buyerOrderGoodsList.stream().map(BuyerOrderGoods::getSkup).collect(Collectors.toList());
|
|
|
823
|
-// req.setSkupList(skupList);
|
|
|
824
|
-// }
|
|
|
825
|
-// }
|
|
|
826
|
-
|
|
|
827
|
if(StringUtils.isNotEmpty(req.getMobile())) {
|
895
|
if(StringUtils.isNotEmpty(req.getMobile())) {
|
828
|
Integer uid = getUidByMobile(req.getMobile());
|
896
|
Integer uid = getUidByMobile(req.getMobile());
|
829
|
if(null != uid) {
|
897
|
if(null != uid) {
|
|
@@ -831,8 +899,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
@@ -831,8 +899,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
831
|
}
|
899
|
}
|
832
|
}
|
900
|
}
|
833
|
|
901
|
|
834
|
- return true;
|
|
|
835
|
-
|
|
|
836
|
}
|
902
|
}
|
837
|
|
903
|
|
838
|
private List<Byte> convertStatus(String statusStr){
|
904
|
private List<Byte> convertStatus(String statusStr){
|