add campaign module

This commit is contained in:
东皇大叔 2020-07-18 17:32:30 +08:00
parent a86b679fbf
commit a58431c7bc
29 changed files with 389 additions and 52 deletions

89
campaign/pom.xml Normal file
View File

@ -0,0 +1,89 @@
<?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.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>

View File

@ -0,0 +1,21 @@
package com.pudonghot.yo.campaign;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author Donghuang
* @date Jul 18, 2020 17:25:36
*/
@SpringBootApplication
public class YoCampaign {
/**
* main
*
* @param args args
*/
public static void main(final String[] args) {
SpringApplication.run(YoCampaign.class, args);
}
}

View File

@ -0,0 +1,16 @@
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() {
}
}

View File

@ -0,0 +1,8 @@
package com.pudonghot.yo.campaign.service;
/**
* @author Donghuang
* @date Jul 18, 2020 17:24:50
*/
public interface CampaignService {
}

View File

@ -0,0 +1,12 @@
package com.pudonghot.yo.campaign.service.impl;
import org.springframework.stereotype.Service;
import com.pudonghot.yo.campaign.service.CampaignService;
/**
* @author Donghuang
* @date Jul 18, 2020 17:25:17
*/
@Service
public class CampaignServiceImpl implements CampaignService {
}

View File

@ -0,0 +1,26 @@
# Yo Campaign
server.port=8085
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

View File

@ -0,0 +1,23 @@
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://172.18.4.35/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://172.18.4.35/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=172.18.4.35
spring.redis.port=6379
spring.redis.password=123456

View File

@ -0,0 +1,37 @@
<?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] %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] %-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>

View File

@ -0,0 +1,17 @@
<?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"
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">
<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" />
</beans>

View File

@ -0,0 +1 @@
OK

View File

@ -0,0 +1,17 @@
package com.pudonghot.yo.campaign;
import org.junit.Test;
import lombok.extern.slf4j.Slf4j;
/**
* @author Donghuang
* @date Jul 18, 2020 17:23:28
*/
@Slf4j
public class TestDriver {
@Test
public void run() {
log.info("Test run.");
}
}

View File

@ -0,0 +1,14 @@
<?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: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://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>

View File

@ -17,7 +17,7 @@ yo.datasource.username=yoqw
yo.datasource.password=yoqw_query!
# Datasource
yo.fs.datasource.url=jdbc:mysql://172.18.4.35/freeswitch?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
yo.fs.datasource.url=jdbc:mysql://172.18.4.35/fs_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
yo.fs.datasource.username=freeswitch
yo.fs.datasource.password=RR!h5IpirsnJ

View File

