...
|
...
|
@@ -603,6 +603,87 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
//发货
|
|
|
public JSONObject deliveryGoodsToBuyer(BuyerOrderReq req){
|
|
|
LOGGER.info("deliveryGoodsToBuyer enter, req is {}", req);
|
|
|
BuyerOrder buyerOrder = checkForPlatformExpress(req);
|
|
|
String args = "orderAppraise.deliveryGoodsToBuyer";
|
|
|
if( Constant.BUYER_ORDER_STATUS_JUDGE_PASS.getByteVal()!=buyerOrder.getStatus().byteValue()){
|
|
|
throw new ServiceException(400,"错误:订单状态变化,不允许发货,请重新刷新列表");
|
|
|
}
|
|
|
//重新设置mobile
|
|
|
restMobileFromBuyer(req,buyerOrder.getOrderCode());
|
|
|
|
|
|
//记录操作日志
|
|
|
int operateType =OperateTypeEnum.OPERATE_TYPE_DELIVERY_GOODS.getCode();
|
|
|
UserHelper userHelper = new UserHelper();
|
|
|
saveOrderOperateRecord(buyerOrder.getOrderCode(), userHelper, operateType, "");
|
|
|
|
|
|
JSONObject jsonObject = asyncCallAppraise(args, buyerOrder.getOrderCode(), req);
|
|
|
LOGGER.info("deliveryGoodsToBuyer saveOrderOperateRecord operateType={} ,order code ={} ,userHelper = {} ,result json {}",operateType,buyerOrder.getOrderCode() ,userHelper,jsonObject);
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
private BuyerOrder checkForPlatformExpress(BuyerOrderReq req){
|
|
|
if(StringUtils.isBlank(req.getOrderCode())) {
|
|
|
throw new ServiceException(400,"错误:参数错误,订单号为空");
|
|
|
}
|
|
|
//物流公司id,默认值为 23
|
|
|
if(req.getExpressCompanyId()==null){
|
|
|
throw new ServiceException(400,"错误:参数错误,物流公司为空");
|
|
|
}
|
|
|
if(StringUtils.isBlank(req.getWaybillCode())){
|
|
|
throw new ServiceException(400,"错误:参数错误,物流单号为空");
|
|
|
}
|
|
|
if(req.getDepotNo()==null){
|
|
|
throw new ServiceException(400,"错误:参数错误,仓库号为空");
|
|
|
}
|
|
|
if(StringUtils.isBlank(req.getMobile())){
|
|
|
throw new ServiceException(400,"错误:参数错误,手机号为空");
|
|
|
}
|
|
|
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(req.getOrderCode());
|
|
|
if(null == buyerOrder) {
|
|
|
throw new ServiceException(400,"错误:订单为空");
|
|
|
}
|
|
|
|
|
|
//查看是否存在寄回的物流信息,如果存在,则不允许再次寄回
|
|
|
List<ExpressRecord> sellerExpressRecordList = expressRecordMapper.selectByOrderCodeListAndType(Lists.newArrayList(buyerOrder.getOrderCode()), Lists.newArrayList(EXPRESS_TYPE_JUDGE_TO_BUYER, EXPRESS_TYPE_JUDGE_TO_SELLER,EXPRESS_TYPE_RETURN_BACK_TO_SELLER));
|
|
|
if(CollectionUtils.isNotEmpty(sellerExpressRecordList)) {
|
|
|
throw new ServiceException(400,"错误:订单已存在物流信息["+sellerExpressRecordList.get(0).getWaybillCode()+"]");
|
|
|
}
|
|
|
return buyerOrder;
|
|
|
}
|
|
|
|
|
|
public JSONObject sendBackGoodsToSeller(BuyerOrderReq req){
|
|
|
LOGGER.info("sendBackGoodsToSeller enter, req is {}", req);
|
|
|
BuyerOrder buyerOrder = checkForPlatformExpress(req);
|
|
|
//重新设置mobile
|
|
|
resetMobileFromSeller(req,buyerOrder.getOrderCode());
|
|
|
|
|
|
//调用前台接口
|
|
|
String args ;
|
|
|
if(buyerOrder.getStatus().byteValue()==Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal()) {
|
|
|
args = "orderAppraise.returnBack";
|
|
|
}else if(buyerOrder.getStatus().byteValue()==Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal()
|
|
|
||buyerOrder.getStatus().byteValue()==Constant.CANCEL_QUALITY_CHECK_FAKE.getByteVal()
|
|
|
||buyerOrder.getStatus().byteValue()==Constant.CANCEL_MINI_FAULT_REJECT.getByteVal()
|
|
|
||buyerOrder.getStatus().byteValue()==Constant.CANCEL_MINI_FAULT_OUT_TIME_REJECT.getByteVal()){
|
|
|
args = "orderAppraise.returnBackOrderCauseOfJudgeFailure";
|
|
|
}else{
|
|
|
throw new ServiceException(400,"错误:订单状态不合法,不允许平台发货或寄回");
|
|
|
}
|
|
|
|
|
|
//记录操作日志
|
|
|
int operateType =OperateTypeEnum.OPERATE_TYPE_DELIVERY_GOODS.getCode();
|
|
|
UserHelper userHelper = new UserHelper();
|
|
|
saveOrderOperateRecord(buyerOrder.getOrderCode(), userHelper, operateType, "");
|
|
|
|
|
|
JSONObject jsonObject = asyncCallAppraise(args, buyerOrder.getOrderCode(), req);
|
|
|
LOGGER.info("sendBackGoodsToSeller saveOrderOperateRecord operateType={} ,order code ={} ,userHelper = {} ,result json {}",operateType,buyerOrder.getOrderCode() ,userHelper,jsonObject);
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
//鉴定通过 :更新订单状态为judge_pass ,期望状态有两种情况:平台鉴定中或者瑕疵接受了
|
|
|
public JSONObject judgeCenterNotPass(String orderCode){
|
|
|
if(StringUtils.isBlank(orderCode)){
|
...
|
...
|
@@ -754,6 +835,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public JSONObject returnBackOrderCauseOfJudgeFailure(BuyerOrderReq req){
|
|
|
if(null == req.getId() || null == req.getStatus()) {
|
|
|
return null;
|
...
|
...
|
|