Authored by qinchao

Merge branch 'dev_returnback' into test6.8.2

@@ -24,6 +24,11 @@ public class ExpressInfoConstant { @@ -24,6 +24,11 @@ public class ExpressInfoConstant {
24 public static final Integer EXPRESS_TYPE_3 = 3; 24 public static final Integer EXPRESS_TYPE_3 = 3;
25 25
26 /** 26 /**
  27 + * 鉴定中心退回到卖家(直接退回,不涉及到鉴定过程,买家取消订单,但是卖家已发货给鉴定中心)
  28 + */
  29 + public static final Integer EXPRESS_TYPE_REBACK = 4;
  30 +
  31 + /**
27 * 未签收 32 * 未签收
28 */ 33 */
29 public static final Integer EXPRESS_STATUS_UNSING = 0; 34 public static final Integer EXPRESS_STATUS_UNSING = 0;
@@ -28,6 +28,19 @@ public class AppraiseController { @@ -28,6 +28,19 @@ public class AppraiseController {
28 private AppraiseService appraiseService; 28 private AppraiseService appraiseService;
29 29
30 /** 30 /**
  31 + * 卖家发货后,买家又取消了订单,鉴定中心寄回商品给卖家
  32 + * 提供给运营平台使用
  33 + * @return
  34 + */
  35 + @RequestMapping(value="/returnBack")
  36 + @IgnoreSession
  37 + @IgnoreSignature
  38 + public ApiResponse returnBack(@RequestBody AppraiseExpressInfoBo appraiseExpressInfoBo) {
  39 + logger.info("in returnBack , req {}", appraiseExpressInfoBo);
  40 + return appraiseService.returnBack(appraiseExpressInfoBo.getExpressCompanyId(), appraiseExpressInfoBo.getOrderCode(), appraiseExpressInfoBo.getWayBillCode(),appraiseExpressInfoBo.getDepotNum());
  41 + }
  42 +
  43 + /**
31 * 商品鉴定不通过,鉴定中心寄回商品给卖家 44 * 商品鉴定不通过,鉴定中心寄回商品给卖家
32 * 提供给运营平台使用 45 * 提供给运营平台使用
33 * @return 46 * @return
@@ -20,6 +20,15 @@ public interface IExpressInfoService { @@ -20,6 +20,15 @@ public interface IExpressInfoService {
20 20
21 21
22 /** 22 /**
  23 + * 卖家发货的商品,买家取消后,鉴定中心寄回商品给卖家
  24 + * @param sellerUid 卖家uid
  25 + * @param expressCompanyId 快递公司id
  26 + * @param orderCode 订单号
  27 + * @param wayBillCode 快递单号
  28 + */
  29 + void returnBack(Integer sellerUid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum);
  30 +
  31 + /**
23 * 商品鉴定不通过,鉴定中心寄回商品给卖家 32 * 商品鉴定不通过,鉴定中心寄回商品给卖家
24 * @param sellerUid 卖家uid 33 * @param sellerUid 卖家uid
25 * @param expressCompanyId 快递公司id 34 * @param expressCompanyId 快递公司id
@@ -206,6 +206,33 @@ public class AppraiseService { @@ -206,6 +206,33 @@ public class AppraiseService {
206 } 206 }
207 207
208 208
  209 + /**
  210 + * 直接退回商品,记录物流,不涉及状态更改
  211 + * @param expressCompanyId
  212 + * @param orderCode
  213 + * @param wayBillCode
  214 + * @return
  215 + */
  216 + public ApiResponse returnBack(Integer expressCompanyId, Long orderCode, String wayBillCode, Integer depotNum){
  217 + ApiResponse apiResponse=new ApiResponse();
  218 + BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
  219 +
  220 + if (buyerOrder == null){
  221 + LOGGER.warn("returnBack getOrderInfo order not exist, orderCode {}", orderCode);
  222 + throw new ServiceException(ServiceError.ORDER_NULL);
  223 + }
  224 + OrderStatus expectStatus = OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE;
  225 + if (buyerOrder.getStatus() != expectStatus.getCode()){
  226 + LOGGER.warn("returnBack expectStatus {}, actual status {}, orderCode {}", expectStatus,
  227 + buyerOrder.getStatus(), orderCode);
  228 + throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE);
  229 + }
  230 +
  231 + //记录物流信息
  232 + int sellerUid = buyerOrder.getSellerUid();
  233 + expressInfoService.returnBack(sellerUid, expressCompanyId, orderCode, wayBillCode, depotNum);
  234 + return apiResponse;
  235 + }
209 236
210 /** 237 /**
211 * 更新发到卖家的物流信息 238 * 更新发到卖家的物流信息
@@ -226,7 +253,7 @@ public class AppraiseService { @@ -226,7 +253,7 @@ public class AppraiseService {
226 } 253 }
227 OrderStatus expectStatus = OrderStatus.PLATFORM_CHECKING; 254 OrderStatus expectStatus = OrderStatus.PLATFORM_CHECKING;
228 if (buyerOrder.getStatus() != expectStatus.getCode()){ 255 if (buyerOrder.getStatus() != expectStatus.getCode()){
229 - LOGGER.warn("appraiseFail expectStatus {}, actual status {}, ordercode {}", expectStatus, 256 + LOGGER.warn("appraiseFail expectStatus {}, actual status {}, orderCode {}", expectStatus,
230 buyerOrder.getStatus(), orderCode); 257 buyerOrder.getStatus(), orderCode);
231 throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE); 258 throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE);
232 } 259 }
@@ -148,6 +148,21 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -148,6 +148,21 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
148 } 148 }
149 149
150 @Override 150 @Override
  151 + public void returnBack(Integer sellerUid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum){
  152 + Integer expressType = ExpressInfoConstant.EXPRESS_TYPE_REBACK;
  153 +
  154 + LOGGER.info("returnBack expressCompanyId = {}, orderCode = {}, wayBillCode = {} " +
  155 + ",expressType = {},depotNum={}", new Object[]{expressCompanyId, orderCode, wayBillCode,expressType,depotNum});
  156 +
  157 + // 保存订单物流信息
  158 + saveExpress(sellerUid,expressCompanyId,orderCode,wayBillCode,expressType,depotNum);
  159 +
  160 + // 发送mq获取物流信息
  161 + sendExpressMQ(sellerUid,expressCompanyId,orderCode,wayBillCode);
  162 + LOGGER.info("returnBack end ! send express to erp ");
  163 + }
  164 +
  165 + @Override
151 public void appraiseFail(Integer sellerUid ,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum) { 166 public void appraiseFail(Integer sellerUid ,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum) {
152 Integer expressType = ExpressInfoConstant.EXPRESS_TYPE_3; 167 Integer expressType = ExpressInfoConstant.EXPRESS_TYPE_3;
153 168
@@ -300,6 +315,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -300,6 +315,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
300 return ExpressInfoConstant.EXPRESS_TYPE_3; 315 return ExpressInfoConstant.EXPRESS_TYPE_3;
301 }else if(OrderStatus.WAITING_RECEIVE.getCode()==buyerOrder.getStatus()||OrderStatus.DONE.getCode()==buyerOrder.getStatus()){ 316 }else if(OrderStatus.WAITING_RECEIVE.getCode()==buyerOrder.getStatus()||OrderStatus.DONE.getCode()==buyerOrder.getStatus()){
302 return ExpressInfoConstant.EXPRESS_TYPE_2; 317 return ExpressInfoConstant.EXPRESS_TYPE_2;
  318 + }else if(OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode()==buyerOrder.getStatus()){
  319 + return ExpressInfoConstant.EXPRESS_TYPE_REBACK;
303 } 320 }
304 return 0; 321 return 0;
305 322