Commit 6264ccd9 authored by Tu Bach's avatar Tu Bach

Merge branch 'master' into tubn

# Conflicts:
#	lib/ojdbc7.jar
parents a48a4e9e 2b5770de
File added
target/
/.idea/
logs/
out/
\ No newline at end of file
out/
/campaign.iml
/lib
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.util.Properties;
public class MavenWrapperDownloader {
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL =
"https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if (mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if (mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: : " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if (!outputFile.getParentFile().exists()) {
if (!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
}
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip
#redis address, port
redis_address=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
redis_timeout=3000
#end
\ No newline at end of file
This diff is collapsed.
package com.viettel.campaign;
import com.viettel.campaign.config.DataSourceProperties;
import com.viettel.campaign.utils.Config;
import com.viettel.campaign.utils.RedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ServiceCampaignApplication {
@Autowired
DataSourceProperties dataSourceProperties;
public static void main(String[] args) {
SpringApplication.run(ServiceCampaignApplication.class, args);
RedisUtil redis = new RedisUtil(Config.redisAddress,Config.redisTimeout);
redis.setup();
}
}
package com.viettel.campaign.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.sql.DataSource;
import java.util.HashMap;
/**
* @author anhvd_itsol
*/
@Configuration
@PropertySource({ "classpath:application.yml" })
@EnableJpaRepositories(
basePackages = "com.viettel.campaign.repository.acd_full",
entityManagerFactoryRef = "acdFullEntityManager",
transactionManagerRef = DataSourceQualify.ACD_FULL
)
public class ACDFullDatasourceConfig {
@Autowired
private Environment env;
@Value("${datasource-property.acd-full.driver-class-name}")
private String driverClassName;
@Value("${datasource-property.acd-full.url}")
private String url;
@Value("${datasource-property.acd-full.max_pool_size}")
private Integer maxPoolSize;
@Value("${datasource-property.acd-full.password}")
private String password;
@Value("${datasource-property.acd-full.username}")
private String username;
@Bean("datasource.datasource2")
public DataSource dataSource(){
OracleDataSource r = new OracleDataSource();
r.setDriverClassName(driverClassName);
r.setPoolName("app.datasource2");
r.setJdbcUrl(url);
r.setMaximumPoolSize(maxPoolSize);
r.setPassword(password);
r.setUsername(username);
return r;
}
@Bean
public LocalContainerEntityManagerFactoryBean acdFullEntityManager() {
LocalContainerEntityManagerFactoryBean em2
= new LocalContainerEntityManagerFactoryBean();
em2.setDataSource(dataSource());
em2.setPackagesToScan(
new String[] { "com.viettel.campaign.model.acd_full" });
em2.setPersistenceUnitName(DataSourceQualify.JPA_UNIT_NAME_ACD_FULL); // Important !!
HibernateJpaVendorAdapter vendorAdapter
= new HibernateJpaVendorAdapter();
em2.setJpaVendorAdapter(vendorAdapter);
HashMap<String, Object> properties = new HashMap<>();
properties.put("hibernate.dialect", env.getProperty("spring.jpa.database-platform"));
em2.setJpaPropertyMap(properties);
return em2;
}
@Bean(name = DataSourceQualify.ACD_FULL)
public PlatformTransactionManager acdFullTransactionManager() {
JpaTransactionManager transactionManager
= new JpaTransactionManager();
transactionManager.setEntityManagerFactory(
acdFullEntityManager().getObject());
return transactionManager;
}
@Bean(name = DataSourceQualify.NAMED_JDBC_PARAMETER_TEMPLATE_ACD_FULL)
@DependsOn("datasource.datasource2")
public NamedParameterJdbcTemplate namedParameterJdbcTemplate(@Qualifier("datasource.datasource2") DataSource abcDataSource) {
return new NamedParameterJdbcTemplate(abcDataSource);
}
}
package com.viettel.campaign.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.PlatformTransactionManager;
import javax.sql.DataSource;
import java.util.HashMap;
/**
* @author anhvd_itsol
*/
@Configuration
@PropertySource({ "classpath:application.yml" })
@EnableJpaRepositories(
basePackages = "com.viettel.campaign.repository.ccms_full",
entityManagerFactoryRef = "ccmsFullEntityManager",
transactionManagerRef = DataSourceQualify.CCMS_FULL
)
public class CCMSFullDatasourceConfig {
@Autowired
private Environment env;
@Value("${datasource-property.ccms-full.driver-class-name}")
private String driverClassName;
@Value("${datasource-property.ccms-full.url}")
private String url;
@Value("${datasource-property.ccms-full.max_pool_size}")
private Integer maxPoolSize;
@Value("${datasource-property.ccms-full.password}")
private String password;
@Value("${datasource-property.ccms-full.username}")
private String username;
@Bean(name= "datasource.datasource1")
public DataSource dataSource(){
OracleDataSource r = new OracleDataSource();
r.setDriverClassName(driverClassName);
r.setPoolName("app.datasource1");
r.setJdbcUrl(url);
r.setMaximumPoolSize(maxPoolSize);
r.setPassword(password);
r.setUsername(username);
return r;
}
@Bean
public LocalContainerEntityManagerFactoryBean ccmsFullEntityManager() {
LocalContainerEntityManagerFactoryBean em
= new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan(
new String[] { "com.viettel.campaign.model.ccms_full" });
em.setPersistenceUnitName(DataSourceQualify.JPA_UNIT_NAME_CCMS_FULL); // Important !!
HibernateJpaVendorAdapter vendorAdapter
= new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
HashMap<String, Object> properties = new HashMap<>();
properties.put("hibernate.dialect", env.getProperty("spring.jpa.database-platform"));
em.setJpaPropertyMap(properties);
return em;
}
@Bean(name = DataSourceQualify.CCMS_FULL)
public PlatformTransactionManager ccmsFullTransactionManager() {
JpaTransactionManager transactionManager
= new JpaTransactionManager();
transactionManager.setEntityManagerFactory(
ccmsFullEntityManager().getObject());
return transactionManager;
}
@Bean(name = DataSourceQualify.NAMED_JDBC_PARAMETER_TEMPLATE_CCMS_FULL)
@DependsOn("datasource.datasource1")
public NamedParameterJdbcTemplate namedParameterJdbcTemplate(@Qualifier("datasource.datasource1") DataSource abcDataSource) {
return new NamedParameterJdbcTemplate(abcDataSource);
}
}
package com.viettel.campaign.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @author anhvd_itsol
*/
@Component
@ConfigurationProperties(prefix = "datasource-property")
public class DataSourceProperties {
public static class CCMSFull{
private String driverClassName;
private String url;
private String username;
private String password;
private Integer maxPoolSize;
public String getDriverClassName() {
return driverClassName;
}
public void setDriverClassName(String driverClassName) {
this.driverClassName = driverClassName;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Integer getMaxPoolSize() {
return maxPoolSize;
}
public void setMaxPoolSize(Integer maxPoolSize) {
this.maxPoolSize = maxPoolSize;
}
}
public static class ACDFull{
private String driverClassName;
private String url;
private String username;
private String password;
private Integer maxPoolSize;
public String getDriverClassName() {
return driverClassName;
}
public void setDriverClassName(String driverClassName) {
this.driverClassName = driverClassName;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Integer getMaxPoolSize() {
return maxPoolSize;
}
public void setMaxPoolSize(Integer maxPoolSize) {
this.maxPoolSize = maxPoolSize;
}
}
}
package com.viettel.campaign.config;
/**
* @author anhvd_itsol
*/
public class DataSourceQualify {
public static final String CCMS_FULL = "ccmsFullTransactionManager";
public static final String ACD_FULL = "acdFullTransactionManager";
public static final String JPA_UNIT_NAME_CCMS_FULL ="PERSITENCE_UNIT_NAME_1";
public static final String JPA_UNIT_NAME_ACD_FULL ="PERSITENCE_UNIT_NAME_2";
public static final String NAMED_JDBC_PARAMETER_TEMPLATE_CCMS_FULL ="NAMED_JDBC_PARAMETER_TEMPLATE_CCMS_FULL";
public static final String NAMED_JDBC_PARAMETER_TEMPLATE_ACD_FULL ="NAMED_JDBC_PARAMETER_TEMPLATE_ACD_FULL";
}
package com.viettel.campaign.config;
//import com.viettel.campaign.job.CampaignJob;
import com.viettel.campaign.job.CampaignJob;
import com.viettel.campaign.service.ApParamService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.Trigger;
import org.springframework.scheduling.TriggerContext;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.concurrent.ScheduledFuture;
......@@ -26,9 +31,6 @@ import java.util.concurrent.ScheduledFuture;
@Configuration
public class JobConfig implements SchedulingConfigurer {
@Autowired
private ApParamService apParamService;
TaskScheduler taskScheduler;
private ScheduledFuture<?> job1;
private ScheduledFuture<?> job2;
......@@ -38,18 +40,18 @@ public class JobConfig implements SchedulingConfigurer {
return new CampaignJob();
}
@Override
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
threadPoolTaskScheduler.setPoolSize(10);
threadPoolTaskScheduler.setThreadNamePrefix("scheduler-thread");
threadPoolTaskScheduler.initialize();
job1(threadPoolTaskScheduler);
job2(threadPoolTaskScheduler);
this.taskScheduler = threadPoolTaskScheduler;
taskRegistrar.setTaskScheduler(threadPoolTaskScheduler);
}
// @Override
// public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
//
// ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
// threadPoolTaskScheduler.setPoolSize(10);
// threadPoolTaskScheduler.setThreadNamePrefix("scheduler-thread");
// threadPoolTaskScheduler.initialize();
// job1(threadPoolTaskScheduler);
// job2(threadPoolTaskScheduler);
// this.taskScheduler = threadPoolTaskScheduler;
// taskRegistrar.setTaskScheduler(threadPoolTaskScheduler);
// }
private void job1(TaskScheduler scheduler) {
job1 = scheduler.schedule(() -> {
......@@ -70,8 +72,7 @@ public class JobConfig implements SchedulingConfigurer {
private void job2(TaskScheduler scheduler) {
job2 = scheduler.schedule(() -> {
// log.info("processing job2 ...");
// log.info(Thread.currentThread().getName() + " The Task2 executed at " + new Date());
log.info(Thread.currentThread().getName() + " The Job executed at " + new Date());
campaignJob().process();
}, triggerContext -> {
......@@ -82,8 +83,17 @@ public class JobConfig implements SchedulingConfigurer {
// @Override
// public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
//// scheduledTaskRegistrar.addTriggerTask(() -> campaignJob().process2(), (TriggerContext triggerContext) -> yourService.getCron());
// }
@Override
public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) {
ThreadPoolTaskScheduler threadPoolTaskScheduler = new ThreadPoolTaskScheduler();
threadPoolTaskScheduler.setPoolSize(10);
threadPoolTaskScheduler.setThreadNamePrefix("scheduler-thread");
threadPoolTaskScheduler.initialize();
scheduledTaskRegistrar.setTaskScheduler(threadPoolTaskScheduler);
// scheduledTaskRegistrar.addTriggerTask(() -> campaignJob().process(), (TriggerContext triggerContext) -> yourService.getCron());
scheduledTaskRegistrar.addTriggerTask(() -> campaignJob().process(), triggerContext -> {
CronTrigger trigger = new CronTrigger("0/5 * * * * ?");
return trigger.nextExecutionTime(triggerContext);
});
}
}
package com.viettel.campaign.config;
import org.modelmapper.ModelMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author anhvd_itsol
*/
@Configuration
public class ModelMapperConfig {
@Bean
public ModelMapper modelMapper() {
return new ModelMapper();
}
}
package com.viettel.campaign.config;
import com.zaxxer.hikari.HikariDataSource;
/**
* @author anhvd_itsol
*/
public class OracleDataSource extends HikariDataSource {
public OracleDataSource(){
super.addDataSourceProperty("useSSL", "false");
super.addDataSourceProperty("cachePrepStmts", "true");
super.addDataSourceProperty("prepStmtCacheSize", "256");
super.addDataSourceProperty("allowMultiQueries", "true");
super.addDataSourceProperty("useServerPrepStmts", "false");
super.addDataSourceProperty("useLocalSessionState", "true");
super.addDataSourceProperty("prepStmtCacheSqlLimit", "81920");
super.addDataSourceProperty("nullCatalogMeansCurrent", "true");
super.addDataSourceProperty("rewriteBatchedStatements", "false");
super.addDataSourceProperty("useOldAliasMetadataBehavior", "true");
this.setIdleTimeout(600000); this.setConnectionTimeout(18000); this.setMinimumIdle(0);
this.setMaxLifetime(1800000); this.setInitializationFailTimeout(0);
}
}
package com.viettel.campaign.config;
import com.viettel.campaign.service.Receiver;
import org.springframework.context.annotation.Configuration;
import java.util.HashMap;
import java.util.Map;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.springframework.context.annotation.Bean;
import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
import org.springframework.kafka.core.ConsumerFactory;
import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
import org.springframework.kafka.support.serializer.JsonDeserializer;
/**
* @author hanv_itsol
* @project campaign
*/
@Configuration
public class ReceiverConfig {
// @Value("${spring.kafka.bootstrap-servers}")
private String bootstrapServers = "192.168.1.201:9092";
@Bean
public Map<String, Object> consumerConfigs() {
Map<String, Object> props = new HashMap<>();
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, JsonDeserializer.class);
props.put(ConsumerConfig.GROUP_ID_CONFIG, "hanv");
return props;
}
@Bean
public ConsumerFactory<String, String> consumerFactory() {
return new DefaultKafkaConsumerFactory<>(consumerConfigs(), new StringDeserializer(),
new JsonDeserializer<>());
}
@Bean
public ConcurrentKafkaListenerContainerFactory<String, String> kafkaListenerContainerFactory() {
ConcurrentKafkaListenerContainerFactory<String, String> factory =
new ConcurrentKafkaListenerContainerFactory<>();
factory.setConsumerFactory(consumerFactory());
return factory;
}
@Bean
public Receiver receiver() {
return new Receiver();
}
}
//package com.viettel.campaign.config;
//
//import com.viettel.campaign.service.Receiver;
//import org.springframework.context.annotation.Configuration;
//import java.util.HashMap;
//import java.util.Map;
//
//import org.apache.kafka.clients.consumer.ConsumerConfig;
//import org.apache.kafka.common.serialization.StringDeserializer;
//import org.springframework.context.annotation.Bean;
//import org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory;
//import org.springframework.kafka.core.ConsumerFactory;
//import org.springframework.kafka.core.DefaultKafkaConsumerFactory;
//import org.springframework.kafka.support.serializer.JsonDeserializer;
//
///**
// * @author hanv_itsol
// * @project campaign
// */
//@Configuration
//public class ReceiverConfig {
//// @Value("${spring.kafka.bootstrap-servers}")
// private String bootstrapServers = "192.168.1.201:9092";
//
// @Bean
// public Map<String, Object> consumerConfigs() {
// Map<String, Object> props = new HashMap<>();
// props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
// props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
// props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, JsonDeserializer.class);
// props.put(ConsumerConfig.GROUP_ID_CONFIG, "hanv");
// return props;
// }
//
// @Bean
// public ConsumerFactory<String, String> consumerFactory() {
// return new DefaultKafkaConsumerFactory<>(consumerConfigs(), new StringDeserializer(),
// new JsonDeserializer<>());
// }
//
// @Bean
// public ConcurrentKafkaListenerContainerFactory<String, String> kafkaListenerContainerFactory() {
// ConcurrentKafkaListenerContainerFactory<String, String> factory =
// new ConcurrentKafkaListenerContainerFactory<>();
// factory.setConsumerFactory(consumerFactory());
//
// return factory;
// }
//
// @Bean
// public Receiver receiver() {
// return new Receiver();
// }
//}
package com.viettel.campaign.config;
import java.util.HashMap;
import java.util.Map;
import com.viettel.campaign.service.Sender;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.common.serialization.StringSerializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.core.DefaultKafkaProducerFactory;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.kafka.core.ProducerFactory;
import org.springframework.kafka.support.serializer.JsonSerializer;
/**
* @author hanv_itsol
* @project campaign
*/
@Configuration
public class SenderConfig {
private String bootstrapServers = "192.168.1.201:9092";
@Bean
public Map<String, Object> producerConfigs() {
Map<String, Object> props = new HashMap<>();
props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class);
return props;
}
@Bean
public ProducerFactory<String, String> producerFactory() {
return new DefaultKafkaProducerFactory<>(producerConfigs());
}
@Bean
public KafkaTemplate<String, String> simpleKafkaTemplate() {
return new KafkaTemplate<>(producerFactory());
}
@Bean
public Sender sender() {
return new Sender();
}
}
//package com.viettel.campaign.config;
//
//import java.util.HashMap;
//import java.util.Map;
//
//import com.viettel.campaign.service.Sender;
//import org.apache.kafka.clients.producer.ProducerConfig;
//import org.apache.kafka.common.serialization.StringSerializer;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.kafka.core.DefaultKafkaProducerFactory;
//import org.springframework.kafka.core.KafkaTemplate;
//import org.springframework.kafka.core.ProducerFactory;
//import org.springframework.kafka.support.serializer.JsonSerializer;
//
///**
// * @author hanv_itsol
// * @project campaign
// */
//@Configuration
//public class SenderConfig {
// private String bootstrapServers = "192.168.1.201:9092";
//
// @Bean
// public Map<String, Object> producerConfigs() {
// Map<String, Object> props = new HashMap<>();
// props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
// props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
// props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class);
//
// return props;
// }
//
// @Bean
// public ProducerFactory<String, String> producerFactory() {
// return new DefaultKafkaProducerFactory<>(producerConfigs());
// }
//
// @Bean
// public KafkaTemplate<String, String> simpleKafkaTemplate() {
// return new KafkaTemplate<>(producerFactory());
// }
//
// @Bean
// public Sender sender() {
// return new Sender();
// }
//}
package com.viettel.campaign.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
/**
* @author hanv_itsol
* @project service-campaign
*/
@EnableWebSecurity
@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
}
}
//package com.viettel.campaign.config;
//
//import com.viettel.campaign.filter.CorsFilter;
//import org.springframework.boot.web.servlet.FilterRegistrationBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//
///**
// * @author hanv_itsol
// * @project service-campaign
// */
//
//@EnableWebSecurity
//@Configuration
//public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
//
// @Override
// protected void configure(HttpSecurity http) throws Exception {
// http.csrf().disable();
// }
//
// @Bean
// public FilterRegistrationBean filterRegistrationBean() {
// FilterRegistrationBean registrationBean = new FilterRegistrationBean();
// registrationBean.setName("CorsFilter");
// CorsFilter corsFilter = new CorsFilter();
// registrationBean.setFilter(corsFilter);
// registrationBean.setOrder(1);
// return registrationBean;
// }
//}
package com.viettel.campaign.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
/**
* @author hanv_itsol
* @project service-campaign
*/
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.enableSimpleBroker("/topic");
registry.setApplicationDestinationPrefixes("/app");
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/websocket").setAllowedOrigins("*").withSockJS();
}
}
\ No newline at end of file
package com.viettel.campaign.filter;
import com.viettel.campaign.utils.RedisUtil;
import com.viettel.econtact.filter.UserSession;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
......@@ -11,23 +13,44 @@ import java.io.IOException;
@Component
public class CorsFilter implements Filter {
private Logger logger = Logger.getLogger(CorsFilter.class);
// private Logger logger = Logger.getLogger(CorsFilter.class);
@Override
public void init(FilterConfig filterConfig) throws ServletException {
public void init(FilterConfig filterConfig){
}
@Override
public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) resp;
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "Origin, Authorization, X-Requested-With, Content-Type, Accept, token1, X-Auth-Token");
HttpServletRequest request = (HttpServletRequest) req;
// chain.doFilter(req, resp);
try {
if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
chain.doFilter(req, resp);
return;
}
if ("/".equals(request.getRequestURI())) {
chain.doFilter(req, resp);
return;
}
String xAuthToken = request.getHeader("X-Auth-Token");
if (xAuthToken == null || "".equals(xAuthToken)) {
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is null.");
return;
}
Object obj = RedisUtil.getInstance().get(xAuthToken);
if (obj instanceof UserSession) {
chain.doFilter(req, resp);
} catch (Exception e) {
logger.error(e.getMessage(), e);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
} else {
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is invalid.");
}
}
......
package com.viettel.campaign.filter;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
/**
* @author hanv_itsol
* @project service-campaign
*/
@Getter
@Setter
public class UserSession implements Serializable {
String authToken;
String ownserId;
String accountId;
Long userId;
String userName;
String role;
Long siteId;
Long companySiteId;
Long expTime;
}
package com.viettel.campaign.job;
import com.viettel.campaign.model.ccms_full.Campaign;
import com.viettel.campaign.model.ccms_full.Customer;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @author hanv_itsol
......@@ -13,11 +25,109 @@ import java.util.Date;
@Slf4j
public class CampaignJob {
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
private static final String CUSTOMER_INACTIVE_DUARATION = "CUSTOMER_INACTIVE_DUARATION";
private static final String CRON_EXPRESSION_CHECK_START = "CRON_EXPRESSION_CHECK_START";
private static final String CRON_EXPRESSION_CHECK_END = "CRON_EXPRESSION_CHECK_END";
// @Scheduled(fixedRate = 6000)
@Autowired
private ProcessConfigService processConfigService;
@Autowired
private CampaignService campaignService;
@Autowired
private CustomerTimeService customerTimeService;
@Autowired
private CustomerService customerService;
// @Scheduled(fixedRate = 5000)
// @Transactional( propagation = Propagation.REQUIRED)
public void process() {
log.info("processing job2 ..."+ dateFormat.format(new Date()));
log.info(Thread.currentThread().getName() + " The Task executed at " + dateFormat.format(new Date()));
List<ProcessConfig> list = processConfigService.findAll();
list.parallelStream().forEach(p -> {
boolean isExecute = DateTimeUtil.isRun(p.getConfigValue(), p.getLastProcess());
switch (p.getConfigCode()){
case CUSTOMER_INACTIVE_DUARATION:
if(isExecute){
List<Customer> customers = customerService.findAllByCondition(p.getSiteId(), new Date());
updateCustomer(customers);
updateCustomerTime(customers);
log.info("Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}", p.getSiteId());
p.setLastProcess(new Date());
processConfigService.update(p);
}
break;
case CRON_EXPRESSION_CHECK_START:
// process
if(isExecute){
List<Long> status = new ArrayList<>();
status.add(1L);
status.add(1L);
List<Campaign> campaigns = campaignService.findCampaignByCompanySiteIdAndStartTimeIsLessThanEqualAndStatusIn(p.getSiteId(), new Date(), status);
campaigns.parallelStream().forEach(campaign -> {
log.info("Chuyen trang thai chien dich ... #{} ... tu Du thao sang Trien khai", campaign.getCampaignId());
campaign.setProcessStatus(1);
campaign.setStatus(2L);
campaign.setCampaignStart(new Date());
campaignService.updateProcess(campaign);
});
log.info("Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}", p.getSiteId());
p.setLastProcess(new Date());
processConfigService.update(p);
}
break;
case CRON_EXPRESSION_CHECK_END:
// process
if(isExecute){
List<Long> status = new ArrayList<>();
status.add(2L);
status.add(3L);
List<Campaign> campaigns = campaignService.findCampaignByCompanySiteIdAndEndTimeIsLessThanEqualAndStatusIn(p.getSiteId(), new Date(), status);
campaigns.parallelStream().forEach(campaign -> {
log.info("Chuyen trang thai chien dich ... #{} ... sang Ket thuc", campaign.getCampaignId());
campaign.setStatus(4L);
campaign.setCampaignEnd(new Date());
campaignService.updateProcess(campaign);
});
log.info("Cap nhat thoi gian thuc hien tien trinh cho siteId ... #{}", p.getSiteId());
p.setLastProcess(new Date());
processConfigService.update(p);
}
break;
default:
// update last check time
}
});
}
private void updateCustomer(List<Customer> customers){
customers.parallelStream().forEach(c -> {
log.info("Cap nhat trang thai khoa cua KH ... #{}", c.getCustomerId());
c.setIpccStatus("active");
customerService.update(c);
});
}
private void updateCustomerTime(List<Customer> customers){
customers.parallelStream().forEach(customer -> {
// find all customer_time by customerId
List<CustomerTime> customerTimes = customerTimeService.findByCustomerId(customer.getCustomerId());
customerTimes.parallelStream().forEach(customerTime -> {
log.info("Cap nhat Customer time cua KH ... #{}", customerTime.getCustomerId());
customerTime.setStatus(2);
customerTime.setUpdateTime(new Date());
customerTimeService.update(customerTime);
});
});
}
}
package com.viettel.campaign.mapper;
import com.viettel.campaign.web.dto.ApParamDTO;
import com.viettel.campaign.model.ApParam;
import com.viettel.campaign.model.ccms_full.ApParam;
public class ApParamMapper extends BaseMapper<ApParam, ApParamDTO> {
......
package com.viettel.campaign.mapper;
import com.viettel.campaign.model.ccms_full.CampaignAgent;
import com.viettel.campaign.web.dto.CampaignAgentDTO;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
public class CampaignAgentMapper extends BaseMapper<CampaignAgent, CampaignAgentDTO> {
@Autowired
ModelMapper modelMapper;
@Override
public CampaignAgentDTO toDtoBean(CampaignAgent campaignAgent) {
return modelMapper.map(campaignAgent, CampaignAgentDTO.class);
}
@Override
public CampaignAgent toPersistenceBean(CampaignAgentDTO dtoBean) {
return modelMapper.map(dtoBean, CampaignAgent.class);
}
}
package com.viettel.campaign.mapper;
import com.viettel.campaign.web.dto.CampaignCompleteCodeDTO;
import com.viettel.campaign.model.CampaignCompleteCode;
import com.viettel.campaign.web.dto.CampaignCfgDTO;
import com.viettel.campaign.model.ccms_full.CampaignCfg;
public class CampaignCompleteCodeMapper extends BaseMapper<CampaignCompleteCode, CampaignCompleteCodeDTO> {
public class CampaignCompleteCodeMapper extends BaseMapper<CampaignCfg, CampaignCfgDTO> {
@Override
public CampaignCompleteCodeDTO toDtoBean(CampaignCompleteCode entity) {
CampaignCompleteCodeDTO dto = new CampaignCompleteCodeDTO();
public CampaignCfgDTO toDtoBean(CampaignCfg entity) {
CampaignCfgDTO dto = new CampaignCfgDTO();
if (entity != null) {
dto.setCampaignCompleteCodeId(entity.getCampaignCompleteCodeId());
......@@ -27,14 +27,15 @@ public class CampaignCompleteCodeMapper extends BaseMapper<CampaignCompleteCode,
dto.setCompanySiteId(entity.getCompanySiteId());
dto.setIsLock(entity.getIsLock());
dto.setDurationLock(entity.getDurationLock());
dto.setChanel(entity.getChanel());
}
return dto;
}
@Override
public CampaignCompleteCode toPersistenceBean(CampaignCompleteCodeDTO dtoBean) {
CampaignCompleteCode entity = new CampaignCompleteCode();
public CampaignCfg toPersistenceBean(CampaignCfgDTO dtoBean) {
CampaignCfg entity = new CampaignCfg();
if (dtoBean != null) {
entity.setCampaignCompleteCodeId(dtoBean.getCampaignCompleteCodeId());
......@@ -54,6 +55,7 @@ public class CampaignCompleteCodeMapper extends BaseMapper<CampaignCompleteCode,
entity.setCompanySiteId(dtoBean.getCompanySiteId());
entity.setIsLock(dtoBean.getIsLock());
entity.setDurationLock(dtoBean.getDurationLock());
entity.setChanel(dtoBean.getChanel());
}
return entity;
......
package com.viettel.campaign.mapper;
import com.viettel.campaign.model.ccms_full.CustomerList;
import com.viettel.campaign.web.dto.CustomerListDTO;
public class CustomerListMapper extends BaseMapper<CustomerList, CustomerListDTO> {
@Override
public CustomerListDTO toDtoBean(CustomerList customerList) {
CustomerListDTO obj = new CustomerListDTO();
if (customerList != null) {
obj.setCreateAt(customerList.getCreateAt());
obj.setCreateBy(customerList.getCreateBy());
obj.setCustomerListCode(customerList.getCustomerListCode());
obj.setCustomerListId(customerList.getCustomerListId());
obj.setCompanySiteId(customerList.getCompanySiteId());
obj.setCustomerListName(customerList.getCustomerListName());
obj.setDeptCreate(customerList.getDeptCreate());
obj.setSource(customerList.getSource());
obj.setStatus(customerList.getStatus());
obj.setUpdateAt(customerList.getUpdateAt());
obj.setUpdateBy(customerList.getUpdateBy());
}
return obj;
}
@Override
public CustomerList toPersistenceBean(CustomerListDTO dtoBean) {
CustomerList obj = new CustomerList();
if (dtoBean != null) {
obj.setCreateAt(dtoBean.getCreateAt());
obj.setCreateBy(dtoBean.getCreateBy());
obj.setCustomerListCode(dtoBean.getCustomerListCode());
obj.setCustomerListId(dtoBean.getCustomerListId());
obj.setCustomerListName(dtoBean.getCustomerListName());
obj.setCompanySiteId(dtoBean.getCompanySiteId());
obj.setDeptCreate(dtoBean.getDeptCreate());
obj.setSource(dtoBean.getSource());
obj.setStatus(dtoBean.getStatus());
obj.setUpdateAt(dtoBean.getUpdateAt());
obj.setUpdateBy(dtoBean.getUpdateBy());
}
return obj;
}
}
package com.viettel.campaign.mapper;
import com.viettel.campaign.web.dto.CustomerDTO;
import com.viettel.campaign.model.Customer;
import com.viettel.campaign.model.ccms_full.Customer;
public class CustomerMapper extends BaseMapper<Customer, CustomerDTO> {
......
package com.viettel.campaign.model.acd_full;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "AGENTS")
@Getter
@Setter
public class Agents {
@Id
@Basic(optional = false)
@Column(name = "AGENT_ID")
private String agentId;
@Column(name = "DESCRIPTION")
private String description;
@Column(name = "SYSTEM_STATUS")
private String systemStatus;
@Column(name = "USER_STATUS")
private String userStatus;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_START_WORK")
private Date lastStartWork;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_FINISH_WORK")
private Date lastFinishWork;
@Column(name = "LOGIN_TYPE")
private String loginType;
@Column(name = "VSA_USER_LOGIN")
private String vsaUserLogin;
@Column(name = "CALL_STATUS")
private String callStatus;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_CHANGE_STATUS")
private Date lastChangeStatus;
@Column(name = "IP_LOGIN")
private String ipLogin;
@Column(name = "NUM_REJECTCALL")
private String numRejectcall;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LOGIN_TIME")
private Date loginTime;
@Column(name = "GROUP_NAME")
private String groupName;
@Column(name = "TOTAL_ANSWER_CALL")
private String totalAnswerCall;
@Column(name = "TOTAL_ANSWER_TIME")
private String totalAnswerTime;
@Column(name = "CALLOUT_ID")
private Integer calloutId;
@Column(name = "LAST_QUEUE_ANSWER")
private String lastQueueAnswer;
@Column(name = "EMAIL_USER_STATUS")
private String emailUserAnswer;
@Column(name = "CHAT_USER_STATUS")
private String chatUserStatus;
@Column(name = "SMS_USER_STATUS")
private String smsUserStatus;
@Column(name = "MULTI_CHANNEL_USER_STATUS")
private String multiChannelUserStatus;
@Column(name = "MAX_TRANSACTION_EMAIL")
private Integer maxTransactionEmail = 1;
@Column(name = "MAX_TRANSACTION_CHAT")
private Integer maxTransactionChat = 1;
@Column(name = "MAX_CURRENT_TRANSACTION")
private Integer maxCurrentTransaction = 6;
@Column(name = "TOTAL_TRANSACTION")
private Integer totalTransaction = 0;
@Column(name = "EMAIL_SYSTEM_STATUS")
private Integer emailSystemStatus = 0;
@Column(name = "CHAT_SYSTEM_STATUS")
private Integer chatSystemStatus = 0;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_CHANGE_CHAT_STATUS")
private Date lastChangeChatStatus;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_CHANGE_EMAIL_STATUS")
private Date lastChangeEmailStatus;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_CHANGE_MULTI_STATUS")
private Date lastChangeMultiStatus;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_START_WORK_CHAT")
private Date lastStartWorkChat;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_START_WORK_EMAIL")
private Date lastStartWorkEmail;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_FINISH_WORK_CHAT")
private Date lastFinishWorkChat;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_FINISH_WORK_EMAIL")
private Date lastFinishWorkEmail;
@Column(name = "TOTAL_ANSWER_CHAT")
private Long totalAnswerChat;
@Column(name = "TOTAL_ANSWER_EMAIL")
private Long totalAnswerEmail;
@Column(name = "TOTAL_ANSWER_TIME_EMAIL")
private Long totalAnswerTimeEmail;
@Column(name = "TOTAL_ANSWER_TIME_CHAT")
private Long totalAnswerTimeChat;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_ASSIGN_TIME_SMS")
private Date lastAssignTimeSms;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_CHANGE_SMS_STATUS")
private Date lastChangeSmsStatus;
@Column(name = "MAX_TRANSACTION_SMS")
private Integer maxTransactionSms = 1;
@Column(name = "SMS_SYSTEM_STATUS")
private Integer smsSystemStatus = 0;
@Column(name = "FACEBOOK_SYSTEM_STATUS")
private Integer facebookSystemStatus = 0;
@Column(name = "FACEBOOK_USER_STATUS")
private String facebookUserStatus;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_START_WORK_SMS")
private Date lastStartWorkSms;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_START_WORK_FACEBOOK")
private Date lastStartWorkFacebook;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_FINISH_WORK_SMS")
private Date lastFinishWorkSms;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_FINISH_WORK_FACEBOOK")
private Date lastFinishWorkFacebook;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_CHANGE_FACEBOOK_STATUS")
private Date lastChangeFacebookStatus;
@Column(name = "MAX_TRANSACTION_FACEBOOK")
private Integer maxTransactionFacebook = 1;
@Column(name = "TICKET_USER_STATUS")
private String ticketUserStatus;
@Column(name = "TICKET_SYSTEM_STATUS")
private Integer ticketSystemStatus;
@Column(name = "MAX_TRANSACTION_TICKET")
private Integer maxTransactionTicket;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_START_WORK_TICKET")
private Date lastStartWorkTicket;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_FINISH_WORK_TICKET")
private Date lastFinishWorkTicket;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Column(name = "SITE_ID")
private Long siteId;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "LAST_CHANGE_TICKET_STATUS")
private Date lastChangeTicketStatus;
@Column(name = "AGENT_TYPE")
private Short agentType;
@Column(name = "STATUS")
private Long status = 1L;
@Column(name = "CREATE_BY")
private String createBy;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATE_DATE")
private Date createDate;
@Column(name = "UPDATE_BY")
private String updateBy;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "UPDATE_DATE")
private Date updateDate;
@Column(name = "USER_KAZOO_ID")
private String userKazooId;
@Column(name = "CAMPAIGN_SYSTEM_STATUS")
private String campaignSystemStatus;
@Column(name = "CURRENT_CAMPAIGN_ID")
private Long currentCampaignId;
}
package com.viettel.campaign.model.acd_full;
/**
* @author anhvd_itsol
*/
public class modeltest {
}
package com.viettel.campaign.model;
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
......
package com.viettel.campaign.model;
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
......@@ -6,7 +6,6 @@ import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Entity
......@@ -17,25 +16,27 @@ 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 BigDecimal campaignId;
private Long campaignId;
@Column(name = "COMPANY_SITE_ID")
private BigDecimal companySiteId;
private Long companySiteId;
@Column(name = "CAMPAIGN_CODE")
private String campaignCode;
@Column(name = "CAMPAIGN_NAME")
private String campaignName;
@Column(name = "CHANEL")
private BigDecimal chanel;
private Long chanel;
@Column(name = "CONTENT")
private String content;
@Column(name = "CUSTOMER_NUMBER")
private BigDecimal customerNumber;
private Long customerNumber;
@Column(name = "TARGET")
private String target;
@Column(name = "STATUS")
private BigDecimal status;
private Long status;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "START_TIME")
private Date startTime;
......@@ -65,7 +66,7 @@ public class Campaign implements Serializable {
@Column(name = "PROCESS_STATUS")
private Integer processStatus;
@Column(name = "DIAL_MODE")
private BigDecimal dialMode;
private Long dialMode;
@Column(name = "DEPT_CODE")
private String deptCode;
@Column(name = "TIME_RANGE")
......@@ -73,29 +74,29 @@ public class Campaign implements Serializable {
@Column(name = "DAY_OF_WEEK")
private String dayOfWeek;
@Column(name = "CURRENT_TIME_MODE")
private BigDecimal currentTimeModel;
private Long currentTimeMode;
@Column(name = "WRAPUP_TIME_CONNECT")
private BigDecimal wrapupTimeConnect;
private Long wrapupTimeConnect;
@Column(name = "WRAPUP_TIME_DISCONNECT")
private BigDecimal wrapupTimeDisconnect;
private Long wrapupTimeDisconnect;
@Column(name = "PREVIEW_TIME")
private BigDecimal previewTime;
private Long previewTime;
@Column(name = "RATE_DIAL")
private BigDecimal rateDial;
private Long rateDial;
@Column(name = "RATE_MISS")
private BigDecimal rateMiss;
private Long rateMiss;
@Column(name = "AVG_TIME_PROCESS")
private BigDecimal avgTimeProcess;
private Long avgTimeProcess;
@Column(name = "IS_APPLY_CUST_LOCK")
private BigDecimal isApplyCustLock;
private Long isApplyCustLock;
@Column(name = "TARGET_TYPE")
private BigDecimal targetType;
private Long targetType;
@Column(name = "IS_TARGET")
private BigDecimal isTarget;
private Long isTarget;
@Column(name = "CAMPAIGN_IVR_CALLED_ID")
private BigDecimal campaignIvrCalledId;
private Long campaignIvrCalledId;
@Column(name = "CONCURRENT_CALL")
private BigDecimal concurrentCall;
private Long concurrentCall;
@Column(name = "CALL_OUT_TIME_IN_DAY")
private String callOutTimeInDay;
@Column(name = "MUSIC_LIST")
......@@ -111,5 +112,6 @@ public class Campaign implements Serializable {
@Column(name = "TIME_WAIT_AGENT")
private Integer timeWaitAgent;
@Column(name = "QUEST_INDEX")
private BigDecimal questIndex;
private Long questIndex;
}
package com.viettel.campaign.model;
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import java.io.Serializable;
@Entity
......@@ -16,6 +13,8 @@ import java.io.Serializable;
public class CampaignAgent implements Serializable {
@Id
@GeneratedValue(generator = "CAMPAIGN_AGENT_SEQ")
@SequenceGenerator(name = "CAMPAIGN_AGENT_SEQ", sequenceName = "CAMPAIGN_AGENT_SEQ", allocationSize = 1)
@Column(name = "CAMPAIGN_AGENT_ID")
private Long campaignAgentId;
@Column(name = "CAMPAIGN_ID")
......
package com.viettel.campaign.model;
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
......@@ -12,7 +11,7 @@ import java.util.Date;
@Table(name = "CAMPAIGN_COMPLETE_CODE")
@Getter
@Setter
public class CampaignCompleteCode implements Serializable {
public class CampaignCfg implements Serializable {
@Id
@GeneratedValue(generator = "CAMPAIGN_COMPLETE_CODE_SEQ")
......@@ -54,4 +53,7 @@ public class CampaignCompleteCode implements Serializable {
private Short isLock;
@Column(name = "DURATION_LOCK")
private Long durationLock;
@Column(name = "CHANEL")
private Long chanel;
}
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;
@Entity
@Table(name = "CAMPAIGN_CUSTOMER")
@Getter
@Setter
public class CampaignCustomer {
@Id
@GeneratedValue(generator = "CAMPAIGN_CUSTOMER_SEQ")
@SequenceGenerator(name = "CAMPAIGN_CUSTOMER_SEQ", sequenceName = "CAMPAIGN_CUSTOMER_SEQ", allocationSize = 1)
@Basic(optional = false)
@NotNull
@Column(name = "CAMPAIGN_CUSTOMER_ID")
private Long campaignCustomerId;
@Column(name = "CAMPAIGN_ID")
private Long campaignId;
@Column(name = "CUSTOMER_ID")
private Long customerId;
@Column(name = "STATUS")
private Short status;
@Column(name = "AGENT_ID")
private Long agentId;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "RECALL_TIME")
private Date recallTime;
@Column(name = "RECALL_COUNT")
private Long recallCount = 0L;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CALL_TIME")
private Date callTime;
@Column(name = "CUSTOMER_LIST_ID")
private Long customerListId;
@Column(name = "IN_CAMPAIGN_STATUS")
private Short inCampaignStatus;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "SEND_TIME")
private Date sendTime;
@Column(name = "PROCESS_STATUS")
private Short processStatus = 0;
@Column(name = "CONTACT_STATUS")
private Short contactStatus;
@Column(name = "REDISTRIBUTE")
private Short redistribute;
@Column(name = "SESSION_ID")
private String sessionId;
@Column(name = "CALL_STATUS")
private Long callStatus;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Column(name = "COMPLAIN_ID")
private Long complainId;
}
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
@Entity
@Table(name = "CAMPAIGN_CUSTOMERLIST")
@Getter
@Setter
public class CampaignCustomerList {
@Id
@GeneratedValue(generator = "campaign_customer_seq")
@SequenceGenerator(name = "campaign_customer_seq", sequenceName = "campaign_customer_seq", allocationSize = 1)
@Basic(optional = false)
@NotNull
@Column(name = "CAMPAIGN_CUSTOMERLIST_ID")
private Long campaignCustomerListId;
@Column(name = "CAMPAIGN_ID")
private Long campaignId;
@Column(name = "CUSTOMER_LIST_ID")
private Long customerListId;
@Column(name = "CUSTOMER_NUMBER")
private Long customerNumber;
@Column(name = "FILTER_TYPE")
private Short filterType;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Column(name = "AGENT_FILTER_STATUS")
private Short agentFilterStatus;
}
package com.viettel.campaign.model.ccms_full;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
@Entity
@Table(name = "CAMPAIGN_CUSTOMERLIST_COLUMN")
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class CampaignCustomerListColumn implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator = "CAMPAIGN_CUS_LIST_COLUMN_SEQ")
@SequenceGenerator(name = "CAMPAIGN_CUS_LIST_COLUMN_SEQ", sequenceName = "CAMPAIGN_CUS_LIST_COLUMN_SEQ", allocationSize = 1)
@NotNull
@Column(name = "CAMPAIGN_CUS_LIST_COLUMN_ID")
private Long campaignCusListColId;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Column(name = "CAMPAIGN_ID")
private Long campaignId;
@Size(max = 200)
@Column(name = "COLUMN_NAME")
private String columnName;
@Column(name = "ORDER_INDEX")
private Long orderIndex;
@Column(name = "CUSTOMIZE_FIELD_ID")
private Long customizeFieldId;
@Size(max = 200)
@Column(name = "CUSTOMIZE_FIELD_TITLE")
private String customizeFieldTitle;
}
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
import org.springframework.stereotype.Component;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* @author anhvd_itsol
*/
@Entity
@Table(name = "CAMPAIGN_LOG")
@Getter
@Setter
public class CampaignLog implements Serializable {
@Id
@NotNull
@GeneratedValue(generator = "CAMPAIGN_LOG_SEQ")
@SequenceGenerator(name = "CAMPAIGN_LOG_SEQ", sequenceName = "CAMPAIGN_LOG_SEQ", allocationSize = 1)
@Basic(optional = false)
@Column(name = "CAMPAIGN_LOG_ID")
private Long campaignLogId;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATE_TIME")
private Date createTime;
@Column(name = "AGENT_ID")
private Long agentId;
@Column(name = "TABLE_NAME")
private String tableName;
@Column(name = "COLUMN_NAME")
private String columnName;
@Column(name = "PRE_VALUE")
private String preValue;
@Column(name = "POST_VALUE")
private String postValue;
@Column(name = "DESCRIPTION")
private String description;
@Column(name = "CAMPAIGN_ID")
private Long campaignId;
@Column(name = "CUSTOMER_ID")
private Long customerId;
}
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
@Entity
@Table(name = "CONTACT_CUST_RESULT")
@Getter
@Setter
public class ContactCustResult implements Serializable {
@Id
@NotNull
@GeneratedValue(generator = "CONTACT_CUST_RESULT_SEQ")
@SequenceGenerator(name = "CONTACT_CUST_RESULT_SEQ", sequenceName = "CONTACT_CUST_RESULT_SEQ", allocationSize = 1)
@Basic(optional = false)
@Column(name = "CONTACT_CUST_RESULT_ID")
private Long contactCustResultId;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Column(name = "CALL_STATUS")
private Short callStatus;
@Column(name = "CONTACT_STATUS")
@NotNull
private Short contactStatus;
@Column(name = "STATUS")
private Short status;
@Column(name = "SATISFACTION")
private Integer satisfaction;
@Column(name = "DESCRIPTION")
private String description;
@Column(name = "CREATE_TIME")
@NotNull
private Date createTime;
@Column(name = "AGENT_ID")
private Long agentId;
@Column(name = "UPDATE_TIME")
private Date updateTime;
@Column(name = "UPDATE_BY")
private Long updateBy;
@Column(name = "CAMPAIGN_ID")
@NotNull
private Long campaignId;
@Column(name = "OLD_CONTACT_CUST_RESULT_ID")
private Long oldContactCustResultId;
@Column(name = "CUSTOMER_ID")
@NotNull
private Long customerId;
@Column(name = "DURATION_CALL")
private Long durationCall;
@Column(name = "START_CALL")
private Date startCall;
@Column(name = "RECEIVE_CUST_LOG_ID")
@NotNull
private Long receiveCustLogId;
@Column(name = "IPCC_CALL_STATUS")
private Short ipccCallStatus;
@Column(name = "CALL_ID")
private String callId;
@Column(name = "PHONE_NUMBER")
@NotNull
private String phoneNumber;
@Column(name = "RECEIVE_TIME")
@NotNull
private Date receiveTime;
@Column(name = "PRE_END_TIME")
private Date preEndTime;
@Column(name = "URL_CALL")
private String urlCall;
@Column(name = "TRANSACTION_ID")
private String transactionId;
@Column(name = "RECALL_TIME")
private Date recallTime;
@Column(name = "IS_FINAL_RECALL")
private Short isFinalRecall;
@Column(name = "IS_SEND_EMAIL")
private Short isSendEmail = 0;
@Column(name = "SALED_ON_TPIN")
private Long saledOnTpin;
@Column(name = "END_TIME")
private Date endTime;
@Column(name = "WAIT_TIME")
private Long waitTime;
@Column(name = "DIAL_MODE")
private String dialMode;
@Column(name = "WRAPUP_TIME")
private Long wrapupTime;
@Column(name = "TIME_MAKE_CALL")
private Long timeMakeCall = 0L;
@Column(name = "TIME_RECEIVE_CUST")
private Long timeReceiveCust = 0L;
}
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
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;
@Entity
@Table(name = "CONTACT_QUEST_RESULT")
@Getter
@Setter
public class ContactQuestResult implements Serializable {
@Id
@Column(name = "CONTACT_QUEST_RESULT_ID")
@NotNull
private Long contactQuestResultId;
@Column(name = "CONTACT_CUST_RESULT_ID")
@NotNull
private Long contactCustResultId;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Column(name = "SCENARIO_QUESTION_ID")
@NotNull
private Long scenarioQuestionId;
@Column(name = "OTHER_OPINION")
private String otherOpinion;
@Column(name = "SCENARIO_ANSWER_ID")
private Long scenarioAnswerId;
@Column(name = "STATUS")
private Short status;
@Column(name = "OLD_CONTACT_CUST_RESULT_ID")
private Long oldContactCustResultId;
@Column(name = "CUSTOMER_ID")
@NotNull
private Long customerId;
@Column(name = "CAMPAIGN_ID")
@NotNull
private Long campaignId;
}
package com.viettel.campaign.model;
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
......
package com.viettel.campaign.model.ccms_full;
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;
}
package com.viettel.campaign.model;
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
......@@ -23,7 +23,7 @@ public class CustomerList implements Serializable {
@Column(name = "CUSTOMER_LIST_ID")
private Long customerListId;
@Column(name = "COMPANY_SITE_ID")
private Long customerSiteId;
private Long companySiteId;
@Size(max = 200)
@Column(name = "CUSTOMER_LIST_CODE")
private String customerListCode;
......
package com.viettel.campaign.model;
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
......
package com.viettel.campaign.model.ccms_full;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* @author hanv_itsol
* @project campaign
*/
@Entity
@Table(name = "CUSTOMER_TIME")
@Getter
@Setter
public class CustomerTime {
@Id
@NotNull
@Column(name = "CUSTOMER_TIME_ID")
private Long customerTimeId;
@Column(name = "COMPANY_SITE_ID")
private String companySiteId;
@Column(name = "CUSTOMER_ID")
private String customerId;
@Column(name = "START_TIME")
private Date startTime;
@Column(name = "END_TIME")
private Date endTime;
@Column(name = "STATUS")
private Integer status;
@Column(name = "CREATE_TIME")
private Date createTime;
@Column(name = "UPDATE_TIME")
private Date updateTime;
@Column(name = "CREATE_BY")
private String createBy;
@Column(name = "UPDATE_BY")
private String updateBy;
@Column(name = "CONTACT_CUST_RESULT_ID")
private Long contactCustResultId;
}
package com.viettel.campaign.model.ccms_full;
public class CustomizeField {
}
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 = "PROCESS_CONFIG")
@Data
public class ProcessConfig implements Serializable {
@Id
@NotNull
@Column(name = "CONFIG_ID")
private Long configId;
@Column(name = "CONFIG_NAME")
private String configName;
@Column(name = "CONFIG_CODE")
private String configCode;
@Column(name = "CONFIG_VALUE")
private String configValue;
@Column(name = "LAST_PROCESS")
private Date lastProcess;
@Column(name = "COMPANY_SITE_ID")
private Long siteId;
}
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
@Entity
@Table(name = "RECEIVE_CUST_LOG")
@Getter
@Setter
public class ReceiveCustLog implements Serializable {
@Id
@GeneratedValue(generator = "RECEIVE_CUST_LOG_SEQ")
@SequenceGenerator(name = "RECEIVE_CUST_LOG_SEQ", sequenceName = "RECEIVE_CUST_LOG_SEQ", allocationSize = 1)
@Basic(optional = false)
@NotNull
@Column(name = "RECEIVE_CUST_LOG_ID")
private Long receiveCustLogId;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Column(name = "CUSTOMER_ID")
@NotNull
private Long customerId;
@Column(name = "START_TIME")
@Temporal(TemporalType.TIMESTAMP)
@NotNull
private Date startTime;
@Column(name = "AGENT_ID")
private Long agentId;
@Column(name = "CAMPAIGN_ID")
private Long campaignId;
@Column(name = "END_TIME")
@Temporal(TemporalType.TIMESTAMP)
private Date endTime;
}
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* @author anhvd_itsol
*/
@Entity
@Table(name = "SCENARIO")
@Getter
@Setter
public class Scenario implements Serializable {
@Id
@NotNull
@GeneratedValue(generator = "SCENARIO_SEQ")
@SequenceGenerator(name = "SCENARIO_SEQ", sequenceName = "SCENARIO_SEQ", allocationSize = 1)
@Basic(optional = false)
@Column(name = "SCENARIO_ID")
private Long scenarioId;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Column(name = "CAMPAIGN_ID")
private Long campaignId;
@Column(name = "CODE")
private String code;
@Column(name = "DESCRIPTION")
private String description;
@Column(name = "CREATE_BY")
private String createBy;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATE_TIME")
private Date createTime;
@Column(name = "UPDATE_BY")
private Long updateBy;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "UPDATE_TIME")
private Date updateTime;
}
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* @author anhvd_itsol
*/
@Entity
@Table(name = "SCENARIO_ANSWER")
@Getter
@Setter
public class ScenarioAnswer {
@Id
@NotNull
@GeneratedValue(generator = "SCENARIO_ANSWER_SEQ")
@SequenceGenerator(name = "SCENARIO_ANSWER_SEQ", sequenceName = "SCENARIO_ANSWER_SEQ", allocationSize = 1)
@Basic(optional = false)
@Column(name = "SCENARIO_ANSWER_ID")
private Long scenarioAnswerId;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Column(name = "SCENARIO_QUESTION_ID")
private Long scenarioQuestionId;
@Column(name = "CODE")
private String code;
@Column(name = "ANSWER")
private String answer;
@Column(name = "ORDER_INDEX")
private Integer orderIndex;
@Column(name = "HAS_INPUT")
private Short hasInput;
@Column(name = "STATUS")
private Short status;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATE_TIME")
private Date createTime;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "DELETE_TIME")
private Date deleteTime;
@Column(name = "MAPPING_QUESTION_ID")
private Long mappingQuestionId;
}
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* @author anhvd_itsol
*/
@Entity
@Table(name = "SCENARIO_QUESTION")
@Getter
@Setter
public class ScenarioQuestion implements Serializable {
@Id
@NotNull
@GeneratedValue(generator = "SCENARIO_QES_SEQ")
@SequenceGenerator(name = "SCENARIO_QES_SEQ", sequenceName = "SCENARIO_QES_SEQ", allocationSize = 1)
@Basic(optional = false)
@Column(name = "SCENARIO_QUESTION_ID")
private Long scenarioQuestionId;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Column(name = "CAMPAIGN_ID")
private Long campaignId;
@Column(name = "SCENARIO_ID")
private Long scenarioId;
@Column(name = "CODE")
private String code;
@Column(name = "TYPE")
private Short type;
@Column(name = "QUESTION")
private String question;
@Column(name = "ORDER_INDEX")
private Long orderIndex;
@Column(name = "STATUS")
private Short status;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CREATE_TIME")
private Date createTime;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "DELETE_TIME")
private Date deleteTime;
@Column(name = "IS_REQUIRE")
private Short isRequire;
@Column(name = "IS_DEFAULT")
private Short isDefault;
@Column(name = "ANSWER_INDEX")
private Short answerIndex;
}
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
@Entity
@Table(name = "TICKET")
@XmlRootElement
@Getter
@Setter
public class Ticket implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator="ticket_seq")
@SequenceGenerator(name="ticket_seq",sequenceName="ticket_seq", allocationSize=1)
@Basic(optional = false)
@NotNull
@Column(name = "TICKET_ID")
private Long ticketId;
@Column(name = "SOURCE_ID")
private Long sourceId;
@Column(name = "CHANEL_ID")
private Long chanelId;
@Column(name = "CREATE_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date createDate;
@Size(max = 200)
@Column(name = "REF_ID")
private String refId;
@Column(name = "CUSTOMER_ID")
private Long customerId;
@Column(name = "TICKET_STATUS")
private Short ticketStatus;
@Column(name = "RESPONSE_STATUS")
private Long responseStatus;
@Column(name = "PRIORITY_ID")
private Short priorityId;
@Column(name = "RESOLVE_SLA")
@Temporal(TemporalType.TIMESTAMP)
private Date resolveSla;
@Column(name = "FIRST_RESPONE_SLA")
@Temporal(TemporalType.TIMESTAMP)
private Date firstResponeSla;
@Size(max = 400)
@Column(name = "AGENT_PROCESS")
private String agentProcess;
@Size(max = 400)
@Column(name = "AGENT_ASSIGN")
private String agentAssign;
@Column(name = "FIRST_RESPONE_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date firstResponeDate;
@Column(name = "RESOLVE_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date resolveDate;
@Column(name = "ASSIGN_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date assignDate;
@Column(name = "SECOND_RESPONE_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date secondResponeDate;
@Size(max = 20)
@Column(name = "AGENT_ID")
private String agentId;
@Size(max = 20)
@Column(name = "AGENT_ASSIGN_ID")
private String agentAssignId;
@Column(name = "TICKET_SLA_ID")
private Long ticketSlaId;
@Column(name = "SITE_ID")
private Long siteId;
@Column(name = "REQUEST_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date requestDate;
@Column(name = "LAST_REQUEST_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date lastRequestDate;
@Column(name = "TICKET_TYPE_ID")
private Long ticketTypeId;
@Column(name = "SECOND_RESPONE_SLA")
@Temporal(TemporalType.TIMESTAMP)
private Date secondResponeSla;
@Column(name = "COOPERATE_ID")
private Long cooperateId;
@Column(name = "POST_TYPE_ID")
private Long postTypeId;
@Column(name = "USER_READ")
private String userRead;
@Column(name = "POST_CUSTOMER")
private Long postCustomer;
@Column(name = "REASON")
private String reason;
@Column(name = "PROCESS")
private String process;
@Column(name = "LAST_UPDATE_TIME")
@Temporal(TemporalType.TIMESTAMP)
private Date lastUpdateTime;
@Column(name = "SLA_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date slaDate;
@Column(name = "SLA_PROCESS_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date slaProcessDate;
@Column(name = "SLA_COOPERATE_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date slaCooperateDate;
@Column(name = "SLA_PROCESS_CONFIG")
private Long slaProcessConfig;
@Column(name = "SLA_COOPERATE_CONFIG")
private Long slaCooperateConfig;
// @Column(name = "COMPANY_SITE_ID")
// private Long companySiteId;
@Column(name = "REOPEN_DATE")
private Date reopenDate;
@Column(name = "COMPANY_SITE_ID")
private Long companyId;
@Column(name = "ASSIGN_TYPE")
private Long assignType;
//bo sung ignored va close reason
@Column(name = "IGNORED")
private Long ignored;
@Column(name = "REASON_CAT_ITEM_ID")
private Long reasonCatItemId;
@Column(name = "PROBLEM_CAT_ITEM_ID")
private Long problemCatItemId;
@Column(name = "VIEW_TYPE")
private Long viewType;
@Column(name = "SUBJECT")
private String subject;
@Column(name = "CLASSIFY_REQUIRE_ID")
private Long classifyRequireId;
@Column(name = "AGENT_RECEIVE")
private String agentReceive;
@Lob
@Column(name = "CONTENT_RECEIVE")
private String contentReceive;
}
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@Entity
@Table(name = "TICKET_CAT_STATUS")
@Getter
@Setter
public class TicketCatStatus implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator="ticket_cat_status_seq")
@SequenceGenerator(name="ticket_cat_status_seq",sequenceName="ticket_cat_status_seq", allocationSize=1)
@Basic(optional = false)
@NotNull
@Column(name = "STATUS_ID")
private Long statusId;
@Size(max = 100)
@Column(name = "STATUS_NAME")
private String statusName;
@Size(max = 50)
@Column(name = "STATUS_CODE")
private String statusCode;
@Size(max = 100)
@Column(name = "CREATE_BY")
private String createBy;
@Column(name = "CREATE_TIME")
@Temporal(TemporalType.TIMESTAMP)
private Date createTime;
@Column(name = "COMPANY_ID")
private Long companyId;
@Column(name = "ACTIVE")
private Short active;
}
package com.viettel.campaign.model;
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
......
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* @author anhvd_itsol
*/
@Entity
@Table(name = "TIME_RANGE_DIAL_MODE")
@Getter
@Setter
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;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "START_TIME")
private Date startTime;
@Column(name = "CAMPAIGN_ID")
private Long campaignId;
@Column(name = "DIAL_MODE")
private Short dialMode;
@Column(name = "USER_ID")
private Long userId;
}
package com.viettel.campaign.model.ccms_full;
import javax.persistence.Entity;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author anhvd_itsol
*/
@Entity
@Table(name = "TIME_ZONE_DIAL_MODE")
@Getter
@Setter
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 timeZoneDialModeId;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Column(name = "HOUR")
private String hour;
@Column(name = "MINUTE")
private String minute;
@Column(name = "CAMPAIGN_ID")
private Long campaignId;
@Column(name = "DIAL_MODE")
private Short dialMode;
@Column(name = "USER_ID")
private Long userId;
}
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;
@Entity
@Table(name = "VSA_USERS")
@Getter
@Setter
public class VSAUsers {
@Id
@NotNull
@GeneratedValue(generator = "vsa_users_renew")
@SequenceGenerator(name = "vsa_users_renew", sequenceName = "vsa_users_renew", allocationSize = 1)
@Basic(optional = false)
@Column(name = "USER_ID")
private Long userId;
@Column(name = "USER_NAME")
private String userName;
@Column(name = "STATUS")
private Short status;
@Column(name = "FULL_NAME")
private String fullName;
@Column(name = "USER_TYPE_ID")
private Long userTypeId;
@Column(name = "CREATE_DATE")
private Date createDate;
@Column(name = "DESCRIPTION")
private String description;
@Column(name = "STAFF_CODE")
private String staffCode;
@Column(name = "MANAGER_ID")
private Long managerId;
@Column(name = "LOCATION_ID")
private Long locationId;
@Column(name = "DEPT_ID")
private Long deptId;
@Column(name = "DEPT_LEVEL")
private String deptLevel;
@Column(name = "POS_ID")
private Long posId;
@Column(name = "DEPT_NAME")
private String deptName;
@Column(name = "GROUP_ID")
private Long groupId;
@Column(name = "SITE_ID")
private Long siteId;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Column(name = "AGENT_TYPE")
private Short agentType;
@Column(name = "MOBILE_NUMBER")
private String mobileNumber;
@Column(name = "FACEBOOK_ID")
private String facebookId;
@Column(name = "LOGIN_TYPE")
private Short loginType;
@Column(name = "GOOGLE_ID")
private String googleId;
@Column(name = "EMAIL")
private String email;
@Column(name = "AVAILABLE_TICKET")
private Long availableTicket;
@Column(name = "USER_KAZOO_ID")
private String userKazooId;
}
package com.viettel.campaign.repository;
import com.viettel.campaign.model.CampaignCompleteCode;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CampaignCompleteCodeRepository extends JpaRepository<CampaignCompleteCode, Long> {
Page<CampaignCompleteCode> findAll(Pageable pageable);
@Query("FROM CampaignCompleteCode WHERE completeName LIKE concat('%', :name, '%') ")
List<CampaignCompleteCode> findByName(@Param("name") String Name, Pageable pageable);
List<CampaignCompleteCode> findByCompleteNameContains(String Name, Pageable pageable);
}
package com.viettel.campaign.repository.acd_full;
import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.model.acd_full.Agents;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository
@Transactional(DataSourceQualify.ACD_FULL)
public interface AgentsRepository extends JpaRepository<Agents, String> {
Agents findByAgentId(String agentId);
@Modifying
@Query(value = "UPDATE Agents SET campaignSystemStatus = :campaignSystemStatus WHERE agentId = :agentId")
void updateAgentLogoutFromCampaign(@Param("agentId") Long agentId, @Param("campaignSystemStatus") String campaignSystemStatus);
}
package com.viettel.campaign.repository.acd_full;
/**
* @author anhvd_itsol
*/
public class acdrepotest {
}
package com.viettel.campaign.repository;
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ApParam;
import com.viettel.campaign.model.ccms_full.ApParam;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
......@@ -17,4 +17,10 @@ public interface ApParamRepository extends JpaRepository<ApParam, Long>, ApParam
@Query(value = "SELECT p FROM ApParam p WHERE parName LIKE concat('%', :parName, '%') ")
List<ApParam> findParamByName(@Param("parName") String parName, Pageable pageable);
@Query(value = "SELECT p FROM ApParam p WHERE status = 1 AND parType LIKE concat('%', :parType, '%') ")
List<ApParam> findParamByParType(@Param("parType") String parType);
@Query(value = "FROM ApParam WHERE status = 1 AND parType = :parType")
List<ApParam> findAllParam(@Param("parType") String parType);
}
package com.viettel.campaign.repository;
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ApParam;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface ApParamRepositoryCustom {
......
package com.viettel.campaign.repository;
package com.viettel.campaign.repository.ccms_full;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.model.ccms_full.CampaignAgent;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Repository
@Transactional(DataSourceQualify.CCMS_FULL)
public interface CampaignAgentRepository extends JpaRepository<CampaignAgent, Long> {
@Query(value = "SELECT campaign_agent_seq.nextval FROM DUAL", nativeQuery = true)
Long getNextSeqId();
@Modifying
@Query("UPDATE CampaignAgent SET status = :status WHERE agentId = :agentId AND campaignId = :campaignId")
void updateCampaignAgentSetStatus(@Param("agentId") Long agentId, @Param("campaignId") Long campaignId, @Param("status") Integer status);
@Modifying
@Query("delete from CampaignAgent c where c.campaignAgentId in (:p_campaign_agent_id)")
int deleteCampaignAgent(@Param("p_campaign_agent_id") List<Long> campaignAgentId);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.CampaignCfg;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CampaignCfgRepository extends JpaRepository<CampaignCfg, Long>{
@Query(" select u FROM CampaignCfg u WHERE u.status = 1")
Page<CampaignCfg> findAll(Pageable pageable);
@Query("FROM CampaignCfg WHERE completeName LIKE concat('%', :name, '%') ")
List<CampaignCfg> findByName(@Param("name") String name, Pageable pageable);
List<CampaignCfg> findByCompleteNameContains(String name, Pageable pageable);
@Modifying
@Query("update CampaignCfg c set c.status = 0 where c.campaignCompleteCodeId in (:p_ids) and c.companySiteId=:p_company_site_id" )
int deletedList(@Param("p_ids") List<Long> p_ids, @Param("p_company_site_id") Long p_company_site_id);
List<CampaignCfg> findCampaignCompleteCodesByCompanySiteId(Long companySiteId);
@Query(value="SELECT max(completeValue) FROM CampaignCfg WHERE companySiteId = :companySiteId GROUP BY companySiteId")
Short findByMaxCompanySiteId(Long companySiteId);
@Modifying
@Query("update CampaignCfg c set c.status = 0 where c.campaignCompleteCodeId=:p_campaignCompleteCode_list_id and c.companySiteId=:p_company_site_id")
int deleteCampaignCompleteCodeBy(@Param("p_campaignCompleteCode_list_id") Long p_campaignCompleteCode_list_id, @Param("p_company_site_id") Long p_company_site_id);
@Query(value = "FROM CampaignCfg WHERE status = 1 AND completeValue = :completeValue AND completeType = :completeType AND companySiteId = :companySiteId")
List<CampaignCfg> getCustomerStatus(@Param("completeValue") String completeValue, @Param("completeType") Short completeType, @Param("companySiteId") Long companySiteId);
@Query(value = "FROM CampaignCfg WHERE status = 1 AND completeValue <> :completeValue AND completeType = :completeType AND companySiteId = :companySiteId")
List<CampaignCfg> getCustomerStatusWithoutValue(@Param("completeValue") String completeValue, @Param("completeType") Short completeType, @Param("companySiteId") Long companySiteId);
@Query("select c from CampaignCfg c where c.companySiteId =:p_company_site_id")
List<CampaignCfg> findAllCampaignCompleteCode();
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.CampaignCfg;
public interface CampaignCfgRepositoryCustom {
CampaignCfg updateStatusById(Long id);
CampaignCfg findMaxValueCampaignType(Long companySiteId);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.CampaignCustomerList;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface CampaignCustomerListRepository extends JpaRepository<CampaignCustomerList, Long> {
@Query("select count (c.campaignId) from CampaignCustomerList c where c.customerListId=:customerListId")
Long campaignCount(@Param("customerListId") long customerListId);
@Query("select count (c.campaignId) from CampaignCustomerList c where c.customerListId in (:ids)")
Long campaignIdsCount(@Param("ids") List<Long> ids);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.model.ccms_full.CampaignCustomer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Repository
@Transactional(DataSourceQualify.CCMS_FULL)
public interface CampaignCustomerRepository extends JpaRepository<CampaignCustomer, Long>, CampaignCustomerRepositoryCustom {
@Query(value = "SELECT COUNT(*) " +
"FROM CAMPAIGN_CUSTOMER CC JOIN CAMPAIGN_COMPLETE_CODE CCC ON CC.CAMPAIGN_ID = CCC.CAMPAIGN_ID " +
"WHERE CC.STATUS = 3 AND CC.CAMPAIGN_ID = :campaignId AND CC.CUSTOMER_ID = :customerId AND CCC.IS_RECALL = 1 AND CCC.STATUS = 1 ",
nativeQuery = true)
Long getCustomerRecall(@Param("campaignId") Long campaignId, @Param("customerId") Long customerId);
@Query(value = "SELECT cc.customer_id \n" +
"FROM campaign_customer cc LEFT JOIN receive_cust_log cl ON cc.customer_id = cl.customer_id\n" +
"WHERE cc.campaign_id = :campaignId \n" +
" AND cc.agent_id = :agentId \n" +
" AND cc.in_campaign_status = 1 \n" +
" AND cl.customer_id IS NULL \n" +
" AND EXISTS(SELECT 1 \n" +
" FROM campaign_complete_code ccc \n" +
" WHERE cc.status = ccc.complete_value \n" +
" AND ccc.status = 1 \n" +
" AND ccc.is_recall = 1 \n" +
" AND ccc.complete_type = 2 \n" +
" AND ccc.company_site_id = :companySiteId) \n" +
" AND cc.recall_time <= SYSDATE\n" +
" AND cc.recall_time + interval :apParam MINUTE >= SYSDATE", nativeQuery = true)
List<CampaignCustomer> getCustomerRecallDate(@Param("campaignId") Long campaignId, @Param("agentId") Long agentId, @Param("companySiteId") Long companySiteId, @Param("apParam") String apParam);
CampaignCustomer findCampaignCustomerByCampaignCustomerId(Long id);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.web.dto.CampaignCustomerDTO;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CampaignCustomerRepositoryCustom {
List<CampaignCustomerDTO> getDataCampaignCustomer(CampaignCustomerDTO dto, String expression);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.web.dto.ApParamDTO;
import com.viettel.campaign.web.dto.CampaignDTO;
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.data.domain.Pageable;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CampaignExecuteRepository {
List<CampaignDTO> searchCampaignExecute(CampaignRequestDTO campaignRequestDto, Pageable pageable);
//<editor-fold: hungtt>
List<ApParamDTO> getComboBoxStatus(String companySiteId, String completeType);
List<ApParamDTO> getComboCampaignType(String companySiteId);
ResultDTO getInteractiveResult(CampaignRequestDTO dto);
List<ContactCustResultDTO> getExcelInteractiveResult(CampaignRequestDTO dto);
List<ContactCustResultDTO> getContactCustById(CampaignRequestDTO dto);
//</editor-fold: hungtt>
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.CampaignLog;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* @author anhvd_itsol
*/
@Repository
public interface CampaignLogRepository extends JpaRepository<CampaignLog, Long> {
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.Campaign;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
@Repository
public interface CampaignRepository extends JpaRepository<Campaign, Long> {
List<Campaign> findAllByCompanySiteId(Long companyId);
List<Campaign> findCampaignByCompanySiteIdAndStartTimeIsLessThanEqualAndStatusIn(Long siteId, Date startTime, List<Long> status);
List<Campaign> findCampaignByCompanySiteIdAndEndTimeIsLessThanEqualAndStatusIn(Long siteId, Date endTime, List<Long> status);
@Query("SELECT COUNT(c.campaignId) " +
" FROM Campaign c JOIN CampaignCustomer cc ON c.campaignId = cc.campaignId " +
" WHERE cc.companySiteId = :pCompanySiteId " +
" AND cc.status = 1 " +
" AND cc.recallTime <= sysdate " +
" AND cc.agentId = :pAgentId")
Long countRecallCustomer(@Param("pCompanySiteId") Long pCompanySiteId, @Param("pAgentId") Long pAgentId);
Campaign findByCampaignId(Long campaignId);
Campaign findCampaignByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
}
package com.viettel.campaign.repository;
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.web.dto.CampaignDTO;
import com.viettel.campaign.dto.request_dto.CampaignRequestDTO;
import com.viettel.campaign.web.dto.ResultDTO;
import org.springframework.data.domain.Pageable;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CampaignRepositoryCustom {
List<CampaignDTO> searchCampaignExecute(String agentId, Pageable pageable);
ResultDTO search(CampaignRequestDTO requestDto);
ResultDTO findByCampaignCode(CampaignRequestDTO requestDTO);
String getMaxCampaignIndex();
ResultDTO checkAllowStatusToPrepare(Long campaignId);
//hungtt
ResultDTO findCustomerListReallocation(CampaignRequestDTO dto);
//hungtt
ResultDTO reallocationCustomer(CampaignRequestDTO dto);
//hungtt
ResultDTO getListFieldsNotShow(CampaignRequestDTO dto);
//hungtt
ResultDTO getListFieldsToShow(CampaignRequestDTO dto);
}
package com.viettel.campaign.repository;
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.Campaign;
import com.viettel.campaign.model.ccms_full.ContactCustResult;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface CampaignRepository extends JpaRepository<Campaign, Long>, CampaignRepositoryCustom {
public interface ContactCustResultRepository extends JpaRepository<ContactCustResult, Long> {
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.ContactQuestResult;
import com.viettel.campaign.web.dto.ContactQuestResultDTO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface ContactQuestResultRepository extends JpaRepository<ContactQuestResult, Long> {
List<ContactQuestResultDTO> findByCompanySiteIdAndCampaignId(Long companySiteId, Long campaignId);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.CustomerContact;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface CustomerContactRepository extends JpaRepository<CustomerContact, Long> {
@Query("FROM CustomerContact WHERE status = 1 AND customerId = :customerId AND contactType = :contactType AND (contact IS NULL OR UPPER(contact) LIKE UPPER(concat('%', :contact, '%')))")
List<CustomerContact> findByCustomerIdAndAndContactTypeAndContact(@Param("customerId") Long customerId, @Param("contactType") Short contactType, @Param("contact") String contact, Pageable pageable);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.CustomerListMapping;
import org.springframework.data.jpa.repository.JpaRepository;
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 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);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.CustomerList;
import org.springframework.data.jpa.repository.JpaRepository;
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 CustomerListRepository extends JpaRepository<CustomerList, Long> {
CustomerList findByCustomerListIdAndCompanySiteId(long customerListId, long companySiteId);
CustomerList findByCustomerListCode(String customerListCode);
@Modifying
@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);
@Query(value = "SELECT * FROM (SELECT c.*, MAX(c.CREATE_AT) OVER() AS LATEST_CREATED FROM CUSTOMER_LIST c) WHERE CREATE_AT = LATEST_CREATED AND COMPANY_SITE_ID =:p_company_site_id", nativeQuery = true)
CustomerList latestCreated(@Param("p_company_site_id") Long p_company_site_id);
}
package com.viettel.campaign.repository;
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.Customer;
import com.viettel.campaign.model.ccms_full.Customer;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
@Repository
......@@ -14,9 +17,19 @@ 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);
@Query("SELECT COUNT(0) FROM Customer t WHERE t.mobileNumber = ?1 and t.siteId = ?2 and t.status = 1 ")
Long findByMobileNumberAndSiteId(String mobileNumber, Long siteId);
@Modifying
@Query("delete from Customer c where c.customerId in (:ids)")
int deleteIds(@Param("ids") List<Long> ids);
@Query("select c from Customer c left join com.viettel.campaign.model.ccms_full.CustomerTime ct on c.customerId = ct.customerId " +
"where c.ipccStatus = 'locked' and c.siteId =?1 and ct.endTime <= ?2")
List<Customer> findAllByCondition(Long siteId, Date endTime);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.CustomerTime;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author hanv_itsol
* @project campaign
*/
@Repository
public interface CustomerTimeRepository extends JpaRepository<CustomerTime, Long> {
List<CustomerTime> findByCustomerId(Long customerId);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.ProcessConfig;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author hanv_itsol
* @project campaign
*/
@Repository
public interface ProcessConfigRepository extends JpaRepository<ProcessConfig, Long> {
List<ProcessConfig> findAllByConfigCode(String configCode);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.ReceiveCustLog;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ReceiveCustLogRepository extends JpaRepository<ReceiveCustLog, Long> {
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.ScenarioAnswer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author anhvd_itsol
*/
@Repository
public interface ScenarioAnswerRepository extends JpaRepository<ScenarioAnswer, Long> {
List<ScenarioAnswer> findByScenarioQuestionIdAndCompanySiteIdAndStatus(Long scenarioQuestionId, Long companySiteId, Short status);
@Query(value="SELECT MAX(orderIndex) FROM ScenarioAnswer WHERE scenarioQuestionId = :scenarioQuestionId AND companySiteId = :companySiteId AND status = 1")
Long getMaxAnswerOrderId(@Param("scenarioQuestionId") Long scenarioQuestionId, @Param("companySiteId") Long companySiteId);
Integer deleteScenarioAnswersByScenarioQuestionId(Long scenarioQuestionId);
ScenarioAnswer findScenarioAnswerByScenarioAnswerId(Long scenarioAnswerId);
}
package com.viettel.campaign.repository.ccms_full;
/**
* @author anhvd_itsol
*/
public interface ScenarioAnswerRepositoryCustom {
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.ScenarioQuestion;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author anhvd_itsol
*/
@Repository
public interface ScenarioQuestionRepository extends JpaRepository<ScenarioQuestion, Long> {
List<ScenarioQuestion> findScenarioQuestionsByScenarioIdAndCampaignIdAndCompanySiteIdAndStatusOrderByOrderIndex(Long scenarioId, Long campaignId, Long companySiteId, Short status);
@Query(value="SELECT MAX(orderIndex) FROM ScenarioQuestion WHERE scenarioId = :scenarioId AND campaignId = :campaignId AND companySiteId = :companySiteId AND status = 1")
Long getMaxOrderId(@Param("scenarioId") Long scenarioId, @Param("campaignId") Long campaignId, @Param("companySiteId") Long companySiteId);
@Query(value = "SELECT COUNT(1) FROM ScenarioQuestion WHERE code = :code AND scenarioId = :scenarioId AND campaignId = :campaignId AND companySiteId = :companySiteId AND status = 1")
Integer countDuplicateQuestionCode(@Param("code") String code, @Param("scenarioId") Long scenarioId, @Param("campaignId") Long campaignId, @Param("companySiteId") Long companySiteId);
ScenarioQuestion findScenarioQuestionByScenarioQuestionId(Long scenarioQuestionId);
}
package com.viettel.campaign.repository.ccms_full;
/**
* @author anhvd_itsol
*/
public interface ScenarioQuestionRepositoryCustom {
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.Scenario;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* @author anhvd_itsol
*/
@Repository
public interface ScenarioRepository extends JpaRepository<Scenario, Long> {
Scenario findScenarioByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
}
package com.viettel.campaign.repository.ccms_full;
/**
* @author anhvd_itsol
*/
public interface ScenarioRepositoryCustom {
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.Ticket;
public interface TicketRepository extends BaseRepository<Ticket>, TicketRepositoryCustom {
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.web.dto.TicketDTO;
import org.springframework.data.domain.Pageable;
import java.util.List;
public interface TicketRepositoryCustom {
List<TicketDTO> getHistory(String customerId, Pageable pageable);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.TimeRangeDialMode;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author anhvd_itsol
*/
@Repository
public interface TimeRangeDialModeRepository extends JpaRepository<TimeRangeDialMode, Long> {
List<TimeRangeDialMode> findTimeRangeDialModeByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
@Query(value = "SELECT * FROM TIME_RANGE_DIAL_MODE r " +
"WHERE r.CAMPAIGN_ID = :campaignId AND r.COMPANY_SITE_ID = :companySiteId AND TO_CHAR(r.START_TIME,'HH24:MI:SS') <= TO_CHAR(SYSDATE,'HH24:MI:SS')", nativeQuery = true)
TimeRangeDialMode findDialModeAtCurrent(@Param("campaignId") Long campaignId, @Param("companySiteId") Long companySiteId);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.TimeZoneDialMode;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author anhvd_itsol
*/
@Repository
public interface TimeZoneDialModeRepository extends JpaRepository<TimeZoneDialMode, Long> {
List<TimeZoneDialMode> findTimeZoneDialModeByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
@Query(value = "SELECT * FROM TIME_ZONE_DIAL_MODE z " +
"WHERE z.CAMPAIGN_ID = :campaignId AND z.COMPANY_SITE_ID = :companySiteId AND concat(z.HOUR, ':', z.MINUTE) <= TO_CHAR(SYSDATE,'HH24:MI')", nativeQuery = true)
TimeZoneDialMode findDialModeAtCurrent(@Param("campaignId") Long campaignId, @Param("companySiteId") Long companySiteId);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.UserActionLogDTO;
import org.springframework.transaction.annotation.Transactional;
/**
* @author anhvd_itsol
*/
public interface UserActionLogRepositoryCustom {
@Transactional(DataSourceQualify.CCMS_FULL)
ResultDTO insertToUserActionLog(UserActionLogDTO userActionLogDTO);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.VSAUsers;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface VSAUsersRepository extends JpaRepository<VSAUsers, Long> {
List<VSAUsers> findAllByCompanySiteId(Long companySiteId);
}
package com.viettel.campaign.repository.ccms_full.impl;
import com.viettel.campaign.repository.ccms_full.ApParamRepositoryCustom;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository
@Transactional
public class AppParamRepositoryImpl implements ApParamRepositoryCustom {
}
package com.viettel.campaign.repository.ccms_full.impl;
import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.model.ccms_full.CampaignCfg;
import com.viettel.campaign.repository.ccms_full.CampaignCfgRepositoryCustom;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@Repository
public class CampaignCfgRepositoryIpml implements CampaignCfgRepositoryCustom {
@Autowired
@PersistenceContext( unitName= DataSourceQualify.JPA_UNIT_NAME_CCMS_FULL)
private EntityManager entityManager;
private Logger log = LoggerFactory.getLogger(CampaignCfgRepositoryIpml.class);
@Override
// @Transactional(DataSourceQualify.CCMS_FULL)
public CampaignCfg updateStatusById(Long id) {
CampaignCfg dto = new CampaignCfg();
try {
CampaignCfg e = entityManager.find(CampaignCfg.class, id);
e.setStatus(new Short("0")); // set status = 0 --> khong hoat dong
entityManager.merge(e);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return dto;
}
@Override
// @Transactional(DataSourceQualify.CCMS_FULL)
public CampaignCfg findMaxValueCampaignType(Long companySiteId) {
CampaignCfg result = new CampaignCfg();
try {
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return result;
}
}
package com.viettel.campaign.repository.ccms_full.impl;
import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.model.ccms_full.ApParam;
import com.viettel.campaign.repository.ccms_full.ApParamRepository;
import com.viettel.campaign.repository.ccms_full.CampaignCustomerRepositoryCustom;
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.CampaignCustomerDTO;
import com.viettel.campaign.web.dto.ResultDTO;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.transform.Transformers;
import org.hibernate.type.*;
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.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@Transactional(DataSourceQualify.CCMS_FULL)
public class CampaignCustomerRepositoryImpl implements CampaignCustomerRepositoryCustom {
@Autowired
ApParamRepository apParamRepository;
@Autowired
@PersistenceContext(unitName = DataSourceQualify.JPA_UNIT_NAME_CCMS_FULL)
EntityManager entityManager;
@Override
public List<CampaignCustomerDTO> getDataCampaignCustomer(CampaignCustomerDTO customerDTO, String expression) {
List<CampaignCustomerDTO> result = new ArrayList<>();
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
try {
SQLQuery query = session.createSQLQuery(expression);
query.setParameter("campaignId", customerDTO.getCampaignId());
query.setParameter("companySiteId", customerDTO.getCompanySiteId());
if (expression.contains(":agentId")) {
query.setParameter("agentId", customerDTO.getAgentId());
}
if (expression.contains(":dungSai")) {
List<ApParam> apParam = apParamRepository.findAllParam("DUNG_SAI");
query.setParameter("dungSai", apParam.get(0).getParValue());
}
query.addScalar("customerId", new LongType());
query.setResultTransformer(Transformers.aliasToBean(CampaignCustomerDTO.class));
result = query.list();
} catch (Exception ex) {
ex.printStackTrace();
} finally {
session.close();
}
return result;
}
}
package com.viettel.campaign.repository.ccms_full.impl;
/**
* @author anhvd_itsol
*/
public class ScenarioAnswerRepositoryImpl {
}
package com.viettel.campaign.repository.ccms_full.impl;
import com.viettel.campaign.repository.ccms_full.ScenarioQuestionRepositoryCustom;
import org.springframework.stereotype.Repository;
/**
* @author anhvd_itsol
*/
@Repository
public class ScenarioQuestionRepositoryImpl implements ScenarioQuestionRepositoryCustom {
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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