Authored by caoyan

订单管理

... ... @@ -45,6 +45,7 @@ import com.yoho.order.model.OrderOperateRecord;
import com.yoho.order.model.SellerOrder;
import com.yoho.order.model.SellerOrderGoods;
import com.yoho.order.model.SellerOrderMeta;
import com.yoho.service.model.order.request.OrderRequest;
import com.yoho.ufo.order.constant.Constant;
import com.yoho.ufo.order.service.IBuyerOrderService;
import com.yoho.ufo.service.impl.UserHelper;
... ... @@ -236,26 +237,42 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
//调用前台接口
String args = "";
if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_TO_BE_RECEIVED.getByteVal()) {
int resultCode = 200;
if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_TO_BE_RECEIVED.getByteVal()) {//鉴定通过
args = "orderAppraise.appraiseSuccess";
}else if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal()) {
resultCode = asyncCallAppraise(args, buyerOrder.getOrderCode(), req);
}else if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal()) {//鉴定不通过
args = "orderAppraise.appraiseFail";
resultCode = asyncCallAppraise(args, buyerOrder.getOrderCode(), req);
}else if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_JUDGING.getByteVal()) {//确认收货
args = "ufo-gateway.confirmReceive";
resultCode = asyncCallConfirmReceive(args, buyerOrder.getOrderCode());
}
if(StringUtils.isNotEmpty(args)) {
if(resultCode != 200) {
return 0;
}
return buyerOrderMapper.updateStatusById(req.getId(), req.getStatus());
}
private int asyncCallConfirmReceive(String args, String orderCode) {
OrderRequest request = new OrderRequest();
request.setOrderCode(Long.valueOf(orderCode));
JSONObject jsonObject = serviceCaller.asyncCall(args, request, JSONObject.class).get(5);
LOGGER.info("call ufo-gateway interface is {},result is {}", args, jsonObject.toJSONString());
return jsonObject.getIntValue("code");
}
private int asyncCallAppraise(String args, String orderCode, BuyerOrderReq req) {
AppraiseExpressInfoBo bo = new AppraiseExpressInfoBo();
bo.setOrderCode(Long.valueOf(buyerOrder.getOrderCode()));
bo.setOrderCode(Long.valueOf(orderCode));
bo.setExpressCompanyId(req.getExpressCompanyId());
bo.setWayBillCode(req.getWaybillCode());
bo.setDepotNum(req.getDepotNo());
JSONObject jsonObject = serviceCaller.asyncCall(args, bo, JSONObject.class).get(5);
LOGGER.info("call orderAppraise result is {}", jsonObject.toJSONString());
if(jsonObject.getIntValue("code") != 200) {
return 0;
}
}
return buyerOrderMapper.updateStatusById(req.getId(), req.getStatus());
LOGGER.info("call ufo-gateway interface is {}, result is {}", args, jsonObject.toJSONString());
return jsonObject.getIntValue("code");
}
public BuyerOrderResp getReceiveInfoByOrderCode(BuyerOrderReq req) {
... ...