@ -53,7 +53,7 @@ public class ChannelAnswer {
null));
final Map<String, Object> eventData = new HashMap<>(8);
eventData.put("callid", event.getHeader("variable_x_conn_id"));
eventData.put("callid", event.getConnId());
if (EslEventUtils.isCaller(event)) {
// feature0普通呼入7普通外呼 51内部求助
eventData.put("feature", "7");

View File

@ -49,7 +49,7 @@ public class ChannelDestroy {
final String callUuid = event.getCallUuid();
final String channelName = event.getChannelName();
log.info("On channel [{}][{}] destroy event.", channelName, callUuid);
final ChannelInfo channelInfo = CallStrUtils.parseChannelName(channelName);
final ChannelInfo channelInfo = CallStrUtils.getChannelInfo(event);
if (channelInfo.isAgent()) {

View File

@ -4,11 +4,11 @@ import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import java.util.function.Function;
import java.util.function.Supplier;
import com.wacai.tigon.mybatis.Search;
import com.pudonghot.yo.model.domain.*;
import com.pudonghot.yo.fsagent.service.*;
import com.wacai.tigon.sequence.IdSequence;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.util.DigestUtils;
import com.pudonghot.yo.fsagent.util.CallStrUtils;
@ -63,12 +63,33 @@ public abstract class BaseDialplanService implements DialplanService {
return find(call);
}
protected String getParam(final Map<String, String> params, final String name, final String... names) {
String val = params.get(name);
if (StringUtils.isNotBlank(val)) {
return val;
}
for (String n : names) {
val = params.get(n);
if (StringUtils.isNotBlank(val)) {
return val;
}
}
return null;
}
protected String getChannelName(final Map<String, String> params) {
return params.get("Channel-Name");
return getParam(params, "Channel-Name", "variable_channel_name");
}
public String getPresenceId(final Map<String, String> params) {
return getParam(params, "Channel-Presence-ID", "variable_presence_id");
}
protected ChannelInfo getChannelInfo(final Map<String, String> params) {
return CallStrUtils.parseChannelName(getChannelName(params));
return CallStrUtils.parseChannelName(getChannelName(params), getPresenceId(params));
}
protected DialplanConfig onCallerAgent(final Call call, final Function<Agent, DialplanConfig> consumer) {
@ -105,10 +126,6 @@ public abstract class BaseDialplanService implements DialplanService {
return call.getParams().get("variable_x_called_number");
}
protected boolean calledNumberEquals(final Map<String, String> params, final String target) {
return target.equals(getCalledNumber(params));
}
protected boolean calledNumberEquals(final Call call, final String target) {
return target.equals(call.getCalledNumber());
}

View File

@ -6,6 +6,7 @@ import lombok.ToString;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.freeswitch.esl.client.transport.event.Event;
/**
@ -14,7 +15,7 @@ import org.freeswitch.esl.client.transport.event.Event;
*/
public class CallStrUtils {
public static final Pattern PATTERN_USER_AND_DOMAIN =
Pattern.compile("^sofia/internal/([^@]+)@(.+)$");
Pattern.compile("^sofia/internal/([^@]+)@([^\\:]+)(?:\\:\\d+)?$");
public static final Pattern PATTERN_EXTERNAL_NUMBER =
Pattern.compile("^sofia/external/(\\w+)$");
@ -28,7 +29,24 @@ public class CallStrUtils {
* @return channel info
*/
public static ChannelInfo getChannelInfo(final Event event) {
return parseChannelName(event.getChannelName());
return parseChannelName(event.getChannelName(), event.getPresenceId());
}
/**
* get channel info by presence id and channel name
*
* @param presenceId presence id
* @param channelName channel name
* @return channel info
*/
public static ChannelInfo parseChannelName(final String channelName, final String presenceId) {
if (StringUtils.isNotBlank(presenceId)) {
final String[] presence = presenceId.split("@");
if (presence.length == 2) {
return new ChannelInfo(presence[0], presence[1], true);
}
}
return parseChannelName(channelName);
}
/**
@ -37,7 +55,7 @@ public class CallStrUtils {
* @param channelName channel name
* @return channel info
*/
public static ChannelInfo parseChannelName(final String channelName) {
static ChannelInfo parseChannelName(final String channelName) {
Matcher m = PATTERN_USER_AND_DOMAIN.matcher(channelName);
if (m.find()) {
return new ChannelInfo(m.group(1), m.group(2), true);

View File

@ -1,8 +1,7 @@
package com.pudonghot.yo.fsagent;
package com.pudonghot.yo.fsagent.util;
import org.junit.Test;
import lombok.extern.slf4j.Slf4j;
import com.pudonghot.yo.fsagent.util.CallStrUtils;
/**
* @author Donghuang
@ -14,7 +13,9 @@ public class CallStrUtilsTest {
@Test
public void testParse() {
log.info("User and domain [{}]", CallStrUtils.parseChannelName("sofia/internal/700001@d1.wacai.info"));
log.info("User and domain [{}]", CallStrUtils.parseChannelName("sofia/internal/700002@d1.wacai.info:5060"));
log.info("External number [{}]", CallStrUtils.parseChannelName("sofia/external/013764268709"));
log.info("External number [{}]", CallStrUtils.parseChannelName("sofia/external/013764268709", "donghuang@d1.wacia.info"));
log.info("Dial target [{}]", CallStrUtils.parseDialTarget("4.Q"));
log.info("Dial target [{}]", CallStrUtils.parseDialTarget("1.A"));
log.info("Dial target [{}]", CallStrUtils.parseDialTarget("4.AG"));

View File

@ -90,9 +90,22 @@ public class Event {
* @param name header name
* @return header value
*/
public String getHeader(final String name) {
return headers.get(name);
}
public String getHeader(String name, String... names) {
String val = headers.get(name);
if (StringUtils.isNotBlank(val)) {
return val;
}
for (String n : names) {
val = headers.get(n);
if (StringUtils.isNotBlank(val)) {
return val;
}
}
return null;
}
/**
* Convenience method.
@ -101,7 +114,11 @@ public class Event {
* @return channel name
*/
public String getChannelName() {
return getHeader("variable_channel_name");
return getHeader("Channel-Name", "variable_channel_name");
}
public String getPresenceId() {
return getHeader("Channel-Presence-ID", "variable_presence_id");
}
/**
@ -251,4 +268,5 @@ public class Event {
mapToString.put("body", body.size() + " lines");
return mapToString.toString();
}
}

View File

@ -37,8 +37,6 @@ public class AgentStatus extends TenantDomain {
public enum State {
IDLE,
WAITING,
RECEIVING,
IN_A_CALL,
ACW
}

View File

@ -7,10 +7,12 @@ import com.wacai.tigon.mybatis.Search;
import com.pudonghot.yo.mapper.AgentMapper;
import com.wacai.tigon.sequence.IdSequence;
import com.pudonghot.yo.model.domain.Agent;
import com.pudonghot.yo.fs.model.domain.Channel;
import com.pudonghot.yo.mapper.AgentStatusMapper;
import com.pudonghot.yo.model.domain.AgentStatus;
import com.pudonghot.yo.model.exception.ErrorCode;
import com.pudonghot.yo.model.exception.AssertUtils;
import com.pudonghot.yo.service.CommonChannelService;
import com.pudonghot.yo.service.CommonDelayScheduleService;
import com.pudonghot.yo.service.CommonAgentStatusService;
import org.springframework.beans.factory.annotation.Autowired;
@ -32,6 +34,8 @@ public class CommonAgentStatusServiceImpl
private IdSequence idSeq;
@Setter(onMethod_ = {@Autowired})
private CommonDelayScheduleService delayScheduleService;
@Setter(onMethod_ = {@Autowired})
private CommonChannelService commonChannelService;
/**
* {@inheritDoc}
@ -65,13 +69,14 @@ public class CommonAgentStatusServiceImpl
agentStatus.setRegistered(true);
agentStatus.setStatus(AgentStatus.Status.OFFLINE);
agentStatus.setState(AgentStatus.State.IDLE);
agentStatusMapper.insert(agentStatus);
}
else {
agentStatus.setRegistered(true);
agentStatus.setCheckRegKey(null);
agentStatus.setState(AgentStatus.State.IDLE);
clear(agentStatus);
setState(agent, agentStatus);
agentStatusMapper.update(agentStatus);
}
}
@ -93,8 +98,8 @@ public class CommonAgentStatusServiceImpl
log.info("Unregister agent [{}]. ", agent);
final AgentStatus agentStatus = findValidAgentStatus(agent);
agentStatus.setRegistered(false);
agentStatus.setState(AgentStatus.State.IDLE);
clear(agentStatus);
setState(agent, agentStatus);
agentStatusMapper.update(agentStatus);
}
@ -225,7 +230,7 @@ public class CommonAgentStatusServiceImpl
delayScheduleService.acw(agent);
}
else {
agentStatus.setState(AgentStatus.State.IDLE);
setState(agent, agentStatus);
}
log.info("Update agent status [{}].", agentStatus);
@ -258,7 +263,7 @@ public class CommonAgentStatusServiceImpl
AssertUtils.state(agentStatus.getState() == AgentStatus.State.ACW,
AGENT_UPDATE_STATUS_FAIL);
clear(agentStatus);
agentStatus.setState(AgentStatus.State.IDLE);
setState(agent, agentStatus);
agentStatus.setAcwTime(null);
log.info("Update agent status [{}].", agentStatus);
agentStatusMapper.update(agentStatus);
@ -281,7 +286,7 @@ public class CommonAgentStatusServiceImpl
final AgentStatus agentStatus = findValidAgentStatus(agent);
clear(agentStatus);
agentStatus.setState(AgentStatus.State.IDLE);
setState(agent, agentStatus);
log.info("Update agent status [{}].", agentStatus);
agentStatusMapper.update(agentStatus);
@ -311,4 +316,11 @@ public class CommonAgentStatusServiceImpl
agentStatus.setAcwTime(null);
agentStatus.setUpdatedTime(new Date());
}
private void setState(final Agent agent, final AgentStatus agentStatus) {
final Channel channel = commonChannelService.find(agent);
agentStatus.setState(channel != null ?
AgentStatus.State.IN_A_CALL :
AgentStatus.State.IDLE);
}
}

View File

@ -1,5 +1,7 @@
package com.pudonghot.yo.service;
import com.pudonghot.yo.mapper.AgentMapper;
import com.pudonghot.yo.model.domain.Agent;
import org.junit.Test;
import org.junit.runner.RunWith;
import lombok.extern.slf4j.Slf4j;
@ -15,11 +17,13 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@SpringBootTest(classes = TestDriver.class)
@RunWith(SpringJUnit4ClassRunner.class)
public class CommonAgentStatusServiceTest {
@Autowired
private AgentMapper agentMapper;
@Autowired
private CommonAgentStatusService agentStatusService;
@Test
public void testRun() {
log.info("Run.");
log.info("Agent status [{}].", agentStatusService.findValidAgentStatus(agentMapper.find(1)));
}
}

View File

@ -120,7 +120,6 @@ public class CallController implements SessionAbility {
dialService.unhold(StringUtils.defaultIfBlank(callId, channel.getUuid()));
}
@RequestMapping(value = "/transfer", params = {
"devicetype=3",
"transtype=custConfirm",

View File

@ -16,7 +16,7 @@ yo.datasource.username=yoqw
yo.datasource.password=yoqw_query!
# Datasource FreeSWITCH
yo.fs.datasource.url=jdbc:mysql://172.18.4.35/freeswitch?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
yo.fs.datasource.url=jdbc:mysql://172.18.4.35/fs_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
yo.fs.datasource.username=freeswitch
yo.fs.datasource.password=RR!h5IpirsnJ
@ -25,6 +25,9 @@ spring.redis.host=172.18.4.35
spring.redis.port=6379
spring.redis.password=123456
# Tenant
yo.openapi.default-tenant=GOBLIN
# Dubbo
## Dubbo Registry

View File

@ -20,5 +20,9 @@
<dubbo:reference id="dialService"
interface="com.pudonghot.yo.fsagent.api.DialService"
version="${yo.fsagent.dubbo.service.version}"/>
version="${yo.fsagent.dubbo.service.version}" />
<dubbo:reference id="ivrTransferService"
interface="com.pudonghot.yo.fsagent.api.IvrTransferService"
version="${yo.fsagent.dubbo.service.version}" />
</beans>

View File

@ -34,6 +34,7 @@
<module>state</module>
<module>cms</module>
<module>openapi</module>
<module>campaign</module>
</modules>
<dependencyManagement>

View File

@ -1,24 +1,14 @@
package com.pudonghot.yo.state;
import org.springframework.boot.SpringApplication;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
/**
* @author Donghuang <br>
* Oct 26, 2019 15:56:08
*/
@SpringBootApplication
public class YoState implements WebMvcConfigurer {
@Autowired
private ThreadPoolTaskExecutor executor;
@Value("${yo.openapi.web-async-timeout:50000}")
private Long webAsyncTimeout;
public class YoState {
/**
* main
@ -28,13 +18,4 @@ public class YoState implements WebMvcConfigurer {
public static void main(final String[] args) {
SpringApplication.run(YoState.class, args);
}
/**
* {@inheritDoc}
*/
@Override
public void configureAsyncSupport(final AsyncSupportConfigurer configurer) {
configurer.setDefaultTimeout(webAsyncTimeout);
configurer.setTaskExecutor(executor);
}
}

View File

@ -1,4 +1,4 @@
# Yo OpenAPI
# Yo State
server.port=8085
spring.application.name=yo-state
spring.jackson.time-zone=GMT+8

View File

@ -12,7 +12,7 @@ yo.datasource.username=yoqw
yo.datasource.password=yoqw_query!
# Datasource FreeSWITCH
yo.fs.datasource.url=jdbc:mysql://172.18.4.35/freeswitch?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
yo.fs.datasource.url=jdbc:mysql://172.18.4.35/fs_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
yo.fs.datasource.username=freeswitch
yo.fs.datasource.password=RR!h5IpirsnJ