Merge remote-tracking branch 'origin/2.0-dev' into 2.0-dev

new-dev
袁野 11 months ago
parent 06bc72e01b
commit 47eedd711e
  1. 239
      error.log
  2. 54
      hai-bweb/src/main/java/com/bweb/controller/ApiCouponController.java
  3. 57
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageAgentController.java
  4. 16
      hai-bweb/src/main/java/com/bweb/controller/HighDiscountPackageController.java
  5. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  6. 49
      hai-cweb/src/main/java/com/cweb/controller/HighDiscountPackageController.java
  7. 200
      hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java
  8. 372
      hai-cweb/src/main/java/com/cweb/controller/WechatController.java
  9. 25
      hai-order/src/main/java/com/web/controller/OrderPayController.java
  10. 2
      hai-schedule/src/main/java/com/hai/schedule/HighGasSchedule.java
  11. 142
      hai-service/src/main/java/com/hai/dao/ApiCouponMapper.java
  12. 7
      hai-service/src/main/java/com/hai/dao/ApiCouponMapperExt.java
  13. 402
      hai-service/src/main/java/com/hai/dao/ApiCouponSqlProvider.java
  14. 148
      hai-service/src/main/java/com/hai/dao/HighDiscountPackageAgentCodeMapper.java
  15. 7
      hai-service/src/main/java/com/hai/dao/HighDiscountPackageAgentCodeMapperExt.java
  16. 416
      hai-service/src/main/java/com/hai/dao/HighDiscountPackageAgentCodeSqlProvider.java
  17. 23
      hai-service/src/main/java/com/hai/dao/HighDiscountPackageAgentRecordMapper.java
  18. 14
      hai-service/src/main/java/com/hai/dao/HighDiscountPackageAgentRecordSqlProvider.java
  19. 37
      hai-service/src/main/java/com/hai/dao/HighDiscountPackageAgentRelMapper.java
  20. 14
      hai-service/src/main/java/com/hai/dao/HighDiscountPackageAgentRelSqlProvider.java
  21. 43
      hai-service/src/main/java/com/hai/dao/HighDiscountPackageMapper.java
  22. 14
      hai-service/src/main/java/com/hai/dao/HighDiscountPackageSqlProvider.java
  23. 321
      hai-service/src/main/java/com/hai/entity/ApiCoupon.java
  24. 1333
      hai-service/src/main/java/com/hai/entity/ApiCouponExample.java
  25. 16
      hai-service/src/main/java/com/hai/entity/HighDiscountPackage.java
  26. 337
      hai-service/src/main/java/com/hai/entity/HighDiscountPackageAgentCode.java
  27. 1393
      hai-service/src/main/java/com/hai/entity/HighDiscountPackageAgentCodeExample.java
  28. 16
      hai-service/src/main/java/com/hai/entity/HighDiscountPackageAgentRecord.java
  29. 60
      hai-service/src/main/java/com/hai/entity/HighDiscountPackageAgentRecordExample.java
  30. 16
      hai-service/src/main/java/com/hai/entity/HighDiscountPackageAgentRel.java
  31. 60
      hai-service/src/main/java/com/hai/entity/HighDiscountPackageAgentRelExample.java
  32. 70
      hai-service/src/main/java/com/hai/entity/HighDiscountPackageExample.java
  33. 4
      hai-service/src/main/java/com/hai/entity/HighDiscountPackageRecord.java
  34. 1
      hai-service/src/main/java/com/hai/enum_type/ApiProductTypeEnum.java
  35. 54
      hai-service/src/main/java/com/hai/openApi/service/ApiCouponService.java
  36. 10
      hai-service/src/main/java/com/hai/openApi/service/ApiOrderCreateHandleService.java
  37. 61
      hai-service/src/main/java/com/hai/openApi/service/impl/ApiCouponServiceImpl.java
  38. 56
      hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderCreateHandleServiceImpl.java
  39. 103
      hai-service/src/main/java/com/hai/openApi/service/impl/ApiOrderServiceImpl.java
  40. 2
      hai-service/src/main/java/com/hai/order/model/CreateOrderChildModel.java
  41. 2
      hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java
  42. 34
      hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java
  43. 46
      hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java
  44. 12
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java
  45. 1
      hai-service/src/main/java/com/hai/order/type/OrderChildGoodsType.java
  46. 1
      hai-service/src/main/java/com/hai/order/type/OrderProductType.java
  47. 1
      hai-service/src/main/java/com/hai/service/HighCouponCodeService.java
  48. 4
      hai-service/src/main/java/com/hai/service/HighDiscountPackageActualService.java
  49. 40
      hai-service/src/main/java/com/hai/service/HighDiscountPackageAgentService.java
  50. 11
      hai-service/src/main/java/com/hai/service/HighDiscountPackageService.java
  51. 2
      hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentRelServiceImpl.java
  52. 5
      hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageActualServiceImpl.java
  53. 167
      hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageAgentServiceImpl.java
  54. 217
      hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageServiceImpl.java
  55. 1
      hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java
  56. 2
      hai-service/src/main/java/com/hai/service/impl/HltUnionCardVipServiceImpl.java
  57. 2
      hai-user/src/main/java/com/web/controller/LoginController.java
  58. 201
      v1/src/main/java/com/v1/controller/business/ApiCouponController.java
  59. 53
      v1/src/main/java/com/v1/controller/orderController.java

@ -0,0 +1,239 @@
2023-11-24 10:56:26,020 ERROR (UserCenter.java:74)- ------------------------------Kzk4xEVyxaDQghFfhXKI/g==
2023-11-24 11:13:08,714 ERROR (UserCenter.java:74)- ------------------------------Kzk4xEVyxaDQghFfhXKI/g==
2023-11-24 11:13:58,800 ERROR (UserCenter.java:74)- ------------------------------Kzk4xEVyxaDQghFfhXKI/g==
2023-11-24 11:15:07,389 ERROR (UserCenter.java:74)- ------------------------------Kzk4xEVyxaDQghFfhXKI/g==
2023-11-24 11:15:14,684 ERROR (UserCenter.java:74)- ------------------------------Kzk4xEVyxaDQghFfhXKI/g==
2023-11-24 11:15:28,916 ERROR (UserCenter.java:74)- ------------------------------Kzk4xEVyxaDQghFfhXKI/g==
2023-11-24 13:30:09,188 ERROR (ResponseMsgUtil.java:59)- ---controller error---
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:226)
at com.google.gson.Gson.fromJson(Gson.java:927)
at com.google.gson.Gson.fromJson(Gson.java:892)
at com.google.gson.Gson.fromJson(Gson.java:841)
at com.google.gson.Gson.fromJson(Gson.java:813)
at cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo.fromJson(WxMaPhoneNumberInfo.java:23)
at cn.binarywang.wx.miniapp.api.impl.WxMaUserServiceImpl.getPhoneNoInfo(WxMaUserServiceImpl.java:56)
at com.web.controller.LoginController.wxMini(LoginController.java:245)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.alibaba.csp.sentinel.adapter.servlet.CommonFilter.doFilter(CommonFilter.java:110)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:215)
... 68 common frames omitted
2023-11-24 13:31:41,124 ERROR (UserCenter.java:74)- ------------------------------Kzk4xEVyxaDQghFfhXKI/g==
2023-11-24 13:46:21,025 ERROR (UserCenter.java:74)- ------------------------------Kzk4xEVyxaDQghFfhXKI/g==
2023-11-24 14:21:02,835 ERROR (UserCenter.java:74)- ------------------------------Kzk4xEVyxaDQghFfhXKI/g==
2023-11-24 14:27:07,253 ERROR (UserCenter.java:74)- ------------------------------Kzk4xEVyxaDQghFfhXKI/g==
2023-11-24 14:33:09,302 ERROR (UserCenter.java:74)- ------------------------------Kzk4xEVyxaDQghFfhXKI/g==
2023-11-24 14:33:35,050 ERROR (UserCenter.java:74)- ------------------------------Kzk4xEVyxaDQghFfhXKI/g==
2023-11-24 14:34:22,404 ERROR (UserCenter.java:74)- ------------------------------Kzk4xEVyxaDQghFfhXKI/g==
2023-11-24 14:36:33,686 ERROR (UserCenter.java:74)- ------------------------------Kzk4xEVyxaDQghFfhXKI/g==
2023-11-24 14:37:12,540 ERROR (ResponseMsgUtil.java:59)- ---controller error---
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:226)
at com.google.gson.Gson.fromJson(Gson.java:927)
at com.google.gson.Gson.fromJson(Gson.java:892)
at com.google.gson.Gson.fromJson(Gson.java:841)
at com.google.gson.Gson.fromJson(Gson.java:813)
at cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo.fromJson(WxMaPhoneNumberInfo.java:23)
at cn.binarywang.wx.miniapp.api.impl.WxMaUserServiceImpl.getPhoneNoInfo(WxMaUserServiceImpl.java:56)
at com.web.controller.LoginController.wxMini(LoginController.java:245)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.alibaba.csp.sentinel.adapter.servlet.CommonFilter.doFilter(CommonFilter.java:110)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:215)
... 68 common frames omitted
2023-11-24 14:39:54,738 ERROR (ResponseMsgUtil.java:59)- ---controller error---
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:226)
at com.google.gson.Gson.fromJson(Gson.java:927)
at com.google.gson.Gson.fromJson(Gson.java:892)
at com.google.gson.Gson.fromJson(Gson.java:841)
at com.google.gson.Gson.fromJson(Gson.java:813)
at cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo.fromJson(WxMaPhoneNumberInfo.java:23)
at cn.binarywang.wx.miniapp.api.impl.WxMaUserServiceImpl.getPhoneNoInfo(WxMaUserServiceImpl.java:56)
at com.web.controller.LoginController.wxMini(LoginController.java:245)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.alibaba.csp.sentinel.adapter.servlet.CommonFilter.doFilter(CommonFilter.java:110)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:215)
... 68 common frames omitted

