Authored by qinchao

增加方法

... ... @@ -15,7 +15,7 @@ public enum Constant {
//更新为质检中
BUYER_ORDER_STATUS_PLATFORM_RECEIVE((byte)31,"平台质检中"),
//有货平台鉴定中(平台已收货,点开始鉴定-->进入鉴定中)
//有货平台鉴定中(平台已收货,点质检通过-->进入鉴定中)
BUYER_ORDER_STATUS_JUDGING((byte)3,"平台鉴定中"),
//瑕疵等待确认
... ...
... ... @@ -108,6 +108,7 @@ public class BuyerOrderController {
}
}
//鉴定通过并发货,pc端使用
@RequestMapping(value = "/judgePassAndDelivery")
public ApiResponse judgePassAndDelivery(BuyerOrderReq req) {
LOGGER.info("judgePass in. req is {}", req);
... ... @@ -119,6 +120,30 @@ public class BuyerOrderController {
}
}
//鉴定通过,phone端使用
@RequestMapping(value = "/judgeCenterPass")
public ApiResponse judgeCenterPass(String orderCode) {
LOGGER.info("judgeCenterPass in. req is {}", orderCode);
JSONObject result = buyerOrderService.judgeCenterPass(orderCode);
if(result.getIntValue("code") == 200) {
return new ApiResponse.ApiResponseBuilder().code(200).message("鉴定通过完成").build();
}else {
return new ApiResponse.ApiResponseBuilder().code(500).message(result.getString("message")).build();
}
}
//鉴定通过,phone端使用
@RequestMapping(value = "/judgeCenterNotPass")
public ApiResponse judgeCenterNotPass(String orderCode) {
LOGGER.info("judgeCenterNotPass in. req is {}", orderCode);
JSONObject result = buyerOrderService.judgeCenterNotPass(orderCode);
if(result.getIntValue("code") == 200) {
return new ApiResponse.ApiResponseBuilder().code(200).message("鉴定不通过完成").build();
}else {
return new ApiResponse.ApiResponseBuilder().code(500).message(result.getString("message")).build();
}
}
//发货给买家
/*@RequestMapping(value = "/deliverGoods")
public ApiResponse deliverGoods(BuyerOrderReq req) {
... ...
... ... @@ -35,6 +35,10 @@ public interface IBuyerOrderService {
JSONObject judgePassAndDelivery(BuyerOrderReq req);
JSONObject judgeCenterPass(String orderCode);
JSONObject judgeCenterNotPass(String orderCode);
//JSONObject deliverGoods(BuyerOrderReq req);
... ...
... ... @@ -564,7 +564,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
String args = "orderAppraise.appraiseSuccess";
LOGGER.info("judgePass begin call enter interface is {}, orderCode is {}", buyerOrder.getOrderCode(), args);
//JSONObject jsonObject = asyncCallJudgeResultUpdate(args, buyerOrder.getOrderCode());
//重新设置mobile
restMobileFromBuyer(req,buyerOrder.getOrderCode());
JSONObject jsonObject = asyncCallAppraise(args, buyerOrder.getOrderCode(), req);
... ... @@ -573,6 +573,68 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
return jsonObject;
}
//鉴定通过 :更新订单状态为judge_pass ,期望状态有两种情况:平台鉴定中或者瑕疵接受了
public JSONObject judgeCenterPass(String orderCode){
if(StringUtils.isBlank(orderCode)){
throw new ServiceException(400,"参数错误");
}
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
if(null == buyerOrder) {
throw new ServiceException(400,"订单不存在");
}
if( Constant.BUYER_ORDER_STATUS_JUDGING.getByteVal()!=buyerOrder.getStatus().byteValue()
&& Constant.BUYER_ORDER_STATUS_MINI_FAULT_ACCEPT.getByteVal()!=buyerOrder.getStatus().byteValue()){
throw new ServiceException(400,"错误:订单状态变化,鉴定通过失败,请重新刷新列表");
}
//记录操作日志
int operateType =OperateTypeEnum.ONLY_JUDGE_PASS.getCode();
UserHelper userHelper = new UserHelper();
saveOrderOperateRecord(buyerOrder.getOrderCode(), userHelper, operateType, "");
String args = "orderAppraise.judgeCenterPass";
LOGGER.info("judgeCenterPass begin call enter interface is {}, orderCode is {}", buyerOrder.getOrderCode(), args);
JSONObject jsonObject = asyncCallJudgeResultUpdate(args, buyerOrder.getOrderCode());
LOGGER.info("judgeCenterPass 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)){
throw new ServiceException(400,"参数错误");
}
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
if(null == buyerOrder) {
throw new ServiceException(400,"订单不存在");
}
if( Constant.BUYER_ORDER_STATUS_JUDGING.getByteVal()!=buyerOrder.getStatus().byteValue()
&& Constant.BUYER_ORDER_STATUS_MINI_FAULT_ACCEPT.getByteVal()!=buyerOrder.getStatus().byteValue()){
throw new ServiceException(400,"错误:订单状态变化,鉴定通过失败,请重新刷新列表");
}
//记录操作日志
int operateType =OperateTypeEnum.ONLY_JUDGE_REJECT.getCode();
UserHelper userHelper = new UserHelper();
saveOrderOperateRecord(buyerOrder.getOrderCode(), userHelper, operateType, "");
String args = "orderAppraise.judgeCenterNotPass";
LOGGER.info("judgeCenterNotPass begin call enter interface is {}, orderCode is {}", buyerOrder.getOrderCode(), args);
JSONObject jsonObject = asyncCallJudgeResultUpdate(args, buyerOrder.getOrderCode());
LOGGER.info("judgeCenterNotPass saveOrderOperateRecord operateType={} ,order code ={} ,userHelper = {} ,result json {}",operateType,buyerOrder.getOrderCode() ,userHelper,jsonObject);
return jsonObject;
}
//鉴定不通过
public JSONObject judgeRejectAndDelivery(BuyerOrderReq req){
... ... @@ -604,14 +666,14 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
return jsonObject;
}
/*private JSONObject asyncCallJudgeResultUpdate(String args, String orderCode) {
private JSONObject asyncCallJudgeResultUpdate(String args, String orderCode) {
LOGGER.info("call asyncCallJudgeResultUpdate enter orderCode is {}, interface is {},result is {}", orderCode, args);
OrderRequest request = new OrderRequest();
request.setOrderCode(Long.valueOf(orderCode));
JSONObject jsonObject = serviceCaller.asyncCall(args, request, JSONObject.class).get(5, TimeUnit.SECONDS);
LOGGER.info("call asyncCallJudgeResultUpdate orderCode is {}, interface is {},result is {}", orderCode, args, jsonObject.toJSONString());
return jsonObject;
}*/
}
/*
public JSONObject updateOrderStatus(BuyerOrderReq req) {
... ...