...
|
...
|
@@ -13,23 +13,34 @@ import org.slf4j.LoggerFactory; |
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
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.StorageDepositMapper;
|
|
|
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.ExpressRecord;
|
|
|
import com.yoho.order.model.StorageDeposit;
|
|
|
import com.yoho.ufo.order.constant.Constant;
|
|
|
import com.yoho.ufo.order.constant.OrderAbnormalTypeEnum;
|
|
|
import com.yoho.ufo.order.constant.OrderConfigConstant;
|
|
|
import com.yoho.ufo.order.service.IAppraiseOrderService;
|
|
|
import com.yoho.ufo.service.impl.UserProxyService;
|
|
|
import com.yoho.ufo.service.model.PageResponseBO;
|
|
|
import com.yoho.ufo.util.DateUtil;
|
|
|
import com.yoho.ufo.util.ImagesConstant;
|
|
|
import com.yoho.ufo.util.ImagesHelper;
|
|
|
import com.yohobuy.ufo.model.order.common.EnumExpressType;
|
|
|
import com.yohobuy.ufo.model.order.constants.DepositOutTypeEnum;
|
|
|
import com.yohobuy.ufo.model.order.constants.RegionEnum;
|
|
|
|
|
|
@Service
|
...
|
...
|
@@ -46,8 +57,20 @@ public class AppraiseOrderServiceImpl implements IAppraiseOrderService{ |
|
|
private AppraiseOrderStorageMapper appraiseOrderStorageMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private AppraiseOrderMetaMapper appraiseOrderMetaMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private ExpressRecordMapper expressRecordMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private StorageDepositMapper storageDepositMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private AbnormalOrderMapper abnormalOrderMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private UserProxyService userProxyService;
|
|
|
|
|
|
//已收货
|
|
|
private static final Byte QC_STATUS_RECEIVED = 0;
|
|
|
|
...
|
...
|
@@ -57,26 +80,25 @@ public class AppraiseOrderServiceImpl implements IAppraiseOrderService{ |
|
|
//已发货
|
|
|
private static final Byte QC_STATUS_ALREADY_DELIVER = 2;
|
|
|
|
|
|
private static final Integer PAY_METHOD_MONTHLY = 1;//寄付月结
|
|
|
|
|
|
private static final Integer PAY_METHOD_FREIGHT_COLLECT = 2;//到付
|
|
|
|
|
|
private static final String SELLER_ORDER_META_KEY_BACK_DELIVERY_ADDRESS = "back_delivery_address";
|
|
|
|
|
|
//待处理
|
|
|
private static final List<Byte> receivedList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal(),//卖家已发货
|
|
|
Constant.BUYER_ORDER_STATUS_PLATFORM_RECEIVE.getByteVal(),//平台质检中
|
|
|
Constant.BUYER_ORDER_STATUS_JUDGE_PASS_WAIT_WAREHOUSE.getByteVal()); //鉴定通过待寄存
|
|
|
Constant.BUYER_ORDER_STATUS_JUDGING.getByteVal());//平台鉴定中
|
|
|
|
|
|
//待发货
|
|
|
private static final List<Byte> processingList = Lists.newArrayList(Constant.CANCEL_QUALITY_CHECK_FAKE.getByteVal(),//已取消(商品质检不通过)
|
|
|
Constant.BUYER_ORDER_STATUS_JUDGE_PASS.getByteVal(),//平台鉴定通过
|
|
|
private static final List<Byte> processingList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_JUDGE_PASS.getByteVal(),//平台鉴定通过
|
|
|
Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal(),//已取消(商品鉴定不通过)
|
|
|
Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal(),//无法鉴定
|
|
|
Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal());//已取消(买家在卖家发货后取消)
|
|
|
Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal());//无法鉴定
|
|
|
|
|
|
//已发货
|
|
|
private static final List<Byte> alreadyDeliverList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_TO_BE_RECEIVED.getByteVal(),//平台已发货
|
|
|
private static final List<Byte> alreadyDeliverList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_JUDGE_PASS.getByteVal(),//平台鉴定通过
|
|
|
Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal(),//已取消(鉴定不通过)
|
|
|
Constant.CANCEL_QUALITY_CHECK_FAKE.getByteVal(),//已取消(质检不通过)
|
|
|
Constant.CANCEL_MINI_FAULT_REJECT.getByteVal(),//已取消(瑕疵确认不通过)
|
|
|
Constant.CANCEL_MINI_FAULT_OUT_TIME_REJECT.getByteVal(),//已取消(瑕疵确认超时)
|
|
|
Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal(),//无法鉴定
|
|
|
Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal());//已取消(买家在卖家发货后取消)
|
|
|
Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal());//无法鉴定
|
|
|
|
|
|
|
|
|
public Map<String, Integer> getCountByStatus(AppraiseOrderReq req){
|
...
|
...
|
@@ -144,6 +166,115 @@ public class AppraiseOrderServiceImpl implements IAppraiseOrderService{ |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public AppraiseOrderResp getOrderDetail(String orderCode) {
|
|
|
AppraiseOrder order = appraiseOrderMapper.selectByOrderCode(orderCode);
|
|
|
if(null == order) {
|
|
|
return null;
|
|
|
}
|
|
|
AppraiseOrderResp resp = new AppraiseOrderResp();
|
|
|
resp.setOrderCode(order.getOrderCode());
|
|
|
resp.setStatus(order.getStatus());
|
|
|
resp.setStatusStr(Constant.convertOrderStatusStr(order.getStatus()));
|
|
|
resp.setCreateTimeStr(DateUtil.int2DateStr(order.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
resp.setAttributes(order.getAttributes());
|
|
|
|
|
|
//卖家物流单号
|
|
|
ExpressRecord sellerExpressRecord = expressRecordMapper.selectByOrderCodeAndType(order.getOrderCode(),
|
|
|
order.getUid(), EnumExpressType.EXPRESS_TYPE_1.getCode());
|
|
|
if(null != sellerExpressRecord) {
|
|
|
resp.setSellerWaybillCode(sellerExpressRecord.getWaybillCode());
|
|
|
}
|
|
|
|
|
|
//查询平台快递单号
|
|
|
List<ExpressRecord> platformExpressList = expressRecordMapper.selectByOrderCodeListAndType(Lists.newArrayList(order.getOrderCode()),
|
|
|
Lists.newArrayList(EnumExpressType.EXPRESS_TYPE_3.getCode(),EnumExpressType.EXPRESS_TYPE_REBACK.getCode()));
|
|
|
if(CollectionUtils.isNotEmpty(platformExpressList)){
|
|
|
resp.setPlatformWaybillCode(platformExpressList.get(0).getWaybillCode());
|
|
|
}
|
|
|
//查询appraise_order_goods
|
|
|
AppraiseOrderGoods goods = appraiseOrderGoodsMapper.selectByOrderCode(Long.valueOf(order.getOrderCode()));
|
|
|
if(null == goods) {
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
//查询appraise_order_storage
|
|
|
List<AppraiseOrderStorage> storageList = appraiseOrderStorageMapper.selectByOrderCodes(Lists.newArrayList(order.getOrderCode()));
|
|
|
if(CollectionUtils.isEmpty(storageList)) {
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
AppraiseOrderStorage storage = storageList.get(0);
|
|
|
|
|
|
//商品信息
|
|
|
resp.setProductImage(ImagesHelper.getImageAbsoluteUrl(goods.getImageUrl(), ImagesConstant.BUCKET_GOODS_IMG));
|
|
|
resp.setProductName(goods.getProductName());
|
|
|
resp.setSizeName(storage.getSizeName());
|
|
|
resp.setProductCode(goods.getProductCode());
|
|
|
|
|
|
rebuildOrderDetailResp(order, resp);
|
|
|
|
|
|
queryStorageDeposit(resp, order.getOrderCode()); //查询寄存信息
|
|
|
|
|
|
queryAbnormalOrder(resp, order.getOrderCode());//查询异常订单信息
|
|
|
|
|
|
resp.setAttributesStr(OrderConfigConstant.getOrderAttributeStr(order.getAttributes(), RegionEnum.MAINLAND.getCode()));
|
|
|
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
private void queryAbnormalOrder(AppraiseOrderResp resp, String orderCode) { // 查询异常订单信息
|
|
|
AbnormalOrder order = abnormalOrderMapper.selectByOrderCode(orderCode);
|
|
|
if(null == order) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
resp.setAbnormalTypeStr(OrderAbnormalTypeEnum.convertAbnormalTypeStr(order.getType().byteValue()));
|
|
|
}
|
|
|
|
|
|
private void queryStorageDeposit(AppraiseOrderResp resp, String orderCode) { // 查询寄存信息
|
|
|
StorageDeposit deposit = storageDepositMapper.selectByOrderCode(orderCode);
|
|
|
if(null == deposit) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
resp.setDepositCode(deposit.getDepositCode());
|
|
|
resp.setShelfCode(deposit.getShelfCode());
|
|
|
resp.setDepositStatus(deposit.getStatus());
|
|
|
String extraInfo = "";
|
|
|
resp.setPayMethod(PAY_METHOD_MONTHLY);
|
|
|
if(null != deposit.getOutType()) {
|
|
|
if(deposit.getOutType().equals(DepositOutTypeEnum.OUTTYPE_DEPOSIT_RECALL.getCode())) {
|
|
|
extraInfo = "(召回出库)";
|
|
|
}else if(deposit.getOutType().equals(DepositOutTypeEnum.OUTTYPE_DEPOSIT_FLASH_PURCHASE.getCode())) {
|
|
|
extraInfo = "(闪购出库)";
|
|
|
}else if(deposit.getOutType().equals(DepositOutTypeEnum.OUTTYPE_EXPIRED.getCode())) {
|
|
|
extraInfo = "(逾期出库)";
|
|
|
resp.setPayMethod(PAY_METHOD_FREIGHT_COLLECT);
|
|
|
}
|
|
|
}
|
|
|
resp.setStatusStr(resp.getStatusStr() + extraInfo);
|
|
|
}
|
|
|
|
|
|
private void rebuildOrderDetailResp(AppraiseOrder order, AppraiseOrderResp resp) {
|
|
|
//卖家信息
|
|
|
resp.setSellerName(userProxyService.getUserNameByUid(order.getUid()));
|
|
|
AppraiseOrderMeta meta = appraiseOrderMetaMapper.selectByOrderCodeAndMetaKey(order.getOrderCode(), SELLER_ORDER_META_KEY_BACK_DELIVERY_ADDRESS);
|
|
|
if(meta != null){
|
|
|
JSONObject metaValue = JSONObject.parseObject(meta.getMetaValue());
|
|
|
resp.setSellerRebackAddressDetail(metaValue.getString("address"));
|
|
|
resp.setSellerRebackAddress(metaValue.getString("area"));
|
|
|
resp.setSellerRebackMobile(metaValue.getString("mobile"));
|
|
|
}
|
|
|
|
|
|
//快递结算方式
|
|
|
if(order.getStatus().equals(Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE)) {//寄付月结
|
|
|
resp.setPayMethod(PAY_METHOD_MONTHLY);
|
|
|
}else {
|
|
|
resp.setPayMethod(PAY_METHOD_FREIGHT_COLLECT);//到付
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private PageResponseBO<AppraiseOrderResp> queryOrderListByStatusAndQueryStr(String queryStr, Integer depotNo,
|
|
|
List<Byte> checkStatusList, String platformExpressInfoFlag, String sortRule){
|
|
|
//先按订单号来查
|
...
|
...
|
|