|
@@ -13,23 +13,34 @@ import org.slf4j.LoggerFactory; |
|
@@ -13,23 +13,34 @@ import org.slf4j.LoggerFactory; |
13
|
import org.springframework.beans.factory.annotation.Autowired;
|
13
|
import org.springframework.beans.factory.annotation.Autowired;
|
14
|
import org.springframework.stereotype.Service;
|
14
|
import org.springframework.stereotype.Service;
|
15
|
|
15
|
|
|
|
16
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
17
|
+import com.yoho.order.dal.AbnormalOrderMapper;
|
16
|
import com.yoho.order.dal.AppraiseOrderGoodsMapper;
|
18
|
import com.yoho.order.dal.AppraiseOrderGoodsMapper;
|
17
|
import com.yoho.order.dal.AppraiseOrderMapper;
|
19
|
import com.yoho.order.dal.AppraiseOrderMapper;
|
|
|
20
|
+import com.yoho.order.dal.AppraiseOrderMetaMapper;
|
18
|
import com.yoho.order.dal.AppraiseOrderStorageMapper;
|
21
|
import com.yoho.order.dal.AppraiseOrderStorageMapper;
|
19
|
import com.yoho.order.dal.ExpressRecordMapper;
|
22
|
import com.yoho.order.dal.ExpressRecordMapper;
|
|
|
23
|
+import com.yoho.order.dal.StorageDepositMapper;
|
|
|
24
|
+import com.yoho.order.model.AbnormalOrder;
|
20
|
import com.yoho.order.model.AppraiseOrder;
|
25
|
import com.yoho.order.model.AppraiseOrder;
|
21
|
import com.yoho.order.model.AppraiseOrderGoods;
|
26
|
import com.yoho.order.model.AppraiseOrderGoods;
|
|
|
27
|
+import com.yoho.order.model.AppraiseOrderMeta;
|
22
|
import com.yoho.order.model.AppraiseOrderReq;
|
28
|
import com.yoho.order.model.AppraiseOrderReq;
|
23
|
import com.yoho.order.model.AppraiseOrderResp;
|
29
|
import com.yoho.order.model.AppraiseOrderResp;
|
24
|
import com.yoho.order.model.AppraiseOrderStorage;
|
30
|
import com.yoho.order.model.AppraiseOrderStorage;
|
25
|
import com.yoho.order.model.ExpressRecord;
|
31
|
import com.yoho.order.model.ExpressRecord;
|
|
|
32
|
+import com.yoho.order.model.StorageDeposit;
|
26
|
import com.yoho.ufo.order.constant.Constant;
|
33
|
import com.yoho.ufo.order.constant.Constant;
|
|
|
34
|
+import com.yoho.ufo.order.constant.OrderAbnormalTypeEnum;
|
27
|
import com.yoho.ufo.order.constant.OrderConfigConstant;
|
35
|
import com.yoho.ufo.order.constant.OrderConfigConstant;
|
28
|
import com.yoho.ufo.order.service.IAppraiseOrderService;
|
36
|
import com.yoho.ufo.order.service.IAppraiseOrderService;
|
|
|
37
|
+import com.yoho.ufo.service.impl.UserProxyService;
|
29
|
import com.yoho.ufo.service.model.PageResponseBO;
|
38
|
import com.yoho.ufo.service.model.PageResponseBO;
|
|
|
39
|
+import com.yoho.ufo.util.DateUtil;
|
30
|
import com.yoho.ufo.util.ImagesConstant;
|
40
|
import com.yoho.ufo.util.ImagesConstant;
|
31
|
import com.yoho.ufo.util.ImagesHelper;
|
41
|
import com.yoho.ufo.util.ImagesHelper;
|
32
|
import com.yohobuy.ufo.model.order.common.EnumExpressType;
|
42
|
import com.yohobuy.ufo.model.order.common.EnumExpressType;
|
|
|
43
|
+import com.yohobuy.ufo.model.order.constants.DepositOutTypeEnum;
|
33
|
import com.yohobuy.ufo.model.order.constants.RegionEnum;
|
44
|
import com.yohobuy.ufo.model.order.constants.RegionEnum;
|
34
|
|
45
|
|
35
|
@Service
|
46
|
@Service
|
|
@@ -46,8 +57,20 @@ public class AppraiseOrderServiceImpl implements IAppraiseOrderService{ |
|
@@ -46,8 +57,20 @@ public class AppraiseOrderServiceImpl implements IAppraiseOrderService{ |
46
|
private AppraiseOrderStorageMapper appraiseOrderStorageMapper;
|
57
|
private AppraiseOrderStorageMapper appraiseOrderStorageMapper;
|
47
|
|
58
|
|
48
|
@Autowired
|
59
|
@Autowired
|
|
|
60
|
+ private AppraiseOrderMetaMapper appraiseOrderMetaMapper;
|
|
|
61
|
+
|
|
|
62
|
+ @Autowired
|
49
|
private ExpressRecordMapper expressRecordMapper;
|
63
|
private ExpressRecordMapper expressRecordMapper;
|
50
|
|
64
|
|
|
|
65
|
+ @Autowired
|
|
|
66
|
+ private StorageDepositMapper storageDepositMapper;
|
|
|
67
|
+
|
|
|
68
|
+ @Autowired
|
|
|
69
|
+ private AbnormalOrderMapper abnormalOrderMapper;
|
|
|
70
|
+
|
|
|
71
|
+ @Autowired
|
|
|
72
|
+ private UserProxyService userProxyService;
|
|
|
73
|
+
|
51
|
//已收货
|
74
|
//已收货
|
52
|
private static final Byte QC_STATUS_RECEIVED = 0;
|
75
|
private static final Byte QC_STATUS_RECEIVED = 0;
|
53
|
|
76
|
|
|
@@ -57,26 +80,25 @@ public class AppraiseOrderServiceImpl implements IAppraiseOrderService{ |
|
@@ -57,26 +80,25 @@ public class AppraiseOrderServiceImpl implements IAppraiseOrderService{ |
57
|
//已发货
|
80
|
//已发货
|
58
|
private static final Byte QC_STATUS_ALREADY_DELIVER = 2;
|
81
|
private static final Byte QC_STATUS_ALREADY_DELIVER = 2;
|
59
|
|
82
|
|
|
|
83
|
+ private static final Integer PAY_METHOD_MONTHLY = 1;//寄付月结
|
|
|
84
|
+
|
|
|
85
|
+ private static final Integer PAY_METHOD_FREIGHT_COLLECT = 2;//到付
|
|
|
86
|
+
|
|
|
87
|
+ private static final String SELLER_ORDER_META_KEY_BACK_DELIVERY_ADDRESS = "back_delivery_address";
|
|
|
88
|
+
|
60
|
//待处理
|
89
|
//待处理
|
61
|
private static final List<Byte> receivedList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal(),//卖家已发货
|
90
|
private static final List<Byte> receivedList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal(),//卖家已发货
|
62
|
- Constant.BUYER_ORDER_STATUS_PLATFORM_RECEIVE.getByteVal(),//平台质检中
|
|
|
63
|
- Constant.BUYER_ORDER_STATUS_JUDGE_PASS_WAIT_WAREHOUSE.getByteVal()); //鉴定通过待寄存
|
91
|
+ Constant.BUYER_ORDER_STATUS_JUDGING.getByteVal());//平台鉴定中
|
64
|
|
92
|
|
65
|
//待发货
|
93
|
//待发货
|
66
|
- private static final List<Byte> processingList = Lists.newArrayList(Constant.CANCEL_QUALITY_CHECK_FAKE.getByteVal(),//已取消(商品质检不通过)
|
|
|
67
|
- Constant.BUYER_ORDER_STATUS_JUDGE_PASS.getByteVal(),//平台鉴定通过
|
94
|
+ private static final List<Byte> processingList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_JUDGE_PASS.getByteVal(),//平台鉴定通过
|
68
|
Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal(),//已取消(商品鉴定不通过)
|
95
|
Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal(),//已取消(商品鉴定不通过)
|
69
|
- Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal(),//无法鉴定
|
|
|
70
|
- Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal());//已取消(买家在卖家发货后取消)
|
96
|
+ Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal());//无法鉴定
|
71
|
|
97
|
|
72
|
//已发货
|
98
|
//已发货
|
73
|
- private static final List<Byte> alreadyDeliverList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_TO_BE_RECEIVED.getByteVal(),//平台已发货
|
99
|
+ private static final List<Byte> alreadyDeliverList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_JUDGE_PASS.getByteVal(),//平台鉴定通过
|
74
|
Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal(),//已取消(鉴定不通过)
|
100
|
Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal(),//已取消(鉴定不通过)
|
75
|
- Constant.CANCEL_QUALITY_CHECK_FAKE.getByteVal(),//已取消(质检不通过)
|
|
|
76
|
- Constant.CANCEL_MINI_FAULT_REJECT.getByteVal(),//已取消(瑕疵确认不通过)
|
|
|
77
|
- Constant.CANCEL_MINI_FAULT_OUT_TIME_REJECT.getByteVal(),//已取消(瑕疵确认超时)
|
|
|
78
|
- Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal(),//无法鉴定
|
|
|
79
|
- Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal());//已取消(买家在卖家发货后取消)
|
101
|
+ Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal());//无法鉴定
|
80
|
|
102
|
|
81
|
|
103
|
|
82
|
public Map<String, Integer> getCountByStatus(AppraiseOrderReq req){
|
104
|
public Map<String, Integer> getCountByStatus(AppraiseOrderReq req){
|
|
@@ -144,6 +166,115 @@ public class AppraiseOrderServiceImpl implements IAppraiseOrderService{ |
|
@@ -144,6 +166,115 @@ public class AppraiseOrderServiceImpl implements IAppraiseOrderService{ |
144
|
return result;
|
166
|
return result;
|
145
|
}
|
167
|
}
|
146
|
|
168
|
|
|
|
169
|
+ @Override
|
|
|
170
|
+ public AppraiseOrderResp getOrderDetail(String orderCode) {
|
|
|
171
|
+ AppraiseOrder order = appraiseOrderMapper.selectByOrderCode(orderCode);
|
|
|
172
|
+ if(null == order) {
|
|
|
173
|
+ return null;
|
|
|
174
|
+ }
|
|
|
175
|
+ AppraiseOrderResp resp = new AppraiseOrderResp();
|
|
|
176
|
+ resp.setOrderCode(order.getOrderCode());
|
|
|
177
|
+ resp.setStatus(order.getStatus());
|
|
|
178
|
+ resp.setStatusStr(Constant.convertOrderStatusStr(order.getStatus()));
|
|
|
179
|
+ resp.setCreateTimeStr(DateUtil.int2DateStr(order.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
180
|
+ resp.setAttributes(order.getAttributes());
|
|
|
181
|
+
|
|
|
182
|
+ //卖家物流单号
|
|
|
183
|
+ ExpressRecord sellerExpressRecord = expressRecordMapper.selectByOrderCodeAndType(order.getOrderCode(),
|
|
|
184
|
+ order.getUid(), EnumExpressType.EXPRESS_TYPE_1.getCode());
|
|
|
185
|
+ if(null != sellerExpressRecord) {
|
|
|
186
|
+ resp.setSellerWaybillCode(sellerExpressRecord.getWaybillCode());
|
|
|
187
|
+ }
|
|
|
188
|
+
|
|
|
189
|
+ //查询平台快递单号
|
|
|
190
|
+ List<ExpressRecord> platformExpressList = expressRecordMapper.selectByOrderCodeListAndType(Lists.newArrayList(order.getOrderCode()),
|
|
|
191
|
+ Lists.newArrayList(EnumExpressType.EXPRESS_TYPE_3.getCode(),EnumExpressType.EXPRESS_TYPE_REBACK.getCode()));
|
|
|
192
|
+ if(CollectionUtils.isNotEmpty(platformExpressList)){
|
|
|
193
|
+ resp.setPlatformWaybillCode(platformExpressList.get(0).getWaybillCode());
|
|
|
194
|
+ }
|
|
|
195
|
+ //查询appraise_order_goods
|
|
|
196
|
+ AppraiseOrderGoods goods = appraiseOrderGoodsMapper.selectByOrderCode(Long.valueOf(order.getOrderCode()));
|
|
|
197
|
+ if(null == goods) {
|
|
|
198
|
+ return resp;
|
|
|
199
|
+ }
|
|
|
200
|
+
|
|
|
201
|
+ //查询appraise_order_storage
|
|
|
202
|
+ List<AppraiseOrderStorage> storageList = appraiseOrderStorageMapper.selectByOrderCodes(Lists.newArrayList(order.getOrderCode()));
|
|
|
203
|
+ if(CollectionUtils.isEmpty(storageList)) {
|
|
|
204
|
+ return resp;
|
|
|
205
|
+ }
|
|
|
206
|
+
|
|
|
207
|
+ AppraiseOrderStorage storage = storageList.get(0);
|
|
|
208
|
+
|
|
|
209
|
+ //商品信息
|
|
|
210
|
+ resp.setProductImage(ImagesHelper.getImageAbsoluteUrl(goods.getImageUrl(), ImagesConstant.BUCKET_GOODS_IMG));
|
|
|
211
|
+ resp.setProductName(goods.getProductName());
|
|
|
212
|
+ resp.setSizeName(storage.getSizeName());
|
|
|
213
|
+ resp.setProductCode(goods.getProductCode());
|
|
|
214
|
+
|
|
|
215
|
+ rebuildOrderDetailResp(order, resp);
|
|
|
216
|
+
|
|
|
217
|
+ queryStorageDeposit(resp, order.getOrderCode()); //查询寄存信息
|
|
|
218
|
+
|
|
|
219
|
+ queryAbnormalOrder(resp, order.getOrderCode());//查询异常订单信息
|
|
|
220
|
+
|
|
|
221
|
+ resp.setAttributesStr(OrderConfigConstant.getOrderAttributeStr(order.getAttributes(), RegionEnum.MAINLAND.getCode()));
|
|
|
222
|
+
|
|
|
223
|
+ return resp;
|
|
|
224
|
+ }
|
|
|
225
|
+
|
|
|
226
|
+ private void queryAbnormalOrder(AppraiseOrderResp resp, String orderCode) { // 查询异常订单信息
|
|
|
227
|
+ AbnormalOrder order = abnormalOrderMapper.selectByOrderCode(orderCode);
|
|
|
228
|
+ if(null == order) {
|
|
|
229
|
+ return;
|
|
|
230
|
+ }
|
|
|
231
|
+
|
|
|
232
|
+ resp.setAbnormalTypeStr(OrderAbnormalTypeEnum.convertAbnormalTypeStr(order.getType().byteValue()));
|
|
|
233
|
+ }
|
|
|
234
|
+
|
|
|
235
|
+ private void queryStorageDeposit(AppraiseOrderResp resp, String orderCode) { // 查询寄存信息
|
|
|
236
|
+ StorageDeposit deposit = storageDepositMapper.selectByOrderCode(orderCode);
|
|
|
237
|
+ if(null == deposit) {
|
|
|
238
|
+ return;
|
|
|
239
|
+ }
|
|
|
240
|
+
|
|
|
241
|
+ resp.setDepositCode(deposit.getDepositCode());
|
|
|
242
|
+ resp.setShelfCode(deposit.getShelfCode());
|
|
|
243
|
+ resp.setDepositStatus(deposit.getStatus());
|
|
|
244
|
+ String extraInfo = "";
|
|
|
245
|
+ resp.setPayMethod(PAY_METHOD_MONTHLY);
|
|
|
246
|
+ if(null != deposit.getOutType()) {
|
|
|
247
|
+ if(deposit.getOutType().equals(DepositOutTypeEnum.OUTTYPE_DEPOSIT_RECALL.getCode())) {
|
|
|
248
|
+ extraInfo = "(召回出库)";
|
|
|
249
|
+ }else if(deposit.getOutType().equals(DepositOutTypeEnum.OUTTYPE_DEPOSIT_FLASH_PURCHASE.getCode())) {
|
|
|
250
|
+ extraInfo = "(闪购出库)";
|
|
|
251
|
+ }else if(deposit.getOutType().equals(DepositOutTypeEnum.OUTTYPE_EXPIRED.getCode())) {
|
|
|
252
|
+ extraInfo = "(逾期出库)";
|
|
|
253
|
+ resp.setPayMethod(PAY_METHOD_FREIGHT_COLLECT);
|
|
|
254
|
+ }
|
|
|
255
|
+ }
|
|
|
256
|
+ resp.setStatusStr(resp.getStatusStr() + extraInfo);
|
|
|
257
|
+ }
|
|
|
258
|
+
|
|
|
259
|
+ private void rebuildOrderDetailResp(AppraiseOrder order, AppraiseOrderResp resp) {
|
|
|
260
|
+ //卖家信息
|
|
|
261
|
+ resp.setSellerName(userProxyService.getUserNameByUid(order.getUid()));
|
|
|
262
|
+ AppraiseOrderMeta meta = appraiseOrderMetaMapper.selectByOrderCodeAndMetaKey(order.getOrderCode(), SELLER_ORDER_META_KEY_BACK_DELIVERY_ADDRESS);
|
|
|
263
|
+ if(meta != null){
|
|
|
264
|
+ JSONObject metaValue = JSONObject.parseObject(meta.getMetaValue());
|
|
|
265
|
+ resp.setSellerRebackAddressDetail(metaValue.getString("address"));
|
|
|
266
|
+ resp.setSellerRebackAddress(metaValue.getString("area"));
|
|
|
267
|
+ resp.setSellerRebackMobile(metaValue.getString("mobile"));
|
|
|
268
|
+ }
|
|
|
269
|
+
|
|
|
270
|
+ //快递结算方式
|
|
|
271
|
+ if(order.getStatus().equals(Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE)) {//寄付月结
|
|
|
272
|
+ resp.setPayMethod(PAY_METHOD_MONTHLY);
|
|
|
273
|
+ }else {
|
|
|
274
|
+ resp.setPayMethod(PAY_METHOD_FREIGHT_COLLECT);//到付
|
|
|
275
|
+ }
|
|
|
276
|
+ }
|
|
|
277
|
+
|
147
|
private PageResponseBO<AppraiseOrderResp> queryOrderListByStatusAndQueryStr(String queryStr, Integer depotNo,
|
278
|
private PageResponseBO<AppraiseOrderResp> queryOrderListByStatusAndQueryStr(String queryStr, Integer depotNo,
|
148
|
List<Byte> checkStatusList, String platformExpressInfoFlag, String sortRule){
|
279
|
List<Byte> checkStatusList, String platformExpressInfoFlag, String sortRule){
|
149
|
//先按订单号来查
|
280
|
//先按订单号来查
|