Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
b79c3b7d
Commit
b79c3b7d
authored
Nov 09, 2018
by
eddie.wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
a913acb5
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
218 additions
and
31 deletions
+218
-31
java-axp-1.0-SNAPSHOT.jar
atms-api/lib/java-axp-1.0-SNAPSHOT.jar
+0
-0
soap-client-1.0.jar
atms-api/lib/soap-client-1.0.jar
+0
-0
pom.xml
atms-api/pom.xml
+26
-31
AutowiringSpringBeanJobFactory.java
.../atms/common/schedule/AutowiringSpringBeanJobFactory.java
+28
-0
LgGlBalanceJob.java
...java/pwc/taxtech/atms/common/schedule/LgGlBalanceJob.java
+64
-0
applicationContext-job.xml
atms-api/src/main/resources/applicationContext-job.xml
+64
-0
job.properties
atms-api/src/main/resources/job.properties
+35
-0
web.xml
atms-api/src/main/webapp/WEB-INF/web.xml
+1
-0
No files found.
atms-api/lib/java-axp-1.0-SNAPSHOT.jar
deleted
100644 → 0
View file @
a913acb5
File deleted
atms-api/lib/soap-client-1.0.jar
0 → 100644
View file @
b79c3b7d
File added
atms-api/pom.xml
View file @
b79c3b7d
...
...
@@ -276,25 +276,6 @@
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.tika
</groupId>
<artifactId>
tika-core
</artifactId>
<version>
1.17
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.apache.tika
</groupId>
<artifactId>
tika-parsers
</artifactId>
<version>
1.17
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.javaaxp
</groupId>
<artifactId>
java-axp
</artifactId>
<version>
1.0
</version>
<scope>
system
</scope>
<systemPath>
${basedir}/lib/java-axp-1.0-SNAPSHOT.jar
</systemPath>
</dependency>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
...
...
@@ -372,20 +353,34 @@
<groupId>
com.grapecity.documents
</groupId>
<artifactId>
gcexcel
</artifactId>
<version>
2.0.0
</version>
<exclusions>
<exclusion>
<groupId>
org.apache.pdfbox
</groupId>
<artifactId>
pdfbox
</artifactId>
</exclusion>
</exclusions>
<exclusions>
<exclusion>
<groupId>
org.apache.pdfbox
</groupId>
<artifactId>
pdfbox
</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.pdfbox/pdfbox -->
<dependency>
<groupId>
org.apache.pdfbox
</groupId>
<artifactId>
pdfbox
</artifactId>
<version>
2.0.12
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.pdfbox/pdfbox -->
<dependency>
<groupId>
org.apache.pdfbox
</groupId>
<artifactId>
pdfbox
</artifactId>
<version>
2.0.12
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.quartz-scheduler/quartz -->
<dependency>
<groupId>
org.quartz-scheduler
</groupId>
<artifactId>
quartz
</artifactId>
<version>
2.3.0
</version>
</dependency>
<!--接口调用-->
<dependency>
<groupId>
pwc.tax
</groupId>
<artifactId>
soap-client
</artifactId>
<version>
1.0
</version>
<scope>
system
</scope>
<systemPath>
${basedir}/lib/soap-client-1.0.jar
</systemPath>
</dependency>
</dependencies>
<profiles>
...
...
atms-api/src/main/java/pwc/taxtech/atms/common/schedule/AutowiringSpringBeanJobFactory.java
0 → 100644
View file @
b79c3b7d
package
pwc
.
taxtech
.
atms
.
common
.
schedule
;
import
org.quartz.spi.TriggerFiredBundle
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.AutowireCapableBeanFactory
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.scheduling.quartz.SpringBeanJobFactory
;
public
class
AutowiringSpringBeanJobFactory
extends
SpringBeanJobFactory
implements
ApplicationContextAware
{
private
transient
AutowireCapableBeanFactory
beanFactory
;
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
beanFactory
=
applicationContext
.
getAutowireCapableBeanFactory
();
}
@Override
protected
Object
createJobInstance
(
TriggerFiredBundle
bundle
)
throws
Exception
{
Object
job
=
super
.
createJobInstance
(
bundle
);
beanFactory
.
autowireBean
(
job
);
return
job
;
}
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/common/schedule/LgGlBalanceJob.java
0 → 100644
View file @
b79c3b7d
package
pwc
.
taxtech
.
atms
.
common
.
schedule
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.collect.Lists
;
import
org.apache.commons.lang3.StringUtils
;
import
org.quartz.JobDataMap
;
import
org.quartz.JobExecutionContext
;
import
org.quartz.JobExecutionException
;
import
org.quartz.SchedulerException
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.quartz.QuartzJobBean
;
import
org.springframework.scheduling.quartz.SchedulerFactoryBean
;
import
pwc.taxtech.atms.dao.EnterpriseAccountMapper
;
import
pwc.taxtech.atms.dao.EnterpriseAccountSetOrgMapper
;
import
pwc.taxtech.atms.dao.OrganizationMapper
;
import
pwc.taxtech.atms.dao.UserMapper
;
import
pwc.taxtech.atms.entity.*
;
import
java.util.List
;
public
class
LgGlBalanceJob
extends
QuartzJobBean
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
LgGlBalanceJob
.
class
);
public
static
final
String
ORG_ID
=
"org_id"
;
public
static
final
String
PERIOD
=
"period"
;
@Autowired
private
EnterpriseAccountMapper
accountMapper
;
@Autowired
private
OrganizationMapper
orgMapper
;
@Autowired
private
EnterpriseAccountSetOrgMapper
setOrgMapper
;
@Override
protected
void
executeInternal
(
JobExecutionContext
jobExecutionContext
)
throws
JobExecutionException
{
JobDataMap
dataMap
=
jobExecutionContext
.
getJobDetail
().
getJobDataMap
();
String
orgId
=
dataMap
.
getString
(
ORG_ID
);
String
period
=
dataMap
.
getString
(
PERIOD
);
List
<
Organization
>
orgList
;
if
(
StringUtils
.
isBlank
(
orgId
))
{
orgList
=
orgMapper
.
selectByExample
(
null
);
}
else
{
orgList
=
Lists
.
newArrayList
(
orgMapper
.
selectByPrimaryKey
(
orgId
));
}
for
(
Organization
organization
:
orgList
)
{
try
{
//查找mapping
EnterpriseAccountSetOrgExample
setOrgExample
=
new
EnterpriseAccountSetOrgExample
();
setOrgExample
.
createCriteria
().
andOrganizationIdEqualTo
(
organization
.
getId
());
EnterpriseAccountSetOrg
accountSetOrg
=
setOrgMapper
.
selectByExample
(
setOrgExample
).
get
(
0
);
//查找企业账套
EnterpriseAccountExample
accountExample
=
new
EnterpriseAccountExample
();
accountExample
.
createCriteria
().
andEnterpriseAccountSetIdEqualTo
(
accountSetOrg
.
getEnterpriseAccountSetId
());
List
<
EnterpriseAccount
>
accountList
=
accountMapper
.
selectByExample
(
accountExample
);
for
(
EnterpriseAccount
account
:
accountList
)
{
}
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"LgGlBalanceJob error. Organization: "
+
organization
.
getId
(),
e
);
}
}
}
}
atms-api/src/main/resources/applicationContext-job.xml
0 → 100644
View file @
b79c3b7d
<?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:context=
"http://www.springframework.org/schema/context"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"
>
<!-- 分布式事务配置 start -->
<!-- 配置线程池-->
<bean
name=
"executor"
class=
"org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"
>
<property
name=
"corePoolSize"
value=
"15"
/>
<property
name=
"maxPoolSize"
value=
"25"
/>
<property
name=
"queueCapacity"
value=
"100"
/>
</bean>
<bean
name=
"transactionManager"
class=
"org.springframework.jdbc.datasource.DataSourceTransactionManager"
>
<property
name=
"dataSource"
ref=
"dataSource"
/>
</bean>
<!-- 配置调度任务-->
<bean
name=
"quartzScheduler"
class=
"org.springframework.scheduling.quartz.SchedulerFactoryBean"
>
<property
name=
"configLocation"
value=
"classpath:job.properties"
/>
<property
name=
"dataSource"
ref=
"dataSource"
/>
<property
name=
"transactionManager"
ref=
"transactionManager"
/>
<!-- 任务唯一的名称,将会持久化到数据库-->
<property
name=
"schedulerName"
value=
"baseScheduler"
/>
<!-- 每台集群机器部署应用的时候会更新触发器-->
<property
name=
"overwriteExistingJobs"
value=
"true"
/>
<property
name=
"applicationContextSchedulerContextKey"
value=
"app_schedule_key"
/>
<property
name=
"jobFactory"
>
<bean
class=
"pwc.taxtech.atms.common.schedule.AutowiringSpringBeanJobFactory"
/>
</property>
<property
name=
"triggers"
>
<list>
<ref
bean=
"lgApiJobTrigger"
/>
</list>
</property>
<property
name=
"jobDetails"
>
<list>
<ref
bean=
"lgGlBalanceJob"
/>
</list>
</property>
<property
name=
"taskExecutor"
ref=
"executor"
/>
</bean>
<!-- 配置Job详情 -->
<bean
name=
"lgGlBalanceJob"
class=
"org.springframework.scheduling.quartz.JobDetailFactoryBean"
>
<property
name=
"jobClass"
value=
"pwc.taxtech.atms.common.schedule.LgGlBalanceJob"
/>
<property
name=
"durability"
value=
"true"
/>
<property
name=
"requestsRecovery"
value=
"false"
/>
<property
name=
"description"
value=
"科目余额数据同步"
/>
</bean>
<!-- 定时任务 -->
<bean
id=
"lgApiJobTrigger"
class=
"org.springframework.scheduling.quartz.CronTriggerFactoryBean"
>
<property
name=
"jobDetail"
ref=
"lgGlBalanceJob"
/>
<property
name=
"cronExpression"
value=
"0 0 1 3 * ?"
/>
</bean>
<!-- 分布式事务配置 end -->
</beans>
\ No newline at end of file
atms-api/src/main/resources/job.properties
0 → 100644
View file @
b79c3b7d
#============================================================================
# Configure JobStore
# Using Spring datasource in quartzJobsConfig.xml
# Spring uses LocalDataSourceJobStore extension of JobStoreCMT
#============================================================================
org.quartz.jobStore.useProperties
=
true
org.quartz.jobStore.tablePrefix
=
QRTZ_
org.quartz.jobStore.isClustered
=
true
org.quartz.jobStore.clusterCheckinInterval
=
5000
org.quartz.jobStore.misfireThreshold
=
60000
org.quartz.jobStore.txIsolationLevelReadCommitted
=
true
# Change this to match your DB vendor
org.quartz.jobStore.class
=
org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass
=
org.quartz.impl.jdbcjobstore.StdJDBCDelegate
#============================================================================
# Configure Main Scheduler Properties
# Needed to manage cluster instances
#============================================================================
org.quartz.scheduler.instanceId
=
AUTO
org.quartz.scheduler.instanceName
=
MY_CLUSTERED_JOB_SCHEDULER
org.quartz.scheduler.rmi.export
=
false
org.quartz.scheduler.rmi.proxy
=
false
#============================================================================
# Configure ThreadPool
#============================================================================
org.quartz.threadPool.class
=
org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount
=
10
org.quartz.threadPool.threadPriority
=
5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread
=
true
\ No newline at end of file
atms-api/src/main/webapp/WEB-INF/web.xml
View file @
b79c3b7d
...
...
@@ -22,6 +22,7 @@
classpath:applicationContext.xml
classpath:applicationContext-mvc.xml
classpath:applicationContext-security.xml
classpath:applicationContext-job.xml
</param-value>
</context-param>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment