Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
6b3dbe6b
Commit
6b3dbe6b
authored
May 21, 2020
by
qwmqiuwenmin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://115.159.76.241/haoban3.0/haoban-manage3.0.git
into developer
parents
0d2ae172
c67eb046
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
84 additions
and
3 deletions
+84
-3
TestApiService.java
...ava/com/gic/haoban/manage/api/service/TestApiService.java
+6
-0
TestServiceImpl.java
...oban/manage/service/service/out/impl/TestServiceImpl.java
+22
-1
dubbo-haoban-manage-service.xml
...ervice/src/main/resources/dubbo-haoban-manage-service.xml
+1
-0
ServiceTest.java
haoban-manage3-service/src/test/java/ServiceTest.java
+23
-2
TestController.java
.../com/gic/haoban/manage/web/controller/TestController.java
+31
-0
dubbo-haoban-manage-web.xml
...3-web/src/main/webapp/WEB-INF/dubbo-haoban-manage-web.xml
+1
-0
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/TestApiService.java
View file @
6b3dbe6b
...
...
@@ -4,4 +4,10 @@ package com.gic.haoban.manage.api.service;
* Created by tgs on 2020/2/9.
*/
public
interface
TestApiService
{
/**
* 测试
* @param id
* @return
*/
public
String
checkThread
(
String
id
,
Long
expireTime
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/TestServiceImpl.java
View file @
6b3dbe6b
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
out
.
impl
;
import
com.gic.haoban.manage.api.service.TestApiService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
/**
* Created by tgs on 2020/2/9.
*/
public
class
TestServiceImpl
{
@Service
public
class
TestServiceImpl
implements
TestApiService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
TestServiceImpl
.
class
);
@Override
public
String
checkThread
(
String
id
,
Long
expireTime
)
{
logger
.
info
(
"测试-start:{}"
,
id
);
if
(
expireTime
!=
null
&&
expireTime
>
0
)
{
logger
.
info
(
"延时:{}"
,
expireTime
);
try
{
Thread
.
sleep
(
expireTime
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
logger
.
info
(
"测试-end:{}"
,
id
);
return
id
;
}
}
haoban-manage3-service/src/main/resources/dubbo-haoban-manage-service.xml
View file @
6b3dbe6b
...
...
@@ -23,6 +23,7 @@
</bean>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.ApplicationApiService"
ref=
"applicationApiServiceImpl"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.TestApiService"
ref=
"testServiceImpl"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.DepartmentApiService"
ref=
"departmentApiServiceImpl"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.StaffApiService"
ref=
"staffApiServiceImpl"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService"
ref=
"wxEnterpriseRelatedApiServiceImpl"
timeout=
"10000"
/>
...
...
haoban-manage3-service/src/test/java/ServiceTest.java
View file @
6b3dbe6b
...
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.gic.api.base.commons.JSONResponse
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.TestApiService
;
import
com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.wechat.api.dto.qywx.*
;
...
...
@@ -11,8 +12,10 @@ import com.gic.wechat.api.enums.QywxMediaTypeEnum;
import
com.gic.wechat.api.service.qywx.QywxDepartmentApiService
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
org.apache.logging.log4j.core.util.ExecutorServices
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.quartz.spi.ThreadPool
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
...
...
@@ -28,6 +31,9 @@ import java.util.ArrayList;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.concurrent.Executor
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
locations
=
{
"classpath:applicationContext-conf.xml"
})
...
...
@@ -47,9 +53,24 @@ public class ServiceTest {
@Autowired
private
StaffApiService
staffApiService
;
@Test
@Autowired
private
TestApiService
testApiService
;
private
final
ExecutorService
pools
=
Executors
.
newFixedThreadPool
(
50
);
@Test
public
void
test
()
{
System
.
err
.
println
(
RedisUtil
.
getCache
(
"init-enterprise-ca66a01b79474c40b3e7c7f93daf1a3b"
));
int
i
=
2000
;
while
(
i
-->
0
)
{
int
finalI
=
i
;
pools
.
execute
(
new
Runnable
(){
@Override
public
void
run
()
{
testApiService
.
checkThread
(
finalI
+
""
,
100L
);
}
});
}
}
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/TestController.java
View file @
6b3dbe6b
...
...
@@ -3,15 +3,21 @@ package com.gic.haoban.manage.web.controller;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService
;
import
com.gic.haoban.manage.api.service.TestApiService
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.qo.QywxXcxSendMessageQo
;
import
com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
/**
* Created 2020/4/9.
...
...
@@ -22,12 +28,20 @@ import java.util.ArrayList;
@RequestMapping
(
"/test"
)
public
class
TestController
extends
WebBaseController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
TestController
.
class
);
@Autowired
private
QywxSuiteApiService
qywxSuiteApiService
;
@Autowired
private
MemberUnionidRelatedApiService
memberUnionidRelatedApiService
;
private
final
ExecutorService
pools
=
Executors
.
newFixedThreadPool
(
500
);
@Autowired
private
TestApiService
testApiService
;
@RequestMapping
(
"/send-message-test"
)
public
HaobanResponse
testSendMessage
(
QywxXcxSendMessageQo
qo
)
{
QywxXcxSendMessageDTO
messageDTO
=
EntityUtil
.
changeEntityByOrika
(
QywxXcxSendMessageDTO
.
class
,
qo
);
...
...
@@ -49,4 +63,21 @@ public class TestController extends WebBaseController {
memberUnionidRelatedApiService
.
cleanByCid
(
cid
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
@RequestMapping
(
"/test-dubbo"
)
public
HaobanResponse
dubbo
(
@RequestParam
(
defaultValue
=
"2000"
)
Integer
n
,
@RequestParam
(
defaultValue
=
"100"
)
String
t
)
{
int
i
=
n
;
while
(
i
-->
0
)
{
int
finalI
=
i
;
pools
.
execute
(
new
Runnable
(){
@Override
public
void
run
()
{
long
start
=
System
.
currentTimeMillis
();
testApiService
.
checkThread
(
finalI
+
""
,
Long
.
valueOf
(
t
));
logger
.
info
(
"时间:{}"
,
System
.
currentTimeMillis
()-
start
);
}
});
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
}
haoban-manage3-web/src/main/webapp/WEB-INF/dubbo-haoban-manage-web.xml
View file @
6b3dbe6b
...
...
@@ -62,5 +62,6 @@
id=
"dealSyncOperationApiService"
/>
<dubbo:reference
id=
"quartzService"
interface=
"com.gic.quartz.api.service.QuartzService"
timeout=
"10000"
/>
<dubbo:reference
id=
"testApiService"
interface=
"com.gic.haoban.manage.api.service.TestApiService"
timeout=
"10000"
/>
</beans>
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