Authored by qinchao

Merge branch 'dev_returnback' into test6.8.2

... ... @@ -24,6 +24,11 @@ public class ExpressInfoConstant {
public static final Integer EXPRESS_TYPE_3 = 3;
/**
* 鉴定中心退回到卖家(直接退回,不涉及到鉴定过程,买家取消订单,但是卖家已发货给鉴定中心)
*/
public static final Integer EXPRESS_TYPE_REBACK = 4;
/**
* 未签收
*/
public static final Integer EXPRESS_STATUS_UNSING = 0;
... ...
... ... @@ -28,6 +28,19 @@ public class AppraiseController {
private AppraiseService appraiseService;
/**
* 卖家发货后,买家又取消了订单,鉴定中心寄回商品给卖家
* 提供给运营平台使用
* @return
*/
@RequestMapping(value="/returnBack")
@IgnoreSession
@IgnoreSignature
public ApiResponse returnBack(@RequestBody AppraiseExpressInfoBo appraiseExpressInfoBo) {
logger.info("in returnBack , req {}", appraiseExpressInfoBo);
return appraiseService.returnBack(appraiseExpressInfoBo.getExpressCompanyId(), appraiseExpressInfoBo.getOrderCode(), appraiseExpressInfoBo.getWayBillCode(),appraiseExpressInfoBo.getDepotNum());
}
/**
* 商品鉴定不通过,鉴定中心寄回商品给卖家
* 提供给运营平台使用
* @return
... ...
... ... @@ -20,6 +20,15 @@ public interface IExpressInfoService {
/**
* 卖家发货的商品,买家取消后,鉴定中心寄回商品给卖家
* @param sellerUid 卖家uid
* @param expressCompanyId 快递公司id
* @param orderCode 订单号
* @param wayBillCode 快递单号
*/
void returnBack(Integer sellerUid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum);
/**
* 商品鉴定不通过,鉴定中心寄回商品给卖家
* @param sellerUid 卖家uid
* @param expressCompanyId 快递公司id
... ...
... ... @@ -206,6 +206,33 @@ public class AppraiseService {
}
/**
* 直接退回商品,记录物流,不涉及状态更改
* @param expressCompanyId
* @param orderCode
* @param wayBillCode
* @return
*/
public ApiResponse returnBack(Integer expressCompanyId, Long orderCode, String wayBillCode, Integer depotNum){
ApiResponse apiResponse=new ApiResponse();
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
if (buyerOrder == null){
LOGGER.warn("returnBack getOrderInfo order not exist, orderCode {}", orderCode);
throw new ServiceException(ServiceError.ORDER_NULL);
}
OrderStatus expectStatus = OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE;
if (buyerOrder.getStatus() != expectStatus.getCode()){
LOGGER.warn("returnBack expectStatus {}, actual status {}, orderCode {}", expectStatus,
buyerOrder.getStatus(), orderCode);
throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE);
}
//记录物流信息
int sellerUid = buyerOrder.getSellerUid();
expressInfoService.returnBack(sellerUid, expressCompanyId, orderCode, wayBillCode, depotNum);
return apiResponse;
}
/**
* 更新发到卖家的物流信息
... ... @@ -226,7 +253,7 @@ public class AppraiseService {
}
OrderStatus expectStatus = OrderStatus.PLATFORM_CHECKING;
if (buyerOrder.getStatus() != expectStatus.getCode()){
LOGGER.warn("appraiseFail expectStatus {}, actual status {}, ordercode {}", expectStatus,
LOGGER.warn("appraiseFail expectStatus {}, actual status {}, orderCode {}", expectStatus,
buyerOrder.getStatus(), orderCode);
throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE);
}
... ...
... ... @@ -148,6 +148,21 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
}
@Override
public void returnBack(Integer sellerUid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum){
Integer expressType = ExpressInfoConstant.EXPRESS_TYPE_REBACK;
LOGGER.info("returnBack expressCompanyId = {}, orderCode = {}, wayBillCode = {} " +
",expressType = {},depotNum={}", new Object[]{expressCompanyId, orderCode, wayBillCode,expressType,depotNum});
// 保存订单物流信息
saveExpress(sellerUid,expressCompanyId,orderCode,wayBillCode,expressType,depotNum);
// 发送mq获取物流信息
sendExpressMQ(sellerUid,expressCompanyId,orderCode,wayBillCode);
LOGGER.info("returnBack end ! send express to erp ");
}
@Override
public void appraiseFail(Integer sellerUid ,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum) {
Integer expressType = ExpressInfoConstant.EXPRESS_TYPE_3;
... ... @@ -300,6 +315,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
return ExpressInfoConstant.EXPRESS_TYPE_3;
}else if(OrderStatus.WAITING_RECEIVE.getCode()==buyerOrder.getStatus()||OrderStatus.DONE.getCode()==buyerOrder.getStatus()){
return ExpressInfoConstant.EXPRESS_TYPE_2;
}else if(OrderStatus.BUYER_CANCEL_BEFORE_DEPOT_RECEIVE.getCode()==buyerOrder.getStatus()){
return ExpressInfoConstant.EXPRESS_TYPE_REBACK;
}
return 0;
... ...