...
|
...
|
@@ -225,66 +225,56 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { |
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public int updateOrderStatus(BuyerOrderReq req) {
|
|
|
public JSONObject updateOrderStatus(BuyerOrderReq req) {
|
|
|
if(null == req.getId() || null == req.getStatus()) {
|
|
|
return 0;
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
BuyerOrder buyerOrder = buyerOrderMapper.selectById(req.getId());
|
|
|
if(null == buyerOrder) {
|
|
|
return 0;
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
//调用前台接口
|
|
|
String args = "";
|
|
|
int resultCode = 200;
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_TO_BE_RECEIVED.getByteVal()) {//鉴定通过
|
|
|
args = "orderAppraise.appraiseSuccess";
|
|
|
resultCode = asyncCallAppraise(args, buyerOrder.getOrderCode(), req);
|
|
|
jsonObject = 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);
|
|
|
jsonObject = 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());
|
|
|
jsonObject = asyncCallConfirmReceive(args, buyerOrder.getOrderCode());
|
|
|
}
|
|
|
|
|
|
if(resultCode != 200) {
|
|
|
return 0;
|
|
|
if(resultCode == 200) {
|
|
|
buyerOrderMapper.updateStatusById(req.getId(), req.getStatus());
|
|
|
}
|
|
|
|
|
|
return buyerOrderMapper.updateStatusById(req.getId(), req.getStatus());
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
private int asyncCallConfirmReceive(String args, String orderCode) {
|
|
|
private JSONObject 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");
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
private int asyncCallAppraise(String args, String orderCode, BuyerOrderReq req) {
|
|
|
private JSONObject asyncCallAppraise(String args, String orderCode, BuyerOrderReq req) {
|
|
|
AppraiseExpressInfoBo bo = new AppraiseExpressInfoBo();
|
|
|
bo.setOrderCode(Long.valueOf(orderCode));
|
|
|
bo.setExpressCompanyId(req.getExpressCompanyId());
|
|
|
bo.setWayBillCode(req.getWaybillCode());
|
|
|
bo.setDepotNum(req.getDepotNo());
|
|
|
JSONObject jsonObject = null;
|
|
|
LOGGER.info("appraise orderCode is {},startTime is {}", orderCode, DateUtil.getCurrentTimeSecond());
|
|
|
try {
|
|
|
jsonObject = serviceCaller.asyncCall(args, bo, JSONObject.class).get(5);
|
|
|
} catch (Exception e) {
|
|
|
LOGGER.error("appraise fail!!! orderCode is {}, error is {}", orderCode,e.getMessage());
|
|
|
}finally {
|
|
|
LOGGER.info("appraise orderCode is {}, endTime is {}", orderCode, DateUtil.getCurrentTimeSecond());
|
|
|
}
|
|
|
JSONObject jsonObject = serviceCaller.asyncCall(args, bo, JSONObject.class).get(5);
|
|
|
LOGGER.info("call ufo-gateway interface is {},result is {}", args, jsonObject.toJSONString());
|
|
|
|
|
|
if(null == jsonObject) {
|
|
|
return 0;
|
|
|
}
|
|
|
LOGGER.info("call ufo-gateway interface is {}, result is {}", args, jsonObject.toJSONString());
|
|
|
return jsonObject.getIntValue("code");
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
public BuyerOrderResp getReceiveInfoByOrderCode(BuyerOrderReq req) {
|
...
|
...
|
|