parent
06bc72e01b
commit
47eedd711e
@ -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 |
File diff suppressed because one or more lines are too long
@ -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); |
||||
} |
||||
} |
||||
} |
@ -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()); |
||||
} |
||||
} |
||||
} |
@ -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(); |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -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(); |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -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); |
||||
|
||||
|
||||
|
||||
} |
@ -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); |
||||
} |
||||
|
||||
} |
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); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue