...
|
...
|
@@ -3,19 +3,17 @@ package com.yoho.ufo.order.service.impl; |
|
|
import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Collections;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Optional;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import com.yoho.order.dal.*;
|
|
|
import com.yoho.order.model.*;
|
|
|
import com.yoho.ufo.util.CollectionUtil;
|
|
|
import com.yohobuy.ufo.model.order.req.AppraiseOrderWaybillUpdateReq;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.elasticsearch.common.collect.Lists;
|
...
|
...
|
@@ -31,29 +29,6 @@ import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yoho.core.rest.client.ServiceCaller;
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yoho.order.dal.AbnormalOrderMapper;
|
|
|
import com.yoho.order.dal.AppraiseOrderGoodsMapper;
|
|
|
import com.yoho.order.dal.AppraiseOrderMapper;
|
|
|
import com.yoho.order.dal.AppraiseOrderMetaMapper;
|
|
|
import com.yoho.order.dal.AppraiseOrderStorageMapper;
|
|
|
import com.yoho.order.dal.ExpressRecordMapper;
|
|
|
import com.yoho.order.dal.OrderOperateRecordMapper;
|
|
|
import com.yoho.order.dal.OrdersPayRefundMapper;
|
|
|
import com.yoho.order.dal.StorageDepositMapper;
|
|
|
import com.yoho.order.dal.StoredSellerMapper;
|
|
|
import com.yoho.order.model.AbnormalOrder;
|
|
|
import com.yoho.order.model.AppraiseOrder;
|
|
|
import com.yoho.order.model.AppraiseOrderGoods;
|
|
|
import com.yoho.order.model.AppraiseOrderMeta;
|
|
|
import com.yoho.order.model.AppraiseOrderReq;
|
|
|
import com.yoho.order.model.AppraiseOrderResp;
|
|
|
import com.yoho.order.model.AppraiseOrderStorage;
|
|
|
import com.yoho.order.model.ExpressCompany;
|
|
|
import com.yoho.order.model.ExpressRecord;
|
|
|
import com.yoho.order.model.OrderOperateRecord;
|
|
|
import com.yoho.order.model.OrdersPayRefund;
|
|
|
import com.yoho.order.model.StorageDeposit;
|
|
|
import com.yoho.order.model.StoredSeller;
|
|
|
import com.yoho.service.model.order.request.OrderRequest;
|
|
|
import com.yoho.ufo.exception.PlatformException;
|
|
|
import com.yoho.ufo.order.constant.Constant;
|
...
|
...
|
@@ -123,7 +98,10 @@ public class AppraiseOrderServiceImpl implements IAppraiseOrderService { |
|
|
|
|
|
@Autowired
|
|
|
private AbnormalOrderMapper abnormalOrderMapper;
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private ExpressInfoMapper expressInfoMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private UserProxyService userProxyService;
|
|
|
|
...
|
...
|
@@ -253,10 +231,26 @@ public class AppraiseOrderServiceImpl implements IAppraiseOrderService { |
|
|
req.setStatusList(checkStatusList);
|
|
|
req.setBuyStartTime(parseTime(req.getBuyStartTimeStr()));
|
|
|
req.setBuyEndTime(parseTime(req.getBuyEndTimeStr()));
|
|
|
PageResponseBO<AppraiseOrderResp> resp = new PageResponseBO<>();
|
|
|
|
|
|
if(StringUtils.isNotBlank(req.getWaybillCode())) {
|
|
|
List<ExpressInfo> expressInfo = expressInfoMapper.selectExpressInfoListByWaybillCode(req.getWaybillCode());
|
|
|
if(expressInfo.isEmpty()) {
|
|
|
resp.setList(Lists.newArrayList());
|
|
|
return resp;
|
|
|
}
|
|
|
req.setOrderCode(expressInfo.get(0).getOrderCode().toString());
|
|
|
}
|
|
|
|
|
|
int count = appraiseOrderMapper.selectParentListCount(req);
|
|
|
AppraiseOrder bySub = null;
|
|
|
if (count == 0 && StringUtils.isNotBlank(req.getOrderCode())) {
|
|
|
bySub = appraiseOrderMapper.selectParentBySubOrderCode(req.getOrderCode());
|
|
|
if (bySub != null) {
|
|
|
count = 1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
PageResponseBO<AppraiseOrderResp> resp = new PageResponseBO<>();
|
|
|
resp.setTotal(count);
|
|
|
if (count == 0) {
|
|
|
resp.setList(Lists.newArrayList());
|
...
|
...
|
@@ -264,7 +258,7 @@ public class AppraiseOrderServiceImpl implements IAppraiseOrderService { |
|
|
}
|
|
|
|
|
|
req.setStart((req.getPage() - 1) * req.getSize());
|
|
|
List<AppraiseOrder> orderList = appraiseOrderMapper.selectParentList(req);
|
|
|
List<AppraiseOrder> orderList = (bySub == null) ? appraiseOrderMapper.selectParentList(req) : Arrays.asList(bySub);
|
|
|
List<AppraiseOrderResp> respList = exchangeBo(orderList);
|
|
|
|
|
|
resp.setPage(req.getPage());
|
...
|
...
|
@@ -368,6 +362,14 @@ public class AppraiseOrderServiceImpl implements IAppraiseOrderService { |
|
|
Map<Long, AppraiseOrderMeta> feeMap = feeList.stream().collect(Collectors.toMap(AppraiseOrderMeta::getOrderCode, Function.identity()));
|
|
|
Map<String, OrdersPayRefund> refundMap = refundList.stream().collect(Collectors.toMap(OrdersPayRefund::getRefundCode, Function.identity()));
|
|
|
List<AppraiseOrderResp> result = Lists.newArrayList();
|
|
|
List<Long> orderCodeList = orderList.stream().filter(order -> order.getStatus() == AppraiseOrderStatus.JUDGE_PASS_WAIT_WAREHOUSE.getCode()).map(order -> new Long(order.getOrderCode())).collect(Collectors.toList());
|
|
|
Map<String, String> orderCodeMap = new HashMap<>();
|
|
|
if(!orderCodeList.isEmpty()) {
|
|
|
List<StorageDeposit> deposited = storageDepositMapper.selectDepositedByOrderCode(orderCodeList);
|
|
|
if(!deposited.isEmpty()) {
|
|
|
orderCodeMap = CollectionUtil.extractMap(deposited, o -> o.getOrderCode().toString(), StorageDeposit::getDepositCode);
|
|
|
}
|
|
|
}
|
|
|
for(AppraiseOrder order : orderList) {
|
|
|
AppraiseOrderResp r = new AppraiseOrderResp();
|
|
|
BeanUtils.copyProperties(order, r);
|
...
|
...
|
@@ -398,7 +400,12 @@ public class AppraiseOrderServiceImpl implements IAppraiseOrderService { |
|
|
r.setUsedAmount(order.getAmount().toString());
|
|
|
}
|
|
|
r.setCreateTimeStr(formatTime(order.getCreateTime()));
|
|
|
r.setStatusStr(getStatusStr(order.getStatus()));
|
|
|
String depositCode = orderCodeMap.get(order.getOrderCode());
|
|
|
if (depositCode != null) {
|
|
|
r.setStatusStr("平台鉴定通过(已寄存)<br/>[ " + depositCode+" ]");
|
|
|
} else {
|
|
|
r.setStatusStr(getStatusStr(order.getStatus()));
|
|
|
}
|
|
|
result.add(r);
|
|
|
}
|
|
|
return result;
|
...
|
...
|
@@ -907,8 +914,14 @@ public class AppraiseOrderServiceImpl implements IAppraiseOrderService { |
|
|
LOGGER.info("sendBackGoodsToSeller saveOrderOperateRecord operateType={} ,order code ={} ,userHelper = {} ,result json {}",operateType,appraiseOrder.getOrderCode() ,userHelper,jsonObject);
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
private JSONObject asyncCallAppraise(String args, String orderCode, AppraiseOrderReq req) {
|
|
|
|
|
|
@Override
|
|
|
public JSONObject updateSellerWaybillCode(AppraiseOrderWaybillUpdateReq req) {
|
|
|
String args = "ufo-gateway.updateWaybillCode";
|
|
|
return serviceCaller.call(args, req, JSONObject.class);
|
|
|
}
|
|
|
|
|
|
private JSONObject asyncCallAppraise(String args, String orderCode, AppraiseOrderReq req) {
|
|
|
AppraiseExpressInfoBo bo = new AppraiseExpressInfoBo();
|
|
|
bo.setOrderCode(Long.valueOf(orderCode));
|
|
|
bo.setExpressCompanyId(req.getExpressCompanyId());
|
...
|
...
|
|