Commit b4f1148a authored by Tu Bach's avatar Tu Bach

tubn campaign execute manual

parents 0970abdf 03ae6a62
No preview for this file type
...@@ -4,3 +4,4 @@ logs/ ...@@ -4,3 +4,4 @@ logs/
out/ out/
/campaign.iml /campaign.iml
/lib /lib
/log
<<<<<<< HEAD
[main] 21/08/2019 13:37:21 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 13:45:49 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 14:08:23 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 15:55:40 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 16:52:45 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 22:23:57 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 22:41:39 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
=======
[main] 19/08/2019 17:50:53 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 19/08/2019 17:53:34 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 10:20:46 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 11:20:33 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 11:34:24 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 11:41:11 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 14:02:16 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 18:17:32 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 18:25:43 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 18:37:48 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 18:39:48 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 18:42:11 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 23:14:07 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[qtp310412574-32] 21/08/2019 23:28:47 ERROR RedisUtil: (111) :
java.lang.NullPointerException
at com.viettel.campaign.utils.RedisUtil.get(RedisUtil.java:106)
at com.viettel.campaign.service.impl.CampaignExecuteServiceImp.searchCampaignExecute(CampaignExecuteServiceImp.java:233)
at com.viettel.campaign.service.impl.CampaignExecuteServiceImp$$FastClassBySpringCGLIB$$b9c5a263.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684)
at com.viettel.campaign.service.impl.CampaignExecuteServiceImp$$EnhancerBySpringCGLIB$$560ac5ac.searchCampaignExecute(<generated>)
at com.viettel.campaign.web.rest.CampaignController.searchCampaignExecute(CampaignController.java:44)
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:707)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:215)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at com.viettel.campaign.filter.CorsFilter.doFilter(CorsFilter.java:34)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:503)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:132)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
at java.lang.Thread.run(Thread.java:748)
[qtp310412574-37] 21/08/2019 23:29:12 ERROR RedisUtil: (111) :
java.lang.NullPointerException
at com.viettel.campaign.utils.RedisUtil.get(RedisUtil.java:106)
at com.viettel.campaign.service.impl.CampaignExecuteServiceImp.searchCampaignExecute(CampaignExecuteServiceImp.java:233)
at com.viettel.campaign.service.impl.CampaignExecuteServiceImp$$FastClassBySpringCGLIB$$b9c5a263.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684)
at com.viettel.campaign.service.impl.CampaignExecuteServiceImp$$EnhancerBySpringCGLIB$$560ac5ac.searchCampaignExecute(<generated>)
at com.viettel.campaign.web.rest.CampaignController.searchCampaignExecute(CampaignController.java:44)
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:707)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:215)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at com.viettel.campaign.filter.CorsFilter.doFilter(CorsFilter.java:34)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:503)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
at java.lang.Thread.run(Thread.java:748)
[qtp310412574-38] 21/08/2019 23:30:12 ERROR RedisUtil: (111) :
java.lang.NullPointerException
at com.viettel.campaign.utils.RedisUtil.get(RedisUtil.java:106)
at com.viettel.campaign.service.impl.CampaignExecuteServiceImp.searchCampaignExecute(CampaignExecuteServiceImp.java:233)
at com.viettel.campaign.service.impl.CampaignExecuteServiceImp$$FastClassBySpringCGLIB$$b9c5a263.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684)
at com.viettel.campaign.service.impl.CampaignExecuteServiceImp$$EnhancerBySpringCGLIB$$560ac5ac.searchCampaignExecute(<generated>)
at com.viettel.campaign.web.rest.CampaignController.searchCampaignExecute(CampaignController.java:44)
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:707)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:215)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at com.viettel.campaign.filter.CorsFilter.doFilter(CorsFilter.java:34)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:503)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
at java.lang.Thread.run(Thread.java:748)
[main] 21/08/2019 23:35:55 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 23:46:40 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 23:57:29 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
>>>>>>> origin/master
...@@ -49,8 +49,8 @@ ...@@ -49,8 +49,8 @@
<dependency> <dependency>
<groupId>com.oracle</groupId> <groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId> <artifactId>ojdbc7</artifactId>
<scope>system</scope> <!-- <scope>system</scope>-->
<systemPath>${project.basedir}/lib/ojdbc7.jar</systemPath> <!-- <systemPath>${project.basedir}/lib/ojdbc7.jar</systemPath>-->
<version>1.0</version> <version>1.0</version>
</dependency> </dependency>
<dependency> <dependency>
......
package com.viettel.campaign.job; package com.viettel.campaign.job;
import com.viettel.campaign.model.ccms_full.Campaign; import com.viettel.campaign.model.ccms_full.*;
import com.viettel.campaign.model.ccms_full.Customer; import com.viettel.campaign.service.*;
import com.viettel.campaign.model.ccms_full.CustomerTime;
import com.viettel.campaign.model.ccms_full.ProcessConfig;
import com.viettel.campaign.service.CampaignService;
import com.viettel.campaign.service.CustomerService;
import com.viettel.campaign.service.CustomerTimeService;
import com.viettel.campaign.service.ProcessConfigService;
import com.viettel.campaign.utils.DateTimeUtil; import com.viettel.campaign.utils.DateTimeUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -42,68 +36,75 @@ public class CampaignJob { ...@@ -42,68 +36,75 @@ public class CampaignJob {
@Autowired @Autowired
private CustomerService customerService; private CustomerService customerService;
@Autowired
private UserActionLogService userActionLogService;
// @Scheduled(fixedRate = 5000) // @Scheduled(fixedRate = 5000)
// @Transactional( propagation = Propagation.REQUIRED) // @Transactional( propagation = Propagation.REQUIRED)
public void process() { public void process() {
log.info(Thread.currentThread().getName() + " The Task executed at " + dateFormat.format(new Date())); // log.info(Thread.currentThread().getName() + " The Task executed at " + dateFormat.format(new Date()));
List<ProcessConfig> list = processConfigService.findAll(); // List<ProcessConfig> list = processConfigService.findAll();
//
list.parallelStream().forEach(p -> { // list.parallelStream().forEach(p -> {
boolean isExecute = DateTimeUtil.isRun(p.getConfigValue(), p.getLastProcess()); // boolean isExecute = DateTimeUtil.isRun(p.getConfigValue(), p.getLastProcess());
switch (p.getConfigCode()){ // switch (p.getConfigCode()){
case CUSTOMER_INACTIVE_DUARATION: // case CUSTOMER_INACTIVE_DUARATION:
if(isExecute){ // if(isExecute){
List<Customer> customers = customerService.findAllByCondition(p.getSiteId(), new Date()); // List<Customer> customers = customerService.findAllByCondition(p.getSiteId(), new Date());
updateCustomer(customers); // updateCustomer(customers);
updateCustomerTime(customers); // updateCustomerTime(customers);
log.info("Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}", p.getSiteId()); // log.info("Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}", p.getSiteId());
p.setLastProcess(new Date()); // p.setLastProcess(new Date());
processConfigService.update(p); // processConfigService.update(p);
} // }
break; // break;
case CRON_EXPRESSION_CHECK_START: // case CRON_EXPRESSION_CHECK_START:
// process // // process
if(isExecute){ // if(isExecute){
List<Long> status = new ArrayList<>(); // List<Long> status = new ArrayList<>();
status.add(1L); // status.add(1L);
status.add(1L); // status.add(1L);
List<Campaign> campaigns = campaignService.findCampaignByCompanySiteIdAndStartTimeIsLessThanEqualAndStatusIn(p.getSiteId(), new Date(), status); // List<Campaign> campaigns = campaignService.findCampaignByCompanySiteIdAndStartTimeIsLessThanEqualAndStatusIn(p.getSiteId(), new Date(), status);
campaigns.parallelStream().forEach(campaign -> { // campaigns.parallelStream().forEach(campaign -> {
log.info("Chuyen trang thai chien dich ... #{} ... tu Du thao sang Trien khai", campaign.getCampaignId()); // log.info("Chuyen trang thai chien dich ... #{} ... tu Du thao sang Trien khai", campaign.getCampaignId());
campaign.setProcessStatus(1); // campaign.setProcessStatus(1);
campaign.setStatus(2L); // campaign.setStatus(2L);
campaign.setCampaignStart(new Date()); // campaign.setCampaignStart(new Date());
campaignService.updateProcess(campaign); // campaignService.updateProcess(campaign);
}); // //write log
// saveLog(campaign, 1);
log.info("Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}", p.getSiteId()); // });
p.setLastProcess(new Date()); //
processConfigService.update(p); // log.info("Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}", p.getSiteId());
} // p.setLastProcess(new Date());
break; // processConfigService.update(p);
case CRON_EXPRESSION_CHECK_END: // }
// process // break;
if(isExecute){ // case CRON_EXPRESSION_CHECK_END:
List<Long> status = new ArrayList<>(); // // process
status.add(2L); // if(isExecute){
status.add(3L); // List<Long> status = new ArrayList<>();
List<Campaign> campaigns = campaignService.findCampaignByCompanySiteIdAndEndTimeIsLessThanEqualAndStatusIn(p.getSiteId(), new Date(), status); // status.add(2L);
campaigns.parallelStream().forEach(campaign -> { // status.add(3L);
log.info("Chuyen trang thai chien dich ... #{} ... sang Ket thuc", campaign.getCampaignId()); // List<Campaign> campaigns = campaignService.findCampaignByCompanySiteIdAndEndTimeIsLessThanEqualAndStatusIn(p.getSiteId(), new Date(), status);
campaign.setStatus(4L); // campaigns.parallelStream().forEach(campaign -> {
campaign.setCampaignEnd(new Date()); // log.info("Chuyen trang thai chien dich ... #{} ... sang Ket thuc", campaign.getCampaignId());
campaignService.updateProcess(campaign); // campaign.setStatus(4L);
}); // campaign.setCampaignEnd(new Date());
// campaignService.updateProcess(campaign);
log.info("Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}", p.getSiteId()); // //write log
p.setLastProcess(new Date()); // saveLog(campaign, 2);
processConfigService.update(p); // });
} //
break; // log.info("Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}", p.getSiteId());
default: // p.setLastProcess(new Date());
// update last check time // processConfigService.update(p);
} // }
}); // break;
// default:
// // update last check time
// }
// });
} }
...@@ -129,5 +130,16 @@ public class CampaignJob { ...@@ -129,5 +130,16 @@ public class CampaignJob {
}); });
} }
private void saveLog(Campaign c, int t){
UserActionLog log = new UserActionLog();
log.setAgentId(1L);
log.setSessionId("-1");
log.setStartTime(new Date());
log.setActionType(t == 1 ? 13L : 14L);
log.setObjectId(c.getCampaignId());
log.setCompanySiteId(c.getCompanySiteId());
userActionLogService.save(log);
}
} }
package com.viettel.campaign.model.ccms_full;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* @author hanv_itsol
* @project campaign
*/
@Entity
@Table(name = "USER_ACTION_LOG")
@Data
public class UserActionLog implements Serializable {
@Id
@NotNull
@Column(name = "AGENT_ID")
private Long agentId;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Column(name = "SESSION_ID")
private String sessionId;
@Column(name = "START_TIME")
private Date startTime;
@Column(name = "END_TIME")
private Date endTime;
@Column(name = "ACTION_TYPE")
private Long actionType;
@Column(name = "DESCRIPTION")
private String description;
@Column(name = "OBJECT_ID")
private Long objectId;
}
...@@ -14,4 +14,6 @@ public interface CampaignCustomerListRepository extends JpaRepository<CampaignCu ...@@ -14,4 +14,6 @@ public interface CampaignCustomerListRepository extends JpaRepository<CampaignCu
@Query("select count (c.campaignId) from CampaignCustomerList c where c.customerListId in (:ids)") @Query("select count (c.campaignId) from CampaignCustomerList c where c.customerListId in (:ids)")
Long campaignIdsCount(@Param("ids") List<Long> ids); Long campaignIdsCount(@Param("ids") List<Long> ids);
void deleteCampaignCustomerListByCampaignIdAndCustomerListIdAndCompanySiteId(Long campaignId, Long customerListId, Long companySiteId);
} }
...@@ -35,4 +35,20 @@ public interface CampaignCustomerRepository extends JpaRepository<CampaignCustom ...@@ -35,4 +35,20 @@ public interface CampaignCustomerRepository extends JpaRepository<CampaignCustom
Long getCustomerRecall(@Param("campaignId") Long campaignId, @Param("customerId") Long customerId); Long getCustomerRecall(@Param("campaignId") Long campaignId, @Param("customerId") Long customerId);
CampaignCustomer findCampaignCustomerByCampaignCustomerId(Long id); CampaignCustomer findCampaignCustomerByCampaignCustomerId(Long id);
@Query(value = "SELECT * FROM CAMPAIGN_CUSTOMER CC " +
"WHERE CC.STATUS = 0 " +
"AND CC.CAMPAIGN_ID = :campaignId " +
"AND CC.COMPANY_SITE_ID = :companySiteId " +
"AND CC.CUSTOMER_LIST_ID = :customerListId", nativeQuery = true)
List<CampaignCustomer> findCustomerNoContact(@Param("campaignId") Long campaignId, @Param("companySiteId") Long companySiteId, @Param("customerListId") Long customerListId);
@Query(value = "SELECT * FROM CAMPAIGN_CUSTOMER CC " +
"WHERE CC.STATUS IN (SELECT COMPLETE_VALUE from CAMPAIGN_COMPLETE_CODE where STATUS = 1 and IS_FINISH = 0 and IS_RECALL = 0)" +
"AND CC.CAMPAIGN_ID = :campaignId " +
"AND CC.COMPANY_SITE_ID = :companySiteId " +
"AND CC.CUSTOMER_LIST_ID = :customerListId", nativeQuery = true)
List<CampaignCustomer> findCustomerContacted(@Param("campaignId") Long campaignId, @Param("companySiteId") Long companySiteId, @Param("customerListId") Long customerListId);
} }
...@@ -18,14 +18,19 @@ public interface CampaignRepositoryCustom { ...@@ -18,14 +18,19 @@ public interface CampaignRepositoryCustom {
ResultDTO checkAllowStatusToPrepare(Long campaignId); ResultDTO checkAllowStatusToPrepare(Long campaignId);
//hungtt //<editor-fold: hungtt>
ResultDTO findCustomerListReallocation(CampaignRequestDTO dto); ResultDTO findCustomerListReallocation(CampaignRequestDTO dto);
//hungtt
ResultDTO reallocationCustomer(CampaignRequestDTO dto); ResultDTO reallocationCustomer(CampaignRequestDTO dto);
//hungtt
ResultDTO getListFieldsNotShow(CampaignRequestDTO dto); ResultDTO getListFieldsNotShow(CampaignRequestDTO dto);
//hungtt
ResultDTO getListFieldsToShow(CampaignRequestDTO dto); ResultDTO getListFieldsToShow(CampaignRequestDTO dto);
//hungtt
ResultDTO getCampaignCustomerList(CampaignRequestDTO dto); ResultDTO getCampaignCustomerList(CampaignRequestDTO dto);
ResultDTO getCustomerList(CampaignRequestDTO dto);
ResultDTO getCustomerChoosenList(CampaignRequestDTO dto);
//</editor-fold>
} }
...@@ -24,4 +24,7 @@ public interface ScenarioAnswerRepository extends JpaRepository<ScenarioAnswer, ...@@ -24,4 +24,7 @@ public interface ScenarioAnswerRepository extends JpaRepository<ScenarioAnswer,
Integer deleteScenarioAnswersByScenarioQuestionId(Long scenarioQuestionId); Integer deleteScenarioAnswersByScenarioQuestionId(Long scenarioQuestionId);
ScenarioAnswer findScenarioAnswerByScenarioAnswerId(Long scenarioAnswerId); ScenarioAnswer findScenarioAnswerByScenarioAnswerId(Long scenarioAnswerId);
@Query(value = "SELECT COUNT(1) FROM ScenarioAnswer WHERE 1 = 1 AND code = :code AND scenarioQuestionId = :scenarioQuestionId AND scenarioAnswerId <> :scenarioAnswerId")
Integer countDuplicateScenarioCode(@Param("code") String code, @Param("scenarioQuestionId") Long scenarioQuestionId, @Param("scenarioAnswerId") Long scenarioAnswerId);
} }
...@@ -9,4 +9,6 @@ import com.viettel.campaign.web.dto.ScenarioQuestionDTO; ...@@ -9,4 +9,6 @@ import com.viettel.campaign.web.dto.ScenarioQuestionDTO;
public interface ScenarioQuestionRepositoryCustom { public interface ScenarioQuestionRepositoryCustom {
Integer countDuplicateQuestionCode(ScenarioQuestionDTO questionDTO); Integer countDuplicateQuestionCode(ScenarioQuestionDTO questionDTO);
Integer countDuplicateOrderIndex(ScenarioQuestionDTO questionDTO);
} }
...@@ -2,7 +2,9 @@ package com.viettel.campaign.repository.ccms_full; ...@@ -2,7 +2,9 @@ package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.Scenario; import com.viettel.campaign.model.ccms_full.Scenario;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.data.repository.query.Param;
/** /**
* @author anhvd_itsol * @author anhvd_itsol
...@@ -11,4 +13,7 @@ import org.springframework.stereotype.Repository; ...@@ -11,4 +13,7 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface ScenarioRepository extends JpaRepository<Scenario, Long> { public interface ScenarioRepository extends JpaRepository<Scenario, Long> {
Scenario findScenarioByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId); Scenario findScenarioByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
@Query(value = "SELECT COUNT(1) FROM Scenario WHERE 1 = 1 AND companySiteId = :companySiteId AND code = :code AND scenarioId <> :scenarioId")
Integer countDuplicateScenarioCode(@Param("companySiteId") Long companySiteId, @Param("code") String code, @Param("scenarioId") Long scenarioId);
} }
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.UserActionLog;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* @author hanv_itsol
* @project campaign
*/
@Repository
public interface UserActionLogRepository extends JpaRepository<UserActionLog, Long> {
//
}
...@@ -92,7 +92,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -92,7 +92,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
sb.append(" FROM CAMPAIGN a"); sb.append(" FROM CAMPAIGN a");
sb.append(" LEFT JOIN (SELECT campaign_id, COUNT (*) AS SLKHThamgiaCD"); sb.append(" LEFT JOIN (SELECT campaign_id, COUNT (*) AS SLKHThamgiaCD");
sb.append(" FROM campaign_customer cc INNER JOIN CUSTOMER cus ON cc.CUSTOMER_ID = cus.CUSTOMER_ID"); sb.append(" FROM campaign_customer cc INNER JOIN CUSTOMER cus ON cc.CUSTOMER_ID = cus.CUSTOMER_ID");
sb.append(" WHERE 1 = 1 AND cc.IN_CAMPAIGN_STATUS = 1 AND cus.STATUS = 1"); sb.append(" WHERE 1 = 1 AND cus.STATUS = 1");
sb.append(" group by campaign_id) b"); sb.append(" group by campaign_id) b");
sb.append(" ON a.CAMPAIGN_ID = b.CAMPAIGN_ID"); sb.append(" ON a.CAMPAIGN_ID = b.CAMPAIGN_ID");
sb.append(" LEFT JOIN (SELECT campaign_id, COUNT (*) AS SLKHChuaTuongTac"); sb.append(" LEFT JOIN (SELECT campaign_id, COUNT (*) AS SLKHChuaTuongTac");
...@@ -577,10 +577,280 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -577,10 +577,280 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
// StringBuilder sb = new StringBuilder(); // StringBuilder sb = new StringBuilder();
try { try {
String sql = SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_MNG, "get-list-campaign-customer"); // String sql = SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_MNG, "get-list-campaign-customer");
String sql = "with campaign_customer_id as (\n" +
" select ccl.CUSTOMER_LIST_ID from campaign_customerlist ccl\n" +
" where ccl.campaign_id = :p_campaign_id and ccl.company_site_id = :p_company_site_id\n" +
"),\n" +
"customer_table as (\n" +
" select count(a.customer_id) totalCustomer, a.customer_list_id customerListId from customer_list_mapping a\n" +
" left join customer b on a.customer_id = b.customer_id\n" +
" where b.status = 1\n" +
" group by a.customer_list_id\n" +
"),\n" +
"campaign_customer_table as (\n" +
" select count(a.customer_id) campaignCustomer, a.customer_list_id customerListId, a.campaign_id from campaign_customer a\n" +
" where a.campaign_id = :p_campaign_id\n" +
" group by a.customer_list_id, a.campaign_id\n" +
"),\n" +
"customer_interactive_table as (\n" +
" select count(a.customer_id) campaignCustomerCalled, a.customer_list_id customerListId, a.campaign_id from campaign_customer a\n" +
" where a.status <> 0 and a.campaign_id = :p_campaign_id\n" +
" group by a.customer_list_id, a.campaign_id\n" +
"),\n" +
"customer_not_interactive_table as (\n" +
" select count(a.customer_id) cusNotInteractive, a.customer_list_id customerListId, a.campaign_id from campaign_customer a\n" +
" where a.status = 0 and a.campaign_id = :p_campaign_id and a.in_campaign_status = 1\n" +
" group by a.customer_list_id, a.campaign_id\n" +
"),\n" +
"data_temp as (\n" +
"select a.customer_list_id customerListId,\n" +
" a.customer_list_code customerListCode,\n" +
" a.customer_list_name customerListName,\n" +
" nvl(b.totalCustomer, 0) totalCusList,\n" +
" nvl(c.campaignCustomer, 0) totalCusCampaign,\n" +
" nvl(d.campaignCustomerCalled, 0) totalCusCalled,\n" +
" nvl(e.cusNotInteractive, 0) totalCusNotInteract\n" +
"from customer_list a\n" +
"left join customer_table b on a.customer_list_id = b.customerListId\n" +
"left join campaign_customer_table c on a.customer_list_id = c.customerListId\n" +
"left join customer_interactive_table d on a.customer_list_id = d.customerListId\n" +
"left join customer_not_interactive_table e on a.customer_list_id = e.customerListId\n" +
"where a.customer_list_id in (select CUSTOMER_LIST_ID from campaign_customer_id)\n" +
"),\n" +
"data as (\n" +
"select a.*, rownum row_ from data_temp a\n" +
"),\n" +
"count_data as (\n" +
"select count(*) totalRow from data_temp\n" +
")\n" +
"select a.customerListId, a.customerListCode, a.customerListName, a.totalCusList, a.totalCusCampaign, a.totalCusCalled, a.totalCusNotInteract, totalRow from data a, count_data\n" +
"where row_ >= ((:p_page_number - 1) * :p_page_size + 1) and row_ < (:p_page_number * :p_page_size + 1)\n";
params.put("p_campaign_id", dto.getCampaignId()); params.put("p_campaign_id", dto.getCampaignId());
params.put("p_company_site_id", dto.getCompanySiteId());
params.put("p_page_number", dto.getPage().toString());
params.put("p_page_size", dto.getPageSize().toString());
list = namedParameterJdbcTemplate.query(sql, params, BeanPropertyRowMapper.newInstance(CustomerListDTO.class));
int total = 0;
if (list.size() > 0) {
total = list.get(0).getTotalRow();
}
resultDTO.setListData(list);
resultDTO.setTotalRow(total);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
} catch (Exception e) {
logger.error(e.getMessage(), e);
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
}
return resultDTO;
}
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO getCustomerList(CampaignRequestDTO dto) {
List<CustomerListDTO> list = new ArrayList();
ResultDTO resultDTO = new ResultDTO();
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
// Map<String, String> params = new HashMap<>();
StringBuilder sb = new StringBuilder();
try {
// String sql = SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_MNG, "get-customer-list");
sb.append(" with campaign_customer_id as (");
sb.append(" select ccl.CUSTOMER_LIST_ID from campaign_customerlist ccl");
sb.append(" where ccl.campaign_id = :p_campaign_id and ccl.company_site_id = :p_company_site_id");
sb.append(" ),");
sb.append(" customer_table as (");
sb.append(" select count(a.customer_id) totalCustomer, a.customer_list_id customerListId from customer_list_mapping a");
sb.append(" left join customer b on a.customer_id = b.customer_id");
sb.append(" where b.status = 1");
sb.append(" group by a.customer_list_id");
sb.append(" ),");
sb.append(" customer_active_table as (");
sb.append(" select count(a.customer_id) customerActive, a.customer_list_id customerListId from customer_list_mapping a");
sb.append(" left join customer b on a.customer_id = b.customer_id");
sb.append(" where b.status = 1 and b.ipcc_status = 'active'");
sb.append(" group by a.customer_list_id");
sb.append(" ),");
sb.append(" customer_lock_table as (");
sb.append(" select count(a.customer_id) customerLock, a.customer_list_id customerListId from customer_list_mapping a");
sb.append(" left join customer b on a.customer_id = b.customer_id");
sb.append(" where b.status = 1 and b.ipcc_status = 'locked'");
sb.append(" group by a.customer_list_id");
sb.append(" ),");
sb.append(" customer_dnc_table as (");
sb.append(" select count(a.customer_id) customerDnc, a.customer_list_id customerListId from customer_list_mapping a");
sb.append(" left join customer b on a.customer_id = b.customer_id");
sb.append(" where b.status = 1 and b.call_allowed = 0");
sb.append(" group by a.customer_list_id");
sb.append(" ),");
sb.append(" data_temp as (");
sb.append(" select a.customer_list_id customerListId,");
sb.append(" a.customer_list_code customerListCode,");
sb.append(" a.customer_list_name customerListName,");
sb.append(" nvl(b.totalCustomer, 0) totalCusList,");
sb.append(" nvl(c.customerActive, 0) totalCusActive,");
sb.append(" nvl(d.customerLock, 0) totalCusLock,");
sb.append(" nvl(e.customerDnc, 0) totalCusDnc,");
sb.append(" a.create_at createAt,");
sb.append(" a.company_site_id companySiteId,");
sb.append(" a.status status");
sb.append(" from customer_list a");
sb.append(" left join customer_table b on a.customer_list_id = b.customerListId");
sb.append(" left join customer_active_table c on a.customer_list_id = c.customerListId");
sb.append(" left join customer_lock_table d on a.customer_list_id = d.customerListId");
sb.append(" left join customer_dnc_table e on a.customer_list_id = e.customerListId");
sb.append(" where a.status = 1");
sb.append(" and (:p_cus_list_code is null or upper(a.customer_list_code) like '%'||:p_cus_list_code||'%')");
sb.append(" and (:p_cus_list_name is null or upper(a.customer_list_name) like '%'||:p_cus_list_name||'%')");
sb.append(" and (a.create_at <= to_date(:p_to_date, 'DD/MM/YYYY'))");
sb.append(" and (a.create_at >= to_date(:p_from_date, 'DD/MM/YYYY'))");
sb.append(" and (a.company_site_id = :p_company_site_id)");
sb.append(" and (a.customer_list_id not in (select CUSTOMER_LIST_ID from campaign_customer_id))");
sb.append(" ),");
sb.append(" data as (");
sb.append(" select a.*, rownum row_ from data_temp a");
sb.append(" ),");
sb.append(" count_data as (");
sb.append(" select count(*) totalRow from data_temp");
sb.append(" )");
sb.append(" select a.customerListId, a.customerListCode, a.customerListName, a.totalCusList, a.totalCusActive, a.totalCusLock, a.totalCusDnc, totalRow from data a, count_data");
sb.append(" where row_ >= ((:p_page_number - 1) * :p_page_size + 1) and row_ < (:p_page_number * :p_page_size + 1)");
// params.put("p_campaign_id", dto.getCampaignId());
// params.put("p_cus_list_code", DataUtil.isNullOrEmpty(dto.getCustListCode()) ? null : dto.getCustListCode().toUpperCase());
// params.put("p_cus_list_name", DataUtil.isNullOrEmpty(dto.getCustListName()) ? null : dto.getCustListName().toUpperCase());
// params.put("p_to_date", dto.getCreateTimeTo());
// params.put("p_from_date", dto.getCreateTimeFr());
// params.put("p_company_site_id", dto.getCompanySiteId());
// params.put("p_page_number", dto.getPage().toString());
// params.put("p_page_size", dto.getPageSize().toString());
//
// list = namedParameterJdbcTemplate.query(sb.toString(), params, BeanPropertyRowMapper.newInstance(CustomerListDTO.class));
SQLQuery query = session.createSQLQuery(sb.toString());
query.setParameter("p_company_site_id", dto.getCompanySiteId());
query.setParameter("p_campaign_id", dto.getCampaignId());
query.setParameter("p_cus_list_code", DataUtil.isNullOrEmpty(dto.getCustListCode()) ? null : dto.getCustListCode().toUpperCase());
query.setParameter("p_cus_list_name", DataUtil.isNullOrEmpty(dto.getCustListName()) ? null : dto.getCustListName().toUpperCase());
query.setParameter("p_to_date", dto.getCreateTimeTo());
query.setParameter("p_from_date", dto.getCreateTimeFr());
query.setParameter("p_page_number", dto.getPage());
query.setParameter("p_page_size", dto.getPageSize());
query.addScalar("customerListId", new LongType());
query.addScalar("customerListCode", new StringType());
query.addScalar("customerListName", new StringType());
query.addScalar("totalCusList", new LongType());
query.addScalar("totalCusActive", new LongType());
query.addScalar("totalCusLock", new LongType());
query.addScalar("totalCusDnc", new LongType());
query.addScalar("totalRow", new IntegerType());
query.setResultTransformer(Transformers.aliasToBean(CustomerListDTO.class));
int total = 0;
list = query.list();
if (list.size() > 0) {
total = list.get(0).getTotalRow();
}
resultDTO.setListData(list);
resultDTO.setTotalRow(total);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
} catch (Exception e) {
logger.error(e.getMessage(), e);
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
} finally {
session.close();
return resultDTO;
}
}
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO getCustomerChoosenList(CampaignRequestDTO dto) {
List<CustomerListDTO> list = new ArrayList();
ResultDTO resultDTO = new ResultDTO();
Map<String, String> params = new HashMap<>();
// StringBuilder sb = new StringBuilder();
try {
// String sql = SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_MNG, "get-customer-list-choosen");
String sql = "with campaign_customer_id as (\n" +
" select ccl.CUSTOMER_LIST_ID from campaign_customerlist ccl\n" +
" where ccl.campaign_id = :p_campaign_id and ccl.company_site_id = :p_company_site_id\n" +
"),\n" +
"customer_table as (\n" +
" select count(a.customer_id) totalCustomer, a.customer_list_id customerListId from customer_list_mapping a\n" +
" left join customer b on a.customer_id = b.customer_id\n" +
" where b.status = 1\n" +
" group by a.customer_list_id\n" +
"),\n" +
"customer_active_table as (\n" +
" select count(a.customer_id) customerActive, a.customer_list_id customerListId from customer_list_mapping a\n" +
" left join customer b on a.customer_id = b.customer_id\n" +
" where b.status = 1 and b.ipcc_status = 'active'\n" +
" group by a.customer_list_id\n" +
"),\n" +
"customer_lock_table as (\n" +
" select count(a.customer_id) customerLock, a.customer_list_id customerListId from customer_list_mapping a\n" +
" left join customer b on a.customer_id = b.customer_id\n" +
" where b.status = 1 and b.ipcc_status = 'locked'\n" +
" group by a.customer_list_id\n" +
"),\n" +
"customer_dnc_table as (\n" +
" select count(a.customer_id) customerDnc, a.customer_list_id customerListId from customer_list_mapping a\n" +
" left join customer b on a.customer_id = b.customer_id\n" +
" where b.status = 1 and b.call_allowed = 0\n" +
" group by a.customer_list_id\n" +
"),\n" +
"customer_filter_table as (\n" +
" select count(a.customer_id) customerFilter, a.customer_list_id customerListId from campaign_customer a\n" +
" where a.campaign_id = :p_campaign_id\n" +
" group by a.customer_list_id\n" +
"),\n" +
"data_temp as (\n" +
"select a.customer_list_id customerListId,\n" +
" a.customer_list_code customerListCode,\n" +
" a.customer_list_name customerListName,\n" +
" nvl(b.totalCustomer, 0) totalCusList,\n" +
" nvl(c.customerActive, 0) totalCusActive,\n" +
" nvl(d.customerLock, 0) totalCusLock,\n" +
" nvl(e.customerDnc, 0) totalCusDnc,\n" +
" nvl(null, 0) totalCusAddRemove,\n" +
" nvl(f.customerFilter, 0) totalCusFilter\n" +
"from customer_list a\n" +
"left join customer_table b on a.customer_list_id = b.customerListId\n" +
"left join customer_active_table c on a.customer_list_id = c.customerListId\n" +
"left join customer_lock_table d on a.customer_list_id = d.customerListId\n" +
"left join customer_dnc_table e on a.customer_list_id = e.customerListId\n" +
"left join customer_filter_table f on a.customer_list_id = f.customerListId\n" +
"where a.customer_list_id in (select CUSTOMER_LIST_ID from campaign_customer_id)\n" +
"),\n" +
"data as (\n" +
"select a.*, rownum row_ from data_temp a\n" +
"),\n" +
"count_data as (\n" +
"select count(*) totalRow from data_temp\n" +
")\n" +
"select a.customerListId, a.customerListCode, a.customerListName, a.totalCusList, a.totalCusActive, a.totalCusLock, a.totalCusDnc, a.totalCusAddRemove, a.totalCusFilter, totalRow from data a, count_data\n" +
"where row_ >= ((:p_page_number - 1) * :p_page_size + 1) and row_ < (:p_page_number * :p_page_size + 1)\n";
params.put("p_campaign_id", dto.getCampaignId());
params.put("p_company_site_id", dto.getCompanySiteId());
params.put("p_page_number", dto.getPage().toString());
params.put("p_page_size", dto.getPageSize().toString());
list = namedParameterJdbcTemplate.query(sql, params, BeanPropertyRowMapper.newInstance(CustomerListDTO.class)); list = namedParameterJdbcTemplate.query(sql, params, BeanPropertyRowMapper.newInstance(CustomerListDTO.class));
int total = 0;
if (list.size() > 0) {
total = list.get(0).getTotalRow();
}
resultDTO.setListData(list); resultDTO.setListData(list);
resultDTO.setTotalRow(total);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS); resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS); resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -68,6 +68,61 @@ public class ScenarioQuestionRepositoryImpl implements ScenarioQuestionRepositor ...@@ -68,6 +68,61 @@ public class ScenarioQuestionRepositoryImpl implements ScenarioQuestionRepositor
} }
} catch (Exception ex) { } catch (Exception ex) {
logger.error(ex.getMessage(), ex); logger.error(ex.getMessage(), ex);
} finally {
session.close();
}
return count;
}
@Override
public Integer countDuplicateOrderIndex(ScenarioQuestionDTO questionDTO) {
logger.info("Start search duplicate order index::");
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
Integer count = null;
try {
StringBuilder sb = new StringBuilder();
sb.append("SELECT COUNT(1) FROM SCENARIO_QUESTION WHERE 1 = 1 AND STATUS = 1 ");
if (questionDTO.getScenarioQuestionId() != null) {
sb.append(" AND SCENARIO_QUESTION_ID <> :p_question_id ");
}
if (questionDTO.getOrderIndex() != null) {
sb.append(" AND ORDER_INDEX = :p_orderIndex ");
}
if (questionDTO.getCampaignId() != null) {
sb.append(" AND CAMPAIGN_ID = :p_campaign_id");
}
if (questionDTO.getCompanySiteId() != null) {
sb.append(" AND COMPANY_SITE_ID = :p_site_id");
}
SQLQuery query = session.createSQLQuery(sb.toString());
if (questionDTO.getScenarioQuestionId() != null) {
query.setParameter("p_question_id", questionDTO.getScenarioQuestionId());
}
if (questionDTO.getOrderIndex() != null) {
query.setParameter("p_orderIndex", questionDTO.getOrderIndex());
}
if (questionDTO.getCampaignId() != null) {
query.setParameter("p_campaign_id", questionDTO.getCampaignId());
}
if (questionDTO.getCompanySiteId() != null) {
query.setParameter("p_site_id", questionDTO.getCompanySiteId());
}
final List<BigDecimal> obj = query.list();
for (BigDecimal i : obj) {
if (i != null) {
count = i.intValue();
}
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
} finally {
session.close();
} }
return count; return count;
} }
......
...@@ -56,6 +56,14 @@ public interface CampaignService { ...@@ -56,6 +56,14 @@ public interface CampaignService {
ResultDTO getListFieldsToShow(CampaignRequestDTO dto); ResultDTO getListFieldsToShow(CampaignRequestDTO dto);
ResultDTO getCampaignCustomerList(CampaignRequestDTO dto); ResultDTO getCampaignCustomerList(CampaignRequestDTO dto);
ResultDTO getCustomerList(CampaignRequestDTO dto);
ResultDTO getCustomerChoosenList(CampaignRequestDTO dto);
ResultDTO addCustomerListToCampaign(CampaignRequestDTO dto);
ResultDTO deleteCustomerListFromCampaign(CampaignRequestDTO dto);
//</editor-fold> //</editor-fold>
} }
...@@ -13,4 +13,6 @@ public interface ScenarioAnswerService { ...@@ -13,4 +13,6 @@ public interface ScenarioAnswerService {
Long getMaxAnswerOrderId(Long scenarioQuestionId, Long companySiteId); Long getMaxAnswerOrderId(Long scenarioQuestionId, Long companySiteId);
ResultDTO delete(ScenarioAnswerDTO scenarioAnswerDTO); ResultDTO delete(ScenarioAnswerDTO scenarioAnswerDTO);
Integer countDuplicateScenarioCode(String code, Long scenarioQuestionId, Long scenarioAnswerId);
} }
...@@ -20,4 +20,6 @@ public interface ScenarioQuestionService { ...@@ -20,4 +20,6 @@ public interface ScenarioQuestionService {
ResultDTO update(ScenarioQuestionDTO scenarioQuestionDTO); ResultDTO update(ScenarioQuestionDTO scenarioQuestionDTO);
Integer countDuplicateOrderIndex(ScenarioQuestionDTO questionDTO);
} }
...@@ -16,5 +16,7 @@ public interface ScenarioService { ...@@ -16,5 +16,7 @@ public interface ScenarioService {
ResultDTO sortQuestionAndAnswer(ScenarioDTO scenarioDTO); ResultDTO sortQuestionAndAnswer(ScenarioDTO scenarioDTO);
Integer countDuplicateScenarioCode(Long companySiteId, String code, Long scenarioId);
ResultDTO saveContacQuestResult(ContactQuestResultDTO dto); ResultDTO saveContacQuestResult(ContactQuestResultDTO dto);
} }
package com.viettel.campaign.service; package com.viettel.campaign.service;
import com.viettel.campaign.model.ccms_full.UserActionLog;
/** /**
* @author anhvd_itsol * @author hanv_itsol
* @project campaign
*/ */
public interface UserActionLogService { public interface UserActionLogService {
void save(UserActionLog log);
} }
...@@ -61,6 +61,12 @@ public class CampaignServiceImpl implements CampaignService { ...@@ -61,6 +61,12 @@ public class CampaignServiceImpl implements CampaignService {
@Autowired @Autowired
ScenarioRepository scenarioRepository; ScenarioRepository scenarioRepository;
@Autowired
CampaignCustomerListRepository campaignCustomerListRepository;
@Autowired
CampaignCustomerRepository campaignCustomerRepository;
@Override @Override
@Transactional(DataSourceQualify.CCMS_FULL) @Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO search(CampaignRequestDTO requestDto) { public ResultDTO search(CampaignRequestDTO requestDto) {
...@@ -370,8 +376,8 @@ public class CampaignServiceImpl implements CampaignService { ...@@ -370,8 +376,8 @@ public class CampaignServiceImpl implements CampaignService {
ResultDTO resultDTO = new ResultDTO(); ResultDTO resultDTO = new ResultDTO();
List<TimeZoneDialModeDTO> lstTimeZone = dto.getLstTimeZone(); List<TimeZoneDialModeDTO> lstTimeZone = dto.getLstTimeZone();
List<TimeRangeDialModeDTO> lstTimeRange = dto.getLstTimeRange(); List<TimeRangeDialModeDTO> lstTimeRange = dto.getLstTimeRange();
Campaign campaignEntity = new Campaign(); Campaign campaignEntity = campaignRepository.findByCampaignId(dto.getCampaignId());
campaignEntity.setCampaignId(dto.getCampaignId()); campaignEntity.setCampaignName(dto.getCampaignName());
campaignEntity.setCampaignCode(dto.getCampaignCode()); campaignEntity.setCampaignCode(dto.getCampaignCode());
campaignEntity.setContent(dto.getContent()); campaignEntity.setContent(dto.getContent());
campaignEntity.setCustomerNumber(dto.getCustomerNumber()); campaignEntity.setCustomerNumber(dto.getCustomerNumber());
...@@ -487,6 +493,74 @@ public class CampaignServiceImpl implements CampaignService { ...@@ -487,6 +493,74 @@ public class CampaignServiceImpl implements CampaignService {
return campaignRepositoryCustom.getCampaignCustomerList(dto); return campaignRepositoryCustom.getCampaignCustomerList(dto);
} }
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO getCustomerList(CampaignRequestDTO dto) {
return campaignRepositoryCustom.getCustomerList(dto);
}
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO getCustomerChoosenList(CampaignRequestDTO dto) {
return campaignRepositoryCustom.getCustomerChoosenList(dto);
}
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO addCustomerListToCampaign(CampaignRequestDTO dto) {
ResultDTO resultDTO = new ResultDTO();
String[] lstCusListId = dto.getLstCustomerListId().split(",");
try {
for(String cusListId : lstCusListId) {
CampaignCustomerList entity = new CampaignCustomerList();
entity.setCampaignId(Long.parseLong(dto.getCampaignId()));
entity.setCompanySiteId(Long.parseLong(dto.getCompanySiteId()));
entity.setCustomerListId(Long.parseLong(cusListId));
campaignCustomerListRepository.save(entity);
}
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
} catch (Exception e) {
logger.error(e.getMessage(), e);
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
}
return resultDTO;
}
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO deleteCustomerListFromCampaign(CampaignRequestDTO dto) {
ResultDTO resultDTO = new ResultDTO();
String[] lstCusListId = dto.getLstCustomerListId().split(",");
long campaignId = Long.parseLong(dto.getCampaignId());
long companySiteId = Long.parseLong(dto.getCompanySiteId());
try {
for(String cusListId : lstCusListId) {
// Xoa danh sach khach hang khoi campaign_customerList
campaignCustomerListRepository.deleteCampaignCustomerListByCampaignIdAndCustomerListIdAndCompanySiteId(campaignId, Long.parseLong(cusListId), companySiteId);
// Thuc hien xoa cac khach hang chua lien lac tai bang campaign_customer
List<CampaignCustomer> listCampaignCustomer = campaignCustomerRepository.findCustomerNoContact(campaignId, companySiteId, Long.parseLong(cusListId));
for (CampaignCustomer entity : listCampaignCustomer) {
campaignCustomerRepository.delete(entity);
}
// Thuc hien update cac khach hang da lien lac
List<CampaignCustomer> list = campaignCustomerRepository.findCustomerContacted(campaignId, companySiteId, Long.parseLong(cusListId));
for (CampaignCustomer campaignCustomer: list) {
campaignCustomer.setInCampaignStatus((short) 0);
}
}
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
} catch (Exception e) {
logger.error(e.getMessage(), e);
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
}
return resultDTO;
}
// hungtt // hungtt
private Map<String, String> setMapData(Map<String, String> mapColumn, Locale locale) { private Map<String, String> setMapData(Map<String, String> mapColumn, Locale locale) {
mapColumn.put("CUSTOMER_ID", BundleUtils.getLangString("CUSTOMER_ID", locale)); mapColumn.put("CUSTOMER_ID", BundleUtils.getLangString("CUSTOMER_ID", locale));
......
...@@ -527,23 +527,27 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -527,23 +527,27 @@ public class CustomerServiceImpl implements CustomerService {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("SELECT"); sb.append("SELECT");
sb.append(" CUSTOMER_LIST_ID customerListId,"); sb.append(" a.CUSTOMER_LIST_ID customerListId,");
sb.append(" COMPANY_SITE_ID companySiteId,"); sb.append(" a.COMPANY_SITE_ID companySiteId,");
sb.append(" CUSTOMER_LIST_CODE customerListCode,"); sb.append(" a.CUSTOMER_LIST_CODE customerListCode,");
sb.append(" CUSTOMER_LIST_NAME customerListName,"); sb.append(" a.CUSTOMER_LIST_NAME customerListName,");
sb.append(" STATUS status,"); sb.append(" a.STATUS status,");
sb.append(" CREATE_BY createBy,"); sb.append(" a.CREATE_BY createBy,");
sb.append(" CREATE_AT createAt,"); sb.append(" a.CREATE_AT createAt,");
sb.append(" UPDATE_BY updateBy,"); sb.append(" a.UPDATE_BY updateBy,");
sb.append(" UPDATE_AT updateAt,"); sb.append(" a.UPDATE_AT updateAt,");
sb.append(" SOURCE source,"); sb.append(" a.SOURCE source,");
sb.append(" DEPT_CREATE deptCreate"); sb.append(" a.DEPT_CREATE deptCreate,");
sb.append(" FROM CUSTOMER_LIST"); sb.append(" b.count count");
sb.append(" FROM CUSTOMER_LIST a");
sb.append(" LEFT JOIN (SELECT COUNT(CAMPAIGN_ID) as count, CUSTOMER_LIST_ID");
sb.append(" FROM CAMPAIGN_CUSTOMERLIST");
sb.append(" GROUP BY CUSTOMER_LIST_ID) b");
sb.append(" ON a.CUSTOMER_LIST_ID = b.CUSTOMER_LIST_ID");
sb.append(" WHERE 1 = 1"); sb.append(" WHERE 1 = 1");
sb.append(" AND STATUS = 1"); sb.append(" AND a.STATUS = 1");
sb.append(" AND COMPANY_SITE_ID = :p_company_site_id"); sb.append(" AND a.COMPANY_SITE_ID = :p_company_site_id");
sb.append(" ORDER BY a.CREATE_AT DESC");
sb.append(" ORDER BY CREATE_AT DESC");
SQLQuery query = session.createSQLQuery(sb.toString()); SQLQuery query = session.createSQLQuery(sb.toString());
...@@ -560,6 +564,7 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -560,6 +564,7 @@ public class CustomerServiceImpl implements CustomerService {
query.addScalar("updateAt", new DateType()); query.addScalar("updateAt", new DateType());
query.addScalar("source", new StringType()); query.addScalar("source", new StringType());
query.addScalar("deptCreate", new StringType()); query.addScalar("deptCreate", new StringType());
query.addScalar("count", new StringType());
query.setResultTransformer(Transformers.aliasToBean(CustomerListDTO.class)); query.setResultTransformer(Transformers.aliasToBean(CustomerListDTO.class));
int count = 0; int count = 0;
......
...@@ -113,4 +113,15 @@ public class ScenarioAnswerServiceImpl implements ScenarioAnswerService { ...@@ -113,4 +113,15 @@ public class ScenarioAnswerServiceImpl implements ScenarioAnswerService {
} }
return resultDTO; return resultDTO;
} }
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public Integer countDuplicateScenarioCode(String code, Long scenarioQuestionId, Long scenarioAnswerId) {
try {
return scenarioAnswerRepository.countDuplicateScenarioCode(code, scenarioQuestionId, scenarioAnswerId);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
return null;
}
} }
...@@ -302,4 +302,15 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService { ...@@ -302,4 +302,15 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService {
return resultDTO; return resultDTO;
} }
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public Integer countDuplicateOrderIndex(ScenarioQuestionDTO questionDTO) {
try {
return questionRepositoryCustom.countDuplicateOrderIndex(questionDTO);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
return null;
}
} }
...@@ -117,6 +117,16 @@ public class ScenarioServiceImpl implements ScenarioService { ...@@ -117,6 +117,16 @@ public class ScenarioServiceImpl implements ScenarioService {
} }
@Override @Override
@Transactional(DataSourceQualify.CCMS_FULL)
public Integer countDuplicateScenarioCode(Long companySiteId, String code, Long scenarioId) {
try {
return scenarioRepository.countDuplicateScenarioCode(companySiteId, code, scenarioId);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
return null;
}
public ResultDTO saveContacQuestResult(ContactQuestResultDTO dto) { public ResultDTO saveContacQuestResult(ContactQuestResultDTO dto) {
ResultDTO resultDTO = new ResultDTO(); ResultDTO resultDTO = new ResultDTO();
......
package com.viettel.campaign.service.impl; package com.viettel.campaign.service.impl;
import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.model.ccms_full.UserActionLog;
import com.viettel.campaign.repository.ccms_full.UserActionLogRepository;
import com.viettel.campaign.service.UserActionLogService; import com.viettel.campaign.service.UserActionLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -11,4 +15,13 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -11,4 +15,13 @@ import org.springframework.transaction.annotation.Transactional;
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class UserActionLogServiceImpl implements UserActionLogService { public class UserActionLogServiceImpl implements UserActionLogService {
@Autowired
UserActionLogRepository userActionLogRepository;
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public void save(UserActionLog log) {
userActionLogRepository.save(log);
}
} }
...@@ -21,10 +21,17 @@ public class CustomerListDTO extends BaseDTO { ...@@ -21,10 +21,17 @@ public class CustomerListDTO extends BaseDTO {
private Date updateAt; private Date updateAt;
private String source; private String source;
private String deptCreate; private String deptCreate;
private String count;
private Long totalCusInList; private Long totalCusInList;
private Long totalCusInteract; private Long totalCusInteract;
private Long totalCusNotInteract; private Long totalCusNotInteract;
private Long totalCusList; private Long totalCusList;
private Long totalCusCampaign; private Long totalCusCampaign;
private Long totalCusCalled; private Long totalCusCalled;
private Long totalCusActive;
private Long totalCusLock;
private Long totalCusDnc;
private Long totalCusAddRemove;
private Long totalCusFilter;
private Integer totalRow;
} }
...@@ -46,5 +46,10 @@ public class CampaignRequestDTO extends BaseDTO { ...@@ -46,5 +46,10 @@ public class CampaignRequestDTO extends BaseDTO {
String roleUser; String roleUser;
String contactCustId; String contactCustId;
List<CustomerCustomDTO> customerCustomDTOList; List<CustomerCustomDTO> customerCustomDTOList;
String custListCode;
String custListName;
String createTimeTo;
String createTimeFr;
String lstCustomerListId;
} }
package com.viettel.campaign.web.rest; package com.viettel.campaign.web.rest;
import com.viettel.campaign.model.ccms_full.ReceiveCustLog;
import com.viettel.campaign.model.ccms_full.TimeRangeDialMode; import com.viettel.campaign.model.ccms_full.TimeRangeDialMode;
import com.viettel.campaign.model.ccms_full.TimeZoneDialMode; import com.viettel.campaign.model.ccms_full.TimeZoneDialMode;
import com.viettel.campaign.service.CampaignExecuteService; import com.viettel.campaign.service.CampaignExecuteService;
import com.viettel.campaign.service.CampaignService; import com.viettel.campaign.service.CampaignService;
import com.viettel.campaign.utils.BundleUtils;
import com.viettel.campaign.utils.Constants;
import com.viettel.campaign.utils.RedisUtil;
import com.viettel.campaign.web.dto.*; import com.viettel.campaign.web.dto.*;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO; import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import com.viettel.econtact.filter.UserSession;
import org.apache.commons.io.FilenameUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -16,6 +20,7 @@ import org.springframework.http.HttpStatus; ...@@ -16,6 +20,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -23,7 +28,8 @@ import java.io.ByteArrayOutputStream; ...@@ -23,7 +28,8 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Locale;
import java.util.Objects;
@RestController @RestController
@RequestMapping("/ipcc/campaign") @RequestMapping("/ipcc/campaign")
...@@ -263,9 +269,67 @@ public class CampaignController { ...@@ -263,9 +269,67 @@ public class CampaignController {
return new ResponseEntity<>(resultDTO, HttpStatus.OK); return new ResponseEntity<>(resultDTO, HttpStatus.OK);
} }
@PostMapping("/getCustomerList")
@ResponseBody
public ResponseEntity getCustomerList(@RequestBody CampaignRequestDTO campaignRequestDTO) {
ResultDTO resultDTO = campaignService.getCustomerList(campaignRequestDTO);
return new ResponseEntity<>(resultDTO, HttpStatus.OK);
}
@PostMapping("/getCustomerChoosenList")
@ResponseBody
public ResponseEntity getCustomerChoosenList(@RequestBody CampaignRequestDTO campaignRequestDTO) {
ResultDTO resultDTO = campaignService.getCustomerChoosenList(campaignRequestDTO);
return new ResponseEntity<>(resultDTO, HttpStatus.OK);
}
@PostMapping("/addCustomerListToCampaign")
@ResponseBody
public ResponseEntity addCustomerListToCampaign(@RequestBody CampaignRequestDTO campaignRequestDTO) {
ResultDTO resultDTO = campaignService.addCustomerListToCampaign(campaignRequestDTO);
return new ResponseEntity<>(resultDTO, HttpStatus.OK);
}
@PostMapping("/deleteCustomerListFromCampaign")
@ResponseBody
public ResponseEntity deleteCustomerListFromCampaign(@RequestBody CampaignRequestDTO campaignRequestDTO) {
ResultDTO resultDTO = campaignService.deleteCustomerListFromCampaign(campaignRequestDTO);
return new ResponseEntity<>(resultDTO, HttpStatus.OK);
}
@RequestMapping(value = "/renewCampaign", method = RequestMethod.PUT) @RequestMapping(value = "/renewCampaign", method = RequestMethod.PUT)
public ResponseEntity<ResultDTO> renewCampaign(@RequestBody CampaignDTO campaignDTO) { public ResponseEntity<ResultDTO> renewCampaign(@RequestBody CampaignDTO campaignDTO) {
ResultDTO result = campaignService.renewCampaign(campaignDTO); ResultDTO result = campaignService.renewCampaign(campaignDTO);
return new ResponseEntity<>(result, HttpStatus.OK); return new ResponseEntity<>(result, HttpStatus.OK);
} }
@RequestMapping(value = "/import-file", method = RequestMethod.POST)
public ResponseEntity<?> importFile(@RequestParam("file") MultipartFile file,
@RequestHeader("X-Auth-Token") String authToken) {
Locale locale = new Locale("vi", "VN");
try {
UserSession userSession = (UserSession) RedisUtil.getInstance().get(authToken);
if (file.isEmpty()) {
return new ResponseEntity<>(BundleUtils.getLangString("common.fileNotSelected"), HttpStatus.OK);
}
if (!Objects.equals(FilenameUtils.getExtension(file.getOriginalFilename()), Constants.FileType.xlsx)) {
return new ResponseEntity<>(BundleUtils.getLangString("common.fileInvalidFormat", locale), HttpStatus.OK);
}
//String path = saveUploadFile(file);
// List<CustomizeFields> dynamicHeaders = customerService.getDynamicHeader(userSession.getCompanySiteId());
// Map<String, Object> map = customerService.readAndValidateCustomer(path, dynamicHeaders, userSession, customerListId);
// File fileExport = (File) map.get("file");
// String message = (String) map.get("message");
// return ResponseEntity.ok()
// .header("Content-Type", Constants.MIME_TYPE.EXCEL_XLSX)
// .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=template_import_customer.xlsx")
// .header("Message", message)
// .body(Files.readAllBytes(fileExport.toPath()));
return new ResponseEntity<>(null, HttpStatus.OK);
} catch (Exception e) {
logger.error(e.getMessage(), e);
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
}
} }
...@@ -37,4 +37,10 @@ public class ScenarioAnswerController { ...@@ -37,4 +37,10 @@ public class ScenarioAnswerController {
ResultDTO resultDTO = scenarioAnswerService.delete(answerDTO); ResultDTO resultDTO = scenarioAnswerService.delete(answerDTO);
return new ResponseEntity<>(resultDTO, HttpStatus.OK); return new ResponseEntity<>(resultDTO, HttpStatus.OK);
} }
@RequestMapping(value = "/count-duplicate-code", method = RequestMethod.GET)
ResponseEntity<Integer> countDuplicateCode(@RequestParam String code, @RequestParam Long scenarioQuestionId, @RequestParam Long scenarioAnswerId) {
Integer count = scenarioAnswerService.countDuplicateScenarioCode(code, scenarioQuestionId, scenarioAnswerId);
return new ResponseEntity<>(count, HttpStatus.OK);
}
} }
...@@ -43,6 +43,12 @@ public class ScenarioController { ...@@ -43,6 +43,12 @@ public class ScenarioController {
return new ResponseEntity<>(resultDTO, HttpStatus.OK); return new ResponseEntity<>(resultDTO, HttpStatus.OK);
} }
@RequestMapping(value = "/count-duplicate-code", method = RequestMethod.GET)
ResponseEntity<Integer> countDuplicateCode(@RequestParam String code, @RequestParam Long scenarioId, @RequestParam Long companySiteId) {
Integer count = scenarioService.countDuplicateScenarioCode(companySiteId, code, scenarioId);
return new ResponseEntity<>(count, HttpStatus.OK);
}
@RequestMapping(value = "/saveContactQuestResult", method = RequestMethod.POST) @RequestMapping(value = "/saveContactQuestResult", method = RequestMethod.POST)
ResponseEntity<ResultDTO> saveContactQuestResult(@RequestBody ContactQuestResultDTO dto) { ResponseEntity<ResultDTO> saveContactQuestResult(@RequestBody ContactQuestResultDTO dto) {
ResultDTO resultDTO = scenarioService.saveContacQuestResult(dto); ResultDTO resultDTO = scenarioService.saveContacQuestResult(dto);
......
...@@ -56,4 +56,9 @@ public class ScenarioQuestionController { ...@@ -56,4 +56,9 @@ public class ScenarioQuestionController {
return new ResponseEntity<>(resultDTO, HttpStatus.OK); return new ResponseEntity<>(resultDTO, HttpStatus.OK);
} }
@RequestMapping(value = "/count-duplicate-order-index", method = RequestMethod.POST)
public Integer countDuplicateOrderIndex(@RequestBody ScenarioQuestionDTO questionDTO) {
return scenarioQuestionService.countDuplicateOrderIndex(questionDTO);
}
} }
...@@ -103,3 +103,6 @@ customer.notLessThan = not less than ...@@ -103,3 +103,6 @@ customer.notLessThan = not less than
customer.importCustomer = IMPORT CUSTOMER customer.importCustomer = IMPORT CUSTOMER
customer.notice = Attention: A record is valid when Full Name is not null and one of three fields Main phone, secondary phone or email is not null customer.notice = Attention: A record is valid when Full Name is not null and one of three fields Main phone, secondary phone or email is not null
customer.fileNotSelected=Please select a file customer.fileNotSelected=Please select a file
common.fileNotSelected=Please select a file
common.fileInvalidFormat=File invalid
...@@ -105,3 +105,6 @@ customer.notLessThan = không được nhỏ hơn ...@@ -105,3 +105,6 @@ customer.notLessThan = không được nhỏ hơn
customer.importCustomer = IMPORT KHÁCH HÀNG customer.importCustomer = IMPORT KHÁCH HÀNG
customer.notice = Chú ý: 1 bản ghi được coi là hợp lệ bắt buộc phải có thông tin Họ và Tên và 1 trong 3 thông tin liên lạc (số điện thoại chính, số điện thoại phụ hoặc email) customer.notice = Chú ý: 1 bản ghi được coi là hợp lệ bắt buộc phải có thông tin Họ và Tên và 1 trong 3 thông tin liên lạc (số điện thoại chính, số điện thoại phụ hoặc email)
customer.fileNotSelected=Bạn chưa chọn file customer.fileNotSelected=Bạn chưa chọn file
common.fileNotSelected=Bạn chưa chọn file
common.fileInvalidFormat=File không hợp lệ
with campaign_customer_id as (
select ccl.CUSTOMER_LIST_ID from campaign_customerlist ccl
where ccl.campaign_id = :p_campaign_id and ccl.company_site_id = :p_company_site_id
),
customer_table as (
select count(a.customer_id) totalCustomer, a.customer_list_id customerListId from customer_list_mapping a
left join customer b on a.customer_id = b.customer_id
where b.status = 1
group by a.customer_list_id
),
customer_active_table as (
select count(a.customer_id) customerActive, a.customer_list_id customerListId from customer_list_mapping a
left join customer b on a.customer_id = b.customer_id
where b.status = 1 and b.ipcc_status = 'active'
group by a.customer_list_id
),
customer_lock_table as (
select count(a.customer_id) customerLock, a.customer_list_id customerListId from customer_list_mapping a
left join customer b on a.customer_id = b.customer_id
where b.status = 1 and b.ipcc_status = 'locked'
group by a.customer_list_id
),
customer_dnc_table as (
select count(a.customer_id) customerDnc, a.customer_list_id customerListId from customer_list_mapping a
left join customer b on a.customer_id = b.customer_id
where b.status = 1 and b.call_allowed = 0
group by a.customer_list_id
),
customer_filter_table as (
select count(a.customer_id) customerFilter, a.customer_list_id customerListId from campaign_customer a
where a.campaign_id = :p_campaign_id
group by a.customer_list_id
),
data_temp as (
select a.customer_list_id customerListId,
a.customer_list_code customerListCode,
a.customer_list_name customerListName,
nvl(b.totalCustomer, 0) totalCusList,
nvl(c.customerActive, 0) totalCusActive,
nvl(d.customerLock, 0) totalCusLock,
nvl(e.customerDnc, 0) totalCusDnc,
nvl(null, 0) totalCusAddRemove,
nvl(f.customerFilter, 0) totalCusFilter
from customer_list a
left join customer_table b on a.customer_list_id = b.customerListId
left join customer_active_table c on a.customer_list_id = c.customerListId
left join customer_lock_table d on a.customer_list_id = d.customerListId
left join customer_dnc_table e on a.customer_list_id = e.customerListId
left join customer_filter_table f on a.customer_list_id = f.customerListId
where a.customer_list_id in (select CUSTOMER_LIST_ID from campaign_customer_id)
),
data as (
select a.*, rownum row_ from data_temp a
),
count_data as (
select count(*) totalRow from data_temp
)
select a.customerListId, a.customerListCode, a.customerListName, a.totalCusList, a.totalCusActive, a.totalCusLock, a.totalCusDnc, a.totalCusAddRemove, a.totalCusFilter, totalRow from data a, count_data
where row_ >= ((:p_page_number - 1) * :p_page_size + 1) and row_ < (:p_page_number * :p_page_size + 1)
with campaign_customer_id as (
select ccl.CUSTOMER_LIST_ID from campaign_customerlist ccl
where ccl.campaign_id = :p_campaign_id and ccl.company_site_id = :p_company_site_id
),
customer_table as (
select count(a.customer_id) totalCustomer, a.customer_list_id customerListId from customer_list_mapping a
left join customer b on a.customer_id = b.customer_id
where b.status = 1
group by a.customer_list_id
),
customer_active_table as (
select count(a.customer_id) customerActive, a.customer_list_id customerListId from customer_list_mapping a
left join customer b on a.customer_id = b.customer_id
where b.status = 1 and b.ipcc_status = 'active'
group by a.customer_list_id
),
customer_lock_table as (
select count(a.customer_id) customerLock, a.customer_list_id customerListId from customer_list_mapping a
left join customer b on a.customer_id = b.customer_id
where b.status = 1 and b.ipcc_status = 'locked'
group by a.customer_list_id
),
customer_dnc_table as (
select count(a.customer_id) customerDnc, a.customer_list_id customerListId from customer_list_mapping a
left join customer b on a.customer_id = b.customer_id
where b.status = 1 and b.call_allowed = 0
group by a.customer_list_id
),
data_temp as (
select a.customer_list_id customerListId,
a.customer_list_code customerListCode,
a.customer_list_name customerListName,
nvl(b.totalCustomer, 0) totalCusList,
nvl(c.customerActive, 0) totalCusActive,
nvl(d.customerLock, 0) totalCusLock,
nvl(e.customerDnc, 0) totalCusDnc,
a.create_at createAt,
a.company_site_id companySiteId,
a.status status
from customer_list a
left join customer_table b on a.customer_list_id = b.customerListId
left join customer_active_table c on a.customer_list_id = c.customerListId
left join customer_lock_table d on a.customer_list_id = d.customerListId
left join customer_dnc_table e on a.customer_list_id = e.customerListId
where a.status = 1
and (:p_cus_list_code is null or upper(a.customer_list_code) like '%'||:p_cus_list_code||'%')
and (:p_cus_list_name is null or upper(a.customer_list_name) like '%'||:p_cus_list_name||'%')
and (a.create_at <= to_date(:p_to_date, 'DD/MM/YYYY'))
and (a.create_at >= to_date(:p_from_date, 'DD/MM/YYYY'))
and (a.company_site_id = :p_company_site_id)
and (a.customer_list_id not in (select CUSTOMER_LIST_ID from campaign_customer_id))
),
data as (
select a.*, rownum row_ from data_temp a
),
count_data as (
select count(*) totalRow from data_temp
)
select a.customerListId, a.customerListCode, a.customerListName, a.totalCusList, a.totalCusActive, a.totalCusLock, a.totalCusDnc, totalRow from data a, count_data
where row_ >= ((:p_page_number - 1) * :p_page_size + 1) and row_ < (:p_page_number * :p_page_size + 1)
with customer_table as ( with campaign_customer_id as (
select ccl.CUSTOMER_LIST_ID from campaign_customerlist ccl
where ccl.campaign_id = :p_campaign_id and ccl.company_site_id = :p_company_site_id
),
customer_table as (
select count(a.customer_id) totalCustomer, a.customer_list_id customerListId from customer_list_mapping a select count(a.customer_id) totalCustomer, a.customer_list_id customerListId from customer_list_mapping a
left join customer b on a.customer_id = b.customer_id left join customer b on a.customer_id = b.customer_id
where b.status = 1 where b.status = 1
...@@ -18,7 +22,8 @@ customer_not_interactive_table as ( ...@@ -18,7 +22,8 @@ customer_not_interactive_table as (
select count(a.customer_id) cusNotInteractive, a.customer_list_id customerListId, a.campaign_id from campaign_customer a select count(a.customer_id) cusNotInteractive, a.customer_list_id customerListId, a.campaign_id from campaign_customer a
where a.status = 0 and a.campaign_id = :p_campaign_id and a.in_campaign_status = 1 where a.status = 0 and a.campaign_id = :p_campaign_id and a.in_campaign_status = 1
group by a.customer_list_id, a.campaign_id group by a.customer_list_id, a.campaign_id
) ),
data_temp as (
select a.customer_list_id customerListId, select a.customer_list_id customerListId,
a.customer_list_code customerListCode, a.customer_list_code customerListCode,
a.customer_list_name customerListName, a.customer_list_name customerListName,
...@@ -31,3 +36,13 @@ left join customer_table b on a.customer_list_id = b.customerListId ...@@ -31,3 +36,13 @@ left join customer_table b on a.customer_list_id = b.customerListId
left join campaign_customer_table c on a.customer_list_id = c.customerListId left join campaign_customer_table c on a.customer_list_id = c.customerListId
left join customer_interactive_table d on a.customer_list_id = d.customerListId left join customer_interactive_table d on a.customer_list_id = d.customerListId
left join customer_not_interactive_table e on a.customer_list_id = e.customerListId left join customer_not_interactive_table e on a.customer_list_id = e.customerListId
where a.customer_list_id in (select CUSTOMER_LIST_ID from campaign_customer_id)
),
data as (
select a.*, rownum row_ from data_temp a
),
count_data as (
select count(*) totalRow from data_temp
)
select a.customerListId, a.customerListCode, a.customerListName, a.totalCusList, a.totalCusCampaign, a.totalCusCalled, a.totalCusNotInteract, totalRow from data a, count_data
where row_ >= ((:p_page_number - 1) * :p_page_size + 1) and row_ < (:p_page_number * :p_page_size + 1)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment