...
|
...
|
@@ -2346,12 +2346,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public PageResponseBO<String> queryPackage(Integer depotNo, String sellerWaybillCode, Integer date) {
|
|
|
public PageResponseBO<String> queryPackage(BuyerOrderReq req) {
|
|
|
|
|
|
BuyerOrderReq req = new BuyerOrderReq();
|
|
|
req.setDepotNo(depotNo);
|
|
|
req.setSellerWaybillCode(sellerWaybillCode);
|
|
|
req.setDate(null == date ? Integer.valueOf(DateUtil.getCurrentDateStr()) : date);
|
|
|
req.setDate(null == req.getDate() ? Integer.valueOf(DateUtil.getCurrentDateStr()) : req.getDate());
|
|
|
|
|
|
int total = signForPackageMapper.selectTotalByCondition(req);
|
|
|
if(total == 0) {
|
...
|
...
|
@@ -2369,6 +2366,48 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public PageResponseBO<SignForPackageRsp> queryPackageListByStatus(BuyerOrderReq req) {
|
|
|
PageResponseBO<SignForPackageRsp> result=new PageResponseBO<>();
|
|
|
if(req.getStatus().intValue() == 0) {//正常包裹
|
|
|
return queryNormalPackageList(req);
|
|
|
}else if(req.getStatus().intValue() == 1) {//异常包裹
|
|
|
return queryAbnormalPackageList(req);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
private PageResponseBO<SignForPackageRsp> queryNormalPackageList(BuyerOrderReq req){
|
|
|
PageResponseBO<SignForPackageRsp> result=new PageResponseBO<>();
|
|
|
req.setDate(null == req.getDate() ? Integer.valueOf(DateUtil.getCurrentDateStr()) : req.getDate());
|
|
|
int total = signForPackageMapper.selectTotalByCondition(req);
|
|
|
if(total == 0) {
|
|
|
return null;
|
|
|
}
|
|
|
List<SignForPackage> list = signForPackageMapper.selectByCondition(req);
|
|
|
if(CollectionUtils.isEmpty(list)) {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
List<String> waybillCodeList = list.stream().map(SignForPackage::getSellerWaybillCode).collect(Collectors.toList());
|
|
|
List<ExpressRecord> expressList = expressRecordMapper.selectByWaybillCodesAndDepotNo(waybillCodeList, req.getDepotNo());
|
|
|
Map<String, List<ExpressRecord>> expressMap = expressList.stream().collect(Collectors.groupingBy(ExpressRecord::getWaybillCode));
|
|
|
|
|
|
List<SignForPackageRsp> rspList = Lists.newArrayList();
|
|
|
for(SignForPackage item : list) {
|
|
|
SignForPackageRsp rsp = new SignForPackageRsp();
|
|
|
rsp.setSellerWaybillCode(item.getSellerWaybillCode());
|
|
|
rsp.setOrderNum(null == expressMap.get(item.getSellerWaybillCode()) ? 0 : expressMap.get(item.getSellerWaybillCode()).size());
|
|
|
rspList.add(rsp);
|
|
|
}
|
|
|
|
|
|
result.setList(rspList);
|
|
|
result.setPage(req.getPage());
|
|
|
result.setSize(req.getSize());
|
|
|
result.setTotal(total);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Integer> queryPackageCntByStatus(Integer depotNo, String sellerWaybillCode, Integer date) {
|
|
|
//正常签收包裹
|
|
|
BuyerOrderReq req = new BuyerOrderReq();
|
...
|
...
|
@@ -2380,7 +2419,14 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon |
|
|
result.put("normalNum", signForPackageMapper.selectTotalByCondition(req));
|
|
|
|
|
|
//异常包裹
|
|
|
String dateStr = null == date ? DateUtil.getCurrentDateStr() : String.valueOf(date);
|
|
|
buildQueryDate(req);
|
|
|
result.put("abnormalNum", abnormalPackageMapper.selectCntByCondition(req));
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
private void buildQueryDate(BuyerOrderReq req) {
|
|
|
String dateStr = null == req.getDate() ? DateUtil.getCurrentDateStr() : String.valueOf(req.getDate());
|
|
|
String year = dateStr.substring(0, 4);
|
|
|
String month = dateStr.substring(4, 6);
|
|
|
String day = dateStr.substring(6, 8);
|
...
|
...
|
@@ -2388,10 +2434,6 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon |
|
|
String endTimeStr = year + "-" + month + "-" + day + " 23:59:59";
|
|
|
req.setStartTime(DateUtil.getTimeSecondsFromStr(startTimeStr, "yyyy-MM-dd HH:mm:ss"));
|
|
|
req.setEndTime(DateUtil.getTimeSecondsFromStr(endTimeStr, "yyyy-MM-dd HH:mm:ss"));
|
|
|
|
|
|
result.put("abnormalNum", abnormalPackageMapper.selectCntByCondition(req));
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
private RedisKeyBuilder getRedisKey(String orderCode) {
|
...
|
...
|
@@ -2932,6 +2974,32 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
private PageResponseBO<SignForPackageRsp> queryAbnormalPackageList(BuyerOrderReq req){
|
|
|
buildQueryDate(req);
|
|
|
int total = abnormalPackageMapper.selectCntByCondition(req);
|
|
|
if(total == 0){
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
List<String> list = abnormalPackageMapper.selectValidSellerWaybillCodeList(req);
|
|
|
List<ExpressRecord> expressList = expressRecordMapper.selectByWaybillCodesAndDepotNo(list, req.getDepotNo());
|
|
|
Map<String, List<ExpressRecord>> expressMap = expressList.stream().collect(Collectors.groupingBy(ExpressRecord::getWaybillCode));
|
|
|
|
|
|
List<SignForPackageRsp> rspList = Lists.newArrayList();
|
|
|
for(String item : list) {
|
|
|
SignForPackageRsp rsp = new SignForPackageRsp();
|
|
|
rsp.setSellerWaybillCode(item);
|
|
|
rsp.setOrderNum(null == expressMap.get(item) ? 0 : expressMap.get(item).size());
|
|
|
rspList.add(rsp);
|
|
|
}
|
|
|
PageResponseBO<SignForPackageRsp> result=new PageResponseBO<>();
|
|
|
result.setList(rspList);
|
|
|
result.setPage(req.getPage());
|
|
|
result.setSize(req.getSize());
|
|
|
result.setTotal(total);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public boolean queryIsExistCsCancleOrder(String sellerWaybillCode) {
|
|
|
boolean flag = false;
|
...
|
...
|
|