From 54a79af122407eca454633845ba279492aa49554 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Thu, 7 Sep 2023 14:51:28 +0800 Subject: [PATCH] 1 --- .../bweb/controller/HighTestController.java | 2 +- .../cweb/controller/Blx/BlxCarController.java | 258 ++++++++++++++++++ .../com/hai/blx/service/BlxCarService.java | 67 +++++ .../blx/service/impl/BlxCarServiceImpl.java | 88 ++++++ .../java/com/hai/dao/ApiBlxOrderMapper.java | 45 +-- .../com/hai/dao/ApiBlxOrderSqlProvider.java | 30 +- .../main/java/com/hai/entity/ApiBlxOrder.java | 32 ++- .../com/hai/entity/ApiBlxOrderExample.java | 108 ++++++-- .../com/hai/openApi/config/BlxConfig.java | 24 ++ .../openApi/service/ApiBlxCouponService.java | 30 ++ .../service/impl/ApiBlxCouponServiceImpl.java | 48 ++++ .../impl/ApiOrderCreateHandleServiceImpl.java | 75 ++++- .../service/impl/ApiOrderServiceImpl.java | 9 +- .../order/model/CreateOrderChildModel.java | 3 + .../service/OrderCreateHandleService.java | 20 ++ .../impl/OrderCreateHandleServiceImpl.java | 57 +++- .../impl/OrderPaySuccessServiceImpl.java | 62 +++++ .../order/service/impl/OrderServiceImpl.java | 25 +- .../hai/order/type/OrderChildGoodsType.java | 1 + .../resources/dev/commonConfig.properties | 2 +- .../business/BlxCouponController.java | 93 ------- .../com/v1/controller/orderController.java | 10 +- v1/src/main/resources/dev/application.yml | 5 + 23 files changed, 926 insertions(+), 168 deletions(-) create mode 100644 hai-cweb/src/main/java/com/cweb/controller/Blx/BlxCarController.java create mode 100644 hai-service/src/main/java/com/hai/blx/service/BlxCarService.java create mode 100644 hai-service/src/main/java/com/hai/blx/service/impl/BlxCarServiceImpl.java diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java index d9d2f7b2..37757ec7 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighTestController.java @@ -1 +1 @@ - package com.bweb.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.entity.*; import com.hai.model.ResponseData; import com.hai.openApi.config.BlxConfig; import com.hai.order.service.OrderService; import com.hai.order.type.OrderRefundOpUserType; import com.hai.order.utils.OrderUtil; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.bouncycastle.LICENSE; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private OrderService orderService; @Resource private HighUserCardService highUserCardService; @Resource private HighOrderService highOrderService; @Resource private BlxConfig blxConfig; @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解析") public ResponseData resolveResponse( @RequestParam(name = "data", required = false) String data ) { try { JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardConsume", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询汇联通工会卡消费记录") public ResponseData getHuiLianTongCardConsume(@RequestParam(name = "businessType", required = true) String businessType, @RequestParam(name = "cardNo", required = true) String cardNo, @RequestParam(name = "sdate", required = true) Long sdate, @RequestParam(name = "edate", required = true) Long edate, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { try { JSONObject consumptionRecord = HuiLianTongUnionCardConfig.queryConsumptionRecordByBusiness(businessType, cardNo, sdate, edate, pageNum, pageSize); if (StringUtils.isBlank(consumptionRecord.getString("data"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, ""); } JSONArray array = HuiLianTongUnionCardConfig.resolveResponse(consumptionRecord.getString("data")).getJSONArray("records"); return ResponseMsgUtil.success(array); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e); return ResponseMsgUtil.exception(e); } } // @RequestMapping(value = "/createOrder", method = RequestMethod.POST) // @ResponseBody // @ApiOperation(value = "创建订单") // public ResponseData createOrder(@RequestBody JSONObject object) { // try { // // Map mapPost = new HashMap<>(); // mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); // mapPost.put("merchId" , "20230258302"); // mapPost.put("timetable" , new Date().getTime()); // mapPost.put("orderNo" , "TEST" + OrderUtil.generateOrderNo()); // mapPost.put("productType" , object.getString("productType")); // mapPost.put("notifyUrl" , "test"); // // mapPost.put("content" , object.toString()); // System.out.println(mapPost); // // Map map = new HashMap<>(); // map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); // map.put("merchId" , "20230258302"); // map.put("timetable" , mapPost.get("timetable").toString()); // map.put("orderNo" , mapPost.get("orderNo")); // map.put("productType" , object.getString("productType")); // map.put("content" , object.toString()); // // System.out.println(map); // // mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); // return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/createOrder" , mapPost , new HashMap<>())); // } catch (Exception e) { // log.error("HighOrderController --> getBackendToken() error!", e); // return ResponseMsgUtil.exception(e); // } // } @RequestMapping(value = "/payOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付订单") public ResponseData payOrder(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/orderPay" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryOrderDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询订单详情") public ResponseData queryOrderDetail(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/queryOrderDetail" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/deposit", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡充值") public ResponseData deposit(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); HighChildOrder highChildOrder = order.getHighChildOrderList().get(0); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } // 汇联通充值 String goodsDesc = "汇联通充值"+order.getPayPrice()+"元"; String tranDesc = ""; String businessType = "ghk_deposit"; String orderNoAgain = OrderUtil.generateOrderNo(); order.setOrderStatus(Integer.valueOf(3)); order.setRemarks("工会卡再次充值订单号" + orderNoAgain); highOrderService.updateOrder(order); // 汇联通卡充值 JSONObject deposit = HuiLianTongUnionCardConfig.deposit(orderNoAgain, highChildOrder.getGoodsSpecName(), order.getPayPrice(), businessType, order.getPaySerialNo(), goodsDesc); return ResponseMsgUtil.success( HuiLianTongUnionCardConfig.resolveResponse(deposit.getString("data"))); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardByCardNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据卡号查询汇联通工会卡详情") public ResponseData getHuiLianTongCardByCardNo(@RequestParam(name = "cardNo", required = true) String cardNo) { try { // 查询工会卡 JSONObject cardInfo = HuiLianTongUnionCardConfig.queryBalance(cardNo); JSONObject resolveResponse = HuiLianTongUnionCardConfig.resolveResponse(cardInfo.getString("data")); return ResponseMsgUtil.success(resolveResponse); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardByCardNo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/consumption", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡支付") public ResponseData consumption(@RequestParam(name = "payRealPrice", required = true) BigDecimal payRealPrice, @RequestParam(name = "cardNo", required = true) String cardNo) { try { String goodsDesc = ""; String tranDesc = ""; String instCode = "11101527"; String businessType = "hisen_consume"; // 工会卡支付 JSONObject consumption = HuiLianTongUnionCardConfig.consumption(OrderUtil.generateOrderNo(), cardNo, payRealPrice, businessType, instCode, goodsDesc, tranDesc); if (!consumption.getString("respCode").equals("0000")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage")); } // 响应参数 JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); if (consumptionResult.getBoolean("success") != true) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumptionResult.getString("message")); } return ResponseMsgUtil.success(consumptionResult); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardByCardNo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/refundOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡退款") public ResponseData refundOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } orderService.refundOrder(order, "工会卡充值退款",OrderRefundOpUserType.TYPE1, null, "系统自动退款"); return ResponseMsgUtil.success("退款成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/externalOrderRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "对外订单退款") public ResponseData externalOrderRefund(@RequestParam(name = "paySerialNo", required = true) String paySerialNo, @RequestParam(name = "WxMchId", required = true) String WxMchId, @RequestParam(name = "payRealPrice", required = true) String payRealPrice) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); mapPost.put("merchId" , "20230394901"); mapPost.put("paySerialNo" , paySerialNo); mapPost.put("wxMchId" , WxMchId); mapPost.put("payRealPrice" , payRealPrice); mapPost.put("refundPrice" , payRealPrice); Map map = new HashMap<>(); map.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); map.put("merchId" , "20230394901"); map.put("paySerialNo" , paySerialNo); map.put("wxMchId" , WxMchId); map.put("payRealPrice" , payRealPrice); map.put("refundPrice" , payRealPrice); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/externalOrderRefund" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getBlxCouponBalance", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询停车券") public ResponseData getBlxCouponBalance(@RequestParam(name = "phone", required = true) String phone) { try { highUserCardService.getBlxCouponBalance(phone); return ResponseMsgUtil.success("object"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryJsParking", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询捷顺停车场") public ResponseData queryJsParking(@RequestParam(name = "gps", required = true) String gps) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("gps" , gps); mapPost.put("range" , "1000"); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/queryJsParking" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getUserCouponPage", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询捷顺停车场") public ResponseData getUserCouponPage(@RequestParam(name = "phone", required = true) String phone) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("phone" , phone); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/getUserCouponPage" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryJsOrderList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询车牌订单列表信息") public ResponseData queryJsOrderList(@RequestParam(name = "carNo", required = true) String carNo, @RequestParam(name = "orderStatus", required = true) String orderStatus) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("orderStatus" , orderStatus); mapPost.put("carNo" , carNo); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/queryJsOrderList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getCouponList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询车牌订单列表信息") public ResponseData getCouponList() { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/getCouponList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/sendCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "发放券") public ResponseData sendCoupon(@RequestParam(name = "couponCode", required = true) String couponCode, @RequestParam(name = "receiverCount", required = true) String receiverCount, @RequestParam(name = "receiverPhone", required = true) String receiverPhone) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/getCouponList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file + package com.bweb.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.entity.*; import com.hai.model.ResponseData; import com.hai.openApi.config.BlxConfig; import com.hai.order.service.OrderService; import com.hai.order.type.OrderRefundOpUserType; import com.hai.order.utils.OrderUtil; import com.hai.service.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.bouncycastle.LICENSE; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @Auther: 胡锐 * @Description: * @Date: 2021/3/26 23:08 */ @Controller @RequestMapping(value = "/test") @Api(value = "订单接口") public class HighTestController { private static Logger log = LoggerFactory.getLogger(HighTestController.class); @Resource private OrderService orderService; @Resource private HighUserCardService highUserCardService; @Resource private HighOrderService highOrderService; @Resource private BlxConfig blxConfig; @RequestMapping(value="/resolveResponse",method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "解析") public ResponseData resolveResponse( @RequestParam(name = "data", required = false) String data ) { try { JSONObject cardInfoObject = HuiLianTongUnionCardConfig.resolveResponse(data); return ResponseMsgUtil.success(cardInfoObject); } catch (Exception e) { log.error("getUserByTelephone",e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardConsume", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询汇联通工会卡消费记录") public ResponseData getHuiLianTongCardConsume(@RequestParam(name = "businessType", required = true) String businessType, @RequestParam(name = "cardNo", required = true) String cardNo, @RequestParam(name = "sdate", required = true) Long sdate, @RequestParam(name = "edate", required = true) Long edate, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request) { try { JSONObject consumptionRecord = HuiLianTongUnionCardConfig.queryConsumptionRecordByBusiness(businessType, cardNo, sdate, edate, pageNum, pageSize); if (StringUtils.isBlank(consumptionRecord.getString("data"))) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR, ""); } JSONArray array = HuiLianTongUnionCardConfig.resolveResponse(consumptionRecord.getString("data")).getJSONArray("records"); return ResponseMsgUtil.success(array); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardConsume() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/createOrder", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "创建订单") public ResponseData createOrder(@RequestBody JSONObject object) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("timetable" , new Date().getTime()); mapPost.put("orderNo" , "TEST" + OrderUtil.generateOrderNo()); mapPost.put("productType" , object.getString("productType")); mapPost.put("content" , object.getJSONObject("content").toString()); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/createOrder" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/payOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "支付订单") public ResponseData payOrder(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/orderPay" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryOrderDetail", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询订单详情") public ResponseData queryOrderDetail(@RequestParam(name = "mchOrderNo", required = true) String mchOrderNo) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); mapPost.put("merchId" , "20230258302"); mapPost.put("mchOrderNo" , mchOrderNo); Map map = new HashMap<>(); map.put("apiKey" , "0C7897EA3BD96156A5881618FF2FF645"); map.put("merchId" , "20230258302"); map.put("mchOrderNo" , mchOrderNo); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/order/queryOrderDetail" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/deposit", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡充值") public ResponseData deposit(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); HighChildOrder highChildOrder = order.getHighChildOrderList().get(0); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } // 汇联通充值 String goodsDesc = "汇联通充值"+order.getPayPrice()+"元"; String tranDesc = ""; String businessType = "ghk_deposit"; String orderNoAgain = OrderUtil.generateOrderNo(); order.setOrderStatus(Integer.valueOf(3)); order.setRemarks("工会卡再次充值订单号" + orderNoAgain); highOrderService.updateOrder(order); // 汇联通卡充值 JSONObject deposit = HuiLianTongUnionCardConfig.deposit(orderNoAgain, highChildOrder.getGoodsSpecName(), order.getPayPrice(), businessType, order.getPaySerialNo(), goodsDesc); return ResponseMsgUtil.success( HuiLianTongUnionCardConfig.resolveResponse(deposit.getString("data"))); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getHuiLianTongCardByCardNo", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "根据卡号查询汇联通工会卡详情") public ResponseData getHuiLianTongCardByCardNo(@RequestParam(name = "cardNo", required = true) String cardNo) { try { // 查询工会卡 JSONObject cardInfo = HuiLianTongUnionCardConfig.queryBalance(cardNo); JSONObject resolveResponse = HuiLianTongUnionCardConfig.resolveResponse(cardInfo.getString("data")); return ResponseMsgUtil.success(resolveResponse); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardByCardNo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/consumption", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡支付") public ResponseData consumption(@RequestParam(name = "payRealPrice", required = true) BigDecimal payRealPrice, @RequestParam(name = "cardNo", required = true) String cardNo) { try { String goodsDesc = ""; String tranDesc = ""; String instCode = "11101527"; String businessType = "hisen_consume"; // 工会卡支付 JSONObject consumption = HuiLianTongUnionCardConfig.consumption(OrderUtil.generateOrderNo(), cardNo, payRealPrice, businessType, instCode, goodsDesc, tranDesc); if (!consumption.getString("respCode").equals("0000")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumption.getString("respMessage")); } // 响应参数 JSONObject consumptionResult = HuiLianTongUnionCardConfig.resolveResponse(consumption.getString("data")); if (consumptionResult.getBoolean("success") != true) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, consumptionResult.getString("message")); } return ResponseMsgUtil.success(consumptionResult); } catch (Exception e) { log.error("HighUserCardController --> getHuiLianTongCardByCardNo() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/refundOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "工会卡退款") public ResponseData refundOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { try { HighOrder order = highOrderService.getOrderByOrderNo(orderNo); if (order.getOrderStatus() != 2) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); } orderService.refundOrder(order, "工会卡充值退款",OrderRefundOpUserType.TYPE1, null, "系统自动退款"); return ResponseMsgUtil.success("退款成功"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/externalOrderRefund", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "对外订单退款") public ResponseData externalOrderRefund(@RequestParam(name = "paySerialNo", required = true) String paySerialNo, @RequestParam(name = "WxMchId", required = true) String WxMchId, @RequestParam(name = "payRealPrice", required = true) String payRealPrice) { try { Map mapPost = new HashMap<>(); mapPost.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); mapPost.put("merchId" , "20230394901"); mapPost.put("paySerialNo" , paySerialNo); mapPost.put("wxMchId" , WxMchId); mapPost.put("payRealPrice" , payRealPrice); mapPost.put("refundPrice" , payRealPrice); Map map = new HashMap<>(); map.put("apiKey" , "B94B5E62807FA56A7260AB581D8A1B48"); map.put("merchId" , "20230394901"); map.put("paySerialNo" , paySerialNo); map.put("wxMchId" , WxMchId); map.put("payRealPrice" , payRealPrice); map.put("refundPrice" , payRealPrice); System.out.println(map); mapPost.put("sign" , WxUtils.generateSignApi(map, MapUtils.getString(map, "apiKey"), WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("https://hsg.dctpay.com/v1/order/externalOrderRefund" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getBlxCouponBalance", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询停车券") public ResponseData getBlxCouponBalance(@RequestParam(name = "phone", required = true) String phone) { try { highUserCardService.getBlxCouponBalance(phone); return ResponseMsgUtil.success("object"); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryJsParking", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询捷顺停车场") public ResponseData queryJsParking(@RequestParam(name = "gps", required = true) String gps) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("gps" , gps); mapPost.put("range" , "1000"); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/queryJsParking" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getUserCouponPage", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询捷顺停车场") public ResponseData getUserCouponPage(@RequestParam(name = "phone", required = true) String phone) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("phone" , phone); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/getUserCouponPage" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/queryJsOrderList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询车牌订单列表信息") public ResponseData queryJsOrderList(@RequestParam(name = "carNo", required = true) String carNo, @RequestParam(name = "orderStatus", required = true) String orderStatus) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("orderStatus" , orderStatus); mapPost.put("carNo" , carNo); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/queryJsOrderList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/getCouponList", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "查询车牌订单列表信息") public ResponseData getCouponList() { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/getCouponList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } @RequestMapping(value = "/sendCoupon", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "发放券") public ResponseData sendCoupon(@RequestParam(name = "couponCode", required = true) String couponCode, @RequestParam(name = "receiverCount", required = true) String receiverCount, @RequestParam(name = "receiverPhone", required = true) String receiverPhone) { try { Map mapPost = new HashMap<>(); mapPost.put("merchId" , "20230258302"); mapPost.put("sign" , WxUtils.generateSignApi(mapPost, "0C7897EA3BD96156A5881618FF2FF645", WXPayConstants.SignType.MD5)); return ResponseMsgUtil.success(HttpsUtils.doPost("http://localhost:9902/v1/blxCoupon/getCouponList" , mapPost , new HashMap<>())); } catch (Exception e) { log.error("HighOrderController --> getBackendToken() error!", e); return ResponseMsgUtil.exception(e); } } } \ No newline at end of file diff --git a/hai-cweb/src/main/java/com/cweb/controller/Blx/BlxCarController.java b/hai-cweb/src/main/java/com/cweb/controller/Blx/BlxCarController.java new file mode 100644 index 00000000..8389a4e9 --- /dev/null +++ b/hai-cweb/src/main/java/com/cweb/controller/Blx/BlxCarController.java @@ -0,0 +1,258 @@ +package com.cweb.controller.Blx; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +import com.hai.blx.service.BlxCarService; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.security.SessionObject; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.entity.BlxCarInfo; + +import com.hai.model.HighUserModel; +import com.hai.model.ResponseData; +import com.hai.openApi.config.BlxConfig; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Controller +@RequestMapping(value = "/blxCar") +@Api(value = "比邻星车辆业务") +public class BlxCarController { + + Logger log = LoggerFactory.getLogger(BlxCarController.class); + + @Autowired + private UserCenter userCenter; + + @Resource + private BlxConfig blxConfig; + + @Resource + private BlxCarService blxCarService; + + @RequestMapping(value = "/queryJsParking", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询附近停车场") + public ResponseData queryJsParking( + @RequestParam(value = "gps", required = true) String gps, + HttpServletRequest request + ) { + try { + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("range" , 10); + jsonObject.put("gps" , gps); + + JSONObject data = blxConfig.queryJsParking(jsonObject); + + if (data.getInteger("code") != 1) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, data.getString("msg")); + } + + return ResponseMsgUtil.success(data.getJSONObject("data").getJSONArray("parkList")); + + } catch (Exception e) { + log.error("GoodsDetailController --> getListUser() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/insertCarInfo",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "增加车辆信息") + public ResponseData insertCarInfo(@RequestBody BlxCarInfo carInfo, HttpServletRequest request) { + try { + + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + if (carInfo.getCarNoType() == null + || StringUtils.isBlank(carInfo.getCarNo())) { + log.error("HighCouponController -> insertCoupon() error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + carInfo.setCreateTime(new Date()); + carInfo.setStatus(1); + carInfo.setUpdateTime(new Date()); + carInfo.setUserId(userInfoModel.getHighUser().getId()); + + blxCarService.insertCar(carInfo); + + return ResponseMsgUtil.success("新增成功"); + + + } catch (Exception e) { + log.error("GoodsDetailController --> getListUser() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value="/updateCarInfo",method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "修改车辆信息") + public ResponseData updateCarInfo(@RequestBody BlxCarInfo carInfo) { + try { + + if (carInfo.getId() == null || + carInfo.getCarNoType() == null + || StringUtils.isBlank(carInfo.getCarNo())) { + log.error("HighCouponController -> insertCoupon() error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + BlxCarInfo blxCarInfo = blxCarService.findCarInfoById(carInfo.getId()); + + blxCarInfo.setStatus(1); + blxCarInfo.setCarNoType(carInfo.getCarNoType()); + blxCarInfo.setCarNo(carInfo.getCarNo()); + blxCarInfo.setUpdateTime(new Date()); + + blxCarService.updateCar(blxCarInfo); + + return ResponseMsgUtil.success("修改成功"); + + + } catch (Exception e) { + log.error("GoodsDetailController --> getListUser() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/deleteCarNoInfo", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "删除车辆车牌信息") + public ResponseData deleteCarNoInfo( + @RequestParam(value = "id", required = true) Long id, + HttpServletRequest request + ) { + try { + + BlxCarInfo blxCarInfo = blxCarService.findCarInfoById(id); + + blxCarInfo.setStatus(0); + blxCarService.updateCar(blxCarInfo); + + return ResponseMsgUtil.success("删除成功!"); + + } catch (Exception e) { + log.error("GoodsDetailController --> getListUser() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + + @RequestMapping(value = "/getCarInfoList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询用户车辆") + public ResponseData getCarInfoList(HttpServletRequest request) { + try { + + + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + Map map = new HashMap<>(); + map.put("userId" , userInfoModel.getHighUser().getId()); + + return ResponseMsgUtil.success(blxCarService.getCarInfoList(map)); + + } catch (Exception e) { + log.error("GoodsDetailController --> getListUser() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getCarNoByOrder", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据车牌查询订单") + public ResponseData getCarNoByOrder( + @RequestParam(value = "carNo", required = true) String carNo, + HttpServletRequest request + ) { + try { + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("carNo" , carNo); + jsonObject.put("orderStatus" , "03"); + + JSONObject data = blxConfig.queryJsOrderList(jsonObject); + + JSONObject jsonObject04 = new JSONObject(); + jsonObject04.put("carNo" , carNo); + jsonObject04.put("orderStatus" , "04"); + + JSONObject data04 = blxConfig.queryJsOrderList(jsonObject04); + + + if (data.getInteger("code") != 1) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, data.getString("msg")); + } + + JSONArray jsonArray = data.getJSONObject("data").getJSONArray("ordlist"); + jsonArray.addAll(data04.getJSONObject("data").getJSONArray("ordlist")); + + return ResponseMsgUtil.success(jsonArray); + + } catch (Exception e) { + log.error("GoodsDetailController --> getListUser() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/defaultCarNoInfo", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "默认车牌") + public ResponseData defaultCarNoInfo( + @RequestParam(value = "id", required = true) Long id, + HttpServletRequest request + ) { + try { + + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + Map map = new HashMap<>(); + map.put("userId" , userInfoModel.getHighUser().getId()); + + List list = blxCarService.getCarInfoList(map); + + for (BlxCarInfo carInfo : list) { + carInfo.setDefaultCarNo(false); + blxCarService.updateCar(carInfo); + } + + BlxCarInfo blxCarInfo = blxCarService.findCarInfoById(id); + + blxCarInfo.setDefaultCarNo(true); + blxCarService.updateCar(blxCarInfo); + + return ResponseMsgUtil.success("设置成功!"); + + } catch (Exception e) { + log.error("GoodsDetailController --> getListUser() error!", e); + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/hai-service/src/main/java/com/hai/blx/service/BlxCarService.java b/hai-service/src/main/java/com/hai/blx/service/BlxCarService.java new file mode 100644 index 00000000..26b90fc1 --- /dev/null +++ b/hai-service/src/main/java/com/hai/blx/service/BlxCarService.java @@ -0,0 +1,67 @@ +package com.hai.blx.service; + +import com.hai.entity.BlxCarInfo; +import com.hai.entity.GoodsPresent; + +import java.util.List; +import java.util.Map; + +/** + * @serviceName .java + * @author Sum1Dream + * @version 1.0.0 + * @Description // 比邻星车辆业务 + * @createTime 11:28 2023/9/5 + **/ +public interface BlxCarService { + + /** + * @Author Sum1Dream + * @Name insertCar + * @Description // 新增车辆信息 + * @Date 11:29 2023/9/5 + * @Param carInfo + * @return void + */ + void insertCar(BlxCarInfo carInfo); + + /** + * @Author Sum1Dream + * @Name updateCar + * @Description // 更新车辆信息 + * @Date 11:29 2023/9/5 + * @Param carInfo + * @return void + */ + void updateCar(BlxCarInfo carInfo); + + /** + * @Author Sum1Dream + * @Name getCarInfoList + * @Description // 查询车辆信息列表 + * @Date 11:30 2023/9/5 + * @Param map + * @return java.util.List + */ + List getCarInfoList(Map map); + + /** + * @Author Sum1Dream + * @Name findCarInfoByMap + * @Description //TODO + * @Date 14:14 2023/9/5 + * @Param map + * @return com.hai.entity.BlxCarInfo + */ + BlxCarInfo findCarInfoByMap(Map map); + + /** + * @Author Sum1Dream + * @Name findCarInfoById + * @Description // 根据ID查询详情 + * @Date 15:13 2023/9/5 + * @Param id + * @return com.hai.entity.BlxCarInfo + */ + BlxCarInfo findCarInfoById(Long id); +} diff --git a/hai-service/src/main/java/com/hai/blx/service/impl/BlxCarServiceImpl.java b/hai-service/src/main/java/com/hai/blx/service/impl/BlxCarServiceImpl.java new file mode 100644 index 00000000..f5ed1e67 --- /dev/null +++ b/hai-service/src/main/java/com/hai/blx/service/impl/BlxCarServiceImpl.java @@ -0,0 +1,88 @@ +package com.hai.blx.service.impl; + +import com.hai.blx.service.BlxCarService; +import com.hai.dao.BlxCarInfoMapper; +import com.hai.entity.BlxCarInfo; +import com.hai.entity.BlxCarInfoExample; +import org.apache.commons.collections4.MapUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +@Service("blxCarService") +public class BlxCarServiceImpl implements BlxCarService { + + @Resource + private BlxCarInfoMapper blxCarInfoMapper; + + @Override + public void insertCar(BlxCarInfo carInfo) { + blxCarInfoMapper.insert(carInfo); + } + + @Override + public void updateCar(BlxCarInfo carInfo) { + blxCarInfoMapper.updateByPrimaryKey(carInfo); + } + + @Override + public List getCarInfoList(Map map) { + BlxCarInfoExample example = new BlxCarInfoExample(); + BlxCarInfoExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getString(map, "carNo") != null) { + criteria.andCarNoEqualTo(MapUtils.getString(map, "carNo")); + } + if (MapUtils.getInteger(map, "carNoType") != null) { + criteria.andCarNoTypeEqualTo(MapUtils.getInteger(map, "carNoType") ); + } + if (MapUtils.getLong(map, "userId") != null) { + criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId") ); + } + if (MapUtils.getInteger(map, "status") != null) { + criteria.andStatusEqualTo(MapUtils.getInteger(map, "status") ); + } else { + criteria.andStatusEqualTo(1); + } + + return blxCarInfoMapper.selectByExample(example); + } + + @Override + public BlxCarInfo findCarInfoByMap(Map map) { + + BlxCarInfoExample example = new BlxCarInfoExample(); + BlxCarInfoExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getString(map, "carNo") != null) { + criteria.andCarNoEqualTo(MapUtils.getString(map, "carNo")); + } + if (MapUtils.getInteger(map, "carNoType") != null) { + criteria.andCarNoTypeEqualTo(MapUtils.getInteger(map, "carNoType") ); + } + if (MapUtils.getLong(map, "userId") != null) { + criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId") ); + } + if (MapUtils.getLong(map, "id") != null) { + criteria.andIdEqualTo(MapUtils.getLong(map, "id") ); + } + if (MapUtils.getInteger(map, "status") != null) { + criteria.andStatusEqualTo(MapUtils.getInteger(map, "status") ); + } + + List list = blxCarInfoMapper.selectByExample(example); + + if (list.size() > 0) { + return list.get(0); + } + + return null; + } + + @Override + public BlxCarInfo findCarInfoById(Long id) { + return blxCarInfoMapper.selectByPrimaryKey(id); + } +} diff --git a/hai-service/src/main/java/com/hai/dao/ApiBlxOrderMapper.java b/hai-service/src/main/java/com/hai/dao/ApiBlxOrderMapper.java index 9e46309e..26a3b174 100644 --- a/hai-service/src/main/java/com/hai/dao/ApiBlxOrderMapper.java +++ b/hai-service/src/main/java/com/hai/dao/ApiBlxOrderMapper.java @@ -42,23 +42,25 @@ public interface ApiBlxOrderMapper extends ApiBlxOrderMapperExt { "insert into api_blx_order (mer_id, order_id, ", "mer_order_id, park_order_id, ", "in_time, out_time, ", - "park_time, park_name, ", - "park_id, car_seat_id, ", - "prak_price, coupon_price, ", - "order_type, order_status, ", - "create_time, update_time, ", - "ext_1, ext_2, ext_3, ", - "ext_4, ext_5, ext_6)", + "over_time, park_time, ", + "park_name, park_id, ", + "car_seat_id, park_price, ", + "coupon_price, order_type, ", + "order_status, create_time, ", + "update_time, ext_1, ", + "ext_2, ext_3, ext_4, ", + "ext_5, ext_6)", "values (#{merId,jdbcType=VARCHAR}, #{orderId,jdbcType=BIGINT}, ", "#{merOrderId,jdbcType=VARCHAR}, #{parkOrderId,jdbcType=VARCHAR}, ", "#{inTime,jdbcType=TIMESTAMP}, #{outTime,jdbcType=TIMESTAMP}, ", - "#{parkTime,jdbcType=INTEGER}, #{parkName,jdbcType=VARCHAR}, ", - "#{parkId,jdbcType=BIGINT}, #{carSeatId,jdbcType=BIGINT}, ", - "#{prakPrice,jdbcType=DECIMAL}, #{couponPrice,jdbcType=DECIMAL}, ", - "#{orderType,jdbcType=INTEGER}, #{orderStatus,jdbcType=INTEGER}, ", - "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", - "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ", - "#{ext4,jdbcType=VARCHAR}, #{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})" + "#{overTime,jdbcType=INTEGER}, #{parkTime,jdbcType=INTEGER}, ", + "#{parkName,jdbcType=VARCHAR}, #{parkId,jdbcType=BIGINT}, ", + "#{carSeatId,jdbcType=BIGINT}, #{parkPrice,jdbcType=DECIMAL}, ", + "#{couponPrice,jdbcType=DECIMAL}, #{orderType,jdbcType=INTEGER}, ", + "#{orderStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ", + "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ", + "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, #{ext4,jdbcType=VARCHAR}, ", + "#{ext5,jdbcType=VARCHAR}, #{ext6,jdbcType=VARCHAR})" }) @Options(useGeneratedKeys=true,keyProperty="id") int insert(ApiBlxOrder record); @@ -76,11 +78,12 @@ public interface ApiBlxOrderMapper extends ApiBlxOrderMapperExt { @Result(column="park_order_id", property="parkOrderId", jdbcType=JdbcType.VARCHAR), @Result(column="in_time", property="inTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="out_time", property="outTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="over_time", property="overTime", jdbcType=JdbcType.INTEGER), @Result(column="park_time", property="parkTime", jdbcType=JdbcType.INTEGER), @Result(column="park_name", property="parkName", jdbcType=JdbcType.VARCHAR), @Result(column="park_id", property="parkId", jdbcType=JdbcType.BIGINT), @Result(column="car_seat_id", property="carSeatId", jdbcType=JdbcType.BIGINT), - @Result(column="prak_price", property="prakPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="park_price", property="parkPrice", jdbcType=JdbcType.DECIMAL), @Result(column="coupon_price", property="couponPrice", jdbcType=JdbcType.DECIMAL), @Result(column="order_type", property="orderType", jdbcType=JdbcType.INTEGER), @Result(column="order_status", property="orderStatus", jdbcType=JdbcType.INTEGER), @@ -97,9 +100,9 @@ public interface ApiBlxOrderMapper extends ApiBlxOrderMapperExt { @Select({ "select", - "id, mer_id, order_id, mer_order_id, park_order_id, in_time, out_time, park_time, ", - "park_name, park_id, car_seat_id, prak_price, coupon_price, order_type, order_status, ", - "create_time, update_time, ext_1, ext_2, ext_3, ext_4, ext_5, ext_6", + "id, mer_id, order_id, mer_order_id, park_order_id, in_time, out_time, over_time, ", + "park_time, park_name, park_id, car_seat_id, park_price, coupon_price, order_type, ", + "order_status, create_time, update_time, ext_1, ext_2, ext_3, ext_4, ext_5, ext_6", "from api_blx_order", "where id = #{id,jdbcType=BIGINT}" }) @@ -111,11 +114,12 @@ public interface ApiBlxOrderMapper extends ApiBlxOrderMapperExt { @Result(column="park_order_id", property="parkOrderId", jdbcType=JdbcType.VARCHAR), @Result(column="in_time", property="inTime", jdbcType=JdbcType.TIMESTAMP), @Result(column="out_time", property="outTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="over_time", property="overTime", jdbcType=JdbcType.INTEGER), @Result(column="park_time", property="parkTime", jdbcType=JdbcType.INTEGER), @Result(column="park_name", property="parkName", jdbcType=JdbcType.VARCHAR), @Result(column="park_id", property="parkId", jdbcType=JdbcType.BIGINT), @Result(column="car_seat_id", property="carSeatId", jdbcType=JdbcType.BIGINT), - @Result(column="prak_price", property="prakPrice", jdbcType=JdbcType.DECIMAL), + @Result(column="park_price", property="parkPrice", jdbcType=JdbcType.DECIMAL), @Result(column="coupon_price", property="couponPrice", jdbcType=JdbcType.DECIMAL), @Result(column="order_type", property="orderType", jdbcType=JdbcType.INTEGER), @Result(column="order_status", property="orderStatus", jdbcType=JdbcType.INTEGER), @@ -147,11 +151,12 @@ public interface ApiBlxOrderMapper extends ApiBlxOrderMapperExt { "park_order_id = #{parkOrderId,jdbcType=VARCHAR},", "in_time = #{inTime,jdbcType=TIMESTAMP},", "out_time = #{outTime,jdbcType=TIMESTAMP},", + "over_time = #{overTime,jdbcType=INTEGER},", "park_time = #{parkTime,jdbcType=INTEGER},", "park_name = #{parkName,jdbcType=VARCHAR},", "park_id = #{parkId,jdbcType=BIGINT},", "car_seat_id = #{carSeatId,jdbcType=BIGINT},", - "prak_price = #{prakPrice,jdbcType=DECIMAL},", + "park_price = #{parkPrice,jdbcType=DECIMAL},", "coupon_price = #{couponPrice,jdbcType=DECIMAL},", "order_type = #{orderType,jdbcType=INTEGER},", "order_status = #{orderStatus,jdbcType=INTEGER},", diff --git a/hai-service/src/main/java/com/hai/dao/ApiBlxOrderSqlProvider.java b/hai-service/src/main/java/com/hai/dao/ApiBlxOrderSqlProvider.java index 1e70959e..e4d0a2e4 100644 --- a/hai-service/src/main/java/com/hai/dao/ApiBlxOrderSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/ApiBlxOrderSqlProvider.java @@ -52,6 +52,10 @@ public class ApiBlxOrderSqlProvider { sql.VALUES("out_time", "#{outTime,jdbcType=TIMESTAMP}"); } + if (record.getOverTime() != null) { + sql.VALUES("over_time", "#{overTime,jdbcType=INTEGER}"); + } + if (record.getParkTime() != null) { sql.VALUES("park_time", "#{parkTime,jdbcType=INTEGER}"); } @@ -68,8 +72,8 @@ public class ApiBlxOrderSqlProvider { sql.VALUES("car_seat_id", "#{carSeatId,jdbcType=BIGINT}"); } - if (record.getPrakPrice() != null) { - sql.VALUES("prak_price", "#{prakPrice,jdbcType=DECIMAL}"); + if (record.getParkPrice() != null) { + sql.VALUES("park_price", "#{parkPrice,jdbcType=DECIMAL}"); } if (record.getCouponPrice() != null) { @@ -132,11 +136,12 @@ public class ApiBlxOrderSqlProvider { sql.SELECT("park_order_id"); sql.SELECT("in_time"); sql.SELECT("out_time"); + sql.SELECT("over_time"); sql.SELECT("park_time"); sql.SELECT("park_name"); sql.SELECT("park_id"); sql.SELECT("car_seat_id"); - sql.SELECT("prak_price"); + sql.SELECT("park_price"); sql.SELECT("coupon_price"); sql.SELECT("order_type"); sql.SELECT("order_status"); @@ -193,6 +198,10 @@ public class ApiBlxOrderSqlProvider { sql.SET("out_time = #{record.outTime,jdbcType=TIMESTAMP}"); } + if (record.getOverTime() != null) { + sql.SET("over_time = #{record.overTime,jdbcType=INTEGER}"); + } + if (record.getParkTime() != null) { sql.SET("park_time = #{record.parkTime,jdbcType=INTEGER}"); } @@ -209,8 +218,8 @@ public class ApiBlxOrderSqlProvider { sql.SET("car_seat_id = #{record.carSeatId,jdbcType=BIGINT}"); } - if (record.getPrakPrice() != null) { - sql.SET("prak_price = #{record.prakPrice,jdbcType=DECIMAL}"); + if (record.getParkPrice() != null) { + sql.SET("park_price = #{record.parkPrice,jdbcType=DECIMAL}"); } if (record.getCouponPrice() != null) { @@ -272,11 +281,12 @@ public class ApiBlxOrderSqlProvider { sql.SET("park_order_id = #{record.parkOrderId,jdbcType=VARCHAR}"); sql.SET("in_time = #{record.inTime,jdbcType=TIMESTAMP}"); sql.SET("out_time = #{record.outTime,jdbcType=TIMESTAMP}"); + sql.SET("over_time = #{record.overTime,jdbcType=INTEGER}"); sql.SET("park_time = #{record.parkTime,jdbcType=INTEGER}"); sql.SET("park_name = #{record.parkName,jdbcType=VARCHAR}"); sql.SET("park_id = #{record.parkId,jdbcType=BIGINT}"); sql.SET("car_seat_id = #{record.carSeatId,jdbcType=BIGINT}"); - sql.SET("prak_price = #{record.prakPrice,jdbcType=DECIMAL}"); + sql.SET("park_price = #{record.parkPrice,jdbcType=DECIMAL}"); sql.SET("coupon_price = #{record.couponPrice,jdbcType=DECIMAL}"); sql.SET("order_type = #{record.orderType,jdbcType=INTEGER}"); sql.SET("order_status = #{record.orderStatus,jdbcType=INTEGER}"); @@ -322,6 +332,10 @@ public class ApiBlxOrderSqlProvider { sql.SET("out_time = #{outTime,jdbcType=TIMESTAMP}"); } + if (record.getOverTime() != null) { + sql.SET("over_time = #{overTime,jdbcType=INTEGER}"); + } + if (record.getParkTime() != null) { sql.SET("park_time = #{parkTime,jdbcType=INTEGER}"); } @@ -338,8 +352,8 @@ public class ApiBlxOrderSqlProvider { sql.SET("car_seat_id = #{carSeatId,jdbcType=BIGINT}"); } - if (record.getPrakPrice() != null) { - sql.SET("prak_price = #{prakPrice,jdbcType=DECIMAL}"); + if (record.getParkPrice() != null) { + sql.SET("park_price = #{parkPrice,jdbcType=DECIMAL}"); } if (record.getCouponPrice() != null) { diff --git a/hai-service/src/main/java/com/hai/entity/ApiBlxOrder.java b/hai-service/src/main/java/com/hai/entity/ApiBlxOrder.java index 7a9d2bab..3ed6872e 100644 --- a/hai-service/src/main/java/com/hai/entity/ApiBlxOrder.java +++ b/hai-service/src/main/java/com/hai/entity/ApiBlxOrder.java @@ -49,6 +49,11 @@ public class ApiBlxOrder implements Serializable { */ private Date outTime; + /** + * 超时时长 + */ + private Integer overTime; + /** * 停车时长 */ @@ -72,7 +77,7 @@ public class ApiBlxOrder implements Serializable { /** * 停车金额 */ - private BigDecimal prakPrice; + private BigDecimal parkPrice; /** * 停车券金额 @@ -187,6 +192,14 @@ public class ApiBlxOrder implements Serializable { this.outTime = outTime; } + public Integer getOverTime() { + return overTime; + } + + public void setOverTime(Integer overTime) { + this.overTime = overTime; + } + public Integer getParkTime() { return parkTime; } @@ -219,12 +232,12 @@ public class ApiBlxOrder implements Serializable { this.carSeatId = carSeatId; } - public BigDecimal getPrakPrice() { - return prakPrice; + public BigDecimal getParkPrice() { + return parkPrice; } - public void setPrakPrice(BigDecimal prakPrice) { - this.prakPrice = prakPrice; + public void setParkPrice(BigDecimal parkPrice) { + this.parkPrice = parkPrice; } public BigDecimal getCouponPrice() { @@ -334,11 +347,12 @@ public class ApiBlxOrder implements Serializable { && (this.getParkOrderId() == null ? other.getParkOrderId() == null : this.getParkOrderId().equals(other.getParkOrderId())) && (this.getInTime() == null ? other.getInTime() == null : this.getInTime().equals(other.getInTime())) && (this.getOutTime() == null ? other.getOutTime() == null : this.getOutTime().equals(other.getOutTime())) + && (this.getOverTime() == null ? other.getOverTime() == null : this.getOverTime().equals(other.getOverTime())) && (this.getParkTime() == null ? other.getParkTime() == null : this.getParkTime().equals(other.getParkTime())) && (this.getParkName() == null ? other.getParkName() == null : this.getParkName().equals(other.getParkName())) && (this.getParkId() == null ? other.getParkId() == null : this.getParkId().equals(other.getParkId())) && (this.getCarSeatId() == null ? other.getCarSeatId() == null : this.getCarSeatId().equals(other.getCarSeatId())) - && (this.getPrakPrice() == null ? other.getPrakPrice() == null : this.getPrakPrice().equals(other.getPrakPrice())) + && (this.getParkPrice() == null ? other.getParkPrice() == null : this.getParkPrice().equals(other.getParkPrice())) && (this.getCouponPrice() == null ? other.getCouponPrice() == null : this.getCouponPrice().equals(other.getCouponPrice())) && (this.getOrderType() == null ? other.getOrderType() == null : this.getOrderType().equals(other.getOrderType())) && (this.getOrderStatus() == null ? other.getOrderStatus() == null : this.getOrderStatus().equals(other.getOrderStatus())) @@ -363,11 +377,12 @@ public class ApiBlxOrder implements Serializable { result = prime * result + ((getParkOrderId() == null) ? 0 : getParkOrderId().hashCode()); result = prime * result + ((getInTime() == null) ? 0 : getInTime().hashCode()); result = prime * result + ((getOutTime() == null) ? 0 : getOutTime().hashCode()); + result = prime * result + ((getOverTime() == null) ? 0 : getOverTime().hashCode()); result = prime * result + ((getParkTime() == null) ? 0 : getParkTime().hashCode()); result = prime * result + ((getParkName() == null) ? 0 : getParkName().hashCode()); result = prime * result + ((getParkId() == null) ? 0 : getParkId().hashCode()); result = prime * result + ((getCarSeatId() == null) ? 0 : getCarSeatId().hashCode()); - result = prime * result + ((getPrakPrice() == null) ? 0 : getPrakPrice().hashCode()); + result = prime * result + ((getParkPrice() == null) ? 0 : getParkPrice().hashCode()); result = prime * result + ((getCouponPrice() == null) ? 0 : getCouponPrice().hashCode()); result = prime * result + ((getOrderType() == null) ? 0 : getOrderType().hashCode()); result = prime * result + ((getOrderStatus() == null) ? 0 : getOrderStatus().hashCode()); @@ -395,11 +410,12 @@ public class ApiBlxOrder implements Serializable { sb.append(", parkOrderId=").append(parkOrderId); sb.append(", inTime=").append(inTime); sb.append(", outTime=").append(outTime); + sb.append(", overTime=").append(overTime); sb.append(", parkTime=").append(parkTime); sb.append(", parkName=").append(parkName); sb.append(", parkId=").append(parkId); sb.append(", carSeatId=").append(carSeatId); - sb.append(", prakPrice=").append(prakPrice); + sb.append(", parkPrice=").append(parkPrice); sb.append(", couponPrice=").append(couponPrice); sb.append(", orderType=").append(orderType); sb.append(", orderStatus=").append(orderStatus); diff --git a/hai-service/src/main/java/com/hai/entity/ApiBlxOrderExample.java b/hai-service/src/main/java/com/hai/entity/ApiBlxOrderExample.java index 6c8e56d6..2c165fb3 100644 --- a/hai-service/src/main/java/com/hai/entity/ApiBlxOrderExample.java +++ b/hai-service/src/main/java/com/hai/entity/ApiBlxOrderExample.java @@ -576,6 +576,66 @@ public class ApiBlxOrderExample { return (Criteria) this; } + public Criteria andOverTimeIsNull() { + addCriterion("over_time is null"); + return (Criteria) this; + } + + public Criteria andOverTimeIsNotNull() { + addCriterion("over_time is not null"); + return (Criteria) this; + } + + public Criteria andOverTimeEqualTo(Integer value) { + addCriterion("over_time =", value, "overTime"); + return (Criteria) this; + } + + public Criteria andOverTimeNotEqualTo(Integer value) { + addCriterion("over_time <>", value, "overTime"); + return (Criteria) this; + } + + public Criteria andOverTimeGreaterThan(Integer value) { + addCriterion("over_time >", value, "overTime"); + return (Criteria) this; + } + + public Criteria andOverTimeGreaterThanOrEqualTo(Integer value) { + addCriterion("over_time >=", value, "overTime"); + return (Criteria) this; + } + + public Criteria andOverTimeLessThan(Integer value) { + addCriterion("over_time <", value, "overTime"); + return (Criteria) this; + } + + public Criteria andOverTimeLessThanOrEqualTo(Integer value) { + addCriterion("over_time <=", value, "overTime"); + return (Criteria) this; + } + + public Criteria andOverTimeIn(List values) { + addCriterion("over_time in", values, "overTime"); + return (Criteria) this; + } + + public Criteria andOverTimeNotIn(List values) { + addCriterion("over_time not in", values, "overTime"); + return (Criteria) this; + } + + public Criteria andOverTimeBetween(Integer value1, Integer value2) { + addCriterion("over_time between", value1, value2, "overTime"); + return (Criteria) this; + } + + public Criteria andOverTimeNotBetween(Integer value1, Integer value2) { + addCriterion("over_time not between", value1, value2, "overTime"); + return (Criteria) this; + } + public Criteria andParkTimeIsNull() { addCriterion("park_time is null"); return (Criteria) this; @@ -826,63 +886,63 @@ public class ApiBlxOrderExample { return (Criteria) this; } - public Criteria andPrakPriceIsNull() { - addCriterion("prak_price is null"); + public Criteria andParkPriceIsNull() { + addCriterion("park_price is null"); return (Criteria) this; } - public Criteria andPrakPriceIsNotNull() { - addCriterion("prak_price is not null"); + public Criteria andParkPriceIsNotNull() { + addCriterion("park_price is not null"); return (Criteria) this; } - public Criteria andPrakPriceEqualTo(BigDecimal value) { - addCriterion("prak_price =", value, "prakPrice"); + public Criteria andParkPriceEqualTo(BigDecimal value) { + addCriterion("park_price =", value, "parkPrice"); return (Criteria) this; } - public Criteria andPrakPriceNotEqualTo(BigDecimal value) { - addCriterion("prak_price <>", value, "prakPrice"); + public Criteria andParkPriceNotEqualTo(BigDecimal value) { + addCriterion("park_price <>", value, "parkPrice"); return (Criteria) this; } - public Criteria andPrakPriceGreaterThan(BigDecimal value) { - addCriterion("prak_price >", value, "prakPrice"); + public Criteria andParkPriceGreaterThan(BigDecimal value) { + addCriterion("park_price >", value, "parkPrice"); return (Criteria) this; } - public Criteria andPrakPriceGreaterThanOrEqualTo(BigDecimal value) { - addCriterion("prak_price >=", value, "prakPrice"); + public Criteria andParkPriceGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("park_price >=", value, "parkPrice"); return (Criteria) this; } - public Criteria andPrakPriceLessThan(BigDecimal value) { - addCriterion("prak_price <", value, "prakPrice"); + public Criteria andParkPriceLessThan(BigDecimal value) { + addCriterion("park_price <", value, "parkPrice"); return (Criteria) this; } - public Criteria andPrakPriceLessThanOrEqualTo(BigDecimal value) { - addCriterion("prak_price <=", value, "prakPrice"); + public Criteria andParkPriceLessThanOrEqualTo(BigDecimal value) { + addCriterion("park_price <=", value, "parkPrice"); return (Criteria) this; } - public Criteria andPrakPriceIn(List values) { - addCriterion("prak_price in", values, "prakPrice"); + public Criteria andParkPriceIn(List values) { + addCriterion("park_price in", values, "parkPrice"); return (Criteria) this; } - public Criteria andPrakPriceNotIn(List values) { - addCriterion("prak_price not in", values, "prakPrice"); + public Criteria andParkPriceNotIn(List values) { + addCriterion("park_price not in", values, "parkPrice"); return (Criteria) this; } - public Criteria andPrakPriceBetween(BigDecimal value1, BigDecimal value2) { - addCriterion("prak_price between", value1, value2, "prakPrice"); + public Criteria andParkPriceBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("park_price between", value1, value2, "parkPrice"); return (Criteria) this; } - public Criteria andPrakPriceNotBetween(BigDecimal value1, BigDecimal value2) { - addCriterion("prak_price not between", value1, value2, "prakPrice"); + public Criteria andParkPriceNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("park_price not between", value1, value2, "parkPrice"); return (Criteria) this; } diff --git a/hai-service/src/main/java/com/hai/openApi/config/BlxConfig.java b/hai-service/src/main/java/com/hai/openApi/config/BlxConfig.java index c293d4df..35c6324c 100644 --- a/hai-service/src/main/java/com/hai/openApi/config/BlxConfig.java +++ b/hai-service/src/main/java/com/hai/openApi/config/BlxConfig.java @@ -261,6 +261,8 @@ public class BlxConfig { log.info("头部参数: " + header); log.info("请求参数: " + map); log.info("响应参数: " + data); + System.out.println(header); + System.out.println(map); log.info("============ 比邻星停车券业务-查询车牌订单列表信息--捷顺-END ============="); return data; @@ -304,6 +306,28 @@ public class BlxConfig { } + /** + * @Author Sum1Dream + * @Name parkOrderPay + * @Description // 订单支付 + * @Date 14:49 2023/9/4 + * @Param object + * @return com.alibaba.fastjson.JSONObject + */ + public JSONObject parkOrderPay(JSONObject object) { + + Map header = new HashMap<>(); + header.put("token" , generateJw()); + header.put("orderCode" , object.getString("orderCode")); + log.info("============ 比邻星停车券业务-停车场订单支付--捷顺-START ============="); + JSONObject data = HttpsUtils.doPost(CommonSysConst.getSysConfig().getBlxPostUrl() + "/peration/member/parking/api/parkOrderPay" , new HashMap<>() , header); + log.info("头部参数: " + header); + log.info("响应参数: " + data); + log.info("============ 比邻星停车券业务-停车场订单支付--捷顺-END ============="); + return data; + + } + diff --git a/hai-service/src/main/java/com/hai/openApi/service/ApiBlxCouponService.java b/hai-service/src/main/java/com/hai/openApi/service/ApiBlxCouponService.java index 92cfc4d7..ad014e4f 100644 --- a/hai-service/src/main/java/com/hai/openApi/service/ApiBlxCouponService.java +++ b/hai-service/src/main/java/com/hai/openApi/service/ApiBlxCouponService.java @@ -1,6 +1,7 @@ package com.hai.openApi.service; import com.hai.entity.ApiBlxCoupon; +import com.hai.entity.ApiBlxOrder; import java.util.List; import java.util.Map; @@ -47,4 +48,33 @@ public interface ApiBlxCouponService { */ List getBlxCouponList(Map map); + /** + * @Author Sum1Dream + * @Name insertBlxOrder + * @Description // 新增停车订单 + * @Date 15:08 2023/9/1 + * @Param apiBlxOrder + * @return void + */ + void insertBlxOrder(ApiBlxOrder apiBlxOrder); + + /** + * @Author Sum1Dream + * @Name editBlxOrder + * @Description // 修改停车订单 + * @Date 15:09 2023/9/1 + * @Param ApiBlxOrder + * @return void + */ + void editBlxOrder(ApiBlxOrder apiBlxOrder); + + /** + * @Author Sum1Dream + * @Name findOrderByMap + * @Description // 根据条件查询停车订单 + * @Date 15:10 2023/9/1 + * @Param map + * @return com.hai.entity.ApiBlxOrder + */ + ApiBlxOrder findOrderByMap(Map map); } diff --git a/hai-service/src/main/java/com/hai/openApi/service/impl/ApiBlxCouponServiceImpl.java b/hai-service/src/main/java/com/hai/openApi/service/impl/ApiBlxCouponServiceImpl.java index 79f01b2a..b7e11af9 100644 --- a/hai-service/src/main/java/com/hai/openApi/service/impl/ApiBlxCouponServiceImpl.java +++ b/hai-service/src/main/java/com/hai/openApi/service/impl/ApiBlxCouponServiceImpl.java @@ -1,11 +1,16 @@ package com.hai.openApi.service.impl; import com.hai.dao.ApiBlxCouponMapper; +import com.hai.dao.ApiBlxOrderMapper; import com.hai.entity.ApiBlxCoupon; import com.hai.entity.ApiBlxCouponExample; +import com.hai.entity.ApiBlxOrder; +import com.hai.entity.ApiBlxOrderExample; import com.hai.openApi.service.ApiBlxCouponService; +import org.apache.commons.collections4.MapUtils; import org.springframework.stereotype.Service; + import javax.annotation.Resource; import java.util.List; import java.util.Map; @@ -16,6 +21,9 @@ public class ApiBlxCouponServiceImpl implements ApiBlxCouponService { @Resource private ApiBlxCouponMapper apiBlxCouponMapper; + @Resource + private ApiBlxOrderMapper apiBlxOrderMapper; + @Override public void insertBlxCoupon(ApiBlxCoupon apiBlxCoupon) { apiBlxCouponMapper.insert(apiBlxCoupon); @@ -52,4 +60,44 @@ public class ApiBlxCouponServiceImpl implements ApiBlxCouponService { return apiBlxCouponMapper.selectByExample(example); } + + @Override + public void insertBlxOrder(ApiBlxOrder apiBlxOrder) { + apiBlxOrderMapper.insert(apiBlxOrder); + } + + @Override + public void editBlxOrder(ApiBlxOrder apiBlxOrder) { + apiBlxOrderMapper.updateByPrimaryKey(apiBlxOrder); + } + + @Override + public ApiBlxOrder findOrderByMap(Map map) { + + ApiBlxOrderExample example = new ApiBlxOrderExample(); + ApiBlxOrderExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getString(map , "merId") != null) { + criteria.andMerIdEqualTo(MapUtils.getString(map , "merId")); + } + if (MapUtils.getLong(map , "orderId") != null) { + criteria.andOrderIdEqualTo(MapUtils.getLong(map , "orderId")); + } + if (MapUtils.getString(map , "merOrderId") != null) { + criteria.andMerOrderIdEqualTo(MapUtils.getString(map , "merOrderId")); + } + if (MapUtils.getString(map , "parkOrderId") != null) { + criteria.andParkOrderIdEqualTo(MapUtils.getString(map , "parkOrderId")); + } + + List list = apiBlxOrderMapper.selectByExample(example); + + if (list.size() > 0 ) { + return list.get(0); + } + + return null; + } + + } diff --git a/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java b/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java index c46c47f9..d59c6206 100644 --- a/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java +++ b/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java @@ -5,9 +5,11 @@ import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; +import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.DataUtilConfig; import com.hai.config.QianZhuConfig; import com.hai.entity.*; +import com.hai.openApi.config.BlxConfig; import com.hai.openApi.config.PriceComputeConfig; import com.hai.openApi.service.ApiBlxCouponService; import com.hai.openApi.service.ApiMchProductService; @@ -51,6 +53,9 @@ public class ApiOrderCreateHandleServiceImpl implements ApiOrderCreateHandleServ @Resource private ApiBlxCouponService apiBlxCouponService; + @Resource + private BlxConfig blxConfig; + @Override public ApiOrder oilHandle(JSONObject object) throws Exception { @@ -395,7 +400,7 @@ public class ApiOrderCreateHandleServiceImpl implements ApiOrderCreateHandleServ } @Override - public ApiOrder blxOrder(JSONObject object) throws Exception { + public ApiOrder blxOrder(JSONObject object) { // 获取下单内容 JSONObject dataObject = JSONObject.parseObject(object.getString("content")); @@ -403,6 +408,72 @@ public class ApiOrderCreateHandleServiceImpl implements ApiOrderCreateHandleServ // 查询api商户 ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId")); - return null; + int num = 0; + + if (dataObject.getString("userCouponCode") != null) { + String[] strings = dataObject.getString("userCouponCode").split(","); + num = strings.length; + } + + BigDecimal currentamt = dataObject.getBigDecimal("currentamt").divide(new BigDecimal(100)); + BigDecimal prePrice = dataObject.getBigDecimal("prePrice").divide(new BigDecimal(100)); + + // 计算剩余扣款金额 + BigDecimal postPrice = currentamt.subtract(new BigDecimal(num)); + + if (postPrice.compareTo(new BigDecimal(0)) < 0) { + postPrice = new BigDecimal(0); + } + + + // 判断金额是否充足 + if (apiMerchants.getAmounts().compareTo(postPrice) < 0) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.INSUFFICIENT_BALANCE); + } + + // 调用下单接口 + JSONObject jsonObject = blxConfig.creatOrder(dataObject); + + // 组装停车订单 + ApiBlxOrder apiBlxOrder = new ApiBlxOrder(); + apiBlxOrder.setMerOrderId((object.getString("orderNo"))); + apiBlxOrder.setOrderType(dataObject.getInteger("orderType")); + apiBlxOrder.setCreateTime(new Date()); + + if (jsonObject.getInteger("code") == 1) { + apiBlxOrder.setParkOrderId(jsonObject.getJSONObject("data").getString("orderCode")); + apiBlxOrder.setOverTime(jsonObject.getJSONObject("data").getInteger("overtime")); + } else { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , jsonObject.getInteger("msg")); + } + apiBlxOrder.setCouponPrice(new BigDecimal(num)); + apiBlxOrder.setInTime(dataObject.getDate("inTime")); + apiBlxOrder.setUpdateTime(new Date()); + apiBlxOrder.setParkTime(dataObject.getInteger("parkTime")); + apiBlxOrder.setParkName(dataObject.getString("parkName")); + apiBlxOrder.setParkPrice(currentamt.add(prePrice)); + apiBlxOrder.setOutTime(dataObject.getDate("outTime")); + apiBlxOrder.setMerId(object.getString("merchId")); + apiBlxOrder.setOrderStatus(4); + + apiBlxCouponService.insertBlxOrder(apiBlxOrder); + + + // 组装api订单 + ApiOrder apiOrder = new ApiOrder(); + apiOrder.setCreateTime(new Date()); + apiOrder.setTitle(apiMerchants.getMerchantName() + "|" + OrderProductType.PRODUCT_TYPE14.getName() + "|扣款" + postPrice); + apiOrder.setFacePrice(postPrice); + apiOrder.setCostPrice(postPrice); + apiOrder.setOrderPrice(currentamt); + apiOrder.setMchId(object.getString("merchId")); + apiOrder.setMchName(apiMerchants.getMerchantName()); + apiOrder.setUpdateTime(new Date()); + apiOrder.setProductType(object.getInteger("productType")); + apiOrder.setMchOrderNo(object.getString("orderNo")); + apiOrder.setNotifyUrl(object.getString("notifyUrl")); + apiOrder.setContent(object.toJSONString()); + + return apiOrder; } } diff --git a/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java b/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java index 622ae273..5afb8239 100644 --- a/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java @@ -212,6 +212,7 @@ public class ApiOrderServiceImpl implements ApiOrderService { createOrderChildModel.setMemPhone(apiMerchants.getPhone()); createOrderChildModel.setCompanyId(2L); createOrderChildModel.setGoodsType(OrderChildGoodsType.TYPE12.getNumber()); + createOrderChildModel.setPrice(apiOrder.getCostPrice()); createOrderChildModel.setCouponCode(dataObject.getString("couponCode")); createOrderChildModel.setSaleCount(dataObject.getInteger("receiverCount")); createOrderChildModel.setIsTyAgent(false); @@ -225,16 +226,15 @@ public class ApiOrderServiceImpl implements ApiOrderService { // 处理停车订单 if (OrderProductType.PRODUCT_TYPE14.getNumber().equals(object.getInteger("productType"))) { - apiOrder = orderCreateHandleService.blxCouponHandle(object); + apiOrder = orderCreateHandleService.blxOrder(object); // 组装子订单内容 CreateOrderChildModel createOrderChildModel = new CreateOrderChildModel(); createOrderChildModel.setMemName(apiMerchants.getMerchantName()); createOrderChildModel.setMemPhone(apiMerchants.getPhone()); createOrderChildModel.setCompanyId(2L); - createOrderChildModel.setGoodsType(OrderChildGoodsType.TYPE12.getNumber()); - createOrderChildModel.setCouponCode(dataObject.getString("couponCode")); - createOrderChildModel.setSaleCount(dataObject.getInteger("receiverCount")); + createOrderChildModel.setGoodsType(OrderChildGoodsType.TYPE13.getNumber()); + createOrderChildModel.setSaleCount(1); createOrderChildModel.setIsTyAgent(false); createOrderChildModel.setGoodsPrice(apiOrder.getOrderPrice()); @@ -385,6 +385,5 @@ public class ApiOrderServiceImpl implements ApiOrderService { map.put("sourceContent", "退款金额:" + apiOrder.getCostPrice() + " 元"); apiMerchantsService.recharge(merchants.getId(), apiOrder.getCostPrice(), map); - } } diff --git a/hai-service/src/main/java/com/hai/order/model/CreateOrderChildModel.java b/hai-service/src/main/java/com/hai/order/model/CreateOrderChildModel.java index e9d74fa7..751f7c81 100644 --- a/hai-service/src/main/java/com/hai/order/model/CreateOrderChildModel.java +++ b/hai-service/src/main/java/com/hai/order/model/CreateOrderChildModel.java @@ -122,6 +122,9 @@ public class CreateOrderChildModel { /** ======================= 比邻星停车券 start ======================== **/ // 停车券编码 private String couponCode; + // 实际单价 + private BigDecimal price; /** ======================= 比邻星停车券 end ======================== **/ + } diff --git a/hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java b/hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java index fc4fbdef..c6077cdd 100644 --- a/hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java +++ b/hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java @@ -86,6 +86,26 @@ public interface OrderCreateHandleService { */ HighChildOrder goods(HighOrder order, CreateOrderChildModel createOrderChild) throws Exception; + /** + * @Author Sum1Dream + * @Name blxCoupon + * @Description // 比邻星停车券业务 + * @Date 17:11 2023/9/1 + * @Param order + * @Param createOrderChildModel + * @return com.hai.entity.HighChildOrder + */ HighChildOrder blxCoupon(HighOrder order , CreateOrderChildModel createOrderChildModel) throws Exception; + /** + * @Author Sum1Dream + * @Name blxOrder + * @Description // 比邻星停车券核销 + * @Date 17:11 2023/9/1 + * @Param order + * @Param createOrderChildModel + * @return com.hai.entity.HighChildOrder + */ + HighChildOrder blxOrder(HighOrder order , CreateOrderChildModel createOrderChildModel) throws Exception; + } diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java index 999e10f1..88f471b9 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java @@ -17,6 +17,7 @@ import com.hai.goods.service.GoodsSkuService; import com.hai.goods.service.ShoppingCartService; import com.hai.model.GasPayPriceModel; import com.hai.model.OutRechargePriceModel; +import com.hai.openApi.service.ApiBlxCouponService; import com.hai.order.model.CreateOrderChildModel; import com.hai.order.model.CreateOrderModel; import com.hai.order.service.OrderCreateHandleService; @@ -53,6 +54,8 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { @Resource private CommonService commonService; + @Resource + private ApiBlxCouponService apiBlxCouponService; @Resource @@ -971,6 +974,58 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { @Override public HighChildOrder blxCoupon(HighOrder order, CreateOrderChildModel createOrderChildModel) throws Exception { - return null; + + ApiBlxCoupon apiBlxCoupon = apiBlxCouponService.findBlxCoupon(createOrderChildModel.getCouponCode()); + + // 生成交易子订单 + HighChildOrder childOrder = new HighChildOrder(); + childOrder.setOrderNo(order.getOrderNo()); + childOrder.setMemId(order.getMemId()); + childOrder.setMemName(order.getMemName()); + childOrder.setMemPhone(order.getMemPhone()); + childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo()); + childOrder.setGoodsType(OrderChildGoodsType.TYPE12.getNumber()); + childOrder.setGoodsId(apiBlxCoupon.getId()); + childOrder.setGoodsName(apiBlxCoupon.getCouponName()); + childOrder.setGoodsSpecName(apiBlxCoupon.getCouponCode()); + childOrder.setGoodsPrice(new BigDecimal(apiBlxCoupon.getDenomination())); + childOrder.setGoodsActualPrice(createOrderChildModel.getPrice()); + childOrder.setSaleCount(createOrderChildModel.getSaleCount()); + childOrder.setGiveawayType(false); + childOrder.setChildOrderStatus(OrderChildStatus.STATUS1.getNumber()); + childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount()))); + childOrder.setTotalActualPrice(childOrder.getGoodsActualPrice().multiply(new BigDecimal(childOrder.getSaleCount()))); + childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice())); + childOrder.setPraiseStatus(0); + childOrder.setCreateTime(new Date()); + + return childOrder; + } + + @Override + public HighChildOrder blxOrder(HighOrder order, CreateOrderChildModel createOrderChildModel) { + + + // 生成交易子订单 + HighChildOrder childOrder = new HighChildOrder(); + childOrder.setOrderNo(order.getOrderNo()); + childOrder.setMemId(order.getMemId()); + childOrder.setMemName(order.getMemName()); + childOrder.setMemPhone(order.getMemPhone()); + childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo()); + childOrder.setGoodsType(OrderChildGoodsType.TYPE13.getNumber()); + childOrder.setGoodsName("停车券核销"); + childOrder.setGoodsPrice(createOrderChildModel.getGoodsPrice()); + childOrder.setGoodsActualPrice(createOrderChildModel.getGoodsPrice()); + childOrder.setSaleCount(createOrderChildModel.getSaleCount()); + childOrder.setGiveawayType(false); + childOrder.setChildOrderStatus(OrderChildStatus.STATUS1.getNumber()); + childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount()))); + childOrder.setTotalActualPrice(childOrder.getGoodsActualPrice().multiply(new BigDecimal(childOrder.getSaleCount()))); + childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice())); + childOrder.setPraiseStatus(0); + childOrder.setCreateTime(new Date()); + + return childOrder; } } diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java index 05841ac1..9fef60cf 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java @@ -12,6 +12,8 @@ import com.hai.enum_type.*; import com.hai.goods.service.GoodsOrderExtService; import com.hai.goods.service.GoodsPresentService; import com.hai.msg.entity.MsgTopic; +import com.hai.openApi.config.BlxConfig; +import com.hai.openApi.service.ApiBlxCouponService; import com.hai.order.service.OrderPaySuccessService; import com.hai.order.service.OrderService; import com.hai.order.topic.OrderTopic; @@ -59,6 +61,9 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { @Resource private HighCouponService couponService; + @Resource + private BlxConfig blxConfig; + @Resource private HighCouponCodeService couponCodeService; @@ -109,6 +114,8 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { @Resource private GoodsPresentService presentService; + @Resource + private ApiBlxCouponService apiBlxCouponService; @Override @@ -227,6 +234,10 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { thirdOrderHandle(order); } else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE11.getNumber())) { goodsRecharge(order , childOrder); + } else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE12.getNumber())) { + blxCoupon(order , childOrder); + } else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE13.getNumber())) { + blxOrder(order , childOrder); } } } @@ -513,4 +524,55 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { presentService.presentUser(order , highChildOrder); } + private void blxCoupon(HighOrder order , HighChildOrder highChildOrder) { + // 派发停车券 + ApiBlxCoupon apiBlxCoupon = apiBlxCouponService.findBlxCoupon(highChildOrder.getGoodsSpecName()); + + HighCoupon coupon = couponService.getCouponDetail(highChildOrder.getGoodsSpecName()); + + if (apiBlxCoupon == null || apiBlxCoupon.getCouponStatus() != 1) { + throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买"); + } + // 计算上送卡券数量 + int num = coupon.getSalesPrice().divide(new BigDecimal(apiBlxCoupon.getDenomination())).intValue(); + if (num > 0) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("couponCode" , coupon.getCouponKey()); + jsonObject.put("receiverPhone" , order.getMemPhone()); + jsonObject.put("receiverCount" , num); + + JSONObject object = blxConfig.sendCoupon(jsonObject); + + if (object.getInteger("code") == 1) { + order.setOrderStatus(OrderStatus.STATUS3.getNumber()); + order.setFinishTime(new Date()); + orderService.updateOrderData(order); + + } + } + } + + private void blxOrder(HighOrder order , HighChildOrder highChildOrder) { + // 获取下单订单号 + Map map = new HashMap<>(); + map.put("orderId" , order.getId()); + ApiBlxOrder apiBlxOrder = apiBlxCouponService.findOrderByMap(map); + + if (apiBlxOrder != null) { + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("orderCode" , apiBlxOrder.getParkOrderId()); + + JSONObject object = blxConfig.parkOrderPay(jsonObject); + + if (object.getInteger("code") == 1) { + order.setOrderStatus(OrderStatus.STATUS3.getNumber()); + order.setFinishTime(new Date()); + orderService.updateOrderData(order); + + } + } + + } + } diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index 06640a28..c6f87749 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -164,7 +164,7 @@ public class OrderServiceImpl implements OrderService { BsDistributionUserRel popularizeUser = bsDistributionUserRelService.findDistributionUserRel(mapUser); HighOrder order = new HighOrder(); - if (popularizeUser != null) { + if (popularizeUser != null && createOrderModel.getMemId() != null) { order.setPromoteCode(popularizeUser.getAgentId().toString()); } @@ -332,6 +332,29 @@ public class OrderServiceImpl implements OrderService { // 比邻星停车券 } else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE12.getNumber())) { HighChildOrder childOrder = orderCreateHandleService.blxCoupon(order , child); + childOrderList.add(childOrder); + order.setProductType(OrderProductType.PRODUCT_TYPE13.getNumber()); + order.setSecUserId(childOrder.getId()); + if (StringUtils.isBlank(order.getTitle())) { + order.setTitle(childOrder.getGoodsName()); + order.setExt6(childOrder.getGoodsImg()); + } else { + order.setTitle(order.getTitle() + "+" +childOrder.getGoodsName()); + order.setExt6(order.getExt6() + "," +childOrder.getGoodsImg()); + } + // 比邻星停车券核销 + } else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE13.getNumber())) { + HighChildOrder childOrder = orderCreateHandleService.blxOrder(order , child); + childOrderList.add(childOrder); + order.setProductType(OrderProductType.PRODUCT_TYPE13.getNumber()); + order.setSecUserId(childOrder.getId()); + if (StringUtils.isBlank(order.getTitle())) { + order.setTitle(childOrder.getGoodsName()); + order.setExt6(childOrder.getGoodsImg()); + } else { + order.setTitle(order.getTitle() + "+" +childOrder.getGoodsName()); + order.setExt6(order.getExt6() + "," +childOrder.getGoodsImg()); + } } else { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知业务类型"); } diff --git a/hai-service/src/main/java/com/hai/order/type/OrderChildGoodsType.java b/hai-service/src/main/java/com/hai/order/type/OrderChildGoodsType.java index 91d9af2e..c51519da 100644 --- a/hai-service/src/main/java/com/hai/order/type/OrderChildGoodsType.java +++ b/hai-service/src/main/java/com/hai/order/type/OrderChildGoodsType.java @@ -21,6 +21,7 @@ public enum OrderChildGoodsType { TYPE10(10, "第三方充值"), TYPE11(11, "实物商品购买"), TYPE12(12, "比邻星停车券"), + TYPE13(13, "比邻星停车"), ; private Integer number; diff --git a/hai-service/src/main/resources/dev/commonConfig.properties b/hai-service/src/main/resources/dev/commonConfig.properties index 5cd558a2..8df47b2b 100644 --- a/hai-service/src/main/resources/dev/commonConfig.properties +++ b/hai-service/src/main/resources/dev/commonConfig.properties @@ -132,4 +132,4 @@ filesystem=https://hsgcs.dctpay.com/filesystem/ #payPostUrl=http://localhost:9601/crest/ # -blxPostUrl=https://vertical-formats-gateway.blx.bodata.cn:18443 +blxPostUrl=https://gateway.vf.bilinxing.com diff --git a/v1/src/main/java/com/v1/controller/business/BlxCouponController.java b/v1/src/main/java/com/v1/controller/business/BlxCouponController.java index 925212fc..c5430592 100644 --- a/v1/src/main/java/com/v1/controller/business/BlxCouponController.java +++ b/v1/src/main/java/com/v1/controller/business/BlxCouponController.java @@ -313,98 +313,5 @@ public class BlxCouponController { } } - @RequestMapping(value = "/creatOrder", method = RequestMethod.POST) - @ResponseBody - @ApiOperation(value = "停车添加订单") - public ResponseData creatOrder(@RequestBody JSONObject object , HttpServletRequest request ) { - try { - - String ip = ""; - // 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for - if (request.getHeader("x-forwarded-for") == null) { - ip = request.getRemoteAddr(); - } else { - ip = request.getHeader("x-forwarded-for"); - } - - if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) { - log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!"); - } - - if ( - StringUtils.isBlank(object.getString("merchId")) || - StringUtils.isBlank(object.getString("organizeCode")) || - StringUtils.isBlank(object.getString("userMobile")) || - StringUtils.isBlank(object.getString("userCouponCode")) || - StringUtils.isBlank(object.getString("parkOrderId")) || - StringUtils.isBlank(object.getString("orderType")) || - StringUtils.isBlank(object.getString("prePrice")) || - StringUtils.isBlank(object.getString("parkId")) || - StringUtils.isBlank(object.getString("parkName")) || - StringUtils.isBlank(object.getString("parkTime")) || - StringUtils.isBlank(object.getString("carSeatId")) || - StringUtils.isBlank(object.getString("inTime")) || - StringUtils.isBlank(object.getString("outTime")) || - StringUtils.isBlank(object.getString("carNo")) || - StringUtils.isBlank(object.getString("parkType")) || - StringUtils.isBlank(object.getString("sign")) - ) { - log.error("getRechargeProduct error!", "请求参数校验失败!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR); - } - - ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId")); - - if (apiMerchants == null) { - log.error("getRechargeProduct error!", "帐户号错误!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_NOT_EXIST); - } - - if (!secConfigService.isConfig(OrderProductType.PRODUCT_TYPE13.getApiCode(), object.getString("merchId"))) { - log.error("getAllCities error!", "当前帐户无权限查询!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, ""); - } - - Map map = new HashMap<>(); - map.put("apiKey" , apiMerchants.getApiKey()); - map.put("merchId" , object.getString("merchId")); - map.put("organizeCode" , object.getString("organizeCode")); - map.put("userMobile" , object.getString("userMobile")); - map.put("userCouponCode" , object.getString("userCouponCode")); - map.put("parkOrderId" , object.getString("parkOrderId")); - map.put("orderType" , object.getString("orderType")); - map.put("prePrice" , object.getString("prePrice")); - map.put("parkId" , object.getString("parkId")); - map.put("parkName" , object.getString("parkName")); - map.put("parkTime" , object.getString("parkTime")); - map.put("carSeatId" , object.getString("carSeatId")); - map.put("inTime" , object.getString("inTime")); - map.put("outTime" , object.getString("outTime")); - map.put("carNo" , object.getString("carNo")); - map.put("parkType" , object.getString("parkType")); - - if (!secConfigService.isSignVerify(map , object.getString("sign"))) { - log.error("getRechargeProduct error!", "签名校验失败!"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY); - } - - JSONObject jsonObject = new JSONObject(); - jsonObject.put("carNo" , object.getString("carNo")); - jsonObject.put("orderStatus" , object.getString("orderStatus")); - - JSONObject data = blxConfig.queryJsOrderList(jsonObject); - - if (data.getInteger("code") == 1) { - return ResponseMsgUtil.success(data.getJSONObject("data").getJSONArray("ordlist")); - } - - return ResponseMsgUtil.success(null); - - } catch (Exception e) { - log.error("HighOpenApiController --> getRechargeProduct() error!", e); - return ResponseMsgUtil.exception(e); - } - } } diff --git a/v1/src/main/java/com/v1/controller/orderController.java b/v1/src/main/java/com/v1/controller/orderController.java index eae9133e..b27ac6f9 100644 --- a/v1/src/main/java/com/v1/controller/orderController.java +++ b/v1/src/main/java/com/v1/controller/orderController.java @@ -179,18 +179,20 @@ public class orderController { } if (object.getInteger("productType").equals(OrderProductType.PRODUCT_TYPE14.getNumber())) { if ( StringUtils.isBlank(dataObject.getString("userMobile")) + || StringUtils.isBlank(dataObject.getString("userCouponCode")) || StringUtils.isBlank(dataObject.getString("parkOrderId")) || StringUtils.isBlank(dataObject.getString("parkName")) || dataObject.getInteger("orderType") == null || dataObject.getBigDecimal("prePrice") == null + || dataObject.getBigDecimal("currentamt") == null || dataObject.getInteger("parkId") == null || dataObject.getInteger("parkTime") == null - || dataObject.getDate("inTime") == null - || dataObject.getDate("outTime") == null - || dataObject.getDate("carNo") == null + || dataObject.getString("inTime") == null + || dataObject.getString("outTime") == null + || dataObject.getString("carNo") == null ) { log.error("OrderController -> create() error!",""); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写卡券编码,手机号,购买数量"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写相关参数"); } } diff --git a/v1/src/main/resources/dev/application.yml b/v1/src/main/resources/dev/application.yml index 87ac408e..40b1943b 100644 --- a/v1/src/main/resources/dev/application.yml +++ b/v1/src/main/resources/dev/application.yml @@ -56,8 +56,13 @@ spring: rocketmq: name-server: 139.9.154.68:9876 producer: + access-key: huifukeji + secret-key: HF123456. #必须指定group group: default-group + consumer: + access-key: huifukeji + secret-key: HF123456. #配置日期返回至前台为时间戳 jackson: