|
|
package com.yoho.ufo.order.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Collections;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
import java.util.Optional;
|
|
|
import java.util.Set;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import com.yoho.order.dal.*;
|
|
|
import com.yoho.order.model.*;
|
|
|
import com.yoho.ufo.dal.ProductLimitSaleMapper;
|
|
|
import com.yoho.ufo.dal.model.ProductLimitSale;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.elasticsearch.common.collect.Lists;
|
...
|
...
|
@@ -28,6 +32,7 @@ import org.springframework.stereotype.Service; |
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.base.Splitter;
|
|
|
import com.yoho.core.dal.datasource.annotation.Database;
|
...
|
...
|
@@ -36,13 +41,56 @@ import com.yoho.core.redis.cluster.operations.nosync.YHValueOperations; |
|
|
import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
|
|
|
import com.yoho.core.rest.client.ServiceCaller;
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yoho.order.dal.AppraiseAddressMapper;
|
|
|
import com.yoho.order.dal.BuyerOrderGoodsMapper;
|
|
|
import com.yoho.order.dal.BuyerOrderMapper;
|
|
|
import com.yoho.order.dal.BuyerOrderMetaMapper;
|
|
|
import com.yoho.order.dal.ExpressCompanyMapper;
|
|
|
import com.yoho.order.dal.ExpressInfoMapper;
|
|
|
import com.yoho.order.dal.ExpressRecordMapper;
|
|
|
import com.yoho.order.dal.OrderConfigMapper;
|
|
|
import com.yoho.order.dal.OrderCouponMapper;
|
|
|
import com.yoho.order.dal.OrderOperateRecordMapper;
|
|
|
import com.yoho.order.dal.OrdersPayMapper;
|
|
|
import com.yoho.order.dal.PhoneUidDepotMapper;
|
|
|
import com.yoho.order.dal.QiniuLiveRecordMapper;
|
|
|
import com.yoho.order.dal.QualityCheckMapper;
|
|
|
import com.yoho.order.dal.SellerOrderGoodsMapper;
|
|
|
import com.yoho.order.dal.SellerOrderMapper;
|
|
|
import com.yoho.order.dal.SellerOrderMetaMapper;
|
|
|
import com.yoho.order.dal.SignForPackageMapper;
|
|
|
import com.yoho.order.dal.StoredSellerMapper;
|
|
|
import com.yoho.order.model.AppraiseAddress;
|
|
|
import com.yoho.order.model.BuyerOrder;
|
|
|
import com.yoho.order.model.BuyerOrderFeedback;
|
|
|
import com.yoho.order.model.BuyerOrderGoods;
|
|
|
import com.yoho.order.model.BuyerOrderMeta;
|
|
|
import com.yoho.order.model.BuyerOrderReq;
|
|
|
import com.yoho.order.model.ExpressCompany;
|
|
|
import com.yoho.order.model.ExpressInfo;
|
|
|
import com.yoho.order.model.ExpressRecord;
|
|
|
import com.yoho.order.model.OrderConfig;
|
|
|
import com.yoho.order.model.OrderCoupon;
|
|
|
import com.yoho.order.model.OrderOperateRecord;
|
|
|
import com.yoho.order.model.OrdersPay;
|
|
|
import com.yoho.order.model.PhoneUidDepot;
|
|
|
import com.yoho.order.model.QiniuLiveRecord;
|
|
|
import com.yoho.order.model.QualityCheck;
|
|
|
import com.yoho.order.model.QualityCheckResp;
|
|
|
import com.yoho.order.model.SellerOrder;
|
|
|
import com.yoho.order.model.SellerOrderGoods;
|
|
|
import com.yoho.order.model.SellerOrderMeta;
|
|
|
import com.yoho.order.model.SignForPackage;
|
|
|
import com.yoho.order.model.StoredSeller;
|
|
|
import com.yoho.service.model.order.request.OrderRequest;
|
|
|
import com.yoho.ufo.constants.PlatformConstant;
|
|
|
import com.yoho.ufo.constants.RedisKeyConstants;
|
|
|
import com.yoho.ufo.dal.IdentifyRecordsMapper;
|
|
|
import com.yoho.ufo.dal.ProductLimitSaleMapper;
|
|
|
import com.yoho.ufo.dal.ProductMapper;
|
|
|
import com.yoho.ufo.dal.model.IdentifyRecords;
|
|
|
import com.yoho.ufo.dal.model.Product;
|
|
|
import com.yoho.ufo.dal.model.ProductLimitSale;
|
|
|
import com.yoho.ufo.exception.CommonException;
|
|
|
import com.yoho.ufo.order.constant.Constant;
|
|
|
import com.yoho.ufo.order.constant.OrderConfigConstant;
|
...
|
...
|
@@ -640,7 +688,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotEmpty(req.getQueryStr())) {
|
|
|
return queryOrderListByStatusAndQueryStr(req.getQueryStr(), req.getDepotNo(), checkStatusList, platformExpressInfoFlag);
|
|
|
return queryOrderListByStatusAndQueryStr(req.getQueryStr(), req.getDepotNo(), checkStatusList, platformExpressInfoFlag, req.getSortRule());
|
|
|
}
|
|
|
|
|
|
req.setStatus(null);
|
...
|
...
|
@@ -672,7 +720,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
}
|
|
|
|
|
|
private PageResponseBO<BuyerOrderResp> queryOrderListByStatusAndQueryStr(String queryStr, Integer depotNo,
|
|
|
List<Byte> checkStatusList, String platformExpressInfoFlag){
|
|
|
List<Byte> checkStatusList, String platformExpressInfoFlag, String sortRule){
|
|
|
//先按订单号来查
|
|
|
BuyerOrderReq req = new BuyerOrderReq();
|
|
|
req.setOrderCode(queryStr);
|
...
|
...
|
@@ -680,6 +728,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
req.setStatusList(checkStatusList);
|
|
|
req.setPlatformExpressInfoFlag(platformExpressInfoFlag);
|
|
|
req.setSize(100);
|
|
|
req.setSortRule(sortRule);
|
|
|
List<BuyerOrder> orderList = buyerOrderMapper.selectByCondition(req);
|
|
|
if(CollectionUtils.isEmpty(orderList)){//再按卖家运单号来查
|
|
|
orderList = Lists.newArrayList();
|
...
|
...
|
@@ -689,6 +738,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
req.setStatusList(checkStatusList);
|
|
|
req.setPlatformExpressInfoFlag(platformExpressInfoFlag);
|
|
|
req.setSize(100);
|
|
|
req.setSortRule(sortRule);
|
|
|
List<BuyerOrder> list = buyerOrderMapper.selectByCondition(req);
|
|
|
if(CollectionUtils.isNotEmpty(list)){
|
|
|
orderList.addAll(list);
|
...
|
...
|
@@ -828,6 +878,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
if (Constant.BUYER_ORDER_STATUS_PLATFORM_RECEIVE.getByteVal() != buyerOrder.getStatus().byteValue()) {
|
|
|
throw new ServiceException(400, "错误:订单状态已变化");
|
|
|
}
|
|
|
|
|
|
ufoLiveService.checkHasLiveVedioTime(Long.valueOf(orderCode)); // 检查是否有录制视频
|
|
|
|
|
|
int operateType = OperateTypeEnum.ONLY_JUDGE_UNSURE.getCode();
|
|
|
UserHelper userHelper = new UserHelper();
|
|
|
saveOrderOperateRecord(buyerOrder.getOrderCode(), userHelper, operateType, "");
|
...
|
...
|
@@ -1049,6 +1102,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
throw new ServiceException(400,"错误:订单状态变化,操作[鉴定通过]失败,请重新刷新列表");
|
|
|
}
|
|
|
|
|
|
ufoLiveService.checkHasLiveVedioTime(Long.valueOf(orderCode)); // 检查是否有录制视频
|
|
|
|
|
|
//记录操作日志
|
|
|
int operateType =OperateTypeEnum.ONLY_JUDGE_PASS.getCode();
|
|
|
UserHelper userHelper = new UserHelper();
|
...
|
...
|
@@ -1078,6 +1133,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
throw new ServiceException(400,"错误:订单状态变化,操作[鉴定不通过]失败,请重新刷新列表");
|
|
|
}
|
|
|
|
|
|
ufoLiveService.checkHasLiveVedioTime(Long.valueOf(orderCode)); // 检查是否有录制视频
|
|
|
|
|
|
//记录操作日志
|
|
|
int operateType =OperateTypeEnum.ONLY_JUDGE_REJECT.getCode();
|
|
|
UserHelper userHelper = new UserHelper();
|
...
|
...
|
@@ -1905,11 +1962,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
jsonObj.put("businessCode", "UFO");
|
|
|
jsonObj.put("custid", getCustId(req.getPhoneUid(), sellerGoods.getDepotNo()));
|
|
|
|
|
|
JSONArray cargoArr = new JSONArray();
|
|
|
JSONObject cargoObj = new JSONObject();
|
|
|
cargoObj.put("name", "衣服鞋帽");
|
|
|
cargoObj.put("count", 1);
|
|
|
cargoObj.put("unit", "件");
|
|
|
jsonObj.put("cargo", cargoObj);
|
|
|
cargoArr.add(cargoObj);
|
|
|
jsonObj.put("cargo", cargoArr);
|
|
|
|
|
|
//收件人信息
|
|
|
if(buyerOrder.getStatus().equals(Constant.BUYER_ORDER_STATUS_JUDGE_PASS.getByteVal())
|
...
|
...
|
|