add thread pool

This commit is contained in:
Shaun Chyxion 2022-05-29 22:29:16 +08:00
parent 41b6d8faae
commit 2b11c0b496
14 changed files with 63 additions and 47 deletions

View File

@ -6,13 +6,11 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>crm</artifactId>
<name>Ambition CRM</name>
<packaging>jar</packaging>
<parent>
<groupId>com.pudonghot.ambition</groupId>
<artifactId>ambition-crm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<properties>

View File

@ -1,6 +1,8 @@
package com.pudonghot.ambition.crm;
import org.springframework.boot.SpringApplication;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@ -9,6 +11,8 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
* chyxion@163.com <br>
* Mar 05, 2017 14:40:30
*/
@EnableAsync
@EnableAspectJAutoProxy(proxyTargetClass = true)
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class AmbitionCRM {

View File

@ -0,0 +1,20 @@
package com.pudonghot.ambition.crm.service;
import javax.validation.constraints.NotBlank;
import org.springframework.validation.annotation.Validated;
/**
* @author Donghuang
* @date May 29, 2022 21:24:42
*/
@Validated
public interface ExportTaskService {
/**
* do export
*
* @param operator
*/
void doExport(@NotBlank String operator);
}

View File

@ -470,22 +470,6 @@ public class CustomerServiceSupport
.asc(Customer.ID),
this::exportList,
this::exportCount, c -> {
// "Customer ID",
// "Name",
// "Sum Sales(3 Years)",
// "Sales",
// "Comment",
// "Application",
// "Status",
// "Year Added",
// "Year",
// "Country",
// "State",
// "City",
// "MS",
// "Region",
// "Sales Person");
try {
log.info("Export Customer [{}].", c);
printer.printRecord(c.getId2(),

View File

@ -0,0 +1,24 @@
package com.pudonghot.ambition.crm.service.support;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import com.pudonghot.ambition.crm.service.ExportTaskService;
/**
* @author Donghuang
* @date May 29, 2022 21:29:06
*/
@Service
public class ExportTaskServiceSupport implements ExportTaskService {
@Autowired
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
/**
* {@inheritDoc}
*/
@Override
public void doExport(final String operator) {
}
}

View File

@ -3,11 +3,12 @@ server.port=8088
# MySQL
datasource.host=127.0.0.1
datasource.port=63306
datasource.database-name=ambition_crm_test
datasource.host=172.16.4.6
datasource.port=3306
datasource.database-name=ambition-crm
datasource.username=root
datasource.password=696@2^~)oZ@^#*Q
datasource.password=MySQL2b||!2b
database.backup-dir=/Users/chyxion/Workspaces/ambition-crm/database_backups
database.restore-shell=/data/program/mysql-backup/bin/mysql_restore.sh

View File

@ -10,8 +10,8 @@
<PatternLayout pattern="%highlight{%-d{yyyy-MM-dd HH:mm:ss,SSS}}{FATAL=magenta, ERROR=magenta, WARN=magenta, INFO=magenta, DEBUG=magenta, TRACE=magenta} %highlight{%-5p}{FATAL=red blink, ERROR=red, WARN=yellow bold, INFO=black, DEBUG=green bold, TRACE=blue} [%t][%X{requestId}][%highlight{%c{1.}}{FATAL=cyan, ERROR=cyan, WARN=cyan, INFO=cyan, DEBUG=cyan, TRACE=cyan}] %m%n"/>
</Console>
<RollingFile name="File"
fileName="${log.dir}/${project.artifactId}.log"
filePattern="${log.dir}/$${date:yyyy-MM}/${project.artifactId}-%d{yyyy-MM-dd}-%i.log.gz">
fileName="${log.dir}/app.log"
filePattern="${log.dir}/$${date:yyyy-MM}/app-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout pattern="${pattern}" />
<Policies>
<TimeBasedTriggeringPolicy />

View File

@ -1,12 +1,14 @@
package com.pudonghot.ambition.crm.service;
import java.io.File;
import lombok.val;
import org.junit.Test;
import org.junit.runner.RunWith;
import lombok.extern.slf4j.Slf4j;
import com.pudonghot.ambition.crm.AmbitionCRM;
import com.pudonghot.ambition.crm.model.FileInfo;
import com.pudonghot.ambition.file.AmbitionFileApi;
import com.pudonghot.ambition.file.request.AmFileUploadReq;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
@ -27,8 +29,11 @@ public class DiskFileStoreTest {
private AmbitionFileApi<FileInfo> fileApi;
@Test
public void testUpload() throws Exception {
final FileInfo foobar = fileApi.upload(new File("/Users/chyxion/Workspaces//Eclipse/Default/bzush-schoolmate-api/src/main/java/cn/edu/bzu/schoolmate/controllers/FileController.java"), "foobar");
public void testUpload() {
val req = new AmFileUploadReq();
req.setFile(new File("/Users/chyxion/Workspaces/FileController.java"));
req.setName("foobar");
final FileInfo foobar = fileApi.upload(req);
log.info("Upload result [{}].", foobar);
}
}

View File

@ -12,7 +12,6 @@
<groupId>com.pudonghot.ambition</groupId>
<artifactId>ambition-crm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<dependencies>

View File

@ -6,13 +6,11 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>file-disk</artifactId>
<name>Ambition File Disk</name>
<packaging>jar</packaging>
<parent>
<groupId>com.pudonghot.ambition</groupId>
<artifactId>ambition-crm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<dependencies>

View File

@ -13,7 +13,6 @@
<groupId>com.pudonghot.ambition</groupId>
<artifactId>ambition-crm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<modules>

View File

@ -6,13 +6,11 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>crm-mapper</artifactId>
<name>Ambition Mapper</name>
<packaging>jar</packaging>
<parent>
<groupId>com.pudonghot.ambition</groupId>
<artifactId>ambition-crm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<dependencies>

View File

@ -2,16 +2,8 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<aop:aspectj-autoproxy proxy-target-class="true" />
<tx:annotation-driven />
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
init-method="init"
@ -22,11 +14,6 @@
p:connectionInitSqls="set names utf8mb4;"
/>
<!-- Transaction -->
<bean name="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- MyBatis SqlSessionFactory -->
<bean id="sqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean"

View File

@ -17,7 +17,6 @@
<groupId>com.pudonghot.ambition</groupId>
<artifactId>ambition-crm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<dependencies>