adding generateOrder error msg logic

This commit is contained in:
376654749@qq.com 2022-03-10 12:01:13 +08:00
parent e057f0cce0
commit fc878707a0
2 changed files with 23 additions and 8 deletions

View File

@ -141,8 +141,12 @@ public class OrderController {
returnMap.put("orderNumber", ordersEntity.getOrderNo()); returnMap.put("orderNumber", ordersEntity.getOrderNo());
returnMap.put("orderAmount", ordersEntity.getOrderAmount()); returnMap.put("orderAmount", ordersEntity.getOrderAmount());
return ResponseDTO.succData(returnMap, wxpayService.generateQRCode(wxPayEntity)); return ResponseDTO.succData(returnMap, wxpayService.generateQRCode(wxPayEntity));
}else if (resultMsg.get("code").equals("3")){ }else if (resultMsg.get("code").equals("0")){
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_ERROR,resultMsg.get("msg")); return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_ERROR,resultMsg.get("msg"));
}else if (resultMsg.get("code").equals("3")){
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_FAIL_COUPONDED,resultMsg.get("msg"));
}else if (resultMsg.get("code").equals("4")){
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL,resultMsg.get("msg"));
} }
}catch (Exception e){ }catch (Exception e){
System.out.println(e.getMessage()); System.out.println(e.getMessage());
@ -234,8 +238,12 @@ public class OrderController {
returnMap.put("orderNumber", ordersEntity.getOrderNo()); returnMap.put("orderNumber", ordersEntity.getOrderNo());
returnMap.put("orderAmount", ordersEntity.getOrderAmount()); returnMap.put("orderAmount", ordersEntity.getOrderAmount());
return ResponseDTO.succData(returnMap,wxpayService.dounifiedOrder(wxPayEntity)); return ResponseDTO.succData(returnMap,wxpayService.dounifiedOrder(wxPayEntity));
}else if (resultMsg.get("code").equals("3")){ }else if (resultMsg.get("code").equals("0")){
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_ERROR,resultMsg.get("msg")); return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_ERROR,resultMsg.get("msg"));
}else if (resultMsg.get("code").equals("3")){
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_FAIL_COUPONDED,resultMsg.get("msg"));
}else if (resultMsg.get("code").equals("4")){
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL,resultMsg.get("msg"));
} }
}catch (Exception e){ }catch (Exception e){
System.out.println(e.getMessage()); System.out.println(e.getMessage());
@ -317,6 +325,7 @@ public class OrderController {
ordersEntity.setOrderStatus("0"); ordersEntity.setOrderStatus("0");
ordersEntity.setBasePoint(basePoint); ordersEntity.setBasePoint(basePoint);
ordersEntity.setPayType("3"); ordersEntity.setPayType("3");
resultMsg = orderService.generateOrder(ordersEntity, orderDatilListJson);
//判断订单生成状况 //判断订单生成状况
if (resultMsg.get("code").equals("1")) { if (resultMsg.get("code").equals("1")) {
wxPayEntity.setProduct_id(ordersEntity.getProductCode()); wxPayEntity.setProduct_id(ordersEntity.getProductCode());
@ -326,8 +335,12 @@ public class OrderController {
returnMap.put("orderNumber", ordersEntity.getOrderNo()); returnMap.put("orderNumber", ordersEntity.getOrderNo());
returnMap.put("orderAmount", ordersEntity.getOrderAmount()); returnMap.put("orderAmount", ordersEntity.getOrderAmount());
return ResponseDTO.succData(returnMap, wxpayService.generateQRCode(wxPayEntity)); return ResponseDTO.succData(returnMap, wxpayService.generateQRCode(wxPayEntity));
}else if (resultMsg.get("code").equals("3")){ }else if (resultMsg.get("code").equals("0")){
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_ERROR,resultMsg.get("msg")); return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_ERROR,resultMsg.get("msg"));
}else if (resultMsg.get("code").equals("3")){
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_FAIL_COUPONDED,resultMsg.get("msg"));
}else if (resultMsg.get("code").equals("4")){
return ResponseDTO.wrap(OrderResponseCodeConst.COUPON_USE_FAIL,resultMsg.get("msg"));
} }
}catch (Exception e){ }catch (Exception e){
System.out.println(e.getMessage()); System.out.println(e.getMessage());

View File

@ -65,7 +65,7 @@ public class OrderService {
couponCosumeEntity.setRealCouponAmount(realCouponAmount); couponCosumeEntity.setRealCouponAmount(realCouponAmount);
JSONObject jsonObject = JSONObject.parseObject(couponService.couponCosume(couponCosumeEntity)); JSONObject jsonObject = JSONObject.parseObject(couponService.couponCosume(couponCosumeEntity));
if (!jsonObject.getString("code").equals("0")) { if (!jsonObject.getString("code").equals("0")) {
resultMap.put("code",jsonObject.getString("code")); resultMap.put("code","4");
resultMap.put("msg",jsonObject.getString("msg")); resultMap.put("msg",jsonObject.getString("msg"));
return resultMap; return resultMap;
} }
@ -125,20 +125,22 @@ public class OrderService {
} }
public int checkNotify(String orderNumber){ public int checkNotify(String orderNumber){
if(notifyService.findNotifyByOrderNumber(orderNumber) != null) if(notifyService.findNotifyByOrderNumber(orderNumber) != null) {
return 1; return 1;
else } else {
return 0; return 0;
} }
}
public Boolean afterPaySucceedUpdateOrderStatus(String outTradeNo,String totalFee){ public Boolean afterPaySucceedUpdateOrderStatus(String outTradeNo,String totalFee){
int result = ordersDao.updateOrderStatus(outTradeNo,totalFee); int result = ordersDao.updateOrderStatus(outTradeNo,totalFee);
if(result == 1) if(result == 1) {
return true; return true;
else } else {
return false; return false;
} }
}
@Transactional @Transactional
public ResponseDTO<String> cancelOrder(String addOrSaveJson) throws Exception { public ResponseDTO<String> cancelOrder(String addOrSaveJson) throws Exception {