...
|
...
|
@@ -123,7 +123,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
private static final Integer OPERATE_TYPE_UPDATE_RECEIVE_INFO = 2;//修改收货人信息
|
|
|
|
|
|
|
|
|
public Map<String, Integer> getCountByJudgeStatus(){
|
|
|
public Map<String, Integer> getCountByJudgeStatus(BuyerOrderReq req){
|
|
|
List<Byte> toBeJudgedList = Lists.newArrayList();
|
|
|
List<Byte> alreadyJudgedList = Lists.newArrayList();
|
|
|
toBeJudgedList.add(Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal());
|
...
|
...
|
@@ -131,8 +131,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
alreadyJudgedList.add(Constant.BUYER_ORDER_STATUS_TO_BE_RECEIVED.getByteVal());
|
|
|
alreadyJudgedList.add(Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal());
|
|
|
|
|
|
int toBeJudgedNum = buyerOrderMapper.selectCountByStatus(toBeJudgedList);
|
|
|
int alreadyJudgedNum = buyerOrderMapper.selectCountByStatus(alreadyJudgedList);
|
|
|
int toBeJudgedNum = buyerOrderMapper.selectCountByStatusAndDepotNo(toBeJudgedList, req.getDepotNo());
|
|
|
int alreadyJudgedNum = buyerOrderMapper.selectCountByStatusAndDepotNo(alreadyJudgedList, req.getDepotNo());
|
|
|
|
|
|
Map<String, Integer> resultMap = Maps.newHashMap();
|
|
|
resultMap.put("toBeJudgedNum", toBeJudgedNum);
|
...
|
...
|
@@ -194,14 +194,17 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
|
|
|
//查询seller_order
|
|
|
List<SellerOrder> sellerOrderList = sellerOrderMapper.selectBySkups(skupList);
|
|
|
List<String> sellerOrderCodeList = sellerOrderList.stream().map(SellerOrder::getOrderCode).collect(Collectors.toList());
|
|
|
Map<Integer, SellerOrder> sellerOrderMap = sellerOrderList.stream().collect(Collectors.toMap(SellerOrder::getSkup, s->s));
|
|
|
|
|
|
//查询卖家快递单号
|
|
|
List<ExpressRecord> expressRecordList =expressRecordMapper.selectByOrderCodeList(sellerOrderCodeList);
|
|
|
List<ExpressRecord> expressRecordList =expressRecordMapper.selectByOrderCodeListAndType(buyerOrderCodeList, Lists.newArrayList(EXPRESS_TYPE_SELLER_TO_JUDGE));
|
|
|
Map<String, ExpressRecord> expressRecordMap = expressRecordList.stream().collect(Collectors.toMap(ExpressRecord::getOrderCode, e->e));
|
|
|
|
|
|
List<BuyerOrderResp> respList = convertToResp(orderList, buyerGoodsMap, sellerOrderMap, sellerGoodsMap,expressRecordMap);
|
|
|
//查询平台快递单号
|
|
|
List<ExpressRecord> platformExpressList = expressRecordMapper.selectByOrderCodeListAndType(buyerOrderCodeList, Lists.newArrayList(EXPRESS_TYPE_JUDGE_TO_BUYER, EXPRESS_TYPE_JUDGE_TO_SELLER));
|
|
|
Map<String, ExpressRecord> platformExpressRecordMap = platformExpressList.stream().collect(Collectors.toMap(ExpressRecord::getOrderCode, e->e));
|
|
|
|
|
|
List<BuyerOrderResp> respList = convertToResp(orderList, buyerGoodsMap, sellerOrderMap, sellerGoodsMap,expressRecordMap, platformExpressRecordMap);
|
|
|
|
|
|
PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
|
|
|
result.setList(respList);
|
...
|
...
|
@@ -254,7 +257,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
BuyerOrderResp result = new BuyerOrderResp();
|
|
|
result.setReceiveName(metaValue.getString("addresseeName"));
|
|
|
result.setReceiveMobile(metaValue.getString("mobile"));
|
|
|
result.setReceiveAddress(rebuildReceiveAddress(metaValue.getJSONObject("area")));
|
|
|
result.setReceiveAddress(getAddressInfo(metaValue.getString("areaCode")));
|
|
|
|
|
|
return result;
|
|
|
}
|
...
|
...
|
@@ -306,18 +309,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
resp.setReceiveAreaCode(metaValue.getString("areaCode"));
|
|
|
resp.setReceiveAddressDetail(metaValue.getString("address"));
|
|
|
resp.setZipCode("null".equals(metaValue.getString("zipCode")) ? "--" : metaValue.getString("zipCode"));
|
|
|
|
|
|
String receiveAddressCode = metaValue.getString("areaCode");
|
|
|
//查询四级地址,比如code=110102001:北京市北京市西城区西长安街街道办事处,110000-北京市, 110100-北京市, 110102-西城区 110102001-西长安街街道办事处
|
|
|
Integer firstCode = Integer.valueOf(receiveAddressCode.substring(0, 2) + "0000");
|
|
|
Integer secondeCode = Integer.valueOf(receiveAddressCode.substring(0, 4) + "00");
|
|
|
Integer thirdCode = Integer.valueOf(receiveAddressCode.substring(0, 6));
|
|
|
Integer fourthCode = Integer.valueOf(receiveAddressCode);
|
|
|
List<Area> areaList = areaMapper.selectByCodeList(Lists.newArrayList(firstCode, secondeCode, thirdCode, fourthCode));
|
|
|
Map<Integer, String> areaMap = areaList.stream().collect(Collectors.toMap(Area::getCode, Area::getCaption));
|
|
|
String receiveAddress = areaMap.get(firstCode) + areaMap.get(secondeCode) + areaMap.get(thirdCode) + areaMap.get(fourthCode);
|
|
|
resp.setReceiveAddress(receiveAddress);
|
|
|
|
|
|
resp.setReceiveAddress(getAddressInfo(receiveAddressCode));
|
|
|
|
|
|
//查询buyer_order_goods
|
|
|
List<BuyerOrderGoods> goodsList = buyerOrderGoodsMapper.selectByOrderCode(Lists.newArrayList(buyerOrder.getOrderCode()));
|
...
|
...
|
@@ -355,13 +348,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
|
|
|
resp.setDepotNo(sellerGoods.getDepotNo());
|
|
|
|
|
|
// List<SellerOrder> sellerOrderList = sellerOrderMapper.selectBySkups(Lists.newArrayList(skup));
|
|
|
// if(CollectionUtils.isEmpty(sellerOrderList)) {
|
|
|
// return resp;
|
|
|
// }
|
|
|
//
|
|
|
// SellerOrder sellerOrder = sellerOrderList.get(0);
|
|
|
|
|
|
//商品信息
|
|
|
resp.setProductImage(sellerGoods.getImageUrl());
|
|
|
resp.setProductName(sellerGoods.getProductName());
|
...
|
...
|
@@ -519,6 +505,17 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
private String getAddressInfo(String areaCode) {
|
|
|
//查询四级地址,比如code=110102001:北京市北京市西城区西长安街街道办事处,110000-北京市, 110100-北京市, 110102-西城区 110102001-西长安街街道办事处
|
|
|
Integer firstCode = Integer.valueOf(areaCode.substring(0, 2) + "0000");
|
|
|
Integer secondeCode = Integer.valueOf(areaCode.substring(0, 4) + "00");
|
|
|
Integer thirdCode = Integer.valueOf(areaCode.substring(0, 6));
|
|
|
Integer fourthCode = Integer.valueOf(areaCode);
|
|
|
List<Area> areaList = areaMapper.selectByCodeList(Lists.newArrayList(firstCode, secondeCode, thirdCode, fourthCode));
|
|
|
Map<Integer, String> areaMap = areaList.stream().collect(Collectors.toMap(Area::getCode, Area::getCaption));
|
|
|
return areaMap.get(firstCode) + areaMap.get(secondeCode) + areaMap.get(thirdCode) + areaMap.get(fourthCode);
|
|
|
}
|
|
|
|
|
|
private String getMobileByUid(Integer uid) {
|
|
|
Map<String,Integer> request = Collections.singletonMap("uid", uid);
|
|
|
JSONObject jsonObject = serviceCaller.getcall("uic.getProfileAction", request, JSONObject.class);
|
...
|
...
|
@@ -593,23 +590,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
private String rebuildReceiveAddress(JSONObject address) {
|
|
|
String fourthName = address.getString("caption");
|
|
|
JSONObject thirdObj = address.getJSONObject("parent");
|
|
|
String thirdName = thirdObj.getString("caption");
|
|
|
JSONObject secondObj = thirdObj.getJSONObject("parent");
|
|
|
String secondName = secondObj.getString("caption");
|
|
|
JSONObject firstObj = secondObj.getJSONObject("parent");
|
|
|
String firstName = firstObj.getString("caption");
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
sb.append(firstName).append(secondName).append(thirdName).append(fourthName);
|
|
|
|
|
|
return sb.toString();
|
|
|
}
|
|
|
|
|
|
private List<BuyerOrderResp> convertToResp(List<BuyerOrder> orderList, Map<String, BuyerOrderGoods> buyerGoodsMap,
|
|
|
Map<Integer, SellerOrder> sellerOrderMap, Map<Integer, SellerOrderGoods> sellerGoodsMap, Map<String, ExpressRecord> expressInfoMap){
|
|
|
Map<Integer, SellerOrder> sellerOrderMap, Map<Integer, SellerOrderGoods> sellerGoodsMap, Map<String, ExpressRecord> expressInfoMap,
|
|
|
Map<String, ExpressRecord> platformExpressRecordMap){
|
|
|
List<BuyerOrderResp> respList = Lists.newArrayList();
|
|
|
for(BuyerOrder item : orderList) {
|
|
|
if(null == buyerGoodsMap.get(item.getOrderCode())) {
|
...
|
...
|
@@ -624,7 +607,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
resp.setProductNum(1);//目前固定为1
|
|
|
resp.setSkuStr(sellerGoodsMap.get(skup).getStorageId().toString());
|
|
|
resp.setDepotNo(sellerGoodsMap.get(skup).getDepotNo());
|
|
|
resp.setSellerWaybillCode(null == expressInfoMap.get(sellerOrder.getOrderCode()) ? "" : expressInfoMap.get(sellerOrder.getOrderCode()).getWaybillCode());
|
|
|
resp.setSellerWaybillCode(null == expressInfoMap.get(item.getOrderCode()) ? "" : expressInfoMap.get(item.getOrderCode()).getWaybillCode());
|
|
|
resp.setSellerOrderCode(sellerOrder.getOrderCode());
|
|
|
resp.setSkup(skup);
|
|
|
resp.setCreateTimeStr(null == item.getCreateTime() ? "" : DateUtil.long2DateStr(item.getCreateTime().longValue()*1000, "yyyy-MM-dd HH:mm:ss"));
|
...
|
...
|
@@ -634,6 +617,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
resp.setSizeName(sellerGoodsMap.get(skup).getSizeName());
|
|
|
resp.setGoodsPrice(String.format("%.2f", buyerGoodsMap.get(item.getOrderCode()).getGoodsPrice().doubleValue()));
|
|
|
resp.setAmount(null == item.getAmount() ? null : String.format("%.2f", item.getAmount().doubleValue()));
|
|
|
resp.setPlatformWaybillCode(null == platformExpressRecordMap.get(item.getOrderCode()) ? "" : platformExpressRecordMap.get(item.getOrderCode()).getWaybillCode());
|
|
|
|
|
|
respList.add(resp);
|
|
|
}
|
...
|
...
|
@@ -675,9 +659,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
if(null == expressRecord) {
|
|
|
return false;
|
|
|
}else {
|
|
|
String sellerOrderCode = expressRecord.getOrderCode();
|
|
|
SellerOrder sellerOrder = sellerOrderMapper.selectByOrderCode(sellerOrderCode);
|
|
|
req.setSkup(sellerOrder.getSkup());
|
|
|
String buyerOrderCode = expressRecord.getOrderCode();
|
|
|
List<BuyerOrderGoods> buyerOrderGoodsList = buyerOrderGoodsMapper.selectByOrderCode(Lists.newArrayList(buyerOrderCode));
|
|
|
req.setSkup(buyerOrderGoodsList.get(0).getSkup());
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|