Commit 2acfee33 authored by đinh thị đầm's avatar đinh thị đầm
parents 96aa09ed 95438a14
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="ExternalSystem" externalSystem="Maven" />
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
<facet type="web" name="Web">
<configuration>
<webroots />
<sourceRoots>
<root url="file://$MODULE_DIR$/src/main/java" />
<root url="file://$MODULE_DIR$/src/main/resources" />
</sourceRoots>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$USER_HOME$/Downloads/ojdbc6-11.2.0.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="Maven: org.modelmapper:modelmapper:2.3.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-actuator:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.10.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.10.0" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.19" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator-autoconfigure:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-actuator:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.7" level="project" />
<orderEntry type="library" name="Maven: io.micrometer:micrometer-core:1.0.7" level="project" />
<orderEntry type="library" name="Maven: org.hdrhistogram:HdrHistogram:2.1.10" level="project" />
<orderEntry type="library" name="Maven: org.latencyutils:LatencyUtils:2.0.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.0.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.0.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.8.13" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-batch:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:2.7.9" level="project" />
<orderEntry type="library" name="Maven: org.springframework.batch:spring-batch-core:4.0.1.RELEASE" level="project" />
<orderEntry type="library" name="Maven: javax.batch:javax.batch-api:1.0" level="project" />
<orderEntry type="library" name="Maven: org.codehaus.jettison:jettison:1.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework.batch:spring-batch-infrastructure:4.0.1.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-jpa:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: javax.transaction:javax.transaction-api:1.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-jpa:2.0.11.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.0.11.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-orm:5.0.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aspects:5.0.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.0.11.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.0.11.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.0.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.lettuce:lettuce-core:5.0.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.1.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.2" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.29.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.29.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.29.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.29.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.29.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.29.Final" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-security:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-config:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-web:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.0.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-validation:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.34" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.13.Final" level="project" />
<orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.7" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.7" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.34" level="project" />
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.34" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.0.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.0.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter-sleuth:2.0.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-starter:2.0.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-context:2.0.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-commons:2.0.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-rsa:1.0.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcpkix-jdk15on:1.60" level="project" />
<orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15on:1.60" level="project" />
<orderEntry type="library" name="Maven: org.springframework.cloud:spring-cloud-sleuth-core:2.0.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.aspectj:aspectjrt:1.8.13" level="project" />
<orderEntry type="library" name="Maven: io.zipkin.brave:brave:5.4.3" level="project" />
<orderEntry type="library" name="Maven: io.zipkin.zipkin2:zipkin:2.11.7" level="project" />
<orderEntry type="library" name="Maven: io.zipkin.reporter2:zipkin-reporter:2.7.10" level="project" />
<orderEntry type="library" name="Maven: io.zipkin.brave:brave-context-log4j2:5.4.3" level="project" />
<orderEntry type="library" name="Maven: io.zipkin.brave:brave-instrumentation-spring-web:5.4.3" level="project" />
<orderEntry type="library" name="Maven: io.zipkin.brave:brave-instrumentation-http:5.4.3" level="project" />
<orderEntry type="library" name="Maven: io.zipkin.brave:brave-instrumentation-spring-rabbit:5.4.3" level="project" />
<orderEntry type="library" name="Maven: io.zipkin.brave:brave-instrumentation-kafka-clients:5.4.3" level="project" />
<orderEntry type="library" name="Maven: io.zipkin.brave:brave-instrumentation-httpclient:5.4.3" level="project" />
<orderEntry type="library" name="Maven: io.zipkin.brave:brave-instrumentation-httpasyncclient:5.4.3" level="project" />
<orderEntry type="library" name="Maven: io.zipkin.brave:brave-instrumentation-spring-webmvc:5.4.3" level="project" />
<orderEntry type="library" name="Maven: io.zipkin.brave:brave-instrumentation-servlet:5.4.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web-services:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.0.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.ws:spring-ws-core:3.0.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.ws:spring-xml:3.0.4.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-websocket:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.0.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-websocket:5.0.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.kafka:kafka-streams:1.0.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.kafka:kafka-clients:1.0.2" level="project" />
<orderEntry type="library" name="Maven: org.lz4:lz4-java:1.4" level="project" />
<orderEntry type="library" name="Maven: org.xerial.snappy:snappy-java:1.1.4" level="project" />
<orderEntry type="library" name="Maven: org.apache.kafka:connect-json:1.0.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.kafka:connect-api:1.0.2" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Maven: org.rocksdb:rocksdbjni:5.7.3" level="project" />
<orderEntry type="library" name="Maven: org.springframework.kafka:spring-kafka:2.1.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.0.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.0.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:1.2.2.RELEASE" level="project" />
<orderEntry type="module-library">
<library name="Maven: com.oracle:ojdbc7:1.0">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/ojdbc7.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="Maven: org.hibernate:hibernate-entitymanager:5.1.0.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
<orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.common:hibernate-commons-annotations:5.0.1.Final" level="project" />
<orderEntry type="library" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2.Final" level="project" />
<orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" />
<orderEntry type="library" name="Maven: org.apache.geronimo.specs:geronimo-jta_1.1_spec:1.1.1" level="project" />
<orderEntry type="library" name="Maven: org.hibernate:hibernate-core:5.1.0.Final" level="project" />
<orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" />
<orderEntry type="library" name="Maven: org.jboss:jandex:2.0.0.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.4" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.springframework.boot:spring-boot-devtools:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.0.6.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.0.6.RELEASE" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: com.h2database:h2:1.4.197" level="project" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.16.22" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.0.6.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.0.6.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.0.6.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.9.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:2.15.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.7.11" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.7.11" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.0.10.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.0.10.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.0.10.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.5.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.batch:spring-batch-test:4.0.1.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.6" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.0.10.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.kafka:spring-kafka-test:2.1.10.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apache.kafka:kafka-clients:test:1.0.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apache.kafka:kafka_2.11:1.0.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.sf.jopt-simple:jopt-simple:5.0.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.yammer.metrics:metrics-core:2.2.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.scala-lang:scala-library:2.11.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.101tec:zkclient:0.10" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apache.zookeeper:zookeeper:3.4.10" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apache.kafka:kafka_2.11:test:1.0.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.restdocs:spring-restdocs-mockmvc:2.0.2.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: javax.servlet:javax.servlet-api:3.1.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.restdocs:spring-restdocs-core:2.0.2.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.security:spring-security-test:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:5.0.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.8" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.8" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.8" level="project" />
<orderEntry type="library" name="Maven: joda-time:joda-time:2.9.9" level="project" />
<orderEntry type="library" name="Maven: org.modelmapper:modelmapper:2.3.2" level="project" />
</component>
</module>
\ No newline at end of file
......@@ -189,6 +189,18 @@
<artifactId>modelmapper</artifactId>
<version>2.3.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
</dependencies>
<dependencyManagement>
......
......@@ -16,6 +16,8 @@ public class Campaign implements Serializable {
@Id
@NotNull
@GeneratedValue(generator = "campaign_seq")
@SequenceGenerator(name = "campaign_seq", sequenceName = "campaign_seq", allocationSize = 1)
@Basic(optional = false)
@Column(name = "CAMPAIGN_ID")
private Long campaignId;
......
package com.viettel.campaign.model;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;
@Entity
@Table(name = "CUSTOMER_CONTACT")
@Getter
@Setter
public class CustomerContact {
@Id
@Basic(optional = false)
@NotNull
@Column(name = "CONTACT_ID")
private Long contactId;
@Column(name = "CUSTOMER_ID")
private Long customerId;
@Column(name = "CONTACT_TYPE")
private Short contactType;
@Column(name = "CONTACT")
private String contact;
@Column(name = "IS_DIRECT_LINE")
private Short isDirectLine;
@Column(name = "STATUS")
private Short status;
@Column(name = "CREATE_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date createDate;
@Column(name = "UPDATE_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date updateDate;
@Column(name = "CREATE_BY")
private String createBy;
@Column(name = "UPDATE_BY")
private String updateBy;
@Column(name = "START_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date startDate;
@Column(name = "END_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date endDate;
}
......@@ -18,6 +18,8 @@ import java.util.Date;
public class TimeRangeDialMode implements Serializable {
@Id
@NotNull
@GeneratedValue(generator = "TIME_RANGE_DIAL_MODE_SEQ")
@SequenceGenerator(name = "TIME_RANGE_DIAL_MODE_SEQ", sequenceName = "TIME_RANGE_DIAL_MODE_SEQ", allocationSize = 1)
@Basic(optional = false)
@Column(name = "TIME_RANGE_DIAL_MODE_ID")
private Long timeRangeDialModeId;
......
......@@ -19,9 +19,11 @@ import java.io.Serializable;
public class TimeZoneDialMode implements Serializable{
@Id
@NotNull
@GeneratedValue(generator = "TIME_ZONE_DIAL_MODE_SEQ")
@SequenceGenerator(name = "TIME_ZONE_DIAL_MODE_SEQ", sequenceName = "TIME_ZONE_DIAL_MODE_SEQ", allocationSize = 1)
@Basic(optional = false)
@Column(name = "TIME_ZONE_DIAL_MODE_ID")
private Long timeRangeDialModeId;
private Long timeZoneDialModeId;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
......
......@@ -25,3 +25,4 @@ public interface ApParamRepository extends JpaRepository<ApParam, Long>, ApParam
List<ApParam> findAllParam();
}
package com.viettel.campaign.repository;
import com.viettel.campaign.model.ApParam;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface ApParamRepositoryCustom {
......
package com.viettel.campaign.repository;
import com.viettel.campaign.web.dto.ApParamDTO;
import com.viettel.campaign.web.dto.ContactCustResultDTO;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CampaignExecuteRepository {
//<editor-fold: hungtt>
List<ApParamDTO> getComboBoxStatus(String companySiteId, String completeType);
List<ApParamDTO> getComboCampaignType(String companySiteId);
ResultDTO getInteractiveResult(CampaignRequestDTO dto);
//</editor-fold: hungtt>
}
package com.viettel.campaign.repository;
import com.viettel.campaign.model.Campaign;
import com.viettel.campaign.web.dto.CampaignDTO;
import com.viettel.campaign.web.dto.ResultDTO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
......@@ -16,4 +18,6 @@ public interface CampaignRepository extends JpaRepository<Campaign, Long>, Campa
" AND cc.recallTime <= sysdate " +
" AND cc.agentId = :pAgentId")
Long countRecallCustomer(@Param("pCompanySiteId") Long pCompanySiteId, @Param("pAgentId") Long pAgentId);
Campaign findCampaignByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
}
......@@ -11,4 +11,6 @@ public interface CampaignRepositoryCustom {
ResultDTO search(CampaignRequestDTO requestDto);
ResultDTO findByCampaignCode(CampaignRequestDTO requestDTO);
String getMaxCampaignIndex();
}
package com.viettel.campaign.repository;
import com.viettel.campaign.model.CustomerContact;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface CustomerContactRepository extends JpaRepository<CustomerContact, Long> {
List<CustomerContact> findByCustomerIdAndAndContactTypeAndContact(Long customerId, Short contactType, String contact);
}
......@@ -6,9 +6,27 @@ import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface CustomerListMappingRepository extends JpaRepository<CustomerListMapping, Long> {
// ----------- customer ------------ //
@Modifying
@Query("delete from CustomerListMapping c where c.customerId=:p_customer_id and c.customerListId=:p_customer_list_id and c.companySiteId=:p_company_site_id")
int deleteMappingByCustomerId(@Param("p_customer_id") Long p_customer_id, @Param("p_customer_list_id") Long p_customer_list_id, @Param("p_company_site_id") Long p_company_site_id);
@Modifying
@Query("delete from CustomerListMapping c where c.customerId in (:p_ids) and c.customerListId =:p_customer_list_id and c.companySiteId=:p_company_site_id")
int deleteMappingByCustomerIds(@Param("p_ids") List<Long> p_ids, @Param("p_customer_list_id") Long p_customer_list_id, @Param("p_company_site_id") Long p_company_site_id);
// ----------- customer list --------------- //
@Modifying
@Query("delete from CustomerListMapping c where c.customerListId=:p_customer_list_id and c.companySiteId=:p_company_site_id")
int deleteMappingByCustomerListId(@Param("p_customer_list_id") Long p_customer_list_id, @Param("p_company_site_id") Long p_company_site_id);
@Modifying
@Query("delete from CustomerListMapping c where c.customerListId=:customerListId")
int deleteMappingByCustomerListId(@Param("customerListId") Long customerListId);
@Query("delete from CustomerListMapping c where c.customerListId in (:p_ids) and c.companySiteId=:p_company_site_id")
int deleteMappingByCustomerListIds(@Param("p_ids") List<Long> p_ids, @Param("p_company_site_id") Long p_company_site_id);
}
......@@ -10,11 +10,15 @@ import java.util.List;
public interface CustomerListRepository extends JpaRepository<CustomerList, Long> {
CustomerList findCustomerListByCustomerListId(long customerListId);
CustomerList findByCustomerListIdAndCompanySiteId(long customerListId, long companySiteId);
CustomerList findByCustomerListCode(String customerListCode);
@Modifying
@Query("delete from CustomerList c where c.customerListId in (:ids)")
int deleteCustomerListIds(@Param("ids") List<Long> ids);
@Query("update CustomerList c set c.status = 0 where c.customerListId=:p_customer_list_id and c.companySiteId=:p_company_site_id")
int deleteCustomerList(@Param("p_customer_list_id") Long p_customer_list_id, @Param("p_company_site_id") Long p_company_site_id);
@Modifying
@Query("update CustomerList c set c.status = 0 where c.customerListId in (:p_ids) and c.companySiteId=:p_company_site_id")
int deleteCustomerListIds(@Param("p_ids") List<Long> p_ids, @Param("p_company_site_id") Long p_company_site_id);
}
......@@ -16,6 +16,8 @@ public interface CustomerRepository extends JpaRepository<Customer, Long> {
Page<Customer> findAll(Pageable pageable);
List<Customer> findByCustomerId(Long customerId);
@Query("FROM Customer WHERE name = ?1")
List<Customer> findByName(String firstName, Pageable pageable);
......
package com.viettel.campaign.repository.impl;
import com.viettel.campaign.model.ApParam;
import com.viettel.campaign.repository.ApParamRepositoryCustom;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.List;
@Repository
@Transactional
public class AppParamRepositoryImpl implements ApParamRepositoryCustom {
@Autowired
EntityManager entityManager;
public AppParamRepositoryImpl() {
}
}
package com.viettel.campaign.repository.impl;
import com.viettel.campaign.repository.CampaignExecuteRepository;
import com.viettel.campaign.utils.Constants;
import com.viettel.campaign.utils.DataUtil;
import com.viettel.campaign.utils.HibernateUtil;
import com.viettel.campaign.utils.SQLBuilder;
import com.viettel.campaign.web.dto.ApParamDTO;
import com.viettel.campaign.web.dto.ContactCustResultDTO;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.transform.Transformers;
import org.hibernate.type.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Repository;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Repository
public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
private static final Logger logger = LoggerFactory.getLogger(CampaignRepositoryImpl.class);
@Autowired
NamedParameterJdbcTemplate namedParameterJdbcTemplate;
@Autowired
EntityManager entityManager;
@Override
public List<ApParamDTO> getComboBoxStatus(String companySiteId, String completeType) {
List<ApParamDTO> list = new ArrayList<>();
Map<String, String> params = new HashMap<>();
String sql = SQLBuilder.getSqlQueryById(Constants.SQL_MODULES.MODULE_EXECUTE, "get-combo-connect-status");
try {
params.put("p_company_site_id", companySiteId);
params.put("p_complete_type", completeType);
list = namedParameterJdbcTemplate.query(sql, params, BeanPropertyRowMapper.newInstance(ApParamDTO.class));
// list = namedParameterJdbcTemplate.getJdbcTemplate().query(sql, (PreparedStatementSetter) params, BeanPropertyRowMapper.newInstance(ComboBoxDTO.class));
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return list;
}
@Override
public List<ApParamDTO> getComboCampaignType(String companySiteId) {
List<ApParamDTO> list = new ArrayList<>();
Map<String, String> params = new HashMap<>();
String sql = SQLBuilder.getSqlQueryById(Constants.SQL_MODULES.MODULE_EXECUTE, "get-combo-campaign-type");
try {
params.put("p_company_site_id", companySiteId);
list = namedParameterJdbcTemplate.query(sql, params, BeanPropertyRowMapper.newInstance(ApParamDTO.class));
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return list;
}
@Override
public ResultDTO getInteractiveResult(CampaignRequestDTO dto) {
ResultDTO resultDTO = new ResultDTO();
List<ContactCustResultDTO> list = new ArrayList<>();
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
StringBuilder sqlBuilder = new StringBuilder();
try {
String sql = SQLBuilder.getSqlQueryById(Constants.SQL_MODULES.MODULE_EXECUTE, "get-execute-interactive");
sqlBuilder.append(sql);
if (!DataUtil.isNullOrEmpty(dto.getCampaignName().trim())) {
sqlBuilder.append(" and upper(campaignName) like upper(:p_campaign_name)");
}
if (!DataUtil.isNullOrEmpty(dto.getAgentId().trim())) {
sqlBuilder.append(" and upper(userName) like upper(:p_user_name)");
}
SQLQuery query = session.createSQLQuery(sqlBuilder.toString());
query.setParameterList("p_list_campaign_id", dto.getCampaignId().trim().split(","));
query.setParameter("p_customer_id", dto.getCustomerId().trim());
query.setParameter("p_date_from", dto.getFromDate().trim());
query.setParameter("p_date_to", dto.getToDate().trim());
query.setParameterList("p_list_contact_status", dto.getContactStatus().trim().split(","));
query.setParameterList("p_list_survey_status", dto.getSurveyStatus().trim().split(","));
query.setParameterList("p_list_record_status", dto.getRecordStatus().trim().split(","));
query.setParameter("p_phone_number", dto.getPhoneNumber().trim());
query.setParameter("p_call_time_from", dto.getCallTimeFrom().trim());
query.setParameter("p_call_time_to", dto.getCallTimeTo().trim());
if (!DataUtil.isNullOrEmpty(dto.getCampaignName().trim())) {
query.setParameter("p_campaign_name", dto.getCampaignName().trim());
}
if (!DataUtil.isNullOrEmpty(dto.getAgentId().trim())) {
query.setParameter("p_user_name", dto.getAgentId().trim());
}
query.addScalar("campaignCode", new StringType());
query.addScalar("campaignName", new StringType());
query.addScalar("userName", new StringType());
query.addScalar("phoneNumber", new LongType());
query.addScalar("customerName", new StringType());
query.addScalar("createTime", new DateType());
query.addScalar("contactStatus", new StringType());
query.addScalar("surveyStatus", new StringType());
query.addScalar("status", new ShortType());
query.addScalar("recordStatus", new ShortType());
query.setResultTransformer(Transformers.aliasToBean(ContactCustResultDTO.class));
int count = 0;
list = query.list();
if (list.size() > 0) {
count = list.size();
}
Pageable pageable = SQLBuilder.buildPageable(dto);
if (pageable != null) {
query.setFirstResult(pageable.getPageNumber() * pageable.getPageSize());
query.setMaxResults(pageable.getPageSize());
}
List<ContactCustResultDTO> data = query.list();
for (ContactCustResultDTO contactCustResultDTO: data) {
if (!"AGENT".equals(dto.getRoleUser())) {
contactCustResultDTO.setEnableEdit(true);
} else {
if (contactCustResultDTO.getRecordStatus() == 2) {
contactCustResultDTO.setEnableEdit(true);
} else if (contactCustResultDTO.getRecordStatus() == 1){
/**
* Hoi chi linh xac dinh thoi gian 24h ke tu khi da luu kieu gi??????
*/
} else {
contactCustResultDTO.setEnableEdit(false);
}
}
}
Page<ContactCustResultDTO> dataPage = new PageImpl<>(data, pageable, count);
resultDTO.setData(dataPage);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
} catch (Exception e) {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
logger.error(e.getMessage(), e);
} finally {
session.close();
}
return resultDTO;
}
}
......@@ -21,12 +21,14 @@ import org.springframework.stereotype.Repository;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Repository
public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
private static final Logger logger = LogManager.getLogger(CampaignRepositoryImpl.class);
@Autowired
......@@ -37,18 +39,17 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
ResultDTO result = new ResultDTO();
List<CampaignDTO> lst = new ArrayList<>();
StringBuilder expression = new StringBuilder()
.append(" SELECT C.CAMPAIGN_CODE, C.CAMPAIGN_NAME, C.CONTENT, C.START_TIME, C.END_TIME, C.STATUS ")
.append(" SELECT C.CAMPAIGN_CODE, C.CAMPAIGN_NAME, C.CONTENT, C.START_TIME, C.END_TIME, C.STATUS, CA.STATUS AS AGENT_STATUS ")
.append(" FROM CAMPAIGN C INNER JOIN CAMPAIGN_AGENT CA ON C.CAMPAIGN_ID = CA.CAMPAIGN_ID ")
.append(" WHERE 1 = 1 ")
.append(" WHERE 1 = 1 ");
//.append(" AND CA.AGENT_ID = :pAgentId ")
.append(" AND C.STATUS IN (2,3) ");
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getCampaignCode())) {
expression.append(" AND C.CAMPAIGN_ID IN (:pCampaingId) ");
expression.append(" AND C.CAMPAIGN_CODE IN (:pCampaignCode) ");
}
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getCampaignName())) {
expression.append(" AND UPPER(C.CAMPAIGN_NAME) LIKE CONCAT('%',:pCampaignName,'%') ");
expression.append(" AND UPPER(C.CAMPAIGN_NAME) LIKE :pCampaignName ");
}
if (!DataUtil.isNullOrZero(campaignRequestDto.getStatus().longValue())) {
......@@ -88,40 +89,45 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getCampaignCode())) {
String[] lstCode = campaignRequestDto.getCampaignCode().split(",");
query.setParameter(":pCampaingId", lstCode);
query.setParameter("pCampaignCode", lstCode);
}
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getCampaignName())) {
query.setParameter(":pCampaignName", campaignRequestDto.getCampaignName().toUpperCase());
query.setParameter("pCampaignName", "%" +
campaignRequestDto.getCampaignName().toUpperCase()
.replace("\\", "\\\\")
.replaceAll("%", "\\\\%")
.replaceAll("_", "\\\\_")
+ "%");
}
if (!DataUtil.isNullOrZero(campaignRequestDto.getStatus().longValue())) {
if (campaignRequestDto.getStatus() != 0)
query.setParameter(":pStatus", campaignRequestDto.getStatus());
query.setParameter("pStatus", campaignRequestDto.getStatus());
}
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getFromDateFr())) {
query.setParameter(":pStartTimeFr", campaignRequestDto.getFromDateFr());
query.setParameter("pStartTimeFr", campaignRequestDto.getFromDateFr());
}
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getFromDateTo())) {
query.setParameter(":pStartTimeTo", campaignRequestDto.getFromDateTo());
query.setParameter("pStartTimeTo", campaignRequestDto.getFromDateTo());
}
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getToDateFr())) {
query.setParameter(":pEndTimeFr", campaignRequestDto.getToDateFr());
query.setParameter("pEndTimeFr", campaignRequestDto.getToDateFr());
}
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getToDateTo())) {
query.setParameter(":pEndTimeTo", campaignRequestDto.getToDateTo());
query.setParameter("pEndTimeTo", campaignRequestDto.getToDateTo());
}
if (!DataUtil.isNullOrZero(campaignRequestDto.getNumOfCusFr())) {
query.setParameter(":pCustNumFr", campaignRequestDto.getNumOfCusFr());
query.setParameter("pCustNumFr", campaignRequestDto.getNumOfCusFr());
}
if (!DataUtil.isNullOrZero(campaignRequestDto.getNumOfCusTo())) {
query.setParameter(":pCustNumTo", campaignRequestDto.getNumOfCusTo());
query.setParameter("pCustNumTo", campaignRequestDto.getNumOfCusTo());
}
result.setTotalRow(query.getResultList().size());
......@@ -144,7 +150,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
item.setContent((String) obj[2]);
item.setStartTime((Date) obj[3]);
item.setEndTime((Date) obj[4]);
item.setStatus(((Short) obj[5]));
item.setStatus(((BigDecimal) obj[5]).shortValueExact());
item.setAgentStatus(((BigDecimal) obj[6]).shortValueExact());
lst.add(item);
}
......@@ -368,9 +375,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
result.setData(dataPage);
result.setErrorCode(Constants.ApiErrorCode.SUCCESS);
result.setDescription(Constants.ApiErrorDesc.SUCCESS);
session.close();
return result;
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
result.setErrorCode(Constants.ApiErrorCode.ERROR);
......@@ -381,4 +386,25 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
return result;
}
@Override
public String getMaxCampaignIndex() {
logger.info("Start search max campaign code index::");
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
try {
StringBuilder sqlStr = new StringBuilder();
sqlStr.append(SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_MNG, "get-max-campaign-code-index"));
SQLQuery query = session.createSQLQuery(sqlStr.toString());
List<String> list = query.list();
if(list.size() > 0) {
return list.get(0);
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
return null;
}
}
......@@ -17,4 +17,6 @@ public interface ApParamService {
ResultDTO findParamByParType(String parType);
List<ApParam>findAllParam();
}
package com.viettel.campaign.service;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import org.springframework.stereotype.Service;
@Service
public interface CampaignExecuteService {
//<editor-fold: hungtt>
ResultDTO getComboBoxStatus(String companySiteId, String completeType);
ResultDTO getComboCampaignType(String companySiteId);
ResultDTO searchInteractiveResult(CampaignRequestDTO dto);
//</editor-fold>
}
......@@ -16,4 +16,8 @@ public interface CampaignService {
ResultDTO addNewCampaign(CampaignDTO campaignDTO);
Map countRecallCustomer(Long companySiteId, Long agentId);
ResultDTO findCampaignById(Long campaignId);
ResultDTO changeCampaignStatus(CampaignDTO dto);
}
......@@ -3,22 +3,24 @@ package com.viettel.campaign.service;
import com.viettel.campaign.web.dto.CustomerDTO;
import com.viettel.campaign.web.dto.CustomerListDTO;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO;
import com.viettel.campaign.web.dto.request_dto.CustomerRequestDTO;
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface CustomerService {
Map listAllCustomer(int page, int pageSize, String sort);
ResultDTO listAllCustomer(int page, int pageSize, String sort, long customerListId, long companySiteId);
ResultDTO getCustomerId(Long customerId);
Map listCustByName(int page, int pageSize, String sort, String name);
ResultDTO createCustomer(CustomerDTO customerDTO);
ResultDTO deleteCustomer(CustomerDTO customerDTO);
ResultDTO deleteCustomer(CustomerRequestDTO customerRequestDTO);
ResultDTO deleteIds(List<Long> ids);
ResultDTO deleteIds(CustomerRequestDTO customerRequestDTO);
// ------------ customer list ------------ //
......@@ -30,7 +32,11 @@ public interface CustomerService {
ResultDTO deleteCustomerList(CustomerListDTO customerListDTO);
ResultDTO deleteCustomerListIds(List<Long> ids);
ResultDTO deleteCustomerListIds(CustomerRequestDTO customerRequestDTO);
ResultDTO searchCustomerList(SearchCustomerRequestDTO searchCustomerRequestDTO);
// ------------ customer contact ------------ //
ResultDTO searchCustomerList(String customerListCode, String customerListName, Date dateFrom, Date dateTo, int page, int pageSize, String sort);
ResultDTO getCustomerContact(Long customerId, Short contactType, String contact);
}
......@@ -25,8 +25,6 @@ public class ApParamServiceImpl implements ApParamService {
private static final Logger logger = LogManager.getLogger(ApParamServiceImpl.class);
@Override
public Iterable<ApParam> getAllParams(int page, int pageSize, String sort) {
return apParamRepository.findAll(PageRequest.of(page, pageSize, Sort.by(sort)));
......
package com.viettel.campaign.service;
package com.viettel.campaign.service.impl;
import com.viettel.campaign.service.CampaignCompleteCodeService;
import com.viettel.campaign.utils.Constants;
import com.viettel.campaign.web.dto.CampaignCompleteCodeDTO;
import com.viettel.campaign.web.dto.ResultDTO;
......
package com.viettel.campaign.service.impl;
import com.viettel.campaign.repository.CampaignExecuteRepository;
import com.viettel.campaign.service.CampaignExecuteService;
import com.viettel.campaign.utils.Constants;
import com.viettel.campaign.web.dto.ApParamDTO;
import com.viettel.campaign.web.dto.ContactCustResultDTO;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class CampaignExecuteServiceImp implements CampaignExecuteService {
private static final Logger logger = LoggerFactory.getLogger(CampaignExecuteServiceImp.class);
@Autowired
CampaignExecuteRepository campaignExecuteRepository;
//<editor-fold: hungtt>
@Override
public ResultDTO getComboBoxStatus(String companySiteId, String completeType) {
ResultDTO resultDTO = new ResultDTO();
try {
List<ApParamDTO> lst = campaignExecuteRepository.getComboBoxStatus(companySiteId, completeType);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
resultDTO.setData(lst);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return resultDTO;
}
@Override
public ResultDTO getComboCampaignType(String companySiteId) {
ResultDTO resultDTO = new ResultDTO();
try {
List<ApParamDTO> lst = campaignExecuteRepository.getComboCampaignType(companySiteId);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
resultDTO.setData(lst);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return resultDTO;
}
@Override
public ResultDTO searchInteractiveResult(CampaignRequestDTO dto) {
ResultDTO resultDTO = new ResultDTO();
try {
resultDTO = campaignExecuteRepository.getInteractiveResult(dto);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return resultDTO;
}
//</editor-fold: hungtt>
}
package com.viettel.campaign.service.impl;
import com.viettel.campaign.model.Campaign;
import com.viettel.campaign.model.TimeRangeDialMode;
import com.viettel.campaign.model.TimeZoneDialMode;
import com.viettel.campaign.repository.CampaignRepository;
import com.viettel.campaign.repository.TimeRangeDialModeRepository;
import com.viettel.campaign.repository.TimeZoneDialModeRepository;
import com.viettel.campaign.repository.impl.CampaignRepositoryImpl;
import com.viettel.campaign.service.CampaignService;
import com.viettel.campaign.utils.Constants;
import com.viettel.campaign.web.dto.CampaignDTO;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.TimeRangeDialModeDTO;
import com.viettel.campaign.web.dto.TimeZoneDialModeDTO;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -18,8 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
@Service
@Transactional(rollbackFor = Exception.class)
......@@ -32,6 +35,9 @@ public class CampaignServiceImpl implements CampaignService {
@Autowired
TimeZoneDialModeRepository timeZoneDialModeRepository;
@Autowired
TimeRangeDialModeRepository timeRangeDialModeRepository;
@Autowired
ModelMapper modelMapper;
......@@ -52,29 +58,45 @@ public class CampaignServiceImpl implements CampaignService {
@Override
public ResultDTO addNewCampaign(CampaignDTO campaignDTO) {
logger.info("=== Start add new campaign ");
ResultDTO resultDTO = new ResultDTO();
Campaign campaign = modelMapper.map(campaignDTO, Campaign.class);
TimeZoneDialMode timeZoneDialMode = new TimeZoneDialMode();
Long campaignId;
List<TimeZoneDialModeDTO> timeZoneDialModes = new ArrayList<>();
List<TimeRangeDialModeDTO> timeRangeDialModes = new ArrayList<>();
List<TimeRangeDialMode> lstTimeRangeModeToInsert = new ArrayList<>();
List<TimeZoneDialMode> lstTimeZoneModeToInser = new ArrayList<>();
try {
campaign = campaignRepository.save(campaign);
String campaignCode = generateCampaignCode(campaignDTO.getCampaignType(), campaignDTO.getChanel());
campaign.setCampaignCode(campaignCode);
Campaign campaignResult = campaignRepository.save(campaign);
campaignId = campaign.getCampaignId();
//insert sub tables
if(campaignDTO.getCurrentTimeMode().equals(1)){
timeZoneDialMode.setCompanySiteId(campaignDTO.getCompanySiteId());
timeZoneDialMode.setCampaignId(campaign.getCampaignId());
// timeZoneDialMode.setHour(campaignDTO.getT);
timeZoneDialModeRepository.save(timeZoneDialMode);
if(campaignDTO.getLstTimeRange().size() > 0) {
timeRangeDialModes = campaignDTO.getLstTimeRange();
timeRangeDialModes.forEach(item -> {
item.setCampaignId(campaignId);
TimeRangeDialMode timeRangeDialMode = modelMapper.map(item, TimeRangeDialMode.class);
lstTimeRangeModeToInsert.add(timeRangeDialMode);
});
timeRangeDialModeRepository.saveAll(lstTimeRangeModeToInsert);
}
if(campaignDTO.getCurrentTimeMode().equals(2)) {
if(campaignDTO.getLstTimeZone().size() > 0) {
timeZoneDialModes = campaignDTO.getLstTimeZone();
timeZoneDialModes.forEach(item -> {
item.setCampaignId(campaignId);
TimeZoneDialMode timeZoneDialMode = modelMapper.map(item, TimeZoneDialMode.class);
lstTimeZoneModeToInser.add(timeZoneDialMode);
});
timeZoneDialModeRepository.saveAll(lstTimeZoneModeToInser);
}
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setErrorCode(Constants.ApiErrorDesc.SUCCESS);
resultDTO.setData(campaign);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
resultDTO.setData(campaignResult);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setErrorCode(Constants.ApiErrorDesc.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
}
return resultDTO;
}
......@@ -97,4 +119,59 @@ public class CampaignServiceImpl implements CampaignService {
return result;
}
@Override
public ResultDTO findCampaignById(Long campaignId) {
logger.info("=== Start find campaign by id: " + campaignId);
ResultDTO resultDTO = new ResultDTO();
try {
Campaign campaign = campaignRepository.findById(campaignId).orElse(null);
if (campaign != null) {
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
resultDTO.setData(campaign);
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
}
return resultDTO;
}
@Override
public ResultDTO changeCampaignStatus(CampaignDTO dto) {
ResultDTO result = new ResultDTO();
try {
Campaign entity = campaignRepository.findCampaignByCampaignIdAndCompanySiteId(dto.getCampaignId(), dto.getCompanySiteId());
if (entity != null) {
entity.setStatus(dto.getStatus().longValue());
entity.setUpdateTime(new Date());
entity.setUpdateBy(dto.getUpdateBy());
campaignRepository.save(entity);
result.setData(entity);
result.setDescription(Constants.ApiErrorDesc.SUCCESS);
result.setErrorCode(Constants.ApiErrorCode.SUCCESS);
} else {
result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription("Entity not found");
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription(e.getMessage());
}
return result;
}
private String generateCampaignCode(String campaignType, Short chanel) {
int year = Calendar.getInstance().get(Calendar.YEAR);
String maxIndexStr = campaignRepository.getMaxCampaignIndex();
if(maxIndexStr != null) {
Long maxIndex = Long.valueOf(maxIndexStr) + 1;
String result = campaignType + "_" + String.valueOf(chanel) + "_" + String.valueOf(year) + "_" + maxIndex.toString();
return result;
}
return null;
}
}
package com.viettel.campaign.service.impl;
import com.viettel.campaign.mapper.CustomerListMapper;
import com.viettel.campaign.model.CustomerContact;
import com.viettel.campaign.model.CustomerList;
import com.viettel.campaign.repository.CampaignCustomerListRepository;
import com.viettel.campaign.repository.CustomerListMappingRepository;
import com.viettel.campaign.repository.CustomerListRepository;
import com.viettel.campaign.repository.*;
import com.viettel.campaign.service.CustomerService;
import com.viettel.campaign.utils.Constants;
import com.viettel.campaign.utils.HibernateUtil;
import com.viettel.campaign.utils.SQLBuilder;
import com.viettel.campaign.web.dto.CustomerCustomDTO;
import com.viettel.campaign.web.dto.CustomerDTO;
import com.viettel.campaign.web.dto.CustomerListDTO;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.mapper.CustomerMapper;
import com.viettel.campaign.model.Customer;
import com.viettel.campaign.repository.CustomerRepository;
import com.viettel.campaign.utils.DataUtil;
import com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO;
import com.viettel.campaign.web.dto.request_dto.CustomerRequestDTO;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.transform.Transformers;
import org.hibernate.type.DateType;
import org.hibernate.type.LongType;
import org.hibernate.type.ShortType;
import org.hibernate.type.StringType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.*;
import org.springframework.stereotype.Service;
......@@ -41,6 +46,9 @@ public class CustomerServiceImpl implements CustomerService {
@Autowired
CustomerListRepository customerListRepository;
@Autowired
CustomerContactRepository customerContactRepository;
@Autowired
CampaignCustomerListRepository campaignCustomerListRepository;
......@@ -48,17 +56,94 @@ public class CustomerServiceImpl implements CustomerService {
CustomerListMappingRepository customerListMappingRepository;
@Override
public Map listAllCustomer(int page, int pageSize, String sort) {
Map result = new HashMap();
List<Customer> lst = new ArrayList<>();
public ResultDTO listAllCustomer(int page, int pageSize, String sort, long customerListId, long companySiteId) {
// Map result = new HashMap();
// List<Customer> lst = new ArrayList<>();
//
// Pageable pageable = PageRequest.of(page, pageSize, Sort.by(sort));
// Page<Customer> pc = customerRepository.findAll(pageable);
//
// result.put("totalItem", pc.getTotalElements());
// result.put("customers", pc.iterator());
//
// return result;
ResultDTO resultDTO = new ResultDTO();
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
if (DataUtil.isNullOrZero(companySiteId)) {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
return resultDTO;
}
try {
StringBuilder sqlStrBuilder = new StringBuilder();
sqlStrBuilder.append(SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_MNG, "campaign-customer-detail-by-params"));
SQLQuery query = session.createSQLQuery(sqlStrBuilder.toString());
query.setParameter("p_company_site_id", companySiteId);
query.setParameter("p_customer_list_id", customerListId);
query.addScalar("customerListMappingId", new LongType());
query.addScalar("companySiteId", new LongType());
query.addScalar("customerListId", new LongType());
query.addScalar("customerId", new LongType());
query.addScalar("name", new StringType());
query.addScalar("description", new StringType());
query.addScalar("companyName", new StringType());
query.addScalar("customerType", new StringType());
query.addScalar("currentAddress", new StringType());
query.addScalar("mobileNumber", new StringType());
query.addScalar("email", new StringType());
query.setResultTransformer(Transformers.aliasToBean(CustomerCustomDTO.class));
int count = 0;
List<CustomerListDTO> dtoList = query.list();
if (dtoList.size() > 0) {
count = query.list().size();
}
// Pageable pageable = PageRequest.of(page, pageSize, Sort.by(sort));
// if (pageable != null) {
// query.setFirstResult(pageable.getPageNumber() * pageable.getPageSize());
// query.setMaxResults(pageable.getPageSize());
// }
Pageable pageable = PageRequest.of(page, pageSize, Sort.by(sort));
Page<Customer> pc = customerRepository.findAll(pageable);
result.put("totalItem", pc.getTotalElements());
result.put("customers", pc.iterator());
List<CustomerListDTO> data = query.list();
Page<CustomerListDTO> dataPage = new PageImpl<>(data, pageable, count);
resultDTO.setData(dataPage);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
} catch (Exception e) {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
} finally {
session.close();
}
return result;
return resultDTO;
}
@Override
public ResultDTO getCustomerId(Long customerId) {
ResultDTO resultDTO = new ResultDTO();
List<Customer> customer = customerRepository.findByCustomerId(customerId);
if (customer != null) {
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription("customer data");
resultDTO.setListData(customer);
} else {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription("customer data null");
}
return resultDTO;
}
@Override
......@@ -110,13 +195,15 @@ public class CustomerServiceImpl implements CustomerService {
return resultDTO;
}
@Transactional
@Override
public ResultDTO deleteCustomer(CustomerDTO customerDTO) {
public ResultDTO deleteCustomer(CustomerRequestDTO customerRequestDTO) {
ResultDTO resultDTO = new ResultDTO();
try {
if (customerDTO != null) {
if (customerRequestDTO != null) {
// delete
customerRepository.deleteById(customerDTO.getCustomerId());
// customerRepository.deleteById(customerDTO.getCustomerId());
customerListMappingRepository.deleteMappingByCustomerId(customerRequestDTO.getCustomerId(), customerRequestDTO.getCustomerListId(), customerRequestDTO.getCompanySiteId());
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
......@@ -133,11 +220,12 @@ public class CustomerServiceImpl implements CustomerService {
@Transactional
@Override
public ResultDTO deleteIds(List<Long> ids) {
public ResultDTO deleteIds(CustomerRequestDTO customerRequestDTO) {
ResultDTO resultDTO = new ResultDTO();
try {
if (ids != null) {
customerRepository.deleteIds(ids);
if (customerRequestDTO != null) {
// customerRepository.deleteIds(ids);
customerListMappingRepository.deleteMappingByCustomerIds(customerRequestDTO.getIds(), customerRequestDTO.getCustomerListId(), customerRequestDTO.getCompanySiteId());
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
} else {
......@@ -214,13 +302,15 @@ public class CustomerServiceImpl implements CustomerService {
public ResultDTO updateCustomerList(CustomerListDTO customerListDTO) {
ResultDTO resultDTO = new ResultDTO();
CustomerListMapper customerListMapper = new CustomerListMapper();
CustomerList customerList = customerListRepository.findCustomerListByCustomerListId(customerListDTO.getCustomerListId());
try {
if (customerListDTO != null) {
// update
CustomerList customerList = customerListRepository.findByCustomerListIdAndCompanySiteId(customerListDTO.getCustomerListId(), customerListDTO.getCompanySiteId());
if (customerList != null) {
customerList = customerListMapper.toPersistenceBean(customerListDTO);
customerList = customerListRepository.save(customerList);
customerListRepository.save(customerList);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
......@@ -228,6 +318,10 @@ public class CustomerServiceImpl implements CustomerService {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
}
} else {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
}
} catch (Exception e) {
e.printStackTrace();
}
......@@ -239,16 +333,14 @@ public class CustomerServiceImpl implements CustomerService {
@Override
public ResultDTO deleteCustomerList(CustomerListDTO customerListDTO) {
ResultDTO resultDTO = new ResultDTO();
CustomerListMapper customerListMapper = new CustomerListMapper();
CustomerList customerList = customerListRepository.findCustomerListByCustomerListId(customerListDTO.getCustomerListId());
try {
// delete
if (DataUtil.isNullOrZero(campaignCustomerListRepository.campaignCount(customerListDTO.getCustomerListId()))) {
customerList = customerListMapper.toPersistenceBean(customerListDTO);
customerList = customerListRepository.save(customerList);
customerListMappingRepository.deleteMappingByCustomerListId(customerListDTO.getCustomerListId());
customerListRepository.deleteCustomerList(customerListDTO.getCustomerListId(), customerListDTO.getCompanySiteId());
customerListMappingRepository.deleteMappingByCustomerListId(customerListDTO.getCustomerListId(), customerListDTO.getCompanySiteId());
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
......@@ -266,12 +358,15 @@ public class CustomerServiceImpl implements CustomerService {
@Transactional
@Override
public ResultDTO deleteCustomerListIds(List<Long> ids) {
public ResultDTO deleteCustomerListIds(CustomerRequestDTO customerRequestDTO) {
ResultDTO resultDTO = new ResultDTO();
try {
if (ids != null) {
if (DataUtil.isNullOrZero(campaignCustomerListRepository.campaignIdsCount(ids))) {
customerListRepository.deleteCustomerListIds(ids);
if (customerRequestDTO != null) {
if (DataUtil.isNullOrZero(campaignCustomerListRepository.campaignIdsCount(customerRequestDTO.getIds()))) {
customerListRepository.deleteCustomerListIds(customerRequestDTO.getIds(), customerRequestDTO.getCompanySiteId());
customerListMappingRepository.deleteMappingByCustomerListIds(customerRequestDTO.getIds(), customerRequestDTO.getCompanySiteId());
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
} else {
......@@ -289,71 +384,108 @@ public class CustomerServiceImpl implements CustomerService {
}
@Override
public ResultDTO searchCustomerList(String customerListCode, String customerListName, Date dateFrom, Date dateTo, int page, int pageSize, String sort) {
public ResultDTO searchCustomerList(SearchCustomerRequestDTO searchCustomerRequestDTO) {
ResultDTO resultDTO = new ResultDTO();
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
if (DataUtil.isNullOrEmpty(searchCustomerRequestDTO.getCompanySiteId())) {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
return resultDTO;
}
try {
StringBuilder sqlStrBuilder = new StringBuilder();
sqlStrBuilder.append(SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_MNG, "search-campaign-customer-by-params"));
if (!customerListCode.equals("undefined")) {
if (!DataUtil.isNullOrEmpty(searchCustomerRequestDTO.getCustomerListCode())) {
sqlStrBuilder.append(" AND CUSTOMER_LIST_CODE LIKE :p_list_code");
}
if (!customerListName.equals("undefined")) {
if (!DataUtil.isNullOrEmpty(searchCustomerRequestDTO.getCustomerListName())) {
sqlStrBuilder.append(" AND CUSTOMER_LIST_NAME LIKE :p_list_name");
}
SQLQuery query = session.createSQLQuery(sqlStrBuilder.toString());
query.setParameter("p_date_from", dateFrom);
query.setParameter("p_date_to", dateTo);
query.setParameter("p_date_from", searchCustomerRequestDTO.getConvertedDateFrom());
query.setParameter("p_date_to", searchCustomerRequestDTO.getConvertedDateTo());
query.setParameter("p_company_site_id", searchCustomerRequestDTO.getCompanySiteId());
if (!customerListCode.equals("undefined")) {
if (!DataUtil.isNullOrEmpty(searchCustomerRequestDTO.getCustomerListCode())) {
query.setParameter("p_list_code", "%" +
customerListCode
searchCustomerRequestDTO.getCustomerListCode()
.replace("\\", "\\\\")
.replaceAll("%", "\\\\%")
.replaceAll("_", "\\\\_")
.replaceAll("%", "\\%")
.replaceAll("_", "\\_")
+ "%");
}
if (!customerListName.equals("undefined")) {
if (!DataUtil.isNullOrEmpty(searchCustomerRequestDTO.getCustomerListName())) {
query.setParameter("p_list_name", "%" +
customerListName
searchCustomerRequestDTO.getCustomerListName()
.replace("\\", "\\\\")
.replaceAll("%", "\\\\%")
.replaceAll("_", "\\\\_")
.replaceAll("%", "\\%")
.replaceAll("_", "\\_")
+ "%");
}
// Pageable pageable = PageRequest.of(page, pageSize, Sort.by(sort));
// Page<CustomerList> pc = customerListRepository.search();
//
// result.put("totalItem", pc.getTotalElements());
// result.put("searchList", pc.iterator());
query.addScalar("customerListId", new LongType());
query.addScalar("companySiteId", new LongType());
query.addScalar("customerListCode", new StringType());
query.addScalar("customerListName", new StringType());
query.addScalar("status", new ShortType());
query.addScalar("createBy", new StringType());
query.addScalar("createAt", new DateType());
query.addScalar("updateBy", new StringType());
query.addScalar("updateAt", new DateType());
query.addScalar("source", new StringType());
query.addScalar("deptCreate", new StringType());
query.setResultTransformer(Transformers.aliasToBean(CustomerListDTO.class));
int count = 0;
List<CustomerListDTO> dtoList = query.list();
if (dtoList.size() > 0) {
count = query.list().size();
}
// Pageable pageable = buildPageable();
// Pageable pageable = SQLBuilder.buildPageable(searchCustomerRequestDTO);
// if (pageable != null) {
// query.setFirstResult(pageable.getPageNumber() * pageable.getPageSize());
// query.setMaxResults(pageable.getPageSize());
// }
Pageable pageable = PageRequest.of(page, pageSize, Sort.by(sort));
Pageable pageable = PageRequest.of(searchCustomerRequestDTO.getPage(), searchCustomerRequestDTO.getPageSize(), Sort.by(searchCustomerRequestDTO.getSort()));
List<CustomerListDTO> data = query.list();
Page<CustomerListDTO> dataPage = new PageImpl<>(data, pageable, count);
resultDTO.setData(dataPage);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
} catch (Exception e) {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
} finally {
session.close();
}
return resultDTO;
}
@Override
public ResultDTO getCustomerContact(Long customerId, Short contactType, String contact) {
ResultDTO result = new ResultDTO();
List<CustomerContact> customer = customerContactRepository.findByCustomerIdAndAndContactTypeAndContact(customerId, contactType, contact);
if (customer != null) {
result.setErrorCode(Constants.ApiErrorCode.SUCCESS);
result.setDescription("customer contact data");
result.setListData(customer);
} else {
result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription("customer contact data null");
}
return result;
}
}
......@@ -31,4 +31,8 @@ public class Constants {
String ACTIVE_STR = "Trạng thái kêt nối(Không thành công)";
String INACTIVE_STR = "Trạng thái khảo sát";
}
public interface SQL_MODULES {
String MODULE_EXECUTE = "campaign-execute";
}
}
......@@ -5,7 +5,6 @@ import java.nio.file.Paths;
import java.io.IOException;
import com.viettel.campaign.web.dto.BaseDTO;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import org.springframework.core.io.ClassPathResource;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
......@@ -17,7 +16,6 @@ import org.springframework.data.domain.Sort;
public class SQLBuilder {
public static final String SQL_MODULE_CAMPAIGN_MNG = "campaign-mng";
public static final String SQL_MODULE_CAMPAIGN_STATUS_MNG = "campaign-status-mng";
public static final String SQL_MODULE_CAMPAIGN_CUSTOMER = "campaign-customer";
public static String getSqlQueryById(String module,
String queryId) {
......
......@@ -4,6 +4,7 @@ import lombok.Getter;
import lombok.Setter;
import java.util.Date;
import java.util.List;
@Getter
@Setter
......@@ -57,6 +58,10 @@ public class CampaignDTO extends BaseDTO {
private Long numOfNotJoinedCus;
private Long numOfLockCus;
private String campaignTypeName;
private Date timeRangeStartTime;
private String timeZoneHour;
private String timeZoneMinute;
private List<TimeRangeDialModeDTO> lstTimeRange;
private List<TimeZoneDialModeDTO> lstTimeZone;
private Short agentStatus;
}
package com.viettel.campaign.web.dto;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.util.Date;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ContactCustResultDTO extends BaseDTO{
private Long contacCustResultId;
private Long companySiteId;
private Short callStatus;
private Short recordStatus;
private String description;
private Date createTime;
private String callTime;
private Long agentId;
private Long campaignId;
private String campaignName;
private Long phoneNumber;
private String customerName;
private Long customerId;
private String contactStatus;
private String campaignCode;
private String userName;
private String surveyStatus;
private Short status;
private Boolean enableEdit;
}
package com.viettel.campaign.web.dto;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
@Getter
@Setter
public class CustomerContactDTO {
private Long contactId;
private Long customerId;
private Short contactType;
private String contact;
private Short isDirectLine;
private Short status;
private Date createDate;
private Date updateDate;
private String createBy;
private String updateBy;
private Date startDate;
private Date endDate;
}
package com.viettel.campaign.web.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class CustomerCustomDTO {
Long customerListMappingId;
Long companySiteId;
Long customerListId;
Long customerId;
String name;
String description;
String companyName;
String customerType;
String currentAddress;
String mobileNumber;
String email;
}
......@@ -10,7 +10,7 @@ import lombok.Setter;
@Getter
@Setter
public class TimeZoneDialModeDTO {
private Long timeRangeDialModeId;
private Long timeZoneDialModeId;
private Long companySiteId;
private String hour;
private String minute;
......
......@@ -25,4 +25,20 @@ public class CampaignRequestDTO extends BaseDTO {
String companySiteId;
String agentId;
String types;
String phoneNumber;
String contactStatus;
String campaignStatus;
String customerId;
String customerName;
String callTimeTo;
String callTimeFrom;
String recordStatus;
String connectStatus;
String toDate;
String fromDate;
String campaignType;
String agentName;
String campaignId;
String surveyStatus;
String roleUser;
}
package com.viettel.campaign.web.dto.request_dto;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Getter
@Setter
public class CustomerRequestDTO {
Long customerId;
Long customerListId;
List<Long> ids;
Long companySiteId;
}
package com.viettel.campaign.web.dto.request_dto;
import com.viettel.campaign.web.dto.BaseDTO;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class SearchCustomerRequestDTO extends BaseDTO {
String customerListCode;
String customerListName;
String convertedDateFrom;
String convertedDateTo;
String companySiteId;
}
......@@ -2,6 +2,7 @@ package com.viettel.campaign.web.rest;
import com.viettel.campaign.model.ApParam;
import com.viettel.campaign.service.ApParamService;
import com.viettel.campaign.service.CampaignExecuteService;
import com.viettel.campaign.web.rest.controller.CustomerController;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -19,9 +20,18 @@ public class ApParamController {
private static final Logger LOGGER = Logger.getLogger(CustomerController.class);
private static final String CONNECT_STATUS = "CONNECT_STATUS";
private static final String CONNECT_STATUS_TYPE = "1";
private static final String SURVEY_STATUS = "SURVEY_STATUS";
private static final String SURVEY_STATUS_TYPE = "2";
private static final String CAMPAIGN_TYPE = "CAMPAIGN_TYPE";
@Autowired(required = true)
ApParamService apParamService;
@Autowired
CampaignExecuteService campaignExecuteService;
@GetMapping(path = "/findAlls")
@ResponseBody
public ResponseEntity listAllCustomer(@RequestParam("page") int page, @RequestParam("pageSize") int pageSize, @RequestParam("sort") String sort) {
......@@ -56,5 +66,20 @@ public class ApParamController {
}
return new ResponseEntity(findAll, HttpStatus.OK);
}
//<editor-fold: hungtt>
@GetMapping("/getDataComboBox")
@ResponseBody
public ResponseEntity getComboBox(@RequestParam("parType") String parType, @RequestParam("companySiteId") String companySiteId) {
if (CONNECT_STATUS.equals(parType)) {
return new ResponseEntity<>(campaignExecuteService.getComboBoxStatus(companySiteId, CONNECT_STATUS_TYPE), HttpStatus.OK);
} else if (SURVEY_STATUS.equals(parType)){
return new ResponseEntity<>(campaignExecuteService.getComboBoxStatus(companySiteId, SURVEY_STATUS_TYPE), HttpStatus.OK);
} else {
return new ResponseEntity<>(campaignExecuteService.getComboCampaignType(companySiteId), HttpStatus.OK);
}
}
//</editor-fold: hungtt>
}
package com.viettel.campaign.web.rest.controller;
import com.viettel.campaign.service.CampaignExecuteService;
import com.viettel.campaign.service.CampaignService;
import com.viettel.campaign.web.dto.CampaignDTO;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import org.apache.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
......@@ -16,11 +19,14 @@ import java.util.Map;
@CrossOrigin
public class CampaignController {
private static final Logger LOGGER = Logger.getLogger(CampaignController.class);
private static final Logger logger = LoggerFactory.getLogger(CampaignController.class);
@Autowired
CampaignService campaignService;
@Autowired
CampaignExecuteService campaignExecuteService;
@RequestMapping("/searchCampaignExecute")
@ResponseBody
public ResponseEntity<ResultDTO> searchCampaignExecute(@RequestBody CampaignRequestDTO requestDto) {
......@@ -34,14 +40,14 @@ public class CampaignController {
return new ResponseEntity<>(result, HttpStatus.OK);
}
@RequestMapping(value = "/findByCampaignCode", method = RequestMethod.POST)
@RequestMapping(value = "/find-by-campaign-code", method = RequestMethod.POST)
public ResultDTO findByCampaignCode(@RequestBody CampaignRequestDTO dto) {
return campaignService.findByCampaignCode(dto);
}
@RequestMapping(method = RequestMethod.POST)
public ResultDTO addNewCampaign(@RequestBody CampaignRequestDTO dto) {
return campaignService.findByCampaignCode(dto);
public ResultDTO addNewCampaign(@RequestBody CampaignDTO dto) {
return campaignService.addNewCampaign(dto);
}
@GetMapping("/countRecallCustomer")
......@@ -50,4 +56,22 @@ public class CampaignController {
Map result = campaignService.countRecallCustomer(companySiteId, agentId);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PostMapping("/searchInteractiveResult")
@ResponseBody
public ResponseEntity<ResultDTO> searchInteractiveResult(@RequestBody CampaignRequestDTO dto) {
ResultDTO result = campaignExecuteService.searchInteractiveResult(dto);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@RequestMapping(value = "/find-campaign-by-id/{campaignId}", method = RequestMethod.GET)
public ResponseEntity<ResultDTO> findCampaignById(@PathVariable Long campaignId) {
ResultDTO resultDTO = campaignService.findCampaignById(campaignId);
return new ResponseEntity<>(resultDTO, HttpStatus.OK);
}
@PostMapping("/changeCampaignStatus")
public ResultDTO changeCampaignStatus(@RequestBody CampaignDTO dto) {
return campaignService.changeCampaignStatus(dto);
}
}
......@@ -4,21 +4,32 @@ import com.viettel.campaign.web.dto.CustomerDTO;
import com.viettel.campaign.web.dto.CustomerListDTO;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.service.CustomerService;
import com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO;
import com.viettel.campaign.web.dto.request_dto.CustomerRequestDTO;
import org.apache.log4j.Logger;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import java.util.Date;
import java.io.File;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/ipcc/customer")
@CrossOrigin("*")
@CrossOrigin(origins = "*")
public class CustomerController {
private static final Logger LOGGER = Logger.getLogger(CustomerController.class);
......@@ -28,11 +39,18 @@ public class CustomerController {
@GetMapping("/findAll")
@ResponseBody
public ResponseEntity findAllCustomer(@RequestParam("page") int page, @RequestParam("pageSize") int pageSize, @RequestParam("sort") String sort) {
Map result = customerService.listAllCustomer(page, pageSize, sort);
public ResponseEntity findAllCustomer(@RequestParam("page") int page, @RequestParam("pageSize") int pageSize, @RequestParam("sort") String sort, @RequestParam("customerListId") long customerListId, @RequestParam("companySiteId") long companySiteId) {
ResultDTO result = customerService.listAllCustomer(page, pageSize, sort, customerListId, companySiteId);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@GetMapping("/findCustomerId")
@ResponseBody
public ResponseEntity<ResultDTO> findAllCustomerName(@RequestParam("customerId") Long customerId) {
ResultDTO result = customerService.getCustomerId(customerId);
return new ResponseEntity(result, HttpStatus.OK);
}
@GetMapping("/findCustomerByName")
@ResponseBody
public ResponseEntity findAllCustomerName(@RequestParam("page") int page, @RequestParam("pageSize") int pageSize, @RequestParam("sort") String sort, @RequestParam("name") String name) {
......@@ -61,17 +79,17 @@ public class CustomerController {
@PostMapping("/delete")
@ResponseBody
public ResultDTO deleteCustomer(@RequestBody @Valid CustomerDTO customerDTO) {
public ResultDTO deleteCustomer(@RequestBody @Valid CustomerRequestDTO customerRequestDTO) {
ResultDTO result = new ResultDTO();
result = customerService.deleteCustomer(customerDTO);
result = customerService.deleteCustomer(customerRequestDTO);
return result;
}
@PostMapping("/deleteIds")
@ResponseBody
public ResultDTO deleteIds(@RequestBody @Valid List<Long> ids) {
public ResultDTO deleteIds(@RequestBody @Valid CustomerRequestDTO customerRequestDTO) {
ResultDTO result = new ResultDTO();
result = customerService.deleteIds(ids);
result = customerService.deleteIds(customerRequestDTO);
return result;
}
......@@ -134,16 +152,78 @@ public class CustomerController {
@PostMapping("/deleteCustomerListIds")
@ResponseBody
public ResultDTO deleteCustomerListIds(@RequestBody @Valid List<Long> ids) {
public ResultDTO deleteCustomerListIds(@RequestBody @Valid CustomerRequestDTO customerRequestDTO) {
ResultDTO result = new ResultDTO();
result = customerService.deleteCustomerListIds(ids);
result = customerService.deleteCustomerListIds(customerRequestDTO);
return result;
}
@GetMapping("/searchCustomerList")
@ResponseBody
public ResponseEntity searchCustomerList(@RequestParam("customerListCode") String customerListCode, @RequestParam("customerListName") String customerListName, @RequestParam("dateFrom") Date dateFrom, @RequestParam("dateTo") Date dateTo, @RequestParam("page") int page, @RequestParam("pageSize") int pageSize, @RequestParam("sort") String sort) {
ResultDTO result = customerService.searchCustomerList(customerListCode, customerListName, dateFrom, dateTo, page, pageSize, sort);
@RequestMapping(value = "/searchCustomerList", method = RequestMethod.POST)
public ResponseEntity searchCustomerList(@RequestBody SearchCustomerRequestDTO searchCustomerRequestDTO) {
ResultDTO result = customerService.searchCustomerList(searchCustomerRequestDTO);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@GetMapping("/findCustomerContact")
@ResponseBody
public ResponseEntity<ResultDTO> findAllCustomerContact(@RequestParam("customerId") Long customerId, @RequestParam("contactType") Short contactType, @RequestParam("contact") String contact) {
ResultDTO result = customerService.getCustomerContact(customerId, contactType, contact);
return new ResponseEntity(result, HttpStatus.OK);
}
@GetMapping(value = "/downloadFileTemplate")
public ResponseEntity<byte[]> downloadFileTemplate() {
LOGGER.debug("--------DOWNLOAD FILE TEMPLATE---------");
try {
File file = ResourceUtils.getFile("classpath:templates/test_download.xlsx");
byte[] content = Files.readAllBytes(file.toPath());
return ResponseEntity.ok()
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + file.getName())
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.body(content);
} catch (Exception e) {
LOGGER.error(e.getMessage());
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
}
@PostMapping(value = "/importFile")
public ResponseEntity<byte[]> importFile(@RequestParam("file") MultipartFile file) {
LOGGER.debug("--------IMPORT FILE TEMPLATE---------");
try {
List<CustomerDTO> listCustomer = new ArrayList<>();
XSSFWorkbook workbook = new XSSFWorkbook(file.getInputStream());
XSSFSheet sheet = workbook.getSheetAt(0);
for (int i = 0; i < sheet.getPhysicalNumberOfRows(); i++) {
CustomerDTO customer = new CustomerDTO();
XSSFRow row = sheet.getRow(i);
customer.setCustomerId(Double.valueOf(row.getCell(0).getNumericCellValue()).longValue());
customer.setCreateDate(row.getCell(1).getDateCellValue());
customer.setName(row.getCell(2).getStringCellValue());
listCustomer.add(customer);
}
// for (int i = 0; i < listCustomer.size(); i++) {
// validate du lieu
// }
// if (okay) {
// for (int i = 0; i < listCustomer.size(); i++) {
// customerService.createCustomer(listCustomer.get(i));
// }
// return ResponseEntity.ok()
// .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + file.getName())
// .contentType(MediaType.APPLICATION_OCTET_STREAM)
// .body(file.getBytes());
// } else {
// return ResponseEntity.ok()
// .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + file.getName())
// .header("Message", "Validate failed!")
// .contentType(MediaType.APPLICATION_OCTET_STREAM)
// .body(file.getBytes());
// }
return null;
} catch (Exception e) {
LOGGER.error(e.getMessage());
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
}
}
select AP_PARAM_ID apParamId,
PAR_NAME parName
from AP_PARAM
where PAR_TYPE = 'CAMPAIGN_TYPE' and COMPANY_SITE_ID = :p_company_site_id
select COMPLETE_VALUE apParamId,
COMPLETE_NAME parName
from CAMPAIGN_COMPLETE_CODE
where to_char(COMPLETE_TYPE) = :p_complete_type and STATUS = 1 and COMPANY_SITE_ID = :p_company_site_id
select b.campaign_code campaignCode,
b.campaign_name campaignName,
c.user_name userName,
a.phone_number phoneNumber,
d.name customerName,
a.create_time createTime,
e.complete_name contactStatus,
f.complete_name surveyStatus,
g.status status,
a.status recordStatus
from contact_cust_result a
left join campaign b on a.campaign_id = b.campaign_id
left join vsa_users c on a.agent_id = c.user_id
left join customer d on a.customer_id = d.customer_id
left join campaign_complete_code e on a.contact_status = e.complete_value
left join campaign_complete_code f on a.call_status = e.complete_value
left join campaign g on a.campaign_id = b.campaign_id
where a.campaign_id in (:p_list_campaign_id)
and a.customer_id like '%'||:p_customer_id||'%'
and a.create_time >= to_date(:p_date_from, 'DD/MM/YYYY')
and a.create_time <= to_date(:p_date_to, 'DD/MM/YYYY')
and a.contact_status in (:p_list_contact_status)
and a.call_status in (:p_list_survey_status)
and a.status in (:p_list_record_status)
and a.phone_number like '%'||:p_phone_number||'%'
and a.duration_call >= :p_call_time_from
and a.duration_call <= :p_call_time_to
select
a.CUSTOMER_LIST_MAPPING_ID customerListMappingId,
a.COMPANY_SITE_ID companySiteId,
a.CUSTOMER_LIST_ID customerListId,
a.CUSTOMER_ID customerId,
b.NAME name,
b.DESCRIPTION description,
b.COMPANY_NAME companyName,
b.CUSTOMER_TYPE customerType,
b.CURRENT_ADDRESS currentAddress,
c.MOBILE mobileNumber,
d.EMAIL email
from CUSTOMER_LIST_MAPPING a
join CUSTOMER b on a.CUSTOMER_ID = b.CUSTOMER_ID
left join (SELECT CUSTOMER_ID, LISTAGG(CONTACT, ', ') WITHIN GROUP (ORDER BY NULL) AS MOBILE
FROM CUSTOMER_CONTACT WHERE CONTACT_TYPE = 5 GROUP BY CUSTOMER_ID) c on b.CUSTOMER_ID = c.CUSTOMER_ID
left join (SELECT CUSTOMER_ID, LISTAGG(CONTACT, ', ') WITHIN GROUP (ORDER BY NULL) AS EMAIL
FROM CUSTOMER_CONTACT WHERE CONTACT_TYPE = 2 GROUP BY CUSTOMER_ID) d on b.CUSTOMER_ID = d.CUSTOMER_ID
where 1 = 1
and COMPANY_SITE_ID = :p_company_site_id
and CUSTOMER_LIST_ID = :p_customer_list_id
SELECT CASE WHEN
(SELECT COUNT(1) FROM CAMPAIGN) > 0
THEN (SELECT SUBSTR((SELECT CAMPAIGN_CODE FROM CAMPAIGN WHERE CAMPAIGN_ID = (SELECT MAX(CAMPAIGN_ID) FROM CAMPAIGN)),
INSTR((SELECT CAMPAIGN_CODE FROM CAMPAIGN WHERE CAMPAIGN_ID = (SELECT MAX(CAMPAIGN_ID) FROM CAMPAIGN)), '_', -1, 1 )+1) FROM DUAL)
ELSE '0'
END FROM DUAL
SELECT
CUSTOMER_LIST_ID,
COMPANY_SITE_ID,
CUSTOMER_LIST_CODE,
CUSTOMER_LIST_NAME,
STATUS,
CREATE_BY,
CREATE_AT,
UPDATE_BY,
UPDATE_AT,
SOURCE,
DEPT_CREATE
CUSTOMER_LIST_ID customerListId,
COMPANY_SITE_ID companySiteId,
CUSTOMER_LIST_CODE customerListCode,
CUSTOMER_LIST_NAME customerListName,
STATUS status,
CREATE_BY createBy,
CREATE_AT createAt,
UPDATE_BY updateBy,
UPDATE_AT updateAt,
SOURCE source,
DEPT_CREATE deptCreate
FROM CUSTOMER_LIST
WHERE 1 = 1
AND CREATE_AT BETWEEN :p_date_from AND :p_date_to
AND CREATE_AT BETWEEN to_date(:p_date_from, 'YYYYMMDD') AND to_date(:p_date_to, 'YYYYMMDD')
AND COMPANY_SITE_ID = :p_company_site_id
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