@ -6,8 +6,10 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.PetroConfig;
import com.hai.entity.ApiCoupon;
import com.hai.model.ResponseData;
import com.hai.openApi.service.ApiBlxCouponService;
import com.hai.openApi.service.ApiCouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
@ -19,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
@Controller
@ -31,6 +34,9 @@ public class ApiCouponController {
@Resource
private ApiBlxCouponService apiBlxCouponService;
@Resource
private ApiCouponService apiCouponService;
@RequestMapping(value = "/getBlxCouponList", method = RequestMethod.GET)
@ -62,6 +68,54 @@ public class ApiCouponController {
if (jsonObject.getString("code").equals("1")) {
String data = PetroConfig.decrypt(jsonObject.getString("biz_content"));
JSONArray jsonArray = JSONArray.parseArray(data);
System.out.println(jsonArray);
ApiCoupon apiCoupon;
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
apiCoupon = apiCouponService.findCoupon(object.getString("request_code"));
System.out.println(object);
System.out.println(object.getString("request_code"));
System.out.println(apiCoupon);
if (apiCoupon == null ) {
if (object.getInteger("status") == 1 && object.getInteger("total_num") > 0) {
apiCoupon = new ApiCoupon();
apiCoupon.setCode(object.getString("request_code"));
apiCoupon.setDesc(object.getString("ticket_desc"));
apiCoupon.setGoodsType(object.getString("goods_type"));
apiCoupon.setName(object.getString("ticket_name"));
apiCoupon.setEffectiveDays(object.getInteger("effective_days"));
apiCoupon.setImg(object.getString("img"));
apiCoupon.setCreateTime(new Date());
apiCoupon.setUpdateTime(new Date());
apiCoupon.setStatus(1);
apiCoupon.setType(type);
apiCoupon.setPrice(object.getInteger("face_amount"));
apiCouponService.insertCoupon(apiCoupon);
}
} else {
apiCoupon.setCode(object.getString("request_code"));
apiCoupon.setDesc(object.getString("ticket_desc"));
apiCoupon.setName(object.getString("ticket_name"));
apiCoupon.setGoodsType(object.getString("goods_type"));
apiCoupon.setEffectiveDays(object.getInteger("effective_days"));
apiCoupon.setImg(object.getString("img"));
apiCoupon.setUpdateTime(new Date());
apiCoupon.setPrice(object.getInteger("face_amount"));
apiCoupon.setType(type);
apiCoupon.setStatus(object.getInteger("status"));
apiCouponService.editCoupon(apiCoupon);
}
}
return ResponseMsgUtil.success(jsonArray);
}
return ResponseMsgUtil.success("请求失败");

@ -50,7 +50,7 @@ public class HighDiscountPackageAgentController {
@RequestMapping(value="/distribute",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "分发优惠券")
@ApiOperation(value = "分发优惠券")
public ResponseData distribute(@RequestBody JSONObject object, HttpServletRequest request) {
try {
@ -71,6 +71,7 @@ public class HighDiscountPackageAgentController {
Map<String , Object> mapParent = new HashMap<>();
mapParent.put("agentId" , object.getLong("parentAgentId"));
mapParent.put("discountPackageId" , object.getLong("discountPackageId"));
mapParent.put("type" , 1);
HighDiscountPackageAgentRel discountPackageAgentRelParent = discountPackageAgentService.getDetailRelByMap(mapParent);
if (discountPackageAgentRelParent != null && discountPackageAgentRelParent.getStockCount() < object.getInteger("num") ) {
@ -96,6 +97,7 @@ public class HighDiscountPackageAgentController {
Map<String , Object> map = new HashMap<>();
map.put("agentId" , object.getLong("agentId"));
map.put("discountPackageId" , object.getLong("discountPackageId"));
map.put("type" , 1);
HighDiscountPackageAgentRel discountPackageAgentRel = discountPackageAgentService.getDetailRelByMap(map);
HighDiscountPackageAgentRecord discountPackageAgentRecord = new HighDiscountPackageAgentRecord();
@ -104,6 +106,7 @@ public class HighDiscountPackageAgentController {
if (discountPackageAgentRel == null) {
discountPackageAgentRel = new HighDiscountPackageAgentRel();
discountPackageAgentRel.setStatus(1);
discountPackageAgentRel.setType(1);
discountPackageAgentRel.setOpId(userInfoModel.getSecUser().getId());
discountPackageAgentRel.setOpName(userInfoModel.getSecUser().getLoginName());
discountPackageAgentRel.setAgentId(object.getLong("agentId"));
@ -121,6 +124,7 @@ public class HighDiscountPackageAgentController {
discountPackageAgentService.insertDiscountPackageAgentRel(discountPackageAgentRel);
} else {
discountPackageAgentRel.setUpdateTime(new Date());
discountPackageAgentRel.setType(1);
discountPackageAgentService.updateDiscountPackageAgentRel(discountPackageAgentRel);
}
@ -131,6 +135,7 @@ public class HighDiscountPackageAgentController {
discountPackageAgentRecord.setCreateTime(new Date());
discountPackageAgentRecord.setUpdateTime(new Date());
discountPackageAgentRecord.setStatus(1);
discountPackageAgentRecord.setType(1);
discountPackageAgentRecord.setOpId(userInfoModel.getSecUser().getId());
discountPackageAgentRecord.setOpName(userInfoModel.getSecUser().getLoginName());
discountPackageAgentRecord.setCount(object.getInteger("num"));
@ -139,7 +144,6 @@ public class HighDiscountPackageAgentController {
discountPackageAgentService.insertDiscountPackageAgentRecord(discountPackageAgentRecord);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
@ -151,12 +155,14 @@ public class HighDiscountPackageAgentController {
@RequestMapping(value = "/getDiscountPackageAgentRelList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取优惠券包代理商关联列表")
public ResponseData getDiscountPackageAgentRelList(@RequestParam(name = "agentId", required = false) Long agentId) {
public ResponseData getDiscountPackageAgentRelList(@RequestParam(name = "agentId", required = false) Long agentId,
@RequestParam(name = "type", required = false) Long type) {
try {
Map<String,Object> map = new HashMap<>();
map.put("agentId",agentId);
map.put("type",type);
List<HighDiscountPackageAgentRel> list = discountPackageAgentService.getListRel(map);
@ -171,13 +177,16 @@ public class HighDiscountPackageAgentController {
@RequestMapping(value = "/getDiscountPackageAgentRecord", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取优惠券包代理商分发记录列表")
public ResponseData getDiscountPackageAgentRecord(@RequestParam(name = "agentId", required = false) Long agentId,@RequestParam(name = "discountPackageId", required = false) Long discountPackageId) {
public ResponseData getDiscountPackageAgentRecord(@RequestParam(name = "agentId", required = false) Long agentId,
@RequestParam(name = "type", required = false) Integer type,
@RequestParam(name = "discountPackageId", required = false) Long discountPackageId) {
try {
Map<String,Object> map = new HashMap<>();
map.put("agentId",agentId);
map.put("discountPackageId",discountPackageId);
map.put("type",type);
List<HighDiscountPackageAgentRecord> list = discountPackageAgentService.getListRecord(map);
@ -189,5 +198,45 @@ public class HighDiscountPackageAgentController {
}
}
@RequestMapping(value = "/generateDiscountPackageAgentCode", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "绑定优惠券包")
public ResponseData generateDiscountPackageAgentCode(@RequestBody JSONObject object) {
try {
if (object.getLong("agentId") == null ||
object.getInteger("discountPackageId") == null ||
object.getInteger("num") == null) {
log.error("discountPackageAgent -> distribute() error!","参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(object.getInteger("discountPackageId"));
HighAgent agent = highAgentService.findByAgentMsgId(object.getLong("agentId"));
if (discountPackage == null || agent == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "相关内容不存在!");
}
JSONObject objectMap = new JSONObject();
objectMap.put("agentId",agent.getId());
objectMap.put("agentName",agent.getAgentName());
objectMap.put("discountPackageId",object.getInteger("discountPackageId"));
objectMap.put("discountPackageName",discountPackage.getTitle());
objectMap.put("num" , object.getInteger("num"));
objectMap.put("serialNumber" , object.getString("serialNumber"));
discountPackageAgentService.generateDiscountPackageAgentCode(objectMap);
return ResponseMsgUtil.success("生成成功");
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -750,6 +750,9 @@ public class HighDiscountPackageController {
public ResponseData giveAwayAgent(@RequestBody JSONObject body) {
try {
System.out.println("====================代理商赠送请求body===============================");
System.out.println(body);
if (body == null ||
body.getLong("agentId") == null ||
body.getLong("discountPackageId") == null ||
@ -759,9 +762,11 @@ public class HighDiscountPackageController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
Map<String , Object> mapParent = new HashMap<>();
mapParent.put("agentId" , body.getLong("agentId"));
mapParent.put("discountPackageId" , body.getLong("discountPackageId"));
mapParent.put("type" , 1);
HighDiscountPackageAgentRel discountPackageAgentRelParent = discountPackageAgentService.getDetailRelByMap(mapParent);
if (discountPackageAgentRelParent != null && discountPackageAgentRelParent.getStockCount() < body.getInteger("num") ) {
@ -770,11 +775,6 @@ public class HighDiscountPackageController {
}
discountPackageAgentRelParent.setStockCount(discountPackageAgentRelParent.getStockCount()-body.getInteger("num"));
discountPackageAgentRelParent.setSalesCount(discountPackageAgentRelParent.getSalesCount() + body.getInteger("num"));
discountPackageAgentService.updateDiscountPackageAgentRel(discountPackageAgentRelParent);
List<String> phoneList = new ArrayList<>();
phoneList.add(body.getString("phone"));
@ -782,6 +782,12 @@ public class HighDiscountPackageController {
highDiscountPackageService.giveAway(body.getLong("discountPackageId"), phoneList);
}
discountPackageAgentRelParent.setStockCount(discountPackageAgentRelParent.getStockCount()-body.getInteger("num"));
discountPackageAgentRelParent.setSalesCount(discountPackageAgentRelParent.getSalesCount() + body.getInteger("num"));
discountPackageAgentService.updateDiscountPackageAgentRel(discountPackageAgentRelParent);
return ResponseMsgUtil.success("赠送成功!");
} catch (Exception e) {

File diff suppressed because one or more lines are too long

@ -1,15 +1,19 @@
package com.cweb.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.Base64Util;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.AESEncodeUtil;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.*;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.*;
@ -24,10 +28,7 @@ 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;
import java.util.*;
@Controller
@RequestMapping(value = "/discountPackage")
@ -45,12 +46,17 @@ public class HighDiscountPackageController {
@Resource
private HighDiscountService highDiscountService;
@Resource
private CommonService commonService;
@RequestMapping(value = "/getDiscountPackageList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取优惠券包列表")
public ResponseData getDiscountPackageList(@RequestParam(name = "companyId", required = true) String companyId,
@RequestParam(name = "usingAttribution", required = false) Integer usingAttribution,
@RequestParam(name = "title", required = false) String title,
@RequestParam(name = "showLabel", required = false) String showLabel,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) {
try {
@ -59,6 +65,7 @@ public class HighDiscountPackageController {
map.put("companyId", companyId);
map.put("usingAttribution", usingAttribution);
map.put("title" , title);
map.put("showLabel" , showLabel);
map.put("salesType" , 1);
map.put("status" , 1);
PageHelper.startPage(pageNum, pageSize);
@ -86,9 +93,11 @@ public class HighDiscountPackageController {
for (HighDiscountPackageDetails discount: detailsList) {
discount.setDiscountDetail(highDiscountService.getDiscountById(Long.parseLong(discount.getDiscountId().toString())));
}
map.put("msg", commonService.findSecConfigByType("DISCOUNT_PACKAGE_DETAIL").getCodeValue());
map.put("discountList", detailsList);
return ResponseMsgUtil.success(map);
}
return ResponseMsgUtil.success(null);
} catch (Exception e) {
@ -97,6 +106,38 @@ public class HighDiscountPackageController {
}
}
@RequestMapping(value = "/receivePackage", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "领取券包")
public ResponseData receivePackage(@RequestParam(name = "code", required = false) String code) {
try {
// 用户
String jsonData;
try {
jsonData = AESEncodeUtil.aesDecrypt(Base64Util.decode(code));
} catch (Exception e) {
log.error("HighDiscountController -> getDiscountByQrCode() error!","code解码错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "code解码错误");
}
JSONObject jsonObject = JSON.parseObject(jsonData);
String type = jsonObject.getString("type");
if (!type.equals("DISCOUNT_PACKAGE")){
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前业务不支持!");
}
highDiscountPackageService.receivePackage(jsonObject.getInteger("id") , code);
return ResponseMsgUtil.success("领取成功!");
} catch (Exception e) {
log.error("HighDiscountPackageController --> giveAway() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,200 +0,0 @@
package com.cweb.controller;
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.security.*;
import com.hai.common.utils.*;
import com.hai.config.UnionUserConfig;
import com.hai.entity.HighUser;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.service.HighUserService;
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.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 javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.Objects;
@Controller
@RequestMapping(value = "/user")
@Api(value = "用户共用接口")
public class HighUserCommonController {
private static final Logger log = LoggerFactory.getLogger(WechatController.class);
@Resource
private HighUserService highUserService;
@Resource
private RedisUtil redisUtil;
@Resource
private UnionUserConfig unionUserConfig;
@Resource
private UserCenter userCenter;
@RequestMapping(value = "/login", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "登录接口【用户不存在会自动注册】")
public ResponseData login(@RequestParam(value = "phone", required = true) String phone,
@RequestParam(value = "code", required = true) String code,
@RequestParam(value = "openId", required = false) String openId,
@RequestParam(value = "popularizeUserId", required = false) Long popularizeUserId,
@RequestParam(value = "regionId", required = false) String regionId,
HttpServletRequest request, HttpServletResponse response) {
try {
// 获取手机号验证码
String phoneSmsCode = (String) redisUtil.get("SMS_"+phone);
// 校验验证码
if (StringUtils.isBlank(phoneSmsCode) || !Objects.equals(phoneSmsCode,code)) {
log.error("HighUserController --> bindUserPhone() error!", "验证码错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "验证码错误");
}
redisUtil.del("SMS_"+phone);
HighUser user = highUserService.findByPhone(phone);
if(user == null) {
user = new HighUser();
user.setName("用户" + IDGenerator.nextId(5));
user.setPhone(phone);
user.setRegTime(new Date());
user.setGold(0);
user.setOpenIdH5(openId);
user.setStatus(1);
// 用户信息完整状态
// 0:完整
// 1:需要填写用户信息
// 2:需要填写手机号
user.setInfoCompleteStatus(1);
highUserService.insertUser(user , popularizeUserId);
} else {
user.setOpenIdH5(openId);
highUserService.updateUser(user);
}
HighUserModel highUserModel = new HighUserModel();
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getPhone(), 1 , highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/unionPhoneLogin", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "银联授权手机号登录接口")
public ResponseData unionPhoneLogin(@RequestParam(value = "code", required = true) String code,
@RequestParam(value = "popularizeUserId", required = false) Long popularizeUserId,
@RequestParam(value = "regionId", required = false) String regionId,
HttpServletRequest request, HttpServletResponse response) {
try {
// 获取应用访问令牌
String backendToken = unionUserConfig.getBackendToken();
// 获取授权访问令牌
JSONObject token = unionUserConfig.getAccessToken(backendToken, code);
if (token == null || !token.getString("resp").equals("00")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, token.getString("msg"));
}
// 获取用户手机号
JSONObject userMobile = unionUserConfig.getUserMobile(backendToken, token.getJSONObject("params").getString("accessToken"), token.getJSONObject("params").getString("openId"));
if (userMobile == null || !userMobile.getString("resp").equals("00")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, userMobile.getString("msg"));
}
// 解密,获取手机号
String mobile = UnionUtils.getDecryptedValue(userMobile.getJSONObject("params").getString("mobile"), unionUserConfig.getRsaKey());
HighUser user = highUserService.findByPhone(mobile);
if(user == null) {
user = new HighUser();
user.setName("用户" + IDGenerator.nextId(5));
user.setPhone(mobile);
user.setRegTime(new Date());
user.setGold(0);
user.setUnionOpenId(token.getJSONObject("params").getString("openId"));
user.setUnionUnionId(token.getJSONObject("params").getString("unionId"));
user.setStatus(1);
// 用户信息完整状态
// 0:完整
// 1:需要填写用户信息
// 2:需要填写手机号
user.setInfoCompleteStatus(1);
highUserService.insertUser(user , popularizeUserId);
} else {
user.setUnionOpenId(token.getJSONObject("params").getString("openId"));
user.setUnionUnionId(token.getJSONObject("params").getString("unionId"));
highUserService.updateUser(user);
}
HighUserModel highUserModel = new HighUserModel();
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getPhone(), 1 , highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/loginOut", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "退出登录")
public ResponseData loginOut(HttpServletRequest request, HttpServletResponse response) {
try {
// 用户信息
HighUserModel sessionModel = userCenter.getSessionModel(HighUserModel.class);
if (sessionModel == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户信息");
}
userCenter.remove(request, response);
return ResponseMsgUtil.success("退出成功");
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/ip", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "退出登录")
public ResponseData ip(HttpServletRequest request, HttpServletResponse response) {
try {
// 113.205.199.32
// ;
// return ResponseMsgUtil.success(RequestUtils.getRequestIp());
return ResponseMsgUtil.success(HttpsUtils.doGet("https://api.map.baidu.com/location/ip?ak=X4sSdXsohVOMb1tNiLZloD9ows5FaNjq&ip=113.205.199.32&coor=gcj02"));
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,372 +0,0 @@
package com.cweb.controller;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
import com.alibaba.fastjson.JSONObject;
import com.cweb.config.SessionKeyCache;
import com.cweb.config.SysConst;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.*;
import com.hai.common.utils.*;
import com.hai.config.WxMaConfiguration;
import com.hai.entity.HighUser;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.service.HighUserPayPasswordService;
import com.hai.service.HighUserService;
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 javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.*;
@Controller
@RequestMapping(value = "/wechat")
@Api(value = "微信授权")
public class WechatController {
private static final Logger log = LoggerFactory.getLogger(WechatController.class);
private static final String WX_OPENID_SESSION_REDIS = "WX_OPENID_SESSION_REDIS";
@Autowired
private UserCenter userCenter;
@Resource
private HighUserService highUserService;
@Resource
private RedisUtil redisUtil;
@RequestMapping(value = "/handleCode", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "小程序code解析")
public ResponseData compairCode(@RequestParam(value = "code", required = true) String code,
HttpServletRequest request, HttpServletResponse response) {
try {
//校验code,openId不能同时为空
if (StringUtils.isEmpty(code)) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.REQ_PARAMS_ERROR, "");
}
//请求微信api,获取用户session_key以及openId
final WxMaService wxService = WxMaConfiguration.getMaService();
WxMaJscode2SessionResult session = wxService.jsCode2SessionInfo(code);
//保存小程序用户登录的openId及sessionKey信息
redisUtil.hset(WX_OPENID_SESSION_REDIS, session.getOpenid(), session);
JSONObject jo = new JSONObject();
jo.put("openId", session.getOpenid());
return ResponseMsgUtil.success(jo);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/loginByPhone", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "小程序根据手机号登录或注册")
public ResponseData loginByPhone(@RequestParam(value = "encryptedData", required = true) String encryptedData,
@RequestParam(value = "iv", required = true) String iv,
@RequestParam(value = "openId", required = true) String openId,
@RequestParam(value = "popularizeUserId", required = false) Long popularizeUserId,
@RequestParam(value = "regionId", required = false) String regionId,
HttpServletRequest request, HttpServletResponse response) {
try {
log.error("origin encryptedData:" + encryptedData + ";iv:" + iv);
//校验openId不能为空
//encryptedData,iv与unionId不能同时为空
encryptedData = encryptedData.replace(" ", "+");
iv = iv.replace(" ", "+");
log.error("dest encryptedData:" + encryptedData + ";iv:" + iv);
if (StringUtils.isEmpty(openId)
|| StringUtils.isEmpty(encryptedData) || StringUtils.isEmpty(iv)) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.REQ_PARAMS_ERROR, "");
}
//请求微信api,获取用户session_key以及openId
Object skObject = redisUtil.hget(WX_OPENID_SESSION_REDIS, openId);
if (skObject == null) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_LOGIN_ERROR);
}
WxMaJscode2SessionResult session = (WxMaJscode2SessionResult) skObject;
final WxMaService wxService = WxMaConfiguration.getMaService();
WxMaPhoneNumberInfo phoneNoInfo = wxService.getUserService().getPhoneNoInfo(session.getSessionKey(), encryptedData, iv);
if (phoneNoInfo == null || StringUtils.isEmpty(phoneNoInfo.getPurePhoneNumber())) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "用户phoneNumber解析失败");
}
// 根据手机号查询用户
HighUser user = highUserService.findByPhone(phoneNoInfo.getPurePhoneNumber());
if (user == null) {
user = new HighUser();
user.setName("用户" + IDGenerator.nextId(5));
user.setPhone(phoneNoInfo.getPurePhoneNumber());
user.setRegTime(new Date());
user.setGold(0);
user.setOpenId(session.getOpenid());
user.setUnionId(session.getUnionid());
user.setStatus(1);
// 用户信息完整状态
// 0:完整
// 1:需要填写用户信息
// 2:需要填写手机号
user.setInfoCompleteStatus(1);
highUserService.insertUser(user , popularizeUserId);
} else {
if (session.getOpenid() == null) {
user.setOpenId(session.getOpenid());
user.setUnionId(session.getUnionid());
highUserService.updateUser(user);
}
}
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getPhone(), 1, highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getUserInfo", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "小程序获取用户信息")
public ResponseData getUserInfo(@RequestParam(value = "encryptedData", required = true) String encryptedData,
@RequestParam(value = "iv", required = true) String iv,
@RequestParam(value = "openId", required = true) String openId,
HttpServletRequest request, HttpServletResponse response) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
//校验openId不能为空
//encryptedData,iv与unionId不能同时为空
encryptedData = encryptedData.replace(" ", "+");
iv = iv.replace(" ", "+");
if (StringUtils.isEmpty(openId) || StringUtils.isEmpty(encryptedData) || StringUtils.isEmpty(iv)) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.REQ_PARAMS_ERROR, "");
}
//请求微信api,获取用户session_key以及openId
Object skObject = redisUtil.hget(WX_OPENID_SESSION_REDIS, openId);
if (skObject == null) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_LOGIN_ERROR);
}
WxMaJscode2SessionResult session = (WxMaJscode2SessionResult) skObject;
final WxMaService wxService = WxMaConfiguration.getMaService();
WxMaUserInfo userInfo = wxService.getUserService().getUserInfo(session.getSessionKey(), encryptedData, iv);
if (userInfo == null) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "用户phoneNumber解析失败");
}
HighUser user = highUserService.findByUserId(userInfoModel.getHighUser().getId());
if (user == null) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.COMMON_ERROR, "未找到用户信息");
}
// 用户信息完整状态
// 0:完整
// 1:需要填写用户信息
// 2:需要填写手机号
if (user.getInfoCompleteStatus() == 1) {
if (StringUtils.isNotBlank(user.getPhone())) {
user.setInfoCompleteStatus(0);
} else {
user.setInfoCompleteStatus(2);
}
}
user.setName(userInfo.getNickName());
user.setHeaderImg(userInfo.getAvatarUrl());
highUserService.updateUser(user);
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
if (user.getPhone() == null) {
log.error("login error!", "未绑定手机号");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未绑定手机号");
}
SessionObject so = new SessionObject(user.getPhone(), 1, highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getH5AccessToken", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "【H5】获取AccessToken")
public ResponseData getH5AccessToken(@RequestParam(value = "code", required = true) String code) {
try {
Map<String, Object> params = new HashMap<>();
params.put("appid", SysConst.getSysConfig().getWxH5AppId());
params.put("secret", SysConst.getSysConfig().getWxH5AppSecret());
params.put("code", code);
params.put("grant_type", "authorization_code");
return ResponseMsgUtil.success(HttpsUtils.doGet("https://api.weixin.qq.com/sns/oauth2/access_token", params));
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/loginByTel", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据手机号码登陆")
public ResponseData loginByTel(@RequestParam(value = "phone", required = true) String phone,
@RequestParam(value = "code", required = true) String code,
@RequestParam(value = "popularizeUserId", required = false) Long popularizeUserId,
@RequestParam(value = "regionId", required = false) String regionId,
HttpServletRequest request, HttpServletResponse response) {
try {
// 获取手机号验证码
String phoneSmsCode = (String) redisUtil.get("SMS_"+ phone);
// 验证码校验
if (!(StringUtils.isNotBlank(phoneSmsCode) && Objects.equals(phoneSmsCode,code))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "验证码错误");
}
// 根据手机号查询用户
HighUser user = highUserService.findByPhone(phone);
if (user == null) {
user = new HighUser();
user.setName("用户" + IDGenerator.nextId(5));
user.setPhone(phone);
user.setRegTime(new Date());
user.setGold(0);
user.setStatus(1);
// 用户信息完整状态
// 0:完整
// 1:需要填写用户信息
// 2:需要填写手机号
user.setInfoCompleteStatus(1);
highUserService.insertUser(user , popularizeUserId);
}
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getPhone(), 1, highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/loginBySilence", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据手机号码登陆")
public ResponseData loginByTel(@RequestParam(value = "phone", required = true) String phone,
HttpServletRequest request, HttpServletResponse response) {
try {
// 根据手机号查询用户
HighUser user = highUserService.findByPhone(phone);
if (user == null) {
user = new HighUser();
user.setName("用户" + IDGenerator.nextId(5));
user.setPhone(phone);
user.setRegTime(new Date());
user.setGold(0);
user.setStatus(1);
// 用户信息完整状态
// 0:完整
// 1:需要填写用户信息
// 2:需要填写手机号
user.setInfoCompleteStatus(1);
highUserService.insertUser(user , null);
}
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getPhone(), 1, highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getH5AccessByOpenId", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "【H5】通过openId查询")
public ResponseData getH5AccessByOpenId(@RequestParam(value = "openId", required = true) String openId,
HttpServletRequest request, HttpServletResponse response) {
try {
HighUser user = highUserService.findByOpenIdH5(openId);
if (user == null) {
user = new HighUser();
user.setName("临时游客");
user.setRegTime(new Date());
user.setGold(0);
user.setOpenId(openId);
user.setStatus(1);
// 用户信息完整状态
// 0:完整
// 1:需要填写用户信息
// 2:需要填写手机号
user.setInfoCompleteStatus(1);
return ResponseMsgUtil.success(user);
} else {
// 定义个人所有数据
HighUserModel highUserModel = new HighUserModel();
HighUser detailData = highUserService.getDetailDataByUser(user.getId());
detailData.setPassword(null);
highUserModel.setHighUser(detailData);
SessionObject so = new SessionObject(user.getPhone(), 1, highUserModel);
userCenter.save(request, response, so);
return ResponseMsgUtil.success(so);
}
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
}

@ -168,6 +168,7 @@ public class OrderPayController {
Integer payPlatformType = 1;
String payPlatformKey = null;
String payPlatformMerNo = null;
System.out.println(order);
if (PlatformType.TYPE2.getNumber().equals(body.getInteger("platformType"))) {
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1648729281);
@ -198,21 +199,21 @@ public class OrderPayController {
} else {
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1634835264);
}
} else {
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195);
}
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE5.getNumber())) {
HighCoupon coupon = couponService.getCouponById(order.getHighChildOrderList().get(0).getGoodsId());
if (coupon.getCouponSource() != null && coupon.getCouponSource().equals(4)) {
if (order.getMemDiscountId() != null) {
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195);
} else {
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1634835264);
}else if(coupon.getCouponSource().equals(8)) {
// 查询支付配置
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type3);
if (gasChannelConfig == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!");
}
payPlatformType = gasChannelConfig.getPayPlatformType();
payPlatformMerNo = gasChannelConfig.getPayPlatformMerNo();
payPlatformKey = gasChannelConfig.getPayPlatformMerKey();
weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo());
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N";
} else {
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195);
}
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE6.getNumber())) {
// 查询油站
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(order.getHighChildOrderList().get(0).getGoodsId());
@ -396,6 +397,8 @@ public class OrderPayController {
SortedMap<Object, Object> sortedMap;
System.out.println("-----------------------" + payPlatformType);
if (payPlatformType == 2) {
objectGas.put("outTradeNo" , order.getOrderNo());
objectGas.put("transType" , "JSAPI");

@ -163,7 +163,7 @@ public class HighGasSchedule {
// gasService.getDianAllStation();
// }
@Scheduled(cron = "7 0 0 * * ?") // 每日凌晨00:00:7执行一次
@Scheduled(cron = "0 5 0 * * ?") // 每日凌晨00:00:7执行一次
public void deleteOilNo() {
gasService.deleteOilNo();
}

@ -0,0 +1,142 @@
package com.hai.dao;
import com.hai.entity.ApiCoupon;
import com.hai.entity.ApiCouponExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;
/**
*
* 代码由工具生成,请勿修改!!!
* 如果需要扩展请在其父类进行扩展
*
**/
@Repository
public interface ApiCouponMapper extends ApiCouponMapperExt {
@SelectProvider(type=ApiCouponSqlProvider.class, method="countByExample")
long countByExample(ApiCouponExample example);
@DeleteProvider(type=ApiCouponSqlProvider.class, method="deleteByExample")
int deleteByExample(ApiCouponExample example);
@Delete({
"delete from api_coupon",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into api_coupon (`type`, goods_type, ",
"`name`, code, `desc`, ",
"price, img, effective_days, ",
"create_time, update_time, ",
"`status`, op_id, op_name, ",
"ext_1, ext_2, ext_3)",
"values (#{type,jdbcType=INTEGER}, #{goodsType,jdbcType=VARCHAR}, ",
"#{name,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR}, ",
"#{price,jdbcType=INTEGER}, #{img,jdbcType=VARCHAR}, #{effectiveDays,jdbcType=INTEGER}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{status,jdbcType=INTEGER}, #{opId,jdbcType=BIGINT}, #{opName,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(ApiCoupon record);
@InsertProvider(type=ApiCouponSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(ApiCoupon record);
@SelectProvider(type=ApiCouponSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="goods_type", property="goodsType", jdbcType=JdbcType.VARCHAR),
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
@Result(column="code", property="code", jdbcType=JdbcType.VARCHAR),
@Result(column="desc", property="desc", jdbcType=JdbcType.VARCHAR),
@Result(column="price", property="price", jdbcType=JdbcType.INTEGER),
@Result(column="img", property="img", jdbcType=JdbcType.VARCHAR),
@Result(column="effective_days", property="effectiveDays", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT),
@Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<ApiCoupon> selectByExample(ApiCouponExample example);
@Select({
"select",
"id, `type`, goods_type, `name`, code, `desc`, price, img, effective_days, create_time, ",
"update_time, `status`, op_id, op_name, ext_1, ext_2, ext_3",
"from api_coupon",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="goods_type", property="goodsType", jdbcType=JdbcType.VARCHAR),
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
@Result(column="code", property="code", jdbcType=JdbcType.VARCHAR),
@Result(column="desc", property="desc", jdbcType=JdbcType.VARCHAR),
@Result(column="price", property="price", jdbcType=JdbcType.INTEGER),
@Result(column="img", property="img", jdbcType=JdbcType.VARCHAR),
@Result(column="effective_days", property="effectiveDays", jdbcType=JdbcType.INTEGER),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT),
@Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
ApiCoupon selectByPrimaryKey(Long id);
@UpdateProvider(type=ApiCouponSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") ApiCoupon record, @Param("example") ApiCouponExample example);
@UpdateProvider(type=ApiCouponSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") ApiCoupon record, @Param("example") ApiCouponExample example);
@UpdateProvider(type=ApiCouponSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(ApiCoupon record);
@Update({
"update api_coupon",
"set `type` = #{type,jdbcType=INTEGER},",
"goods_type = #{goodsType,jdbcType=VARCHAR},",
"`name` = #{name,jdbcType=VARCHAR},",
"code = #{code,jdbcType=VARCHAR},",
"`desc` = #{desc,jdbcType=VARCHAR},",
"price = #{price,jdbcType=INTEGER},",
"img = #{img,jdbcType=VARCHAR},",
"effective_days = #{effectiveDays,jdbcType=INTEGER},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"`status` = #{status,jdbcType=INTEGER},",
"op_id = #{opId,jdbcType=BIGINT},",
"op_name = #{opName,jdbcType=VARCHAR},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(ApiCoupon record);
}

@ -0,0 +1,7 @@
package com.hai.dao;
/**
* mapper扩展类
*/
public interface ApiCouponMapperExt {
}

@ -0,0 +1,402 @@
package com.hai.dao;
import com.hai.entity.ApiCoupon;
import com.hai.entity.ApiCouponExample.Criteria;
import com.hai.entity.ApiCouponExample.Criterion;
import com.hai.entity.ApiCouponExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class ApiCouponSqlProvider {
public String countByExample(ApiCouponExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("api_coupon");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(ApiCouponExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("api_coupon");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(ApiCoupon record) {
SQL sql = new SQL();
sql.INSERT_INTO("api_coupon");
if (record.getType() != null) {
sql.VALUES("`type`", "#{type,jdbcType=INTEGER}");
}
if (record.getGoodsType() != null) {
sql.VALUES("goods_type", "#{goodsType,jdbcType=VARCHAR}");
}
if (record.getName() != null) {
sql.VALUES("`name`", "#{name,jdbcType=VARCHAR}");
}
if (record.getCode() != null) {
sql.VALUES("code", "#{code,jdbcType=VARCHAR}");
}
if (record.getDesc() != null) {
sql.VALUES("`desc`", "#{desc,jdbcType=VARCHAR}");
}
if (record.getPrice() != null) {
sql.VALUES("price", "#{price,jdbcType=INTEGER}");
}
if (record.getImg() != null) {
sql.VALUES("img", "#{img,jdbcType=VARCHAR}");
}
if (record.getEffectiveDays() != null) {
sql.VALUES("effective_days", "#{effectiveDays,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getOpId() != null) {
sql.VALUES("op_id", "#{opId,jdbcType=BIGINT}");
}
if (record.getOpName() != null) {
sql.VALUES("op_name", "#{opName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}");
}
return sql.toString();
}
public String selectByExample(ApiCouponExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("`type`");
sql.SELECT("goods_type");
sql.SELECT("`name`");
sql.SELECT("code");
sql.SELECT("`desc`");
sql.SELECT("price");
sql.SELECT("img");
sql.SELECT("effective_days");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("`status`");
sql.SELECT("op_id");
sql.SELECT("op_name");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("api_coupon");
applyWhere(sql, example, false);
if (example != null && example.getOrderByClause() != null) {
sql.ORDER_BY(example.getOrderByClause());
}
return sql.toString();
}
public String updateByExampleSelective(Map<String, Object> parameter) {
ApiCoupon record = (ApiCoupon) parameter.get("record");
ApiCouponExample example = (ApiCouponExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("api_coupon");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getType() != null) {
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
}
if (record.getGoodsType() != null) {
sql.SET("goods_type = #{record.goodsType,jdbcType=VARCHAR}");
}
if (record.getName() != null) {
sql.SET("`name` = #{record.name,jdbcType=VARCHAR}");
}
if (record.getCode() != null) {
sql.SET("code = #{record.code,jdbcType=VARCHAR}");
}
if (record.getDesc() != null) {
sql.SET("`desc` = #{record.desc,jdbcType=VARCHAR}");
}
if (record.getPrice() != null) {
sql.SET("price = #{record.price,jdbcType=INTEGER}");
}
if (record.getImg() != null) {
sql.SET("img = #{record.img,jdbcType=VARCHAR}");
}
if (record.getEffectiveDays() != null) {
sql.SET("effective_days = #{record.effectiveDays,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getOpId() != null) {
sql.SET("op_id = #{record.opId,jdbcType=BIGINT}");
}
if (record.getOpName() != null) {
sql.SET("op_name = #{record.opName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
}
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByExample(Map<String, Object> parameter) {
SQL sql = new SQL();
sql.UPDATE("api_coupon");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
sql.SET("goods_type = #{record.goodsType,jdbcType=VARCHAR}");
sql.SET("`name` = #{record.name,jdbcType=VARCHAR}");
sql.SET("code = #{record.code,jdbcType=VARCHAR}");
sql.SET("`desc` = #{record.desc,jdbcType=VARCHAR}");
sql.SET("price = #{record.price,jdbcType=INTEGER}");
sql.SET("img = #{record.img,jdbcType=VARCHAR}");
sql.SET("effective_days = #{record.effectiveDays,jdbcType=INTEGER}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("op_id = #{record.opId,jdbcType=BIGINT}");
sql.SET("op_name = #{record.opName,jdbcType=VARCHAR}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
ApiCouponExample example = (ApiCouponExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(ApiCoupon record) {
SQL sql = new SQL();
sql.UPDATE("api_coupon");
if (record.getType() != null) {
sql.SET("`type` = #{type,jdbcType=INTEGER}");
}
if (record.getGoodsType() != null) {
sql.SET("goods_type = #{goodsType,jdbcType=VARCHAR}");
}
if (record.getName() != null) {
sql.SET("`name` = #{name,jdbcType=VARCHAR}");
}
if (record.getCode() != null) {
sql.SET("code = #{code,jdbcType=VARCHAR}");
}
if (record.getDesc() != null) {
sql.SET("`desc` = #{desc,jdbcType=VARCHAR}");
}
if (record.getPrice() != null) {
sql.SET("price = #{price,jdbcType=INTEGER}");
}
if (record.getImg() != null) {
sql.SET("img = #{img,jdbcType=VARCHAR}");
}
if (record.getEffectiveDays() != null) {
sql.SET("effective_days = #{effectiveDays,jdbcType=INTEGER}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getOpId() != null) {
sql.SET("op_id = #{opId,jdbcType=BIGINT}");
}
if (record.getOpName() != null) {
sql.SET("op_name = #{opName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
protected void applyWhere(SQL sql, ApiCouponExample example, boolean includeExamplePhrase) {
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (includeExamplePhrase) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -0,0 +1,148 @@
package com.hai.dao;
import com.hai.entity.HighDiscountPackageAgentCode;
import com.hai.entity.HighDiscountPackageAgentCodeExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;
/**
*
* 代码由工具生成,请勿修改!!!
* 如果需要扩展请在其父类进行扩展
*
**/
@Repository
public interface HighDiscountPackageAgentCodeMapper extends HighDiscountPackageAgentCodeMapperExt {
@SelectProvider(type=HighDiscountPackageAgentCodeSqlProvider.class, method="countByExample")
long countByExample(HighDiscountPackageAgentCodeExample example);
@DeleteProvider(type=HighDiscountPackageAgentCodeSqlProvider.class, method="deleteByExample")
int deleteByExample(HighDiscountPackageAgentCodeExample example);
@Delete({
"delete from high_discount_package_agent_code",
"where id = #{id,jdbcType=BIGINT}"
})
int deleteByPrimaryKey(Long id);
@Insert({
"insert into high_discount_package_agent_code (discount_package_id, discount_package_name, ",
"agent_id, agent_name, ",
"discount_package_actual_id, discount_agent_batch_id, ",
"code, qr_code, qr_code_url, ",
"create_time, update_time, ",
"`status`, op_id, op_name, ",
"ext_1, ext_2, ext_3)",
"values (#{discountPackageId,jdbcType=BIGINT}, #{discountPackageName,jdbcType=VARCHAR}, ",
"#{agentId,jdbcType=BIGINT}, #{agentName,jdbcType=VARCHAR}, ",
"#{discountPackageActualId,jdbcType=BIGINT}, #{discountAgentBatchId,jdbcType=BIGINT}, ",
"#{code,jdbcType=VARCHAR}, #{qrCode,jdbcType=VARCHAR}, #{qrCodeUrl,jdbcType=VARCHAR}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{status,jdbcType=INTEGER}, #{opId,jdbcType=BIGINT}, #{opName,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighDiscountPackageAgentCode record);
@InsertProvider(type=HighDiscountPackageAgentCodeSqlProvider.class, method="insertSelective")
@Options(useGeneratedKeys=true,keyProperty="id")
int insertSelective(HighDiscountPackageAgentCode record);
@SelectProvider(type=HighDiscountPackageAgentCodeSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.BIGINT),
@Result(column="discount_package_name", property="discountPackageName", jdbcType=JdbcType.VARCHAR),
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="agent_name", property="agentName", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_package_actual_id", property="discountPackageActualId", jdbcType=JdbcType.BIGINT),
@Result(column="discount_agent_batch_id", property="discountAgentBatchId", jdbcType=JdbcType.BIGINT),
@Result(column="code", property="code", jdbcType=JdbcType.VARCHAR),
@Result(column="qr_code", property="qrCode", jdbcType=JdbcType.VARCHAR),
@Result(column="qr_code_url", property="qrCodeUrl", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT),
@Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<HighDiscountPackageAgentCode> selectByExample(HighDiscountPackageAgentCodeExample example);
@Select({
"select",
"id, discount_package_id, discount_package_name, agent_id, agent_name, discount_package_actual_id, ",
"discount_agent_batch_id, code, qr_code, qr_code_url, create_time, update_time, ",
"`status`, op_id, op_name, ext_1, ext_2, ext_3",
"from high_discount_package_agent_code",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.BIGINT),
@Result(column="discount_package_name", property="discountPackageName", jdbcType=JdbcType.VARCHAR),
@Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
@Result(column="agent_name", property="agentName", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_package_actual_id", property="discountPackageActualId", jdbcType=JdbcType.BIGINT),
@Result(column="discount_agent_batch_id", property="discountAgentBatchId", jdbcType=JdbcType.BIGINT),
@Result(column="code", property="code", jdbcType=JdbcType.VARCHAR),
@Result(column="qr_code", property="qrCode", jdbcType=JdbcType.VARCHAR),
@Result(column="qr_code_url", property="qrCodeUrl", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT),
@Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
HighDiscountPackageAgentCode selectByPrimaryKey(Long id);
@UpdateProvider(type=HighDiscountPackageAgentCodeSqlProvider.class, method="updateByExampleSelective")
int updateByExampleSelective(@Param("record") HighDiscountPackageAgentCode record, @Param("example") HighDiscountPackageAgentCodeExample example);
@UpdateProvider(type=HighDiscountPackageAgentCodeSqlProvider.class, method="updateByExample")
int updateByExample(@Param("record") HighDiscountPackageAgentCode record, @Param("example") HighDiscountPackageAgentCodeExample example);
@UpdateProvider(type=HighDiscountPackageAgentCodeSqlProvider.class, method="updateByPrimaryKeySelective")
int updateByPrimaryKeySelective(HighDiscountPackageAgentCode record);
@Update({
"update high_discount_package_agent_code",
"set discount_package_id = #{discountPackageId,jdbcType=BIGINT},",
"discount_package_name = #{discountPackageName,jdbcType=VARCHAR},",
"agent_id = #{agentId,jdbcType=BIGINT},",
"agent_name = #{agentName,jdbcType=VARCHAR},",
"discount_package_actual_id = #{discountPackageActualId,jdbcType=BIGINT},",
"discount_agent_batch_id = #{discountAgentBatchId,jdbcType=BIGINT},",
"code = #{code,jdbcType=VARCHAR},",
"qr_code = #{qrCode,jdbcType=VARCHAR},",
"qr_code_url = #{qrCodeUrl,jdbcType=VARCHAR},",
"create_time = #{createTime,jdbcType=TIMESTAMP},",
"update_time = #{updateTime,jdbcType=TIMESTAMP},",
"`status` = #{status,jdbcType=INTEGER},",
"op_id = #{opId,jdbcType=BIGINT},",
"op_name = #{opName,jdbcType=VARCHAR},",
"ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR}",
"where id = #{id,jdbcType=BIGINT}"
})
int updateByPrimaryKey(HighDiscountPackageAgentCode record);
}

@ -0,0 +1,7 @@
package com.hai.dao;
/**
* mapper扩展类
*/
public interface HighDiscountPackageAgentCodeMapperExt {
}

@ -0,0 +1,416 @@
package com.hai.dao;
import com.hai.entity.HighDiscountPackageAgentCode;
import com.hai.entity.HighDiscountPackageAgentCodeExample.Criteria;
import com.hai.entity.HighDiscountPackageAgentCodeExample.Criterion;
import com.hai.entity.HighDiscountPackageAgentCodeExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;
public class HighDiscountPackageAgentCodeSqlProvider {
public String countByExample(HighDiscountPackageAgentCodeExample example) {
SQL sql = new SQL();
sql.SELECT("count(*)").FROM("high_discount_package_agent_code");
applyWhere(sql, example, false);
return sql.toString();
}
public String deleteByExample(HighDiscountPackageAgentCodeExample example) {
SQL sql = new SQL();
sql.DELETE_FROM("high_discount_package_agent_code");
applyWhere(sql, example, false);
return sql.toString();
}
public String insertSelective(HighDiscountPackageAgentCode record) {
SQL sql = new SQL();
sql.INSERT_INTO("high_discount_package_agent_code");
if (record.getDiscountPackageId() != null) {
sql.VALUES("discount_package_id", "#{discountPackageId,jdbcType=BIGINT}");
}
if (record.getDiscountPackageName() != null) {
sql.VALUES("discount_package_name", "#{discountPackageName,jdbcType=VARCHAR}");
}
if (record.getAgentId() != null) {
sql.VALUES("agent_id", "#{agentId,jdbcType=BIGINT}");
}
if (record.getAgentName() != null) {
sql.VALUES("agent_name", "#{agentName,jdbcType=VARCHAR}");
}
if (record.getDiscountPackageActualId() != null) {
sql.VALUES("discount_package_actual_id", "#{discountPackageActualId,jdbcType=BIGINT}");
}
if (record.getDiscountAgentBatchId() != null) {
sql.VALUES("discount_agent_batch_id", "#{discountAgentBatchId,jdbcType=BIGINT}");
}
if (record.getCode() != null) {
sql.VALUES("code", "#{code,jdbcType=VARCHAR}");
}
if (record.getQrCode() != null) {
sql.VALUES("qr_code", "#{qrCode,jdbcType=VARCHAR}");
}
if (record.getQrCodeUrl() != null) {
sql.VALUES("qr_code_url", "#{qrCodeUrl,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) {
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
}
if (record.getOpId() != null) {
sql.VALUES("op_id", "#{opId,jdbcType=BIGINT}");
}
if (record.getOpName() != null) {
sql.VALUES("op_name", "#{opName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}");
}
return sql.toString();
}
public String selectByExample(HighDiscountPackageAgentCodeExample example) {
SQL sql = new SQL();
if (example != null && example.isDistinct()) {
sql.SELECT_DISTINCT("id");
} else {
sql.SELECT("id");
}
sql.SELECT("discount_package_id");
sql.SELECT("discount_package_name");
sql.SELECT("agent_id");
sql.SELECT("agent_name");
sql.SELECT("discount_package_actual_id");
sql.SELECT("discount_agent_batch_id");
sql.SELECT("code");
sql.SELECT("qr_code");
sql.SELECT("qr_code_url");
sql.SELECT("create_time");
sql.SELECT("update_time");
sql.SELECT("`status`");
sql.SELECT("op_id");
sql.SELECT("op_name");
sql.SELECT("ext_1");
sql.SELECT("ext_2");
sql.SELECT("ext_3");
sql.FROM("high_discount_package_agent_code");
applyWhere(sql, example, false);
if (example != null && example.getOrderByClause() != null) {
sql.ORDER_BY(example.getOrderByClause());
}
return sql.toString();
}
public String updateByExampleSelective(Map<String, Object> parameter) {
HighDiscountPackageAgentCode record = (HighDiscountPackageAgentCode) parameter.get("record");
HighDiscountPackageAgentCodeExample example = (HighDiscountPackageAgentCodeExample) parameter.get("example");
SQL sql = new SQL();
sql.UPDATE("high_discount_package_agent_code");
if (record.getId() != null) {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getDiscountPackageId() != null) {
sql.SET("discount_package_id = #{record.discountPackageId,jdbcType=BIGINT}");
}
if (record.getDiscountPackageName() != null) {
sql.SET("discount_package_name = #{record.discountPackageName,jdbcType=VARCHAR}");
}
if (record.getAgentId() != null) {
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}");
}
if (record.getAgentName() != null) {
sql.SET("agent_name = #{record.agentName,jdbcType=VARCHAR}");
}
if (record.getDiscountPackageActualId() != null) {
sql.SET("discount_package_actual_id = #{record.discountPackageActualId,jdbcType=BIGINT}");
}
if (record.getDiscountAgentBatchId() != null) {
sql.SET("discount_agent_batch_id = #{record.discountAgentBatchId,jdbcType=BIGINT}");
}
if (record.getCode() != null) {
sql.SET("code = #{record.code,jdbcType=VARCHAR}");
}
if (record.getQrCode() != null) {
sql.SET("qr_code = #{record.qrCode,jdbcType=VARCHAR}");
}
if (record.getQrCodeUrl() != null) {
sql.SET("qr_code_url = #{record.qrCodeUrl,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
}
if (record.getOpId() != null) {
sql.SET("op_id = #{record.opId,jdbcType=BIGINT}");
}
if (record.getOpName() != null) {
sql.SET("op_name = #{record.opName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
}
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByExample(Map<String, Object> parameter) {
SQL sql = new SQL();
sql.UPDATE("high_discount_package_agent_code");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("discount_package_id = #{record.discountPackageId,jdbcType=BIGINT}");
sql.SET("discount_package_name = #{record.discountPackageName,jdbcType=VARCHAR}");
sql.SET("agent_id = #{record.agentId,jdbcType=BIGINT}");
sql.SET("agent_name = #{record.agentName,jdbcType=VARCHAR}");
sql.SET("discount_package_actual_id = #{record.discountPackageActualId,jdbcType=BIGINT}");
sql.SET("discount_agent_batch_id = #{record.discountAgentBatchId,jdbcType=BIGINT}");
sql.SET("code = #{record.code,jdbcType=VARCHAR}");
sql.SET("qr_code = #{record.qrCode,jdbcType=VARCHAR}");
sql.SET("qr_code_url = #{record.qrCodeUrl,jdbcType=VARCHAR}");
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("op_id = #{record.opId,jdbcType=BIGINT}");
sql.SET("op_name = #{record.opName,jdbcType=VARCHAR}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
HighDiscountPackageAgentCodeExample example = (HighDiscountPackageAgentCodeExample) parameter.get("example");
applyWhere(sql, example, true);
return sql.toString();
}
public String updateByPrimaryKeySelective(HighDiscountPackageAgentCode record) {
SQL sql = new SQL();
sql.UPDATE("high_discount_package_agent_code");
if (record.getDiscountPackageId() != null) {
sql.SET("discount_package_id = #{discountPackageId,jdbcType=BIGINT}");
}
if (record.getDiscountPackageName() != null) {
sql.SET("discount_package_name = #{discountPackageName,jdbcType=VARCHAR}");
}
if (record.getAgentId() != null) {
sql.SET("agent_id = #{agentId,jdbcType=BIGINT}");
}
if (record.getAgentName() != null) {
sql.SET("agent_name = #{agentName,jdbcType=VARCHAR}");
}
if (record.getDiscountPackageActualId() != null) {
sql.SET("discount_package_actual_id = #{discountPackageActualId,jdbcType=BIGINT}");
}
if (record.getDiscountAgentBatchId() != null) {
sql.SET("discount_agent_batch_id = #{discountAgentBatchId,jdbcType=BIGINT}");
}
if (record.getCode() != null) {
sql.SET("code = #{code,jdbcType=VARCHAR}");
}
if (record.getQrCode() != null) {
sql.SET("qr_code = #{qrCode,jdbcType=VARCHAR}");
}
if (record.getQrCodeUrl() != null) {
sql.SET("qr_code_url = #{qrCodeUrl,jdbcType=VARCHAR}");
}
if (record.getCreateTime() != null) {
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
}
if (record.getUpdateTime() != null) {
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
}
if (record.getStatus() != null) {
sql.SET("`status` = #{status,jdbcType=INTEGER}");
}
if (record.getOpId() != null) {
sql.SET("op_id = #{opId,jdbcType=BIGINT}");
}
if (record.getOpName() != null) {
sql.SET("op_name = #{opName,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
}
if (record.getExt2() != null) {
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}");
}
if (record.getExt3() != null) {
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
}
sql.WHERE("id = #{id,jdbcType=BIGINT}");
return sql.toString();
}
protected void applyWhere(SQL sql, HighDiscountPackageAgentCodeExample example, boolean includeExamplePhrase) {
if (example == null) {
return;
}
String parmPhrase1;
String parmPhrase1_th;
String parmPhrase2;
String parmPhrase2_th;
String parmPhrase3;
String parmPhrase3_th;
if (includeExamplePhrase) {
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
} else {
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
}
StringBuilder sb = new StringBuilder();
List<Criteria> oredCriteria = example.getOredCriteria();
boolean firstCriteria = true;
for (int i = 0; i < oredCriteria.size(); i++) {
Criteria criteria = oredCriteria.get(i);
if (criteria.isValid()) {
if (firstCriteria) {
firstCriteria = false;
} else {
sb.append(" or ");
}
sb.append('(');
List<Criterion> criterions = criteria.getAllCriteria();
boolean firstCriterion = true;
for (int j = 0; j < criterions.size(); j++) {
Criterion criterion = criterions.get(j);
if (firstCriterion) {
firstCriterion = false;
} else {
sb.append(" and ");
}
if (criterion.isNoValue()) {
sb.append(criterion.getCondition());
} else if (criterion.isSingleValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
} else {
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
}
} else if (criterion.isBetweenValue()) {
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
} else {
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
}
} else if (criterion.isListValue()) {
sb.append(criterion.getCondition());
sb.append(" (");
List<?> listItems = (List<?>) criterion.getValue();
boolean comma = false;
for (int k = 0; k < listItems.size(); k++) {
if (comma) {
sb.append(", ");
} else {
comma = true;
}
if (criterion.getTypeHandler() == null) {
sb.append(String.format(parmPhrase3, i, j, k));
} else {
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
}
}
sb.append(')');
}
}
sb.append(')');
}
}
if (sb.length() > 0) {
sql.WHERE(sb.toString());
}
}
}

@ -39,16 +39,16 @@ public interface HighDiscountPackageAgentRecordMapper extends HighDiscountPackag
int deleteByPrimaryKey(Long id);
@Insert({
"insert into high_discount_package_agent_record (discount_package_title, discount_package_id, ",
"agent_name, agent_id, ",
"`count`, front_count, ",
"insert into high_discount_package_agent_record (`type`, discount_package_title, ",
"discount_package_id, agent_name, ",
"agent_id, `count`, front_count, ",
"after_count, create_time, ",
"update_time, `status`, ",
"op_id, op_name, ext_1, ",
"ext_2, ext_3)",
"values (#{discountPackageTitle,jdbcType=VARCHAR}, #{discountPackageId,jdbcType=BIGINT}, ",
"#{agentName,jdbcType=VARCHAR}, #{agentId,jdbcType=BIGINT}, ",
"#{count,jdbcType=INTEGER}, #{frontCount,jdbcType=INTEGER}, ",
"values (#{type,jdbcType=INTEGER}, #{discountPackageTitle,jdbcType=VARCHAR}, ",
"#{discountPackageId,jdbcType=BIGINT}, #{agentName,jdbcType=VARCHAR}, ",
"#{agentId,jdbcType=BIGINT}, #{count,jdbcType=INTEGER}, #{frontCount,jdbcType=INTEGER}, ",
"#{afterCount,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
"#{opId,jdbcType=BIGINT}, #{opName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
@ -64,6 +64,7 @@ public interface HighDiscountPackageAgentRecordMapper extends HighDiscountPackag
@SelectProvider(type=HighDiscountPackageAgentRecordSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.BIGINT),
@Result(column="agent_name", property="agentName", jdbcType=JdbcType.VARCHAR),
@ -84,14 +85,15 @@ public interface HighDiscountPackageAgentRecordMapper extends HighDiscountPackag
@Select({
"select",
"id, discount_package_title, discount_package_id, agent_name, agent_id, `count`, ",
"front_count, after_count, create_time, update_time, `status`, op_id, op_name, ",
"ext_1, ext_2, ext_3",
"id, `type`, discount_package_title, discount_package_id, agent_name, agent_id, ",
"`count`, front_count, after_count, create_time, update_time, `status`, op_id, ",
"op_name, ext_1, ext_2, ext_3",
"from high_discount_package_agent_record",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.BIGINT),
@Result(column="agent_name", property="agentName", jdbcType=JdbcType.VARCHAR),
@ -121,7 +123,8 @@ public interface HighDiscountPackageAgentRecordMapper extends HighDiscountPackag
@Update({
"update high_discount_package_agent_record",
"set discount_package_title = #{discountPackageTitle,jdbcType=VARCHAR},",
"set `type` = #{type,jdbcType=INTEGER},",
"discount_package_title = #{discountPackageTitle,jdbcType=VARCHAR},",
"discount_package_id = #{discountPackageId,jdbcType=BIGINT},",
"agent_name = #{agentName,jdbcType=VARCHAR},",
"agent_id = #{agentId,jdbcType=BIGINT},",

@ -28,6 +28,10 @@ public class HighDiscountPackageAgentRecordSqlProvider {
SQL sql = new SQL();
sql.INSERT_INTO("high_discount_package_agent_record");
if (record.getType() != null) {
sql.VALUES("`type`", "#{type,jdbcType=INTEGER}");
}
if (record.getDiscountPackageTitle() != null) {
sql.VALUES("discount_package_title", "#{discountPackageTitle,jdbcType=VARCHAR}");
}
@ -98,6 +102,7 @@ public class HighDiscountPackageAgentRecordSqlProvider {
} else {
sql.SELECT("id");
}
sql.SELECT("`type`");
sql.SELECT("discount_package_title");
sql.SELECT("discount_package_id");
sql.SELECT("agent_name");
@ -134,6 +139,10 @@ public class HighDiscountPackageAgentRecordSqlProvider {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getType() != null) {
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
}
if (record.getDiscountPackageTitle() != null) {
sql.SET("discount_package_title = #{record.discountPackageTitle,jdbcType=VARCHAR}");
}
@ -203,6 +212,7 @@ public class HighDiscountPackageAgentRecordSqlProvider {
sql.UPDATE("high_discount_package_agent_record");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
sql.SET("discount_package_title = #{record.discountPackageTitle,jdbcType=VARCHAR}");
sql.SET("discount_package_id = #{record.discountPackageId,jdbcType=BIGINT}");
sql.SET("agent_name = #{record.agentName,jdbcType=VARCHAR}");
@ -228,6 +238,10 @@ public class HighDiscountPackageAgentRecordSqlProvider {
SQL sql = new SQL();
sql.UPDATE("high_discount_package_agent_record");
if (record.getType() != null) {
sql.SET("`type` = #{type,jdbcType=INTEGER}");
}
if (record.getDiscountPackageTitle() != null) {
sql.SET("discount_package_title = #{discountPackageTitle,jdbcType=VARCHAR}");
}

@ -39,18 +39,20 @@ public interface HighDiscountPackageAgentRelMapper extends HighDiscountPackageAg
int deleteByPrimaryKey(Long id);
@Insert({
"insert into high_discount_package_agent_rel (discount_package_title, discount_package_id, ",
"agent_name, agent_id, ",
"stock_count, sales_count, ",
"create_time, update_time, ",
"`status`, op_id, op_name, ",
"ext_1, ext_2, ext_3)",
"values (#{discountPackageTitle,jdbcType=VARCHAR}, #{discountPackageId,jdbcType=BIGINT}, ",
"#{agentName,jdbcType=VARCHAR}, #{agentId,jdbcType=BIGINT}, ",
"#{stockCount,jdbcType=INTEGER}, #{salesCount,jdbcType=INTEGER}, ",
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
"#{status,jdbcType=INTEGER}, #{opId,jdbcType=BIGINT}, #{opName,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
"insert into high_discount_package_agent_rel (`type`, discount_package_title, ",
"discount_package_id, agent_name, ",
"agent_id, stock_count, ",
"sales_count, create_time, ",
"update_time, `status`, ",
"op_id, op_name, ext_1, ",
"ext_2, ext_3)",
"values (#{type,jdbcType=INTEGER}, #{discountPackageTitle,jdbcType=VARCHAR}, ",
"#{discountPackageId,jdbcType=BIGINT}, #{agentName,jdbcType=VARCHAR}, ",
"#{agentId,jdbcType=BIGINT}, #{stockCount,jdbcType=INTEGER}, ",
"#{salesCount,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
"#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
"#{opId,jdbcType=BIGINT}, #{opName,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighDiscountPackageAgentRel record);
@ -62,6 +64,7 @@ public interface HighDiscountPackageAgentRelMapper extends HighDiscountPackageAg
@SelectProvider(type=HighDiscountPackageAgentRelSqlProvider.class, method="selectByExample")
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.BIGINT),
@Result(column="agent_name", property="agentName", jdbcType=JdbcType.VARCHAR),
@ -81,14 +84,15 @@ public interface HighDiscountPackageAgentRelMapper extends HighDiscountPackageAg
@Select({
"select",
"id, discount_package_title, discount_package_id, agent_name, agent_id, stock_count, ",
"sales_count, create_time, update_time, `status`, op_id, op_name, ext_1, ext_2, ",
"ext_3",
"id, `type`, discount_package_title, discount_package_id, agent_name, agent_id, ",
"stock_count, sales_count, create_time, update_time, `status`, op_id, op_name, ",
"ext_1, ext_2, ext_3",
"from high_discount_package_agent_rel",
"where id = #{id,jdbcType=BIGINT}"
})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
@Result(column="discount_package_title", property="discountPackageTitle", jdbcType=JdbcType.VARCHAR),
@Result(column="discount_package_id", property="discountPackageId", jdbcType=JdbcType.BIGINT),
@Result(column="agent_name", property="agentName", jdbcType=JdbcType.VARCHAR),
@ -117,7 +121,8 @@ public interface HighDiscountPackageAgentRelMapper extends HighDiscountPackageAg
@Update({
"update high_discount_package_agent_rel",
"set discount_package_title = #{discountPackageTitle,jdbcType=VARCHAR},",
"set `type` = #{type,jdbcType=INTEGER},",
"discount_package_title = #{discountPackageTitle,jdbcType=VARCHAR},",
"discount_package_id = #{discountPackageId,jdbcType=BIGINT},",
"agent_name = #{agentName,jdbcType=VARCHAR},",
"agent_id = #{agentId,jdbcType=BIGINT},",

@ -28,6 +28,10 @@ public class HighDiscountPackageAgentRelSqlProvider {
SQL sql = new SQL();
sql.INSERT_INTO("high_discount_package_agent_rel");
if (record.getType() != null) {
sql.VALUES("`type`", "#{type,jdbcType=INTEGER}");
}
if (record.getDiscountPackageTitle() != null) {
sql.VALUES("discount_package_title", "#{discountPackageTitle,jdbcType=VARCHAR}");
}
@ -94,6 +98,7 @@ public class HighDiscountPackageAgentRelSqlProvider {
} else {
sql.SELECT("id");
}
sql.SELECT("`type`");
sql.SELECT("discount_package_title");
sql.SELECT("discount_package_id");
sql.SELECT("agent_name");
@ -129,6 +134,10 @@ public class HighDiscountPackageAgentRelSqlProvider {
sql.SET("id = #{record.id,jdbcType=BIGINT}");
}
if (record.getType() != null) {
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
}
if (record.getDiscountPackageTitle() != null) {
sql.SET("discount_package_title = #{record.discountPackageTitle,jdbcType=VARCHAR}");
}
@ -194,6 +203,7 @@ public class HighDiscountPackageAgentRelSqlProvider {
sql.UPDATE("high_discount_package_agent_rel");
sql.SET("id = #{record.id,jdbcType=BIGINT}");
sql.SET("`type` = #{record.type,jdbcType=INTEGER}");
sql.SET("discount_package_title = #{record.discountPackageTitle,jdbcType=VARCHAR}");
sql.SET("discount_package_id = #{record.discountPackageId,jdbcType=BIGINT}");
sql.SET("agent_name = #{record.agentName,jdbcType=VARCHAR}");
@ -218,6 +228,10 @@ public class HighDiscountPackageAgentRelSqlProvider {
SQL sql = new SQL();
sql.UPDATE("high_discount_package_agent_rel");
if (record.getType() != null) {
sql.SET("`type` = #{type,jdbcType=INTEGER}");
}
if (record.getDiscountPackageTitle() != null) {
sql.SET("discount_package_title = #{discountPackageTitle,jdbcType=VARCHAR}");
}

@ -40,25 +40,25 @@ public interface HighDiscountPackageMapper extends HighDiscountPackageMapperExt
@Insert({
"insert into high_discount_package (company_id, using_attribution, ",
"title, sales_type, ",
"effective_tiem, price, ",
"purchase_num, list_img, ",
"banner_img, details_img, ",
"created_user_id, created_time, ",
"updated_user_id, updated_time, ",
"`status`, total_stock, ",
"surplus_stock, ext_1, ",
"ext_2, ext_3)",
"show_label, title, ",
"sales_type, effective_tiem, ",
"price, purchase_num, ",
"list_img, banner_img, ",
"details_img, created_user_id, ",
"created_time, updated_user_id, ",
"updated_time, `status`, ",
"total_stock, surplus_stock, ",
"ext_1, ext_2, ext_3)",
"values (#{companyId,jdbcType=INTEGER}, #{usingAttribution,jdbcType=INTEGER}, ",
"#{title,jdbcType=VARCHAR}, #{salesType,jdbcType=INTEGER}, ",
"#{effectiveTiem,jdbcType=TIMESTAMP}, #{price,jdbcType=DECIMAL}, ",
"#{purchaseNum,jdbcType=INTEGER}, #{listImg,jdbcType=VARCHAR}, ",
"#{bannerImg,jdbcType=VARCHAR}, #{detailsImg,jdbcType=VARCHAR}, ",
"#{createdUserId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, ",
"#{updatedUserId,jdbcType=INTEGER}, #{updatedTime,jdbcType=TIMESTAMP}, ",
"#{status,jdbcType=INTEGER}, #{totalStock,jdbcType=INTEGER}, ",
"#{surplusStock,jdbcType=INTEGER}, #{ext1,jdbcType=VARCHAR}, ",
"#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
"#{showLabel,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, ",
"#{salesType,jdbcType=INTEGER}, #{effectiveTiem,jdbcType=TIMESTAMP}, ",
"#{price,jdbcType=DECIMAL}, #{purchaseNum,jdbcType=INTEGER}, ",
"#{listImg,jdbcType=VARCHAR}, #{bannerImg,jdbcType=VARCHAR}, ",
"#{detailsImg,jdbcType=VARCHAR}, #{createdUserId,jdbcType=INTEGER}, ",
"#{createdTime,jdbcType=TIMESTAMP}, #{updatedUserId,jdbcType=INTEGER}, ",
"#{updatedTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
"#{totalStock,jdbcType=INTEGER}, #{surplusStock,jdbcType=INTEGER}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
})
@Options(useGeneratedKeys=true,keyProperty="id")
int insert(HighDiscountPackage record);
@ -72,6 +72,7 @@ public interface HighDiscountPackageMapper extends HighDiscountPackageMapperExt
@Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
@Result(column="company_id", property="companyId", jdbcType=JdbcType.INTEGER),
@Result(column="using_attribution", property="usingAttribution", jdbcType=JdbcType.INTEGER),
@Result(column="show_label", property="showLabel", jdbcType=JdbcType.VARCHAR),
@Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
@Result(column="sales_type", property="salesType", jdbcType=JdbcType.INTEGER),
@Result(column="effective_tiem", property="effectiveTiem", jdbcType=JdbcType.TIMESTAMP),
@ -95,8 +96,8 @@ public interface HighDiscountPackageMapper extends HighDiscountPackageMapperExt
@Select({
"select",
"id, company_id, using_attribution, title, sales_type, effective_tiem, price, ",
"purchase_num, list_img, banner_img, details_img, created_user_id, created_time, ",
"id, company_id, using_attribution, show_label, title, sales_type, effective_tiem, ",
"price, purchase_num, list_img, banner_img, details_img, created_user_id, created_time, ",
"updated_user_id, updated_time, `status`, total_stock, surplus_stock, ext_1, ",
"ext_2, ext_3",
"from high_discount_package",
@ -106,6 +107,7 @@ public interface HighDiscountPackageMapper extends HighDiscountPackageMapperExt
@Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
@Result(column="company_id", property="companyId", jdbcType=JdbcType.INTEGER),
@Result(column="using_attribution", property="usingAttribution", jdbcType=JdbcType.INTEGER),
@Result(column="show_label", property="showLabel", jdbcType=JdbcType.VARCHAR),
@Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
@Result(column="sales_type", property="salesType", jdbcType=JdbcType.INTEGER),
@Result(column="effective_tiem", property="effectiveTiem", jdbcType=JdbcType.TIMESTAMP),
@ -140,6 +142,7 @@ public interface HighDiscountPackageMapper extends HighDiscountPackageMapperExt
"update high_discount_package",
"set company_id = #{companyId,jdbcType=INTEGER},",
"using_attribution = #{usingAttribution,jdbcType=INTEGER},",
"show_label = #{showLabel,jdbcType=VARCHAR},",
"title = #{title,jdbcType=VARCHAR},",
"sales_type = #{salesType,jdbcType=INTEGER},",
"effective_tiem = #{effectiveTiem,jdbcType=TIMESTAMP},",

@ -36,6 +36,10 @@ public class HighDiscountPackageSqlProvider {
sql.VALUES("using_attribution", "#{usingAttribution,jdbcType=INTEGER}");
}
if (record.getShowLabel() != null) {
sql.VALUES("show_label", "#{showLabel,jdbcType=VARCHAR}");
}
if (record.getTitle() != null) {
sql.VALUES("title", "#{title,jdbcType=VARCHAR}");
}
@ -120,6 +124,7 @@ public class HighDiscountPackageSqlProvider {
}
sql.SELECT("company_id");
sql.SELECT("using_attribution");
sql.SELECT("show_label");
sql.SELECT("title");
sql.SELECT("sales_type");
sql.SELECT("effective_tiem");
@ -167,6 +172,10 @@ public class HighDiscountPackageSqlProvider {
sql.SET("using_attribution = #{record.usingAttribution,jdbcType=INTEGER}");
}
if (record.getShowLabel() != null) {
sql.SET("show_label = #{record.showLabel,jdbcType=VARCHAR}");
}
if (record.getTitle() != null) {
sql.SET("title = #{record.title,jdbcType=VARCHAR}");
}
@ -250,6 +259,7 @@ public class HighDiscountPackageSqlProvider {
sql.SET("id = #{record.id,jdbcType=INTEGER}");
sql.SET("company_id = #{record.companyId,jdbcType=INTEGER}");
sql.SET("using_attribution = #{record.usingAttribution,jdbcType=INTEGER}");
sql.SET("show_label = #{record.showLabel,jdbcType=VARCHAR}");
sql.SET("title = #{record.title,jdbcType=VARCHAR}");
sql.SET("sales_type = #{record.salesType,jdbcType=INTEGER}");
sql.SET("effective_tiem = #{record.effectiveTiem,jdbcType=TIMESTAMP}");
@ -286,6 +296,10 @@ public class HighDiscountPackageSqlProvider {
sql.SET("using_attribution = #{usingAttribution,jdbcType=INTEGER}");
}
if (record.getShowLabel() != null) {
sql.SET("show_label = #{showLabel,jdbcType=VARCHAR}");
}
if (record.getTitle() != null) {
sql.SET("title = #{title,jdbcType=VARCHAR}");
}

@ -0,0 +1,321 @@
package com.hai.entity;
import java.io.Serializable;
import java.util.Date;
/**
* api_coupon
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class ApiCoupon implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 类型1四川中石油 2.贵州中石油
*/
private Integer type;
/**
* 产品类型 4001:油品券,4002:汽油券,4003 柴油券
*/
private String goodsType;
/**
* 卡券
*/
private String name;
/**
* 编码
*/
private String code;
/**
* 描述
*/
private String desc;
/**
* 金额单位
*/
private Integer price;
/**
* 卡券图片
*/
private String img;
/**
* 有效天数
*/
private Integer effectiveDays;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 状态 1正常 0 删除
*/
private Integer status;
/**
* 操作人
*/
private Long opId;
/**
* 操作人名称
*/
private String opName;
/**
* ext_1
*/
private String ext1;
/**
* ext_2
*/
private String ext2;
/**
* ext_3
*/
private String ext3;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getGoodsType() {
return goodsType;
}
public void setGoodsType(String goodsType) {
this.goodsType = goodsType;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
public Integer getEffectiveDays() {
return effectiveDays;
}
public void setEffectiveDays(Integer effectiveDays) {
this.effectiveDays = effectiveDays;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Long getOpId() {
return opId;
}
public void setOpId(Long opId) {
this.opId = opId;
}
public String getOpName() {
return opName;
}
public void setOpName(String opName) {
this.opName = opName;
}
public String getExt1() {
return ext1;
}
public void setExt1(String ext1) {
this.ext1 = ext1;
}
public String getExt2() {
return ext2;
}
public void setExt2(String ext2) {
this.ext2 = ext2;
}
public String getExt3() {
return ext3;
}
public void setExt3(String ext3) {
this.ext3 = ext3;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
ApiCoupon other = (ApiCoupon) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getGoodsType() == null ? other.getGoodsType() == null : this.getGoodsType().equals(other.getGoodsType()))
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
&& (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode()))
&& (this.getDesc() == null ? other.getDesc() == null : this.getDesc().equals(other.getDesc()))
&& (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
&& (this.getImg() == null ? other.getImg() == null : this.getImg().equals(other.getImg()))
&& (this.getEffectiveDays() == null ? other.getEffectiveDays() == null : this.getEffectiveDays().equals(other.getEffectiveDays()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getOpId() == null ? other.getOpId() == null : this.getOpId().equals(other.getOpId()))
&& (this.getOpName() == null ? other.getOpName() == null : this.getOpName().equals(other.getOpName()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getGoodsType() == null) ? 0 : getGoodsType().hashCode());
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode());
result = prime * result + ((getDesc() == null) ? 0 : getDesc().hashCode());
result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
result = prime * result + ((getImg() == null) ? 0 : getImg().hashCode());
result = prime * result + ((getEffectiveDays() == null) ? 0 : getEffectiveDays().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getOpId() == null) ? 0 : getOpId().hashCode());
result = prime * result + ((getOpName() == null) ? 0 : getOpName().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", type=").append(type);
sb.append(", goodsType=").append(goodsType);
sb.append(", name=").append(name);
sb.append(", code=").append(code);
sb.append(", desc=").append(desc);
sb.append(", price=").append(price);
sb.append(", img=").append(img);
sb.append(", effectiveDays=").append(effectiveDays);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", status=").append(status);
sb.append(", opId=").append(opId);
sb.append(", opName=").append(opName);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -29,6 +29,11 @@ public class HighDiscountPackage implements Serializable {
*/
private Integer usingAttribution;
/**
* 展示标签
*/
private String showLabel;
/**
* 标题
*/
@ -145,6 +150,14 @@ public class HighDiscountPackage implements Serializable {
this.usingAttribution = usingAttribution;
}
public String getShowLabel() {
return showLabel;
}
public void setShowLabel(String showLabel) {
this.showLabel = showLabel;
}
public String getTitle() {
return title;
}
@ -304,6 +317,7 @@ public class HighDiscountPackage implements Serializable {
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId()))
&& (this.getUsingAttribution() == null ? other.getUsingAttribution() == null : this.getUsingAttribution().equals(other.getUsingAttribution()))
&& (this.getShowLabel() == null ? other.getShowLabel() == null : this.getShowLabel().equals(other.getShowLabel()))
&& (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
&& (this.getSalesType() == null ? other.getSalesType() == null : this.getSalesType().equals(other.getSalesType()))
&& (this.getEffectiveTiem() == null ? other.getEffectiveTiem() == null : this.getEffectiveTiem().equals(other.getEffectiveTiem()))
@ -331,6 +345,7 @@ public class HighDiscountPackage implements Serializable {
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode());
result = prime * result + ((getUsingAttribution() == null) ? 0 : getUsingAttribution().hashCode());
result = prime * result + ((getShowLabel() == null) ? 0 : getShowLabel().hashCode());
result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
result = prime * result + ((getSalesType() == null) ? 0 : getSalesType().hashCode());
result = prime * result + ((getEffectiveTiem() == null) ? 0 : getEffectiveTiem().hashCode());
@ -361,6 +376,7 @@ public class HighDiscountPackage implements Serializable {
sb.append(", id=").append(id);
sb.append(", companyId=").append(companyId);
sb.append(", usingAttribution=").append(usingAttribution);
sb.append(", showLabel=").append(showLabel);
sb.append(", title=").append(title);
sb.append(", salesType=").append(salesType);
sb.append(", effectiveTiem=").append(effectiveTiem);

@ -0,0 +1,337 @@
package com.hai.entity;
import java.io.Serializable;
import java.util.Date;
/**
* high_discount_package_agent_code
* @author
*/
/**
*
* 代码由工具生成
*
**/
public class HighDiscountPackageAgentCode implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 券包id
*/
private Long discountPackageId;
/**
* 券包名称
*/
private String discountPackageName;
/**
* 代理商id
*/
private Long agentId;
/**
* 代理商名称
*/
private String agentName;
/**
* 券包实际库存id
*/
private Long discountPackageActualId;
/**
* 批次id
*/
private Long discountAgentBatchId;
/**
* 编码
*/
private String code;
/**
* 二维码
*/
private String qrCode;
/**
* 二维码地址
*/
private String qrCodeUrl;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 状态 0删除 1待领取 2待使用 3已使用 4已过期 5已分配
*/
private Integer status;
/**
* 操作人
*/
private Long opId;
/**
* 操作人名称
*/
private String opName;
/**
* ext_1
*/
private String ext1;
/**
* ext_2
*/
private String ext2;
/**
* ext_3
*/
private String ext3;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getDiscountPackageId() {
return discountPackageId;
}
public void setDiscountPackageId(Long discountPackageId) {
this.discountPackageId = discountPackageId;
}
public String getDiscountPackageName() {
return discountPackageName;
}
public void setDiscountPackageName(String discountPackageName) {
this.discountPackageName = discountPackageName;
}
public Long getAgentId() {
return agentId;
}
public void setAgentId(Long agentId) {
this.agentId = agentId;
}
public String getAgentName() {
return agentName;
}
public void setAgentName(String agentName) {
this.agentName = agentName;
}
public Long getDiscountPackageActualId() {
return discountPackageActualId;
}
public void setDiscountPackageActualId(Long discountPackageActualId) {
this.discountPackageActualId = discountPackageActualId;
}
public Long getDiscountAgentBatchId() {
return discountAgentBatchId;
}
public void setDiscountAgentBatchId(Long discountAgentBatchId) {
this.discountAgentBatchId = discountAgentBatchId;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getQrCode() {
return qrCode;
}
public void setQrCode(String qrCode) {
this.qrCode = qrCode;
}
public String getQrCodeUrl() {
return qrCodeUrl;
}
public void setQrCodeUrl(String qrCodeUrl) {
this.qrCodeUrl = qrCodeUrl;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Long getOpId() {
return opId;
}
public void setOpId(Long opId) {
this.opId = opId;
}
public String getOpName() {
return opName;
}
public void setOpName(String opName) {
this.opName = opName;
}
public String getExt1() {
return ext1;
}
public void setExt1(String ext1) {
this.ext1 = ext1;
}
public String getExt2() {
return ext2;
}
public void setExt2(String ext2) {
this.ext2 = ext2;
}
public String getExt3() {
return ext3;
}
public void setExt3(String ext3) {
this.ext3 = ext3;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
HighDiscountPackageAgentCode other = (HighDiscountPackageAgentCode) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getDiscountPackageId() == null ? other.getDiscountPackageId() == null : this.getDiscountPackageId().equals(other.getDiscountPackageId()))
&& (this.getDiscountPackageName() == null ? other.getDiscountPackageName() == null : this.getDiscountPackageName().equals(other.getDiscountPackageName()))
&& (this.getAgentId() == null ? other.getAgentId() == null : this.getAgentId().equals(other.getAgentId()))
&& (this.getAgentName() == null ? other.getAgentName() == null : this.getAgentName().equals(other.getAgentName()))
&& (this.getDiscountPackageActualId() == null ? other.getDiscountPackageActualId() == null : this.getDiscountPackageActualId().equals(other.getDiscountPackageActualId()))
&& (this.getDiscountAgentBatchId() == null ? other.getDiscountAgentBatchId() == null : this.getDiscountAgentBatchId().equals(other.getDiscountAgentBatchId()))
&& (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode()))
&& (this.getQrCode() == null ? other.getQrCode() == null : this.getQrCode().equals(other.getQrCode()))
&& (this.getQrCodeUrl() == null ? other.getQrCodeUrl() == null : this.getQrCodeUrl().equals(other.getQrCodeUrl()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getOpId() == null ? other.getOpId() == null : this.getOpId().equals(other.getOpId()))
&& (this.getOpName() == null ? other.getOpName() == null : this.getOpName().equals(other.getOpName()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getDiscountPackageId() == null) ? 0 : getDiscountPackageId().hashCode());
result = prime * result + ((getDiscountPackageName() == null) ? 0 : getDiscountPackageName().hashCode());
result = prime * result + ((getAgentId() == null) ? 0 : getAgentId().hashCode());
result = prime * result + ((getAgentName() == null) ? 0 : getAgentName().hashCode());
result = prime * result + ((getDiscountPackageActualId() == null) ? 0 : getDiscountPackageActualId().hashCode());
result = prime * result + ((getDiscountAgentBatchId() == null) ? 0 : getDiscountAgentBatchId().hashCode());
result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode());
result = prime * result + ((getQrCode() == null) ? 0 : getQrCode().hashCode());
result = prime * result + ((getQrCodeUrl() == null) ? 0 : getQrCodeUrl().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getOpId() == null) ? 0 : getOpId().hashCode());
result = prime * result + ((getOpName() == null) ? 0 : getOpName().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", discountPackageId=").append(discountPackageId);
sb.append(", discountPackageName=").append(discountPackageName);
sb.append(", agentId=").append(agentId);
sb.append(", agentName=").append(agentName);
sb.append(", discountPackageActualId=").append(discountPackageActualId);
sb.append(", discountAgentBatchId=").append(discountAgentBatchId);
sb.append(", code=").append(code);
sb.append(", qrCode=").append(qrCode);
sb.append(", qrCodeUrl=").append(qrCodeUrl);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", status=").append(status);
sb.append(", opId=").append(opId);
sb.append(", opName=").append(opName);
sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

@ -18,6 +18,11 @@ public class HighDiscountPackageAgentRecord implements Serializable {
*/
private Long id;
/**
* 类型1分发 2分配
*/
private Integer type;
/**
* 优惠券包名称
*/
@ -103,6 +108,14 @@ public class HighDiscountPackageAgentRecord implements Serializable {
this.id = id;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getDiscountPackageTitle() {
return discountPackageTitle;
}
@ -236,6 +249,7 @@ public class HighDiscountPackageAgentRecord implements Serializable {
}
HighDiscountPackageAgentRecord other = (HighDiscountPackageAgentRecord) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getDiscountPackageTitle() == null ? other.getDiscountPackageTitle() == null : this.getDiscountPackageTitle().equals(other.getDiscountPackageTitle()))
&& (this.getDiscountPackageId() == null ? other.getDiscountPackageId() == null : this.getDiscountPackageId().equals(other.getDiscountPackageId()))
&& (this.getAgentName() == null ? other.getAgentName() == null : this.getAgentName().equals(other.getAgentName()))
@ -258,6 +272,7 @@ public class HighDiscountPackageAgentRecord implements Serializable {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getDiscountPackageTitle() == null) ? 0 : getDiscountPackageTitle().hashCode());
result = prime * result + ((getDiscountPackageId() == null) ? 0 : getDiscountPackageId().hashCode());
result = prime * result + ((getAgentName() == null) ? 0 : getAgentName().hashCode());
@ -283,6 +298,7 @@ public class HighDiscountPackageAgentRecord implements Serializable {
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", type=").append(type);
sb.append(", discountPackageTitle=").append(discountPackageTitle);
sb.append(", discountPackageId=").append(discountPackageId);
sb.append(", agentName=").append(agentName);

@ -185,6 +185,66 @@ public class HighDiscountPackageAgentRecordExample {
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andDiscountPackageTitleIsNull() {
addCriterion("discount_package_title is null");
return (Criteria) this;

@ -18,6 +18,11 @@ public class HighDiscountPackageAgentRel implements Serializable {
*/
private Long id;
/**
* 类型1分发 2分配
*/
private Integer type;
/**
* 优惠券包名称
*/
@ -98,6 +103,14 @@ public class HighDiscountPackageAgentRel implements Serializable {
this.id = id;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getDiscountPackageTitle() {
return discountPackageTitle;
}
@ -223,6 +236,7 @@ public class HighDiscountPackageAgentRel implements Serializable {
}
HighDiscountPackageAgentRel other = (HighDiscountPackageAgentRel) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getDiscountPackageTitle() == null ? other.getDiscountPackageTitle() == null : this.getDiscountPackageTitle().equals(other.getDiscountPackageTitle()))
&& (this.getDiscountPackageId() == null ? other.getDiscountPackageId() == null : this.getDiscountPackageId().equals(other.getDiscountPackageId()))
&& (this.getAgentName() == null ? other.getAgentName() == null : this.getAgentName().equals(other.getAgentName()))
@ -244,6 +258,7 @@ public class HighDiscountPackageAgentRel implements Serializable {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getDiscountPackageTitle() == null) ? 0 : getDiscountPackageTitle().hashCode());
result = prime * result + ((getDiscountPackageId() == null) ? 0 : getDiscountPackageId().hashCode());
result = prime * result + ((getAgentName() == null) ? 0 : getAgentName().hashCode());
@ -268,6 +283,7 @@ public class HighDiscountPackageAgentRel implements Serializable {
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", type=").append(type);
sb.append(", discountPackageTitle=").append(discountPackageTitle);
sb.append(", discountPackageId=").append(discountPackageId);
sb.append(", agentName=").append(agentName);

@ -185,6 +185,66 @@ public class HighDiscountPackageAgentRelExample {
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andDiscountPackageTitleIsNull() {
addCriterion("discount_package_title is null");
return (Criteria) this;

@ -306,6 +306,76 @@ public class HighDiscountPackageExample {
return (Criteria) this;
}
public Criteria andShowLabelIsNull() {
addCriterion("show_label is null");
return (Criteria) this;
}
public Criteria andShowLabelIsNotNull() {
addCriterion("show_label is not null");
return (Criteria) this;
}
public Criteria andShowLabelEqualTo(String value) {
addCriterion("show_label =", value, "showLabel");
return (Criteria) this;
}
public Criteria andShowLabelNotEqualTo(String value) {
addCriterion("show_label <>", value, "showLabel");
return (Criteria) this;
}
public Criteria andShowLabelGreaterThan(String value) {
addCriterion("show_label >", value, "showLabel");
return (Criteria) this;
}
public Criteria andShowLabelGreaterThanOrEqualTo(String value) {
addCriterion("show_label >=", value, "showLabel");
return (Criteria) this;
}
public Criteria andShowLabelLessThan(String value) {
addCriterion("show_label <", value, "showLabel");
return (Criteria) this;
}
public Criteria andShowLabelLessThanOrEqualTo(String value) {
addCriterion("show_label <=", value, "showLabel");
return (Criteria) this;
}
public Criteria andShowLabelLike(String value) {
addCriterion("show_label like", value, "showLabel");
return (Criteria) this;
}
public Criteria andShowLabelNotLike(String value) {
addCriterion("show_label not like", value, "showLabel");
return (Criteria) this;
}
public Criteria andShowLabelIn(List<String> values) {
addCriterion("show_label in", values, "showLabel");
return (Criteria) this;
}
public Criteria andShowLabelNotIn(List<String> values) {
addCriterion("show_label not in", values, "showLabel");
return (Criteria) this;
}
public Criteria andShowLabelBetween(String value1, String value2) {
addCriterion("show_label between", value1, value2, "showLabel");
return (Criteria) this;
}
public Criteria andShowLabelNotBetween(String value1, String value2) {
addCriterion("show_label not between", value1, value2, "showLabel");
return (Criteria) this;
}
public Criteria andTitleIsNull() {
addCriterion("title is null");
return (Criteria) this;

@ -30,7 +30,7 @@ public class HighDiscountPackageRecord implements Serializable {
private Integer discountPackageId;
/**
* 使用归属
* 使用归属 3分配优惠券包
*/
private Integer usingAttribution;
@ -60,7 +60,7 @@ public class HighDiscountPackageRecord implements Serializable {
private String recordNo;
/**
* 销售类型 1 售卖 2: 赠送
* 销售类型 1 售卖 2: 赠送 3:领取
*/
private Integer salesType;

@ -19,6 +19,7 @@ public enum ApiProductTypeEnum {
type7(7, "优惠券包"),
type8(8, "汇联通充值"),
type10(10, "实物商品"),
type16(16, "个人油卡充值"),
type17(17, "团购套餐")
;

@ -0,0 +1,54 @@
package com.hai.openApi.service;
import com.alibaba.fastjson.JSONObject;
import com.hai.entity.ApiBlxCoupon;
import com.hai.entity.ApiCoupon;
import java.util.List;
import java.util.Map;
public interface ApiCouponService {
/**
* @Author Sum1Dream
* @Name insertCoupon
* @Description // 新增卡券
* @Date 10:05 2023/12/15
* @Param apiCoupon
* @return void
*/
void insertCoupon(ApiCoupon apiCoupon);
/**
* @Author Sum1Dream
* @Name editCoupon
* @Description // 修改卡券
* @Date 10:06 2023/12/15
* @Param apiCoupon
* @return void
*/
void editCoupon(ApiCoupon apiCoupon);
/**
* @Author Sum1Dream
* @Name findCoupon
* @Description // 根据卡券编码查询券
* @Date 10:06 2023/12/15
* @Param code
* @return com.hai.entity.ApiCoupon
*/
ApiCoupon findCoupon(String code);
/**
* @Author Sum1Dream
* @Name getCouponList
* @Description // 查询券列表
* @Date 10:06 2023/12/15
* @Param map
* @return java.util.List<com.hai.entity.ApiCoupon>
*/
List<ApiCoupon> getCouponList(Map<String , Object> map);
}

@ -88,4 +88,14 @@ public interface ApiOrderCreateHandleService {
*/
ApiOrder blxOrder(JSONObject object) throws Exception;
/**
* @Author Sum1Dream
* @Name petroCouponOrder
* @Description // 中石油卡券下单业务
* @Date 14:49 2023/12/15
* @Param object
* @return com.hai.entity.ApiOrder
*/
ApiOrder petroCouponOrder(JSONObject object) throws Exception;
}

@ -0,0 +1,61 @@
package com.hai.openApi.service.impl;
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.config.PetroConfig;
import com.hai.dao.ApiCouponMapper;
import com.hai.entity.ApiCoupon;
import com.hai.entity.ApiCouponExample;
import com.hai.entity.HighCouponCodeOther;
import com.hai.entity.HighUserCoupon;
import com.hai.openApi.service.ApiCouponService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service("apiCouponService")
public class ApiCouponServiceImpl implements ApiCouponService {
@Resource
private ApiCouponMapper apiCouponMapper;
@Override
public void insertCoupon(ApiCoupon apiCoupon) {
apiCouponMapper.insert(apiCoupon);
}
@Override
public void editCoupon(ApiCoupon apiCoupon) {
apiCouponMapper.updateByPrimaryKeySelective(apiCoupon);
}
@Override
public ApiCoupon findCoupon(String code) {
ApiCouponExample example = new ApiCouponExample();
example.createCriteria().andCodeEqualTo(code).andStatusEqualTo(1);
List<ApiCoupon> list = apiCouponMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
public List<ApiCoupon> getCouponList(Map<String, Object> map) {
ApiCouponExample example = new ApiCouponExample();
example.createCriteria().andStatusEqualTo(1);
return apiCouponMapper.selectByExample(example);
}
}

@ -12,6 +12,7 @@ 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.ApiCouponService;
import com.hai.openApi.service.ApiMchProductService;
import com.hai.openApi.service.ApiOrderCreateHandleService;
import com.hai.openApi.type.OperatorTypeEnum;
@ -56,6 +57,9 @@ public class ApiOrderCreateHandleServiceImpl implements ApiOrderCreateHandleServ
@Resource
private BlxConfig blxConfig;
@Resource
private ApiCouponService apiCouponService;
@Override
public ApiOrder oilHandle(JSONObject object) throws Exception {
@ -476,4 +480,56 @@ public class ApiOrderCreateHandleServiceImpl implements ApiOrderCreateHandleServ
return apiOrder;
}
@Override
public ApiOrder petroCouponOrder(JSONObject object) throws Exception {
// 获取下单内容
JSONObject dataObject = JSONObject.parseObject(object.getString("content"));
// 查询api商户
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId"));
ApiCoupon apiCoupon = apiCouponService.findCoupon(dataObject.getString("code"));
// 查询折扣比例
Map<String, Object> mapProduct = new HashMap<>();
mapProduct.put("mchId" , object.getString("merchId"));
mapProduct.put("productType" , OrderProductType.PRODUCT_TYPE18.getNumber());
ApiMchProduct mchProduct = apiMchProductService.findByMap(mapProduct);
// 计算成本价格
BigDecimal price = priceComputeConfig.computationPriceCost(mchProduct.getDiscount() , new BigDecimal(apiCoupon.getPrice()/100));
// 判断金额是否充足
if (apiMerchants.getAmounts().compareTo(price) < 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.INSUFFICIENT_BALANCE);
}
// 组装内容
JSONObject jsonObject = new JSONObject();
jsonObject.put("name" ,apiCoupon.getName());
jsonObject.put("couponCode" , apiCoupon.getCode());
jsonObject.put("receiverPhone" , dataObject.getString("userMobile"));
// 组装api订单
ApiOrder apiOrder = new ApiOrder();
apiOrder.setCreateTime(new Date());
apiOrder.setTitle(apiMerchants.getMerchantName() + "|" + OrderProductType.PRODUCT_TYPE18.getName() + "|扣款" + price);
apiOrder.setFacePrice(new BigDecimal(apiCoupon.getPrice()));
apiOrder.setCostPrice(price);
apiOrder.setOrderPrice(price);
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(jsonObject.toJSONString());
return apiOrder;
}
}

@ -200,40 +200,84 @@ public class ApiOrderServiceImpl implements ApiOrderService {
createOrderModel.getChildOrderList().add(createOrderChildModel);
orderService.createOrder(createOrderModel);
}
// 处理停车券订单
if (OrderProductType.PRODUCT_TYPE13.getNumber().equals(object.getInteger("productType"))) {
apiOrder = orderCreateHandleService.blxCouponHandle(object);
// 组装子订单内容
CreateOrderChildModel createOrderChildModel = new CreateOrderChildModel();
createOrderChildModel.setMemName(apiMerchants.getMerchantName());
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);
createOrderChildModel.setGoodsPrice(apiOrder.getOrderPrice());
// 组装订单
createOrderModel.getChildOrderList().add(createOrderChildModel);
orderService.createOrder(createOrderModel);
}
//
// // 处理停车券订单
// if (OrderProductType.PRODUCT_TYPE13.getNumber().equals(object.getInteger("productType"))) {
//
// apiOrder = orderCreateHandleService.blxCouponHandle(object);
//
// // 组装子订单内容
// CreateOrderChildModel createOrderChildModel = new CreateOrderChildModel();
// createOrderChildModel.setMemName(apiMerchants.getMerchantName());
// createOrderChildModel.setMemPhone(apiMerchants.getPhone());
// createOrderChildModel.setUserMobile(dataObject.getString("userMobile"));
// 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);
// createOrderChildModel.setGoodsPrice(apiOrder.getOrderPrice());
//
// // 组装订单
// createOrderModel.getChildOrderList().add(createOrderChildModel);
// orderService.createOrder(createOrderModel);
//
// }
// // 处理停车订单
// if (OrderProductType.PRODUCT_TYPE14.getNumber().equals(object.getInteger("productType"))) {
//
// apiOrder = orderCreateHandleService.blxOrder(object);
//
// // 组装子订单内容
// CreateOrderChildModel createOrderChildModel = new CreateOrderChildModel();
// createOrderChildModel.setMemName(apiMerchants.getMerchantName());
// createOrderChildModel.setMemPhone(apiMerchants.getPhone());
// createOrderChildModel.setUserMobile(dataObject.getString("userMobile"));
// createOrderChildModel.setCompanyId(2L);
// createOrderChildModel.setGoodsType(OrderChildGoodsType.TYPE13.getNumber());
// createOrderChildModel.setSaleCount(1);
// createOrderChildModel.setIsTyAgent(false);
// createOrderChildModel.setGoodsPrice(apiOrder.getOrderPrice());
//
// // 组装订单
// createOrderModel.getChildOrderList().add(createOrderChildModel);
// orderService.createOrder(createOrderModel);
//
// }
// 处理停车订单
if (OrderProductType.PRODUCT_TYPE14.getNumber().equals(object.getInteger("productType"))) {
apiOrder = orderCreateHandleService.blxOrder(object);
// if (OrderProductType.PRODUCT_TYPE14.getNumber().equals(object.getInteger("productType"))) {
//
// apiOrder = orderCreateHandleService.blxOrder(object);
//
// // 组装子订单内容
// CreateOrderChildModel createOrderChildModel = new CreateOrderChildModel();
// createOrderChildModel.setMemName(apiMerchants.getMerchantName());
// createOrderChildModel.setMemPhone(dataObject.getString("userMobile"));
// createOrderChildModel.setCompanyId(2L);
// createOrderChildModel.setGoodsType(OrderChildGoodsType.TYPE18.getNumber());
// createOrderChildModel.setSaleCount(1);
// createOrderChildModel.setIsTyAgent(false);
// createOrderChildModel.setGoodsPrice(apiOrder.getOrderPrice());
//
// // 组装订单
// createOrderModel.getChildOrderList().add(createOrderChildModel);
// orderService.createOrder(createOrderModel);
//
// }
// 处理中石油卡券
if (OrderProductType.PRODUCT_TYPE18.getNumber().equals(object.getInteger("productType"))) {
apiOrder = orderCreateHandleService.petroCouponOrder(object);
// 组装子订单内容
CreateOrderChildModel createOrderChildModel = new CreateOrderChildModel();
createOrderChildModel.setMemName(apiMerchants.getMerchantName());
createOrderChildModel.setMemPhone(apiMerchants.getPhone());
createOrderChildModel.setMemName("接口用户");
createOrderChildModel.setMemPhone(dataObject.getString("userMobile"));
createOrderChildModel.setCompanyId(2L);
createOrderChildModel.setGoodsType(OrderChildGoodsType.TYPE13.getNumber());
createOrderChildModel.setCouponCode(dataObject.getString("couponCode"));
createOrderChildModel.setGoodsType(OrderChildGoodsType.TYPE18.getNumber());
createOrderChildModel.setSaleCount(1);
createOrderChildModel.setIsTyAgent(false);
createOrderChildModel.setGoodsPrice(apiOrder.getOrderPrice());
@ -294,6 +338,7 @@ public class ApiOrderServiceImpl implements ApiOrderService {
if (!Objects.equals(highOrder.getOrderStatus(), OrderStatus.STATUS1.getNumber())) {
apiOrder.setStatus(highOrder.getOrderStatus());
apiOrder.setUpdateTime(new Date());
apiOrder.setExt3(highOrder.getHighChildOrderList().get(0).getExt6());
apiOrderMapper.updateByPrimaryKey(apiOrder);
}

@ -126,6 +126,8 @@ public class CreateOrderChildModel {
/** ======================= 比邻星停车券 start ======================== **/
// 停车券编码
private String couponCode;
// 上送手机号
private String userMobile;
// 实际单价
private BigDecimal price;
/** ======================= 比邻星停车券 end ======================== **/

@ -137,4 +137,6 @@ public interface OrderCreateHandleService {
*/
HighChildOrder group(HighOrder order , CreateOrderChildModel createOrderChildModel) throws Exception;
HighChildOrder petroCoupon(HighOrder order , CreateOrderChildModel createOrderChildModel) throws Exception;
}

@ -21,6 +21,7 @@ import com.hai.model.GasPayPriceModel;
import com.hai.model.OutRechargePriceModel;
import com.hai.openApi.config.BlxConfig;
import com.hai.openApi.service.ApiBlxCouponService;
import com.hai.openApi.service.ApiCouponService;
import com.hai.order.model.CreateOrderChildModel;
import com.hai.order.model.CreateOrderModel;
import com.hai.order.service.OrderCreateHandleService;
@ -164,6 +165,9 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
@Resource
private GroupCodeService groupCodeService;
@Resource
private ApiCouponService apiCouponService;
@Override
public List<HighChildOrder> couponHandle(HighDiscountUserRel discountUserRel, CreateOrderChildModel createOrderChild) throws Exception {
if (createOrderChild.getSaleCount() != 1) {
@ -1291,4 +1295,34 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
return childOrder;
}
@Override
public HighChildOrder petroCoupon(HighOrder order, CreateOrderChildModel createOrderChildModel) throws Exception {
ApiCoupon apiCoupon = apiCouponService.findCoupon(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(apiCoupon.getId());
childOrder.setGoodsName(apiCoupon.getName());
childOrder.setGoodsSpecName(apiCoupon.getCode());
childOrder.setGoodsPrice(new BigDecimal(apiCoupon.getPrice()));
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;
}
}

@ -15,6 +15,7 @@ import com.hai.group.GroupCodeService;
import com.hai.msg.entity.MsgTopic;
import com.hai.openApi.config.BlxConfig;
import com.hai.openApi.service.ApiBlxCouponService;
import com.hai.openApi.service.ApiCouponService;
import com.hai.order.service.OrderPaySuccessService;
import com.hai.order.service.OrderService;
import com.hai.order.topic.OrderTopic;
@ -132,7 +133,7 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
private GroupCodeService groupCodeService;
@Resource
private SecConfigService secConfigService;
private ApiCouponService apiCouponService;
@Override
@ -262,6 +263,10 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
levelUp(order);
} else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE17.getNumber())) {
group(order);
} else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE15.getNumber())) {
oilCardHandle(childOrder.getGoodsSpecName(), order);
} else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE18.getNumber())) {
petroCoupon(order , childOrder);
}
}
}
@ -678,4 +683,43 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
}
private void petroCoupon(HighOrder order , HighChildOrder childOrder) throws Exception {
// 派发停车券
ApiCoupon apiCoupon = apiCouponService.findCoupon(childOrder.getGoodsSpecName());
if (apiCoupon == null || apiCoupon.getStatus() != 1) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买");
}
if (apiCoupon.getType().equals(1)) {
PetroConfig.init(1);
} else {
PetroConfig.init(2);
}
// 发放卡券
JSONObject jsonObject = PetroConfig.getCoupon(apiCoupon.getCode() , order.getMemPhone() , order.getOrderNo());
if (!jsonObject.getString("code").equals("1")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买");
}
String data = PetroConfig.decrypt(jsonObject.getString("biz_content"));
JSONObject object = JSONObject.parseObject(data);
Object ticketList = object.getJSONArray("ticket_list").get(0);
JSONObject ticketListObject = (JSONObject) ticketList;;
if (object.getInteger("code") == 1) {
order.setOrderStatus(OrderStatus.STATUS3.getNumber());
order.setFinishTime(new Date());
order.getHighChildOrderList().get(0).setExt5(object.getString("request_code"));
order.getHighChildOrderList().get(0).setExt6(ticketListObject.getString("ticket_num"));
orderService.updateOrderData(order);
}
}
}

@ -377,6 +377,18 @@ public class OrderServiceImpl implements OrderService {
order.setProductType(OrderProductType.PRODUCT_TYPE17.getNumber());
order.setSecUserId(childOrder.getId());
order.setTitle("团购套餐");
} else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE17.getNumber())) {
HighChildOrder childOrder = orderCreateHandleService.group(order , child);
childOrderList.add(childOrder);
order.setProductType(OrderProductType.PRODUCT_TYPE17.getNumber());
order.setSecUserId(childOrder.getId());
order.setTitle("团购套餐");
} else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE18.getNumber())) {
HighChildOrder childOrder = orderCreateHandleService.petroCoupon(order , child);
childOrderList.add(childOrder);
order.setProductType(OrderProductType.PRODUCT_TYPE18.getNumber());
order.setSecUserId(childOrder.getId());
order.setTitle("中石油卡券");
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知业务类型");
}

@ -25,6 +25,7 @@ public enum OrderChildGoodsType {
TYPE14(14, "个人油卡充值"),
TYPE15(15, "升级会员"),
TYPE17(17, "团购套餐"),
TYPE18(18, "中石油卡券"),
;
private Integer number;

@ -28,6 +28,7 @@ public enum OrderProductType {
PRODUCT_TYPE16(16, "个人油卡充值" , "orderLogo/coupon.png", ""),
PRODUCT_TYPE17(17, "团购套餐" , "orderLogo/coupon.png", ""),
PRODUCT_TYPE18(18, "中石油卡券" , "orderLogo/coupon.png", "PETRO_COUPON"),
PRODUCT_TYPE101(101, "惠支付" , "orderLogo/pay.png", "PAY"),
PRODUCT_TYPE102(102, "门店活动" , "orderLogo/store_activity.png", "STORE_ACTIVITY"),
;

@ -151,4 +151,5 @@ public interface HighCouponCodeService {
* @param coupon 卡券id
*/
void payCoupon(HighOrder order,HighChildOrder childOrder, HighCoupon coupon) throws Exception;
}

@ -61,6 +61,10 @@ public interface HighDiscountPackageActualService {
*/
HighDiscountPackageActual getDetailByChildOrderNo(String orderNo);
HighDiscountPackageActual findById(Integer id);
/**
* 查询优惠券包列表
* @param packageId

@ -1,9 +1,7 @@
package com.hai.service;
import com.hai.entity.HighActivityInfo;
import com.hai.entity.HighActivityPartakeRule;
import com.hai.entity.HighDiscountPackageAgentRecord;
import com.hai.entity.HighDiscountPackageAgentRel;
import com.alibaba.fastjson.JSONObject;
import com.hai.entity.*;
import java.util.List;
import java.util.Map;
@ -117,4 +115,38 @@ public interface HighDiscountPackageAgentService {
*/
List<HighDiscountPackageAgentRecord> getListRecord(Map<String, Object> param);
void generateDiscountPackageAgentCode(JSONObject object) throws Exception;
/**
* @Author Sum1Dream
* @Name insertDiscountPackageAgentCode
* @Description // 新增
* @Date 14:51 2023/12/12
* @Param discountPackageAgentCode
* @return void
*/
void insertDiscountPackageAgentCode(HighDiscountPackageAgentCode discountPackageAgentCode);
/**
* @Author Sum1Dream
* @Name updateDiscountPackageAgentCode
* @Description // 更新
* @Date 14:53 2023/12/12
* @Param discountPackageAgentCode
* @return void
*/
void updateDiscountPackageAgentCode(HighDiscountPackageAgentCode discountPackageAgentCode);
HighDiscountPackageAgentCode findDiscountPackageAgentCode(String code);
/**
* @Author Sum1Dream
* @Name getDiscountPackageAgentCodeList
* @Description // 查询列表
* @Date 14:55 2023/12/12
* @Param map
* @return java.util.List<com.hai.entity.HighDiscountPackageAgentCode>
*/
List<HighDiscountPackageAgentCode> getDiscountPackageAgentCodeList(Map<String , Object> map);
}

@ -1,5 +1,6 @@
package com.hai.service;
import com.alibaba.fastjson.JSONObject;
import com.hai.entity.HighDiscount;
import com.hai.entity.HighDiscountPackage;
import com.hai.entity.HighDiscountPackageActual;
@ -117,4 +118,14 @@ public interface HighDiscountPackageService {
*/
String giveAway(Long packageId, String phone , Integer sourceType , String sourceId) throws Exception;
/**
* @Author Sum1Dream
* @Name receivePackage
* @Description // 领取券包
* @Date 18:23 2023/12/12
* @Param object
* @return void
*/
void receivePackage(Integer discountPackageActualId , String code);
}

@ -156,8 +156,6 @@ public class HighDiscountAgentRelServiceImpl implements HighDiscountAgentRelServ
for (HighDiscountAgentRel rel : list) {
rel.setHighDiscount(highDiscountService.getDiscountById(rel.getDiscountId()));
rel.setHighAgent(highAgentService.findByAgentMsgId(rel.getAgentId()));
// rel.setTotalCount(highDiscountAgentCodeService.getTotalDiscount(rel.getId()));
// rel.setSalesCount(highDiscountAgentCodeService.getSalesDiscount(rel.getId()));
}
return list;
}

@ -70,6 +70,11 @@ public class HighDiscountPackageActualServiceImpl implements HighDiscountPackage
return null;
}
@Override
public HighDiscountPackageActual findById(Integer id) {
return discountPackageActualMapper.selectByPrimaryKey(id);
}
@Override
public List<HighDiscountPackageActual> getListByPackageId(Integer packageId, Integer status) {
HighDiscountPackageActualExample example = new HighDiscountPackageActualExample();

@ -1,13 +1,28 @@
package com.hai.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.Base64Util;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.AESEncodeUtil;
import com.hai.common.utils.RedisUtil;
import com.hai.config.CommonSysConst;
import com.hai.dao.HighDiscountPackageAgentCodeMapper;
import com.hai.dao.HighDiscountPackageAgentRecordMapper;
import com.hai.dao.HighDiscountPackageAgentRelMapper;
import com.hai.entity.*;
import com.hai.service.HighDiscountPackageActualService;
import com.hai.service.HighDiscountPackageAgentService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -20,6 +35,18 @@ public class HighDiscountPackageAgentServiceImpl implements HighDiscountPackageA
@Resource
private HighDiscountPackageAgentRelMapper discountPackageAgentRelMapper;
@Resource
private HighDiscountPackageAgentCodeMapper discountPackageAgentCodeMapper;
@Resource
private HighDiscountPackageActualService discountPackageActualService;
@Resource
private HighDiscountPackageAgentService discountPackageAgentService;
@Resource
private RedisUtil redisUtil;
@Override
public void insertDiscountPackageAgentRel(HighDiscountPackageAgentRel discountPackageAgentRel) {
discountPackageAgentRelMapper.insert(discountPackageAgentRel);
@ -47,6 +74,9 @@ public class HighDiscountPackageAgentServiceImpl implements HighDiscountPackageA
if (MapUtils.getLong(map, "discountPackageId") != null) {
criteria.andDiscountPackageIdEqualTo(MapUtils.getLong(map, "discountPackageId"));
}
if (MapUtils.getInteger(map, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type"));
}
List<HighDiscountPackageAgentRel> list = discountPackageAgentRelMapper.selectByExample(example);
@ -66,6 +96,9 @@ public class HighDiscountPackageAgentServiceImpl implements HighDiscountPackageA
if (MapUtils.getLong(param, "agentId") != null) {
criteria.andAgentIdEqualTo(MapUtils.getLong(param, "agentId"));
}
if (MapUtils.getInteger(param, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(param, "type"));
}
return discountPackageAgentRelMapper.selectByExample(example);
}
@ -102,7 +135,141 @@ public class HighDiscountPackageAgentServiceImpl implements HighDiscountPackageA
if (MapUtils.getLong(param, "discountPackageId") != null) {
criteria.andDiscountPackageIdEqualTo(MapUtils.getLong(param, "discountPackageId"));
}
if (MapUtils.getInteger(param, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(param, "type"));
}
return discountPackageAgentRecordMapper.selectByExample(example);
}
@Override
@Transactional(propagation= Propagation.REQUIRED)
public void generateDiscountPackageAgentCode(JSONObject object) throws Exception{
List<HighDiscountPackageActual> discountPackageActualList = discountPackageActualService.getListByPackageId(object.getInteger("discountPackageId") , 1);
if (object.getInteger("num") > discountPackageActualList.size()) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "优惠券包库存不足");
}
Map<String,Object> mapCode = new HashMap<>();
HighDiscountPackageAgentCode discountPackageAgentCode ;
mapCode.put("type" , "DISCOUNT_PACKAGE");
int percent;
for (int i = 1; i <= object.getInteger("num"); i++) {
// 生成百分比
percent = i*100/object.getInteger("num");
redisUtil.set(object.getString("serialNumber") , percent , 3600);
HighDiscountPackageActual discountPackageActual = discountPackageActualList.get(i);
discountPackageAgentCode = new HighDiscountPackageAgentCode();
discountPackageAgentCode.setAgentId(object.getLong("agentId"));
discountPackageAgentCode.setAgentName(object.getString("agentName"));
discountPackageAgentCode.setDiscountPackageId(object.getLong("discountPackageId"));
discountPackageAgentCode.setDiscountPackageName(object.getString("discountPackageName"));
discountPackageAgentCode.setDiscountPackageActualId(discountPackageActual.getId().longValue());
discountPackageAgentCode.setCreateTime(new Date());
discountPackageAgentCode.setStatus(1);
insertDiscountPackageAgentCode(discountPackageAgentCode);
// 二维码参数
mapCode.put("id", discountPackageActual.getId());
String code = Base64Util.encode(AESEncodeUtil.aesEncrypt(JSON.toJSONString(mapCode)));
// 生成二维码
String qrCodeUrl = CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5?accountId=0000022&key=" + object.getLong("discountPackageId") + "&code=" + code;
discountPackageAgentCode.setQrCodeUrl(qrCodeUrl);
discountPackageAgentCode.setCode(code);
discountPackageAgentCode.setDiscountAgentBatchId(object.getLong("serialNumber"));
updateDiscountPackageAgentCode(discountPackageAgentCode);
discountPackageActual.setStatus(2);
discountPackageActual.setExt3(object.getString("serialNumber"));
discountPackageActualService.updateHighDiscountPackageActual(discountPackageActual);
}
Map<String , Object> map = new HashMap<>();
map.put("agentId" , object.getLong("agentId"));
map.put("discountPackageId" , object.getLong("discountPackageId"));
map.put("type" , 2);
HighDiscountPackageAgentRel discountPackageAgentRel = discountPackageAgentService.getDetailRelByMap(map);
HighDiscountPackageAgentRecord discountPackageAgentRecord = new HighDiscountPackageAgentRecord();
if (discountPackageAgentRel == null) {
discountPackageAgentRel = new HighDiscountPackageAgentRel();
discountPackageAgentRel.setStatus(1);
discountPackageAgentRel.setType(2);
discountPackageAgentRel.setAgentId(object.getLong("agentId"));
discountPackageAgentRel.setAgentName(object.getString("agentName"));
discountPackageAgentRel.setDiscountPackageId(object.getLong("discountPackageId"));
discountPackageAgentRel.setDiscountPackageTitle(object.getString("discountPackageName"));
discountPackageAgentRel.setSalesCount(0);
discountPackageAgentRel.setStockCount(0);
discountPackageAgentRel.setCreateTime(new Date());
discountPackageAgentRel.setUpdateTime(new Date());
}
discountPackageAgentRel.setStockCount(object.getInteger("num") + discountPackageAgentRel.getStockCount());
if (discountPackageAgentRel.getId() == null) {
discountPackageAgentService.insertDiscountPackageAgentRel(discountPackageAgentRel);
} else {
discountPackageAgentRel.setUpdateTime(new Date());
discountPackageAgentRel.setType(2);
discountPackageAgentService.updateDiscountPackageAgentRel(discountPackageAgentRel);
}
discountPackageAgentRecord.setAgentId(object.getLong("agentId"));
discountPackageAgentRecord.setAgentName(object.getString("agentName"));
discountPackageAgentRecord.setDiscountPackageId(object.getLong("discountPackageId"));
discountPackageAgentRecord.setDiscountPackageTitle(object.getString("discountPackageName"));
discountPackageAgentRecord.setCreateTime(new Date());
discountPackageAgentRecord.setUpdateTime(new Date());
discountPackageAgentRecord.setStatus(1);
discountPackageAgentRecord.setType(2);
discountPackageAgentRecord.setCount(object.getInteger("num"));
discountPackageAgentRecord.setAfterCount(discountPackageAgentRel.getStockCount());
discountPackageAgentRecord.setFrontCount(discountPackageAgentRel.getStockCount() - object.getInteger("num"));
discountPackageAgentService.insertDiscountPackageAgentRecord(discountPackageAgentRecord);
}
@Override
public void insertDiscountPackageAgentCode(HighDiscountPackageAgentCode discountPackageAgentCode) {
discountPackageAgentCodeMapper.insert(discountPackageAgentCode);
}
@Override
public void updateDiscountPackageAgentCode(HighDiscountPackageAgentCode discountPackageAgentCode) {
discountPackageAgentCodeMapper.updateByPrimaryKey(discountPackageAgentCode);
}
@Override
public HighDiscountPackageAgentCode findDiscountPackageAgentCode(String code) {
HighDiscountPackageAgentCodeExample example = new HighDiscountPackageAgentCodeExample();
HighDiscountPackageAgentCodeExample.Criteria criteria = example.createCriteria();
criteria.andCodeEqualTo(code);
List<HighDiscountPackageAgentCode> list = discountPackageAgentCodeMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
public List<HighDiscountPackageAgentCode> getDiscountPackageAgentCodeList(Map<String, Object> map) {
HighDiscountPackageAgentCodeExample example = new HighDiscountPackageAgentCodeExample();
HighDiscountPackageAgentCodeExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "agentId") != null) {
criteria.andAgentIdEqualTo(MapUtils.getLong(map, "agentId"));
}
if (MapUtils.getLong(map, "discountPackageId") != null) {
criteria.andDiscountPackageIdEqualTo(MapUtils.getLong(map, "discountPackageId"));
}
return discountPackageAgentCodeMapper.selectByExample(example);
}
}

@ -1,7 +1,9 @@
package com.hai.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.google.common.base.Stopwatch;
import com.hai.common.exception.BaseException;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
@ -12,12 +14,14 @@ import com.hai.common.utils.RedisUtil;
import com.hai.dao.*;
import com.hai.entity.*;
import com.hai.enum_type.DiscountPlatform;
import com.hai.model.HighUserModel;
import com.hai.model.UserInfoModel;
import com.hai.service.*;
import com.hai.service.HighDiscountPackageService;
import io.lettuce.core.RedisURI;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
@ -52,6 +56,10 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
@Resource
private HighDiscountAgentRelService highDiscountAgentRelService;
@Autowired
private RedisTemplate redisTemplate;
@Resource
private HighDiscountAgentCodeService highDiscountAgentCodeService;
@ -73,6 +81,10 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
@Resource
private HighDiscountPackageService highDiscountPackageService;
@Resource
private HighDiscountPackageAgentService discountPackageAgentService;
@Resource
private HighDiscountUserRelMapper highDiscountUserRelMapper;
@ -108,6 +120,9 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
if (MapUtils.getString(map, "title") != null) {
criteria.andTitleLike("%" + MapUtils.getString(map, "title") + "%");
}
if (MapUtils.getString(map, "showLabel") != null) {
criteria.andShowLabelLike("%" + MapUtils.getString(map, "showLabel") + "%");
}
if (MapUtils.getInteger(map, "salesType") != null) {
criteria.andSalesTypeEqualTo(MapUtils.getInteger(map, "salesType"));
@ -276,7 +291,7 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
HighDiscountPackageActual discountPackageActual = discountPackageActualService.getHighDiscountPackageActualList(highDiscountPackage.getId()).get(0);
// 修改优惠券包实际库存为已使用
discountPackageActual.setStatus(0);
discountPackageActual.setStatus(3);
discountPackageActual.setUserId(MapUtils.getInteger(map , "userId"));
discountPackageActual.setAllocationTime(new Date());
discountPackageActualService.updateHighDiscountPackageActual(discountPackageActual);
@ -314,7 +329,7 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
userEndTime.set(Calendar.SECOND, 59);
userEndTime.add(Calendar.DATE, discount.getEffectiveDay());
if (userEndTime.getTime().compareTo(discount.getSalesEndTime()) == 1) {
if (userEndTime.getTime().compareTo(discount.getSalesEndTime()) > 0) {
userRel.setUseEndTime(discount.getSalesEndTime());
} else {
userRel.setUseEndTime(userEndTime.getTime());
@ -541,4 +556,202 @@ public class HighDiscountPackageServiceImpl implements HighDiscountPackageServic
return serialNum;
}
@Override
@Transactional(propagation= Propagation.REQUIRED)
public void receivePackage(Integer discountPackageActualId , String code) {
HighUserModel userInfoModel = userCenter.getSessionModel(HighUserModel.class);
String key = "receivePackage_" + discountPackageActualId;
try {
// 分布式锁占坑
Boolean lock = redisTemplate.opsForValue().setIfAbsent(key, discountPackageActualId);
if(Boolean.TRUE.equals(lock)) {
// 加锁成功,处理业务
HighDiscountPackageAgentCode discountPackageAgentCode = discountPackageAgentService.findDiscountPackageAgentCode(code);
if (discountPackageAgentCode == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前系统繁忙,请联系客服人员!");
}
if (discountPackageAgentCode.getStatus() != 1) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "券包已领取!");
}
HighDiscountPackageActual discountPackageActual = discountPackageActualService.findById(discountPackageActualId);
if (discountPackageActual == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "没有找到券包信息");
}
if (!discountPackageActual.getStatus().equals(2)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前券包已领取");
}
// 查询优惠券包
HighDiscountPackage discountPackage = findDiscountPackageById(discountPackageActual.getDiscountPackageId());
if (discountPackage == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "没有找到券包信息");
}
if (!discountPackage.getStatus().equals(1)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "券包状态错误");
}
discountPackageActual.setStatus(3);
discountPackageActual.setAllocationTime(new Date());
discountPackageActualService.updateHighDiscountPackageActual(discountPackageActual);
discountPackageAgentCode.setStatus(2);
discountPackageAgentCode.setUpdateTime(new Date());
discountPackageAgentService.updateDiscountPackageAgentCode(discountPackageAgentCode);
JSONObject object = new JSONObject();
object.put("discountPackageName" , discountPackage.getTitle());
object.put("discountPackageId" , discountPackage.getId());
object.put("userId" , userInfoModel.getHighUser().getId());
object.put("userName" , userInfoModel.getHighUser().getName());
object.put("userPhone" , userInfoModel.getHighUser().getPhone());
object.put("companyId" , discountPackage.getCompanyId());
object.put("discountPackageActualId" , discountPackageActualId);
object.put("usingAttribution" , 3);
object.put("type" , 3);
discountPackageUser(object);
getDiscountPackageDeliver(object);
Map<String , Object> map = new HashMap<>();
map.put("agentId" , discountPackageAgentCode.getAgentId());
map.put("discountPackageId" , discountPackageAgentCode.getDiscountPackageId());
map.put("type" , 2);
HighDiscountPackageAgentRel discountPackageAgentRel = discountPackageAgentService.getDetailRelByMap(map);
discountPackageAgentRel.setUpdateTime(new Date());
discountPackageAgentRel.setStockCount(discountPackageAgentRel.getStockCount() - 1);
discountPackageAgentRel.setSalesCount(discountPackageAgentRel.getSalesCount() + 1);
discountPackageAgentService.updateDiscountPackageAgentRel(discountPackageAgentRel);
} else {
// 加锁失败,重试
Thread.sleep(100);
receivePackage(discountPackageActualId , code);
}
} catch (BaseException baseException) {
redisTemplate.delete(key);
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, baseException.getErrorMsg());
} catch (Exception e) {
redisTemplate.delete(key);
System.out.println(e);
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知错误");
} finally {
// 删除key,释放锁
redisTemplate.delete(key);
}
}
private void getDiscountPackageDeliver(JSONObject object) {
// 记录流水
String serialNum = System.currentTimeMillis()+"";
// 赠送记录流水
HighDiscountPackageDeliver discountPackageDeliver = new HighDiscountPackageDeliver();
discountPackageDeliver.setPackageId(object.getLong("discountPackageId"));
discountPackageDeliver.setPackageName(object.getString("discountPackageName"));
discountPackageDeliver.setSerialNumber(serialNum);
discountPackageDeliver.setOpUserId(object.getLong("userId"));
discountPackageDeliver.setOpUserName(object.getString("userName"));
discountPackageDeliver.setStatus(2);
discountPackageDeliverService.insertDeliver(discountPackageDeliver);
HighDiscountPackageDeliverUser deliverUser = new HighDiscountPackageDeliverUser();
deliverUser.setPackageDeliverId(discountPackageDeliver.getId());
deliverUser.setSerialNumber(System.currentTimeMillis()+"");
deliverUser.setPackageId(object.getLong("discountPackageId"));
deliverUser.setPackageName(object.getString("discountPackageName"));
deliverUser.setPackageActualId(object.getLong("discountPackageActualId"));
deliverUser.setUserId(object.getLong("userId"));
deliverUser.setUserPhone(object.getString("userPhone"));
deliverUser.setStatus(2);
discountPackageDeliverService.insertDeliverUser(deliverUser);
}
private void discountPackageUser(JSONObject object) throws Exception {
// 查询优惠券包实际库存中实际优惠券数量
List<HighDiscountPackageDiscountActual> discountPackageDiscountActual = discountPackageDiscountActualService.getHighDiscountPackageDiscountActualList(object.getInteger("discountPackageActualId"));
// 循环赠送优惠券
for (HighDiscountPackageDiscountActual actualList: discountPackageDiscountActual) {
HighDiscount discount = highDiscountService.getDiscountById(actualList.getDiscountId());
if (discount == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券信息不存在");
}
HighDiscountUserRel userRel = new HighDiscountUserRel();
userRel.setDiscountPlatform(DiscountPlatform.getPlatformByCode(discount.getPlatform()).getNumber());
userRel.setDiscountCompanyId(discount.getCompanyId());
userRel.setDiscountId(discount.getId());
userRel.setDiscountName(discount.getDiscountName());
userRel.setDiscountImg(discount.getDiscountImg());
userRel.setDiscountUseScope(discount.getUseScope());
userRel.setDiscountUsingRange(discount.getUsingRange());
userRel.setDiscountType(discount.getDiscountType());
userRel.setDiscountCondition(discount.getDiscountCondition());
userRel.setExt2("优惠券包");
userRel.setDiscountPrice(discount.getDiscountPrice());
userRel.setAgentId(actualList.getAgentId());
userRel.setUserId(object.getLong("userId"));
userRel.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
userRel.setCreateTime(new Date());
userRel.setDiscountAgentCodeId(actualList.getAgentDiscountCodeId());
// 计算使用有效期
Calendar userEndTime = Calendar.getInstance();
userEndTime.setTime(new Date());
userEndTime.set(Calendar.HOUR_OF_DAY, 23);
userEndTime.set(Calendar.MINUTE, 59);
userEndTime.set(Calendar.SECOND, 59);
userEndTime.add(Calendar.DATE, discount.getEffectiveDay());
if (userEndTime.getTime().compareTo(discount.getSalesEndTime()) > 0) {
userRel.setUseEndTime(discount.getSalesEndTime());
} else {
userRel.setUseEndTime(userEndTime.getTime());
}
HighDiscountAgentCode discountAgentCode = highDiscountAgentCodeService.getCodeById(actualList.getAgentDiscountCodeId());
// 修改优惠券二维码状态
discountAgentCode.setStatus(2);
highDiscountAgentCodeService.updateCode(discountAgentCode);
// 新增优惠券与用户的绑定关系
highDiscountUserRelMapper.insert(userRel);
// 修改优惠券包实际库存实际优惠券状态
actualList.setStatus(0);
discountPackageDiscountActualService.updateHighDiscountPackageDiscountActual(actualList);
}
// 增加记录
HighDiscountPackageRecord discountPackageRecord = new HighDiscountPackageRecord();
discountPackageRecord.setDiscountPackageId(object.getInteger("discountPackageId"));
discountPackageRecord.setDiscountPackageTitle(object.getString("discountPackageName"));
discountPackageRecord.setCompanyId(object.getInteger("companyId"));
discountPackageRecord.setStatus(1);
discountPackageRecord.setUsingAttribution(object.getInteger("usingAttribution"));
discountPackageRecord.setRecordNo("DP" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5) );
discountPackageRecord.setSalesType(object.getInteger("type"));
discountPackageRecord.setUserId(object.getInteger("userId"));
discountPackageRecord.setExt1(object.getString("userPhone"));
discountPackageRecord.setCreatedTime(new Date());
highDiscountPackageRecordMapper.insert(discountPackageRecord);
}
}

@ -136,6 +136,7 @@ public class HighUserServiceImpl implements HighUserService {
distributionUserRelService.insertDistributionUserRel(user.getId(), popularizeUserId, region.getRegionId().toString());
}
}
user.setOpenIdH5(MapUtils.getString(other, "openIdH5"));
user.setOpenId(MapUtils.getString(other, "openId"));
loginLog.setUserId(user.getId());

@ -134,7 +134,7 @@ public class HltUnionCardVipServiceImpl implements HltUnionCardVipService {
HighDiscountPackageActual discountPackageActual = discountPackageActualService.getHighDiscountPackageActualList(highDiscountPackage.getId()).get(0);
// 修改优惠券包实际库存状态
discountPackageActual.setStatus(0);
discountPackageActual.setStatus(3);
discountPackageActual.setUserId(highUser.getId().intValue());
discountPackageActual.setAllocationTime(new Date());
discountPackageActualService.updateHighDiscountPackageActual(discountPackageActual);

File diff suppressed because one or more lines are too long

@ -0,0 +1,201 @@
package com.v1.controller.business;
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.PetroConfig;
import com.hai.entity.ApiCoupon;
import com.hai.entity.ApiMerchants;
import com.hai.entity.ApiOrder;
import com.hai.model.ResponseData;
import com.hai.openApi.service.ApiCouponService;
import com.hai.openApi.service.ApiOrderService;
import com.hai.order.type.OrderProductType;
import com.hai.service.ApiIpAddressService;
import com.hai.service.ApiMerchantsService;
import com.hai.service.SecConfigService;
import com.v1.config.ToolConfig;
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.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value = "/apiCoupon")
@Api(value = "卡券业务")
public class ApiCouponController {
private static Logger log = LoggerFactory.getLogger(ApiCouponController.class);
@Resource
private ApiMerchantsService apiMerchantsService;
@Resource
private ApiCouponService apiCouponService;
@Resource
private SecConfigService secConfigService;
@Resource
private ApiIpAddressService apiIpAddressService;
@Resource
private ApiOrderService apiOrderService;
@RequestMapping(value = "/getCouponList", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "获取卡券列表")
public ResponseData getCouponList(@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("timetable")) ||
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_TYPE18.getApiCode(), object.getString("merchId"))) {
log.error("getAllCities error!", "当前帐户无权限查询!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "");
}
if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) {
log.error("getRechargeProduct error!", "请求时间超过15分钟!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT);
}
Map<String , Object> map = new HashMap<>();
map.put("apiKey" , apiMerchants.getApiKey());
map.put("timetable" , object.getString("timetable"));
map.put("merchId" , object.getString("merchId"));
if (!secConfigService.isSignVerify(map , object.getString("sign"))) {
log.error("getRechargeProduct error!", "签名校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
return ResponseMsgUtil.success(apiCouponService.getCouponList(new HashMap<>()));
} catch (Exception e) {
log.error("HighOpenApiController --> getRechargeProduct() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/couponDetail", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询卡券详情")
public ResponseData couponDetail(@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("mchOrderNo")) ||
StringUtils.isBlank(object.getString("sign")) ||
StringUtils.isBlank(object.getString("timetable")) ||
StringUtils.isBlank(object.getString("merchId"))
) {
log.error("createOrder 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_TYPE18.getApiCode(), object.getString("merchId"))) {
log.error("getAllCities error!", "当前帐户无权限查询!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "");
}
if (!ToolConfig.timetableCheck(15L , object.getLong("timetable"))) {
log.error("getRechargeProduct error!", "请求时间超过15分钟!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT);
}
Map<String , Object> map = new HashMap<>();
map.put("mchOrderNo" , object.getString("mchOrderNo"));
map.put("apiKey" , apiMerchants.getApiKey());
map.put("timetable" , object.getString("timetable"));
map.put("merchId" , object.getString("merchId"));
if (!secConfigService.isSignVerify(map, object.getString("sign"))) {
log.error("createOrder error!", "签名校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
ApiOrder apiOrder = apiOrderService.findByOrderNo(object.getString("mchOrderNo") , null);
JSONObject jsonObject = PetroConfig.couponDetail(apiOrder.getExt3());
if (!jsonObject.getString("code").equals("1")) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "当前卡券不可购买");
}
String data = PetroConfig.decrypt(jsonObject.getString("biz_content"));
JSONObject jsonData = JSONObject.parseObject(data);
jsonData.put("out_trade_no" , object.getString("mchOrderNo"));
return ResponseMsgUtil.success(jsonData);
} catch (Exception e) {
log.error("HighOpenApiController --> createOrder() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -128,8 +128,8 @@ public class orderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.TIME_OUT);
}
JSONObject dataObject = JSONObject.parseObject(object.getString("content"));
if (object.getInteger("productType").equals(OrderProductType.PRODUCT_TYPE6.getNumber())) {
JSONObject dataObject = JSONObject.parseObject(object.getString("content"));
if (dataObject.getBigDecimal("refuelPrice") == null
|| StringUtils.isBlank(dataObject.getString("gasOilNo"))
|| StringUtils.isBlank(dataObject.getString("gasGunNo"))
@ -139,7 +139,6 @@ public class orderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写加油信息;加油金额、油号、抢号");
}
}
JSONObject dataObject = JSONObject.parseObject(object.getString("content"));
if (object.getInteger("productType").equals(OrderProductType.PRODUCT_TYPE9.getNumber()) || object.getInteger("productType").equals(OrderProductType.PRODUCT_TYPE3.getNumber())) {
if (StringUtils.isBlank(dataObject.getString("productId"))
@ -168,28 +167,36 @@ public class orderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写下单手机号,就餐方式,下单信息,门店编码");
}
}
if (object.getInteger("productType").equals(OrderProductType.PRODUCT_TYPE13.getNumber())) {
if ( StringUtils.isBlank(dataObject.getString("couponCode"))
|| StringUtils.isBlank(dataObject.getString("receiverPhone"))
|| dataObject.getInteger("receiverCount") == null
) {
log.error("OrderController -> create() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写卡券编码,手机号,购买数量");
}
}
if (object.getInteger("productType").equals(OrderProductType.PRODUCT_TYPE14.getNumber())) {
// if (object.getInteger("productType").equals(OrderProductType.PRODUCT_TYPE13.getNumber())) {
// if ( StringUtils.isBlank(dataObject.getString("couponCode"))
// || StringUtils.isBlank(dataObject.getString("userMobile"))
// || dataObject.getInteger("receiverCount") == null
// ) {
// log.error("OrderController -> create() error!","");
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写卡券编码,手机号,购买数量");
// }
// }
// 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.getString("inTime") == null
// || dataObject.getString("outTime") == null
// || dataObject.getString("carNo") == null
// ) {
// log.error("OrderController -> create() error!","");
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写相关参数");
// }
// }
if (object.getInteger("productType").equals(OrderProductType.PRODUCT_TYPE18.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.getString("inTime") == null
|| dataObject.getString("outTime") == null
|| dataObject.getString("carNo") == null
|| StringUtils.isBlank(dataObject.getString("couponCode"))
) {
log.error("OrderController -> create() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未填写相关参数");

Loading…
Cancel
Save