merge campaign
This commit is contained in:
parent
ab5d1f579a
commit
2a0e2e2512
102
campaign/pom.xml
102
campaign/pom.xml
@ -1,102 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
|
||||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<artifactId>yo-campaign</artifactId>
|
|
||||||
<version>0.0.1-RELEASE</version>
|
|
||||||
<name>Yo Campaign</name>
|
|
||||||
<description>Yo Campaign</description>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<parent>
|
|
||||||
<groupId>com.pudonghot.yo</groupId>
|
|
||||||
<artifactId>yo</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<relativePath>../</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<spring-boot.run.main-class>com.pudonghot.yo.campaign.YoCampaign</spring-boot.run.main-class>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.pudonghot.yo</groupId>
|
|
||||||
<artifactId>yo-fsagent-api</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.pudonghot.yo</groupId>
|
|
||||||
<artifactId>yo-openapi-dto</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.pudonghot.yo</groupId>
|
|
||||||
<artifactId>yo-service-common</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.wacai.tigon</groupId>
|
|
||||||
<artifactId>tigon-common</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.pudonghot.yo</groupId>
|
|
||||||
<artifactId>yo-web-common</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-httpclient</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.github.openfeign</groupId>
|
|
||||||
<artifactId>feign-jackson</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.dubbo</groupId>
|
|
||||||
<artifactId>dubbo-spring-boot-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.dubbo</groupId>
|
|
||||||
<artifactId>dubbo-dependencies-zookeeper</artifactId>
|
|
||||||
<type>pom</type>
|
|
||||||
</dependency>
|
|
||||||
<!-- Provided Dependencies -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Test Dependencies -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<skip>false</skip>
|
|
||||||
<fork>true</fork>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>pl.project13.maven</groupId>
|
|
||||||
<artifactId>git-commit-id-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
@ -1,23 +0,0 @@
|
|||||||
package com.pudonghot.yo.campaign;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Donghuang
|
|
||||||
* @date Jul 18, 2020 17:25:36
|
|
||||||
*/
|
|
||||||
@EnableFeignClients
|
|
||||||
@SpringBootApplication
|
|
||||||
public class YoCampaign {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* main
|
|
||||||
*
|
|
||||||
* @param args args
|
|
||||||
*/
|
|
||||||
public static void main(final String[] args) {
|
|
||||||
SpringApplication.run(YoCampaign.class, args);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package com.pudonghot.yo.campaign.controller;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Donghuang
|
|
||||||
* @date Jul 18, 2020 17:24:13
|
|
||||||
*/
|
|
||||||
@Controller
|
|
||||||
public class SiteController {
|
|
||||||
|
|
||||||
@GetMapping("/")
|
|
||||||
public void index() {
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
# Yo Campaign
|
|
||||||
server.port=8086
|
|
||||||
spring.application.name=yo-campaign
|
|
||||||
spring.jackson.time-zone=GMT+8
|
|
||||||
spring.jackson.serialization.write-dates-as-timestamps=true
|
|
||||||
spring.jackson.serialization.fail-on-empty-beans=false
|
|
||||||
spring.servlet.multipart.max-file-size=256MB
|
|
||||||
spring.servlet.multipart.max-request-size=256MB
|
|
||||||
site.context-path=
|
|
||||||
|
|
||||||
tigon.query-service.scan.page-size=512
|
|
||||||
|
|
||||||
# Datasource Yo
|
|
||||||
yo.datasource.url=jdbc:mysql://localhost/callcenter?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
|
||||||
yo.datasource.username=yo
|
|
||||||
yo.datasource.password=yo_query!
|
|
||||||
|
|
||||||
# Datasource FreeSWITCH
|
|
||||||
yo.fs.datasource.url=jdbc:mysql://localhost/freeswitch?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
|
||||||
yo.fs.datasource.username=freeswitch
|
|
||||||
yo.fs.datasource.password=RR!h5IpirsnJ
|
|
||||||
|
|
||||||
# Redis
|
|
||||||
spring.redis.host=localhost
|
|
||||||
spring.redis.port=6379
|
|
||||||
# spring.redis.password=123456
|
|
||||||
|
|
||||||
# Dubbo
|
|
||||||
dubbo.registry.address=zookeeper://localhost:2181
|
|
||||||
dubbo.registry.file=${user.home}/dubbo-cache/${spring.application.name}/dubbo.cache
|
|
||||||
yo.fsagent.dubbo.service.version=1.0.0
|
|
||||||
|
|
||||||
# Calling List
|
|
||||||
yo.campaign.feign.calling-list.base-url=http://localhost:1116
|
|
||||||
yo.campaign.feign.calling-list.channel=campaign.json
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
|||||||
server.port=8087
|
|
||||||
spring.application.name=yo-campaign
|
|
||||||
spring.jackson.time-zone=GMT+8
|
|
||||||
spring.jackson.serialization.write-dates-as-timestamps=true
|
|
||||||
spring.jackson.serialization.fail-on-empty-beans=false
|
|
||||||
|
|
||||||
tigon.query-service.scan.page-size=512
|
|
||||||
|
|
||||||
# Datasource
|
|
||||||
yo.datasource.url=jdbc:mysql://localhost/yoqw?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
|
||||||
yo.datasource.username=yoqw
|
|
||||||
yo.datasource.password=yoqw_query!
|
|
||||||
|
|
||||||
# Datasource FreeSWITCH
|
|
||||||
yo.fs.datasource.url=jdbc:mysql://localhost/fs_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
|
||||||
yo.fs.datasource.username=freeswitch
|
|
||||||
yo.fs.datasource.password=RR!h5IpirsnJ
|
|
||||||
|
|
||||||
# Redis
|
|
||||||
spring.redis.host=localhost
|
|
||||||
spring.redis.port=6379
|
|
||||||
spring.redis.password=123456
|
|
||||||
|
|
||||||
# Dubbo
|
|
||||||
|
|
||||||
## Dubbo Registry
|
|
||||||
dubbo.registry.address=zookeeper://localhost:2181
|
|
||||||
dubbo.registry.file=${user.home}/dubbo-cache/${spring.application.name}/dubbo.cache
|
|
||||||
yo.fsagent.dubbo.service.version=1.0.0
|
|
||||||
|
|
||||||
# Calling List
|
|
||||||
#yo.campaign.feign.calling-list.base-url=http://localhost:8093/callinglist
|
|
||||||
#yo.campaign.feign.calling-list.channel=dx-hzqw
|
|
||||||
|
|
||||||
yo.campaign.feign.calling-list.base-url=http://localhost:1116
|
|
||||||
yo.campaign.feign.calling-list.channel=callinglist.json
|
|
@ -1,37 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration debug="true" scan="true" scanPeriod="180 seconds">>
|
|
||||||
|
|
||||||
<property name="log.level" value="DEBUG" />
|
|
||||||
<property name="log.dir" value="${project.basedir}/.logs" />
|
|
||||||
|
|
||||||
<appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<withJansi>true</withJansi>
|
|
||||||
<encoder>
|
|
||||||
<pattern>%magenta(%d{"yyyy-MM-dd HH:mm:ss,SSS"}) [%thread][%X{traceId}] %highlight(%-5level) %cyan(%logger{15}) - %msg %n</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="File" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${log.dir}/${project.artifactId}.log</file>
|
|
||||||
<encoder>
|
|
||||||
<pattern>%d{"yyyy-MM-dd HH:mm:ss,SSS"} [%thread][%X{traceId}] %-5level %logger{15} %msg %n</pattern>
|
|
||||||
</encoder>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<fileNamePattern>${log.dir}/%d{yyyy-MM, aux}/${project.artifactId}-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
|
||||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
|
||||||
<maxFileSize>32MB</maxFileSize>
|
|
||||||
</timeBasedFileNamingAndTriggeringPolicy>
|
|
||||||
</rollingPolicy>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<logger name="org.springframework" level="${log.level}" additivity="false">
|
|
||||||
<appender-ref ref="Console" />
|
|
||||||
<appender-ref ref="File" />
|
|
||||||
</logger>
|
|
||||||
|
|
||||||
<root level="${log.level}">
|
|
||||||
<appender-ref ref="Console" />
|
|
||||||
<appender-ref ref="File" />
|
|
||||||
</root>
|
|
||||||
</configuration>
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xmlns:task="http://www.springframework.org/schema/task"
|
|
||||||
xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
|
||||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
|
||||||
http://www.springframework.org/schema/task
|
|
||||||
http://www.springframework.org/schema/task/spring-task.xsd
|
|
||||||
http://dubbo.apache.org/schema/dubbo
|
|
||||||
http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
|
|
||||||
|
|
||||||
<task:executor id="taskExecutor"
|
|
||||||
pool-size="${yo.task.executor.pool-size:8}"
|
|
||||||
keep-alive="${yo.task.executor.keep-alive:120}"
|
|
||||||
queue-capacity="${yo.task.executor.queue-capacity:1024}" />
|
|
||||||
<task:scheduler id="taskScheduler" pool-size="${yo.task.scheduler.pool-size:8}" />
|
|
||||||
<task:annotation-driven executor="taskExecutor"
|
|
||||||
scheduler="taskScheduler" proxy-target-class="true" />
|
|
||||||
|
|
||||||
<dubbo:reference id="dialService"
|
|
||||||
interface="com.pudonghot.yo.fsagent.api.DialService"
|
|
||||||
version="${yo.fsagent.dubbo.service.version}" />
|
|
||||||
<dubbo:reference id="campaignDialService"
|
|
||||||
interface="com.pudonghot.yo.fsagent.api.CampaignDialService"
|
|
||||||
version="${yo.fsagent.dubbo.service.version}" />
|
|
||||||
</beans>
|
|
@ -1 +0,0 @@
|
|||||||
OK
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
|
||||||
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
|
||||||
</beans>
|
|
1
pom.xml
1
pom.xml
@ -32,7 +32,6 @@
|
|||||||
<module>lib</module>
|
<module>lib</module>
|
||||||
<module>server</module>
|
<module>server</module>
|
||||||
<module>cms</module>
|
<module>cms</module>
|
||||||
<module>campaign</module>
|
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
@ -62,6 +62,18 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.github.openfeign</groupId>
|
||||||
|
<artifactId>feign-httpclient</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.github.openfeign</groupId>
|
||||||
|
<artifactId>feign-jackson</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
|
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
|
||||||
@ -14,6 +15,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|||||||
* Dec 02, 2019 21:06:05
|
* Dec 02, 2019 21:06:05
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
@EnableFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class YoServer implements WebMvcConfigurer {
|
public class YoServer implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@ -11,19 +11,20 @@ import com.pudonghot.yo.campaign.feign.config.FeignClientConfiguration;
|
|||||||
* donghuang@wacai.com <br>
|
* donghuang@wacai.com <br>
|
||||||
* Jan 07, 2020 14:36:47
|
* Jan 07, 2020 14:36:47
|
||||||
*/
|
*/
|
||||||
@FeignClient(url = "${yo.campaign.feign.calling-list.base-url}",
|
@FeignClient(url = "${yo.campaign.calling-list.feign.base-url}",
|
||||||
name = "CampaignFeign",
|
name = "CampaignFeign",
|
||||||
configuration = FeignClientConfiguration.class)
|
configuration = FeignClientConfiguration.class)
|
||||||
public interface FeignCallingListService {
|
public interface FeignCallingListService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fetch calling list
|
* fetch calling list
|
||||||
|
*
|
||||||
* @param numData num data
|
* @param numData num data
|
||||||
* @param campaignKey campaign key
|
* @param campaignKey campaign key
|
||||||
* @param campaignName campaign name
|
* @param campaignName campaign name
|
||||||
* @return calling list
|
* @return calling list
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/${yo.campaign.feign.calling-list.channel}")
|
@RequestMapping("/${yo.campaign.calling-list.feign.channel}")
|
||||||
RespCallingList fetchCallingList(
|
RespCallingList fetchCallingList(
|
||||||
@RequestParam("datanum")
|
@RequestParam("datanum")
|
||||||
int numData,
|
int numData,
|
@ -20,6 +20,7 @@ import com.pudonghot.yo.mapper.CallingListMapper;
|
|||||||
import com.pudonghot.yo.model.domain.CallingList;
|
import com.pudonghot.yo.model.domain.CallingList;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||||
|
import com.pudonghot.yo.service.LeaderElectionService;
|
||||||
import com.pudonghot.yo.mapper.CallingListPreparedMapper;
|
import com.pudonghot.yo.mapper.CallingListPreparedMapper;
|
||||||
import com.pudonghot.yo.model.domain.CallingListPrepared;
|
import com.pudonghot.yo.model.domain.CallingListPrepared;
|
||||||
import com.pudonghot.yo.campaign.service.CampaignService;
|
import com.pudonghot.yo.campaign.service.CampaignService;
|
||||||
@ -52,6 +53,8 @@ public class CallingListServiceImpl
|
|||||||
private CallingListPreparedMapper callingListPreparedMapper;
|
private CallingListPreparedMapper callingListPreparedMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CallingListHistoricalMapper callingListHistoricalMapper;
|
private CallingListHistoricalMapper callingListHistoricalMapper;
|
||||||
|
@Autowired
|
||||||
|
private LeaderElectionService leaderElectionService;
|
||||||
|
|
||||||
@Value("${yo.campaign.calling-list-lock-expire.seconds:300}")
|
@Value("${yo.campaign.calling-list-lock-expire.seconds:300}")
|
||||||
private int expireLockDuration;
|
private int expireLockDuration;
|
||||||
@ -60,6 +63,12 @@ public class CallingListServiceImpl
|
|||||||
|
|
||||||
@Scheduled(fixedRateString = "${yo.campaign.calling-list-lock-expire.rate:120000}")
|
@Scheduled(fixedRateString = "${yo.campaign.calling-list-lock-expire.rate:120000}")
|
||||||
public void expireLock() {
|
public void expireLock() {
|
||||||
|
|
||||||
|
if (!leaderElectionService.isLeader()) {
|
||||||
|
log.debug("Server is not leader, ignore campaign calling list expire lock scheduler task.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Expire calling list lock task.");
|
log.info("Expire calling list lock task.");
|
||||||
val update = new HashMap<String, Object>(8);
|
val update = new HashMap<String, Object>(8);
|
||||||
update.put(CallingList.STATUS, CallingList.Status.READY);
|
update.put(CallingList.STATUS, CallingList.Status.READY);
|
||||||
@ -77,6 +86,12 @@ public class CallingListServiceImpl
|
|||||||
@Scheduled(fixedRateString = "${yo.campaign.calling-list.task-scheduler.fixed-rate:300000}",
|
@Scheduled(fixedRateString = "${yo.campaign.calling-list.task-scheduler.fixed-rate:300000}",
|
||||||
initialDelayString = "${yo.campaign.calling-list.task-scheduler.init-delay:32000}")
|
initialDelayString = "${yo.campaign.calling-list.task-scheduler.init-delay:32000}")
|
||||||
public void fetchRemoteTaskScheduler() {
|
public void fetchRemoteTaskScheduler() {
|
||||||
|
|
||||||
|
if (!leaderElectionService.isLeader()) {
|
||||||
|
log.debug("Server is not leader, ignore campaign calling list fetch remote scheduler task.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
log.debug("Campaign fetch remote calling list task.");
|
log.debug("Campaign fetch remote calling list task.");
|
||||||
val secondOfDay = TimeUtils.secondOfDay(new Date());
|
val secondOfDay = TimeUtils.secondOfDay(new Date());
|
||||||
campaignService.scan(new Search(Campaign.ACTIVE, true)
|
campaignService.scan(new Search(Campaign.ACTIVE, true)
|
||||||
@ -101,6 +116,12 @@ public class CallingListServiceImpl
|
|||||||
|
|
||||||
@Scheduled(cron = "${yo.campaign.calling-list.batch-cron:1 1 1 * * *}")
|
@Scheduled(cron = "${yo.campaign.calling-list.batch-cron:1 1 1 * * *}")
|
||||||
public void deleteCalled() {
|
public void deleteCalled() {
|
||||||
|
|
||||||
|
if (!leaderElectionService.isLeader()) {
|
||||||
|
log.debug("Server is not leader, ignore campaign delete calling list scheduler task.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Delete called calling list.");
|
log.info("Delete called calling list.");
|
||||||
val deleteCalled = mapper.delete(
|
val deleteCalled = mapper.delete(
|
||||||
new Search(CallingList.STATUS,
|
new Search(CallingList.STATUS,
|
@ -15,6 +15,7 @@ import com.pudonghot.yo.model.domain.Campaign;
|
|||||||
import com.pudonghot.yo.mapper.AgentStatusMapper;
|
import com.pudonghot.yo.mapper.AgentStatusMapper;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import com.pudonghot.yo.service.CommonCallDataService;
|
import com.pudonghot.yo.service.CommonCallDataService;
|
||||||
|
import com.pudonghot.yo.service.LeaderElectionService;
|
||||||
import com.pudonghot.yo.fsagent.api.CampaignDialService;
|
import com.pudonghot.yo.fsagent.api.CampaignDialService;
|
||||||
import com.pudonghot.yo.campaign.service.CampaignService;
|
import com.pudonghot.yo.campaign.service.CampaignService;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
@ -49,10 +50,18 @@ public class CampaignServiceImpl
|
|||||||
private CampaignDialService dialService;
|
private CampaignDialService dialService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CommonCallDataService commonCallDataService;
|
private CommonCallDataService commonCallDataService;
|
||||||
|
@Autowired
|
||||||
|
private LeaderElectionService leaderElectionService;
|
||||||
|
|
||||||
@Scheduled(fixedRateString = "${yo.campaign.task-scheduler.fixed-rate:6000}",
|
@Scheduled(fixedRateString = "${yo.campaign.task-scheduler.fixed-rate:6000}",
|
||||||
initialDelayString = "${yo.campaign.task-scheduler.init-delay:32000}")
|
initialDelayString = "${yo.campaign.task-scheduler.init-delay:32000}")
|
||||||
public void taskScheduler() {
|
public void taskScheduler() {
|
||||||
|
|
||||||
|
if (!leaderElectionService.isLeader()) {
|
||||||
|
log.debug("Server is not leader, ignore campaign scheduler task.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
val secondOfDay = TimeUtils.secondOfDay(new Date());
|
val secondOfDay = TimeUtils.secondOfDay(new Date());
|
||||||
scan(new Search(Campaign.ACTIVE, true)
|
scan(new Search(Campaign.ACTIVE, true)
|
||||||
.eq(Campaign.STATUS, Campaign.Status.RUNNING)
|
.eq(Campaign.STATUS, Campaign.Status.RUNNING)
|
@ -1,7 +1,14 @@
|
|||||||
server:
|
server:
|
||||||
port: 28080
|
port: 1893
|
||||||
site:
|
|
||||||
context-path: ''
|
tigon:
|
||||||
|
web:
|
||||||
|
jsonview:
|
||||||
|
success-key: success
|
||||||
|
data-key:
|
||||||
|
code-key: retcode
|
||||||
|
code-type: string
|
||||||
|
message-key: message
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
@ -54,7 +61,7 @@ yo:
|
|||||||
password: RR!h5IpirsnJ
|
password: RR!h5IpirsnJ
|
||||||
fsagent:
|
fsagent:
|
||||||
server:
|
server:
|
||||||
# Nginx Server Port
|
# Nginx Port
|
||||||
port: 8080
|
port: 8080
|
||||||
agent-status:
|
agent-status:
|
||||||
audio:
|
audio:
|
||||||
@ -71,4 +78,16 @@ yo:
|
|||||||
file-ext: .mp3
|
file-ext: .mp3
|
||||||
recording-server:
|
recording-server:
|
||||||
base-path: http://172.20.23.188:8080/rec/
|
base-path: http://172.20.23.188:8080/rec/
|
||||||
|
leader:
|
||||||
|
lock-name: LOCK_LEADER_SERVER
|
||||||
|
campaign:
|
||||||
|
task-scheduler:
|
||||||
|
fixed-rate: 8000
|
||||||
|
dial-batch: 36
|
||||||
|
calling-list:
|
||||||
|
task-scheduler:
|
||||||
|
fixed-rate: 240000
|
||||||
|
batch-cron: 12 12 0 * * *
|
||||||
|
feign:
|
||||||
|
base-url: http://stsl.wldmz.cc/stsl-web-partner/call-data/taskdata
|
||||||
|
channel: dx-hzqw
|
||||||
|
@ -3,9 +3,18 @@ server:
|
|||||||
error:
|
error:
|
||||||
include-stacktrace: always
|
include-stacktrace: always
|
||||||
|
|
||||||
|
tigon:
|
||||||
|
web:
|
||||||
|
jsonview:
|
||||||
|
success-key: success
|
||||||
|
code-key: retcode
|
||||||
|
code-type: string
|
||||||
|
message-key: message
|
||||||
|
data-key:
|
||||||
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: yo-fsagent
|
name: yo-server
|
||||||
freemarker:
|
freemarker:
|
||||||
cache: false
|
cache: false
|
||||||
settings:
|
settings:
|
||||||
@ -40,8 +49,6 @@ dubbo:
|
|||||||
file: ${user.home}/dubbo-cache/${spring.application.name}/dubbo.cache
|
file: ${user.home}/dubbo-cache/${spring.application.name}/dubbo.cache
|
||||||
scan:
|
scan:
|
||||||
base-packages: com.pudonghot.yo.fsagent.service.dubbo.impl
|
base-packages: com.pudonghot.yo.fsagent.service.dubbo.impl
|
||||||
site:
|
|
||||||
context-path: ''
|
|
||||||
|
|
||||||
yo:
|
yo:
|
||||||
datasource:
|
datasource:
|
||||||
@ -70,3 +77,14 @@ yo:
|
|||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
recording-server:
|
recording-server:
|
||||||
base-path: http://172.16.52.80/fs/rec/
|
base-path: http://172.16.52.80/fs/rec/
|
||||||
|
campaign:
|
||||||
|
task-scheduler:
|
||||||
|
fixed-rate: 8000
|
||||||
|
dial-batch: 36
|
||||||
|
calling-list:
|
||||||
|
task-scheduler:
|
||||||
|
fixed-rate: 240000
|
||||||
|
batch-cron: 12 12 0 * * *
|
||||||
|
feign:
|
||||||
|
base-url: http://stsl.wldmz.cc/stsl-web-partner/call-data/taskdata
|
||||||
|
channel: dx-hzqw
|
||||||
|
@ -3,6 +3,7 @@ package com.pudonghot.yo.campaign;
|
|||||||
import lombok.val;
|
import lombok.val;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import com.pudonghot.yo.YoServer;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -15,7 +16,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@SpringBootTest(classes = YoCampaign.class)
|
@SpringBootTest(classes = YoServer.class)
|
||||||
public class FeignCallingListServiceTest {
|
public class FeignCallingListServiceTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
@ -3,10 +3,10 @@ package com.pudonghot.yo.campaign.service;
|
|||||||
import lombok.val;
|
import lombok.val;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import com.pudonghot.yo.YoServer;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import me.chyxion.tigon.mybatis.Search;
|
import me.chyxion.tigon.mybatis.Search;
|
||||||
import com.wacai.tigon.sequence.IdSequence;
|
import com.wacai.tigon.sequence.IdSequence;
|
||||||
import com.pudonghot.yo.campaign.YoCampaign;
|
|
||||||
import com.pudonghot.yo.model.domain.Campaign;
|
import com.pudonghot.yo.model.domain.Campaign;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -18,7 +18,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@SpringBootTest(classes = YoCampaign.class)
|
@SpringBootTest(classes = YoServer.class)
|
||||||
public class CallingListServiceTest {
|
public class CallingListServiceTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
private CampaignService campaignService;
|
private CampaignService campaignService;
|
||||||
@ -31,7 +31,7 @@ public class CallingListServiceTest {
|
|||||||
public void testFetchRemote() {
|
public void testFetchRemote() {
|
||||||
val campaign = campaignService.find(
|
val campaign = campaignService.find(
|
||||||
new Search(Campaign.CAMPAIGN_KEY, "5694"));
|
new Search(Campaign.CAMPAIGN_KEY, "5694"));
|
||||||
callingListService.fetchRemote(idSeq.get(), campaign);
|
callingListService.fetchRemote(idSeq.uuid(), campaign);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
@ -3,9 +3,9 @@ package com.pudonghot.yo.campaign.service;
|
|||||||
import lombok.val;
|
import lombok.val;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
import com.pudonghot.yo.YoServer;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import me.chyxion.tigon.mybatis.Search;
|
import me.chyxion.tigon.mybatis.Search;
|
||||||
import com.pudonghot.yo.campaign.YoCampaign;
|
|
||||||
import com.pudonghot.yo.model.domain.Campaign;
|
import com.pudonghot.yo.model.domain.Campaign;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -17,7 +17,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@SpringBootTest(classes = YoCampaign.class)
|
@SpringBootTest(classes = YoServer.class)
|
||||||
public class CampaignServiceTest {
|
public class CampaignServiceTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
private CampaignService campaignService;
|
private CampaignService campaignService;
|
@ -1,14 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
|
||||||
http://dubbo.apache.org/schema/dubbo
|
|
||||||
http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
|
|
||||||
|
|
||||||
<dubbo:reference id="demoService"
|
|
||||||
interface="com.pudonghot.yo.fsagent.api.DemoService"
|
|
||||||
version="${yo.fsagent.dubbo.service.version}"
|
|
||||||
/>
|
|
||||||
</beans>
|
</beans>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user