Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-enterprise
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
base_platform_enterprise
gic-platform-enterprise
Commits
9b6c3def
Commit
9b6c3def
authored
Mar 19, 2021
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解除联合定时器修复
parent
f9ba3865
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
12 deletions
+75
-12
UnionEnterpriseAuthApiService.java
...gic/enterprise/service/UnionEnterpriseAuthApiService.java
+1
-1
UnionEnterpriseAuthApiServiceImpl.java
...e/outer/impl/union/UnionEnterpriseAuthApiServiceImpl.java
+13
-11
ExecutorPoolSingleton.java
.../java/com/gic/enterprise/utils/ExecutorPoolSingleton.java
+61
-0
No files found.
gic-platform-enterprise-api/src/main/java/com/gic/enterprise/service/UnionEnterpriseAuthApiService.java
View file @
9b6c3def
...
...
@@ -153,7 +153,7 @@ public interface UnionEnterpriseAuthApiService {
ServiceResponse
<
String
>
deleteUnionEnterpriseAuthAppByUnionEnterpriseAuthId
(
@NotNull
Integer
unionEnterpriseAuthId
);
/**
* 到期发送解除联合通知
* 到期发送解除联合通知
定时器名:联合商户解除通知
* @param param
* @return
*/
...
...
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/service/outer/impl/union/UnionEnterpriseAuthApiServiceImpl.java
View file @
9b6c3def
...
...
@@ -10,6 +10,7 @@ import javax.validation.constraints.NotNull;
import
com.alibaba.fastjson.JSON
;
import
com.gic.enterprise.constant.union.UnionEnterpriseAuthResTypeEnum
;
import
com.gic.enterprise.utils.ExecutorPoolSingleton
;
import
com.gic.marketing.process.api.service.sms.SmsSendApiService
;
import
com.gic.member.config.api.service.AuthorizationEnterConfApiService
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -140,11 +141,12 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
resourceGroupApiService
.
syncResourceAuthChangeMQ
(
dto
.
getOwnEnterpriseId
(),
dto
.
getUnionEnterpriseId
(),
resourceGroupDTO
,
oldResourceGroupDTO
,
resourceGroupChangeType
);
//门店通知
if
(
resourceGroupDTO
.
getStoreResource
()
!=
null
)
{
try
{
storeAuthorizationApiService
.
authStore
(
resourceGroupDTO
.
getStoreResource
().
intValue
(),
dto
.
getUnionEnterpriseId
(),
dto
.
getOwnEnterpriseId
());
}
catch
(
Exception
e
)
{
LOGGER
.
warn
(
"调用门店授权接口错误:{}"
,
e
.
getMessage
(),
e
);
}
ExecutorPoolSingleton
.
getInstance
().
executeTask
(
new
Runnable
()
{
@Override
public
void
run
()
{
storeAuthorizationApiService
.
authStore
(
resourceGroupDTO
.
getStoreResource
().
intValue
(),
dto
.
getUnionEnterpriseId
(),
dto
.
getOwnEnterpriseId
());
}
});
}
return
ServiceResponse
.
success
();
...
...
@@ -416,9 +418,9 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
int
days
=
differentDaysByMillisecond
(
calendar
.
getTime
(),
new
Date
());
if
(
days
==
0
)
{
smsArr
=
new
String
[]
{
enterpriseMap
.
get
(
temp
.
getUnionEnterpriseId
()),
enterpriseMap
.
get
(
temp
.
getOwnEnterpriseId
()),
enterpriseMap
.
get
(
temp
.
getOwnEnterpriseId
())};
smsArr
=
new
String
[]
{
enterpriseMap
.
get
(
temp
.
getUnionEnterpriseId
()
.
toString
()
),
enterpriseMap
.
get
(
temp
.
getOwnEnterpriseId
()
.
toString
()
),
enterpriseMap
.
get
(
temp
.
getOwnEnterpriseId
()
.
toString
()
)};
if
(
UnionEnterpriseAuthStatusEnum
.
TO_DO_RELIEVE
.
getCode
().
equals
(
temp
.
getStatusFlag
()))
{
//todo 发通知
...
...
@@ -429,11 +431,11 @@ public class UnionEnterpriseAuthApiServiceImpl implements UnionEnterpriseAuthApi
}
else
{
//发送短信模板
smsArr
=
new
String
[]
{
enterpriseMap
.
get
(
temp
.
getUnionEnterpriseId
()),
enterpriseMap
.
get
(
temp
.
getOwnEnterpriseId
()),
smsArr
=
new
String
[]
{
enterpriseMap
.
get
(
temp
.
getUnionEnterpriseId
()
.
toString
()
),
enterpriseMap
.
get
(
temp
.
getOwnEnterpriseId
()
.
toString
()
),
String
.
valueOf
(
days
),
sdf
.
format
(
calendar
.
getTime
()),
enterpriseMap
.
get
(
temp
.
getOwnEnterpriseId
())};
enterpriseMap
.
get
(
temp
.
getOwnEnterpriseId
()
.
toString
()
)};
}
ServiceResponse
<
UserDTO
>
userResponse
=
userApiService
.
getUserByEnterpriseId
(
temp
.
getUnionEnterpriseId
());
...
...
gic-platform-enterprise-service/src/main/java/com/gic/enterprise/utils/ExecutorPoolSingleton.java
0 → 100644
View file @
9b6c3def
package
com
.
gic
.
enterprise
.
utils
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.SynchronousQueue
;
import
java.util.concurrent.ThreadPoolExecutor
;
import
java.util.concurrent.TimeUnit
;
import
javax.inject.Singleton
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
/**
* 线程池单例类
* 用于导出数据异步使用
* @ClassName: ExecutorPoolSingleton
* @Description:
* @author guojuxing
* @date 2019/11/5 7:56 PM
*/
public
class
ExecutorPoolSingleton
{
private
Logger
logger
=
LogManager
.
getLogger
(
ExecutorPoolSingleton
.
class
);
private
static
final
int
availableProcessor
=
Runtime
.
getRuntime
().
availableProcessors
();
private
static
ExecutorService
executorService
;
private
ExecutorPoolSingleton
()
{
if
(
executorService
==
null
)
{
int
coreNum
=
availableProcessor
/
2
;
// 用单例模式创建线程池,保留2个核心线程,最多线程为CPU个数的2n+1的两倍.
int
maxProcessor
=
(
availableProcessor
*
2
+
1
)
*
2
;
executorService
=
new
ThreadPoolExecutor
(
coreNum
>
2
?
2
:
coreNum
,
maxProcessor
,
60L
,
TimeUnit
.
SECONDS
,
new
SynchronousQueue
<
Runnable
>());
}
}
private
static
ExecutorPoolSingleton
instance
;
public
static
ExecutorPoolSingleton
getInstance
()
{
if
(
instance
==
null
)
{
synchronized
(
Singleton
.
class
)
{
if
(
instance
==
null
)
{
instance
=
new
ExecutorPoolSingleton
();
}
}
}
return
instance
;
}
int
executeThreadNum
=
1
;
/**
* 执行任务
* @param runnable
*/
public
void
executeTask
(
Runnable
runnable
)
{
executorService
.
execute
(
runnable
);
logger
.
info
(
"异步线程执行了%d次:{} "
,
executeThreadNum
++);
}
}
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