...
|
...
|
@@ -635,39 +635,58 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public JSONObject queryOrderForQc(String queryStr) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
|
|
|
jsonObject.put("orderNums", 0);
|
|
|
jsonObject.put("receivedNums", 0);
|
|
|
jsonObject.put("canceledNums", 0);
|
|
|
jsonObject.put("orderList", result);
|
|
|
jsonObject.put("isExistException", 0);
|
|
|
public PageResponseBO<BuyerOrderResp> queryOrderForQc(String queryStr) {
|
|
|
if(StringUtils.isEmpty(queryStr)) {
|
|
|
return jsonObject;
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
//查询卖家已发货的订单
|
|
|
List<BuyerOrder> orderList = queryOrderByQueryStr(queryStr, null, null);
|
|
|
if(CollectionUtils.isEmpty(orderList)) {
|
|
|
return jsonObject;
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
jsonObject.replace("orderNums", orderList.size());
|
|
|
List<BuyerOrderResp> respList = buildBuyerOrderRespForQc(orderList);
|
|
|
if(CollectionUtils.isEmpty(respList)) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
//是否签收
|
|
|
buildIsSignForPackage(respList, queryStr);
|
|
|
|
|
|
PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
|
|
|
result.setPage(1);
|
|
|
result.setList(respList);
|
|
|
result.setSize(respList.size());
|
|
|
result.setTotal(respList.size());
|
|
|
|
|
|
//包裹是否已签收
|
|
|
if(isSignedPackage(queryStr)) {
|
|
|
jsonObject.replace("receivedNums", orderList.size());
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public JSONObject queryOrderBySellerWaybillCodeForQc(String sellerWaybillCode) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
|
|
|
jsonObject.put("orderNum", 0);
|
|
|
jsonObject.put("receivedNum", 0);
|
|
|
jsonObject.put("canceledNum", 0);
|
|
|
jsonObject.put("orderList", result);
|
|
|
jsonObject.put("isExceptionPackage", 0);
|
|
|
jsonObject.put("exceptionBtn", 0);
|
|
|
jsonObject.put("receiveBtn", 0);
|
|
|
if(StringUtils.isEmpty(sellerWaybillCode)) {
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
//是否存在买家在卖家发货后取消的订单
|
|
|
int excepitonOrderTotal = getExcepitonOrderTotal(orderList);
|
|
|
if(excepitonOrderTotal > 0) {
|
|
|
jsonObject.replace("isExistException", 1);
|
|
|
jsonObject.replace("canceledNums", excepitonOrderTotal);
|
|
|
//查询订单
|
|
|
List<BuyerOrder> orderList = queryOrderByQueryStr(sellerWaybillCode, null, null);
|
|
|
if(CollectionUtils.isEmpty(orderList)) {
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
//计算附加信息
|
|
|
buildExtraInfo(jsonObject, orderList, sellerWaybillCode);
|
|
|
|
|
|
List<BuyerOrderResp> respList = buildBuyerOrderRespForQc(orderList);
|
|
|
if(CollectionUtils.isEmpty(respList)) {
|
|
|
return jsonObject;
|
...
|
...
|
@@ -681,23 +700,37 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
private int getExcepitonOrderTotal(List<BuyerOrder> orderList) {
|
|
|
int total = 0;
|
|
|
private void buildExtraInfo(JSONObject jsonObject, List<BuyerOrder> orderList, String sellerWaybillCode){
|
|
|
jsonObject.replace("orderNum", orderList.size());
|
|
|
|
|
|
//是否是异常包裹
|
|
|
AbnormalPackage pkg = abnormalPackageMapper.selectBySellerWaybillCode(sellerWaybillCode);
|
|
|
if(null != pkg){
|
|
|
jsonObject.replace("isExceptionPackage", 1);//是异常包裹
|
|
|
}
|
|
|
|
|
|
//是否存在买家在卖家发货后取消的订单
|
|
|
int canceledNum = 0;
|
|
|
int receivedNum = 0;
|
|
|
for(BuyerOrder order : orderList) {
|
|
|
if(order.getStatus().equals(Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal())) {
|
|
|
total += 1;
|
|
|
if(order.getStatus().equals(Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal())
|
|
|
|| order.getStatus().equals(Constant.CS_CANCEL_BEFORE_DEPOT_RECEIVE.getByteVal())) {
|
|
|
canceledNum += 1;
|
|
|
}else if(!order.getStatus().equals(Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal())){
|
|
|
receivedNum +=1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return total;
|
|
|
if(canceledNum > 0) {
|
|
|
jsonObject.replace("exceptionBtn", jsonObject.getIntValue("isExceptionPackage") == 1 ? 0: 1);//0:按钮不展示 1:按钮展示
|
|
|
jsonObject.replace("canceledNum", canceledNum);
|
|
|
jsonObject.replace("receiveBtn", 0);
|
|
|
}
|
|
|
|
|
|
private boolean isSignedPackage(String sellerWaybillCode){
|
|
|
BuyerOrderReq buyerOrderReq = new BuyerOrderReq();
|
|
|
buyerOrderReq.setSellerWaybillCode(sellerWaybillCode);
|
|
|
List<SignForPackage> sfpList = signForPackageMapper.selectByCondition(buyerOrderReq);
|
|
|
|
|
|
return CollectionUtils.isNotEmpty(sfpList);
|
|
|
jsonObject.replace("receivedNum", receivedNum);
|
|
|
if(orderList.size() - receivedNum - canceledNum > 0 && canceledNum == 0){
|
|
|
jsonObject.replace("receiveBtn", jsonObject.getIntValue("isExceptionPackage") == 1 ? 0: 1);//0:按钮不展示 1:按钮展示
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void buildIsSignForPackage(List<BuyerOrderResp> respList, String sellerWaybillCode) {
|
...
|
...
|
@@ -2505,6 +2538,22 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
return abnormalPackageMapper.insert(pkg);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public PageResponseBO<String> queryAbnormalPackage(BuyerOrderReq req){
|
|
|
int total = abnormalPackageMapper.selectValidCnt();
|
|
|
if(total == 0){
|
|
|
return null;
|
|
|
}
|
|
|
List<String> list = abnormalPackageMapper.selectValidSellerWaybillCodeList(req);
|
|
|
PageResponseBO<String> result=new PageResponseBO<>();
|
|
|
result.setPage(req.getPage());
|
|
|
result.setList(list);
|
|
|
result.setSize(req.getSize());
|
|
|
result.setTotal(total);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
private JSONObject updateBuyerReceiveInfo(BuyerOrderReq req, String oldMetaValue, Integer buyerUid) {
|
|
|
JSONObject metaValue = JSONObject.parseObject(oldMetaValue);
|
|
|
metaValue.replace("consignee", req.getReceiveName());
|
...
|
...
|
|