Showing
1 changed file
with
28 additions
and
11 deletions
@@ -45,6 +45,7 @@ import com.yoho.order.model.OrderOperateRecord; | @@ -45,6 +45,7 @@ import com.yoho.order.model.OrderOperateRecord; | ||
45 | import com.yoho.order.model.SellerOrder; | 45 | import com.yoho.order.model.SellerOrder; |
46 | import com.yoho.order.model.SellerOrderGoods; | 46 | import com.yoho.order.model.SellerOrderGoods; |
47 | import com.yoho.order.model.SellerOrderMeta; | 47 | import com.yoho.order.model.SellerOrderMeta; |
48 | +import com.yoho.service.model.order.request.OrderRequest; | ||
48 | import com.yoho.ufo.order.constant.Constant; | 49 | import com.yoho.ufo.order.constant.Constant; |
49 | import com.yoho.ufo.order.service.IBuyerOrderService; | 50 | import com.yoho.ufo.order.service.IBuyerOrderService; |
50 | import com.yoho.ufo.service.impl.UserHelper; | 51 | import com.yoho.ufo.service.impl.UserHelper; |
@@ -236,26 +237,42 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | @@ -236,26 +237,42 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { | ||
236 | 237 | ||
237 | //调用前台接口 | 238 | //调用前台接口 |
238 | String args = ""; | 239 | String args = ""; |
239 | - if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_TO_BE_RECEIVED.getByteVal()) { | 240 | + int resultCode = 200; |
241 | + if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_TO_BE_RECEIVED.getByteVal()) {//鉴定通过 | ||
240 | args = "orderAppraise.appraiseSuccess"; | 242 | args = "orderAppraise.appraiseSuccess"; |
241 | - }else if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal()) { | 243 | + resultCode = asyncCallAppraise(args, buyerOrder.getOrderCode(), req); |
244 | + }else if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal()) {//鉴定不通过 | ||
242 | args = "orderAppraise.appraiseFail"; | 245 | args = "orderAppraise.appraiseFail"; |
246 | + resultCode = asyncCallAppraise(args, buyerOrder.getOrderCode(), req); | ||
247 | + }else if(req.getStatus().byteValue() == Constant.BUYER_ORDER_STATUS_JUDGING.getByteVal()) {//确认收货 | ||
248 | + args = "ufo-gateway.confirmReceive"; | ||
249 | + resultCode = asyncCallConfirmReceive(args, buyerOrder.getOrderCode()); | ||
243 | } | 250 | } |
244 | 251 | ||
245 | - if(StringUtils.isNotEmpty(args)) { | 252 | + if(resultCode != 200) { |
253 | + return 0; | ||
254 | + } | ||
255 | + | ||
256 | + return buyerOrderMapper.updateStatusById(req.getId(), req.getStatus()); | ||
257 | + } | ||
258 | + | ||
259 | + private int asyncCallConfirmReceive(String args, String orderCode) { | ||
260 | + OrderRequest request = new OrderRequest(); | ||
261 | + request.setOrderCode(Long.valueOf(orderCode)); | ||
262 | + JSONObject jsonObject = serviceCaller.asyncCall(args, request, JSONObject.class).get(5); | ||
263 | + LOGGER.info("call ufo-gateway interface is {},result is {}", args, jsonObject.toJSONString()); | ||
264 | + return jsonObject.getIntValue("code"); | ||
265 | + } | ||
266 | + | ||
267 | + private int asyncCallAppraise(String args, String orderCode, BuyerOrderReq req) { | ||
246 | AppraiseExpressInfoBo bo = new AppraiseExpressInfoBo(); | 268 | AppraiseExpressInfoBo bo = new AppraiseExpressInfoBo(); |
247 | - bo.setOrderCode(Long.valueOf(buyerOrder.getOrderCode())); | 269 | + bo.setOrderCode(Long.valueOf(orderCode)); |
248 | bo.setExpressCompanyId(req.getExpressCompanyId()); | 270 | bo.setExpressCompanyId(req.getExpressCompanyId()); |
249 | bo.setWayBillCode(req.getWaybillCode()); | 271 | bo.setWayBillCode(req.getWaybillCode()); |
250 | bo.setDepotNum(req.getDepotNo()); | 272 | bo.setDepotNum(req.getDepotNo()); |
251 | JSONObject jsonObject = serviceCaller.asyncCall(args, bo, JSONObject.class).get(5); | 273 | JSONObject jsonObject = serviceCaller.asyncCall(args, bo, JSONObject.class).get(5); |
252 | - LOGGER.info("call orderAppraise result is {}", jsonObject.toJSONString()); | ||
253 | - if(jsonObject.getIntValue("code") != 200) { | ||
254 | - return 0; | ||
255 | - } | ||
256 | - } | ||
257 | - | ||
258 | - return buyerOrderMapper.updateStatusById(req.getId(), req.getStatus()); | 274 | + LOGGER.info("call ufo-gateway interface is {}, result is {}", args, jsonObject.toJSONString()); |
275 | + return jsonObject.getIntValue("code"); | ||
259 | } | 276 | } |
260 | 277 | ||
261 | public BuyerOrderResp getReceiveInfoByOrderCode(BuyerOrderReq req) { | 278 | public BuyerOrderResp getReceiveInfoByOrderCode(BuyerOrderReq req) { |
-
Please register or login to post a comment