Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
f1eeb03d
Commit
f1eeb03d
authored
Dec 11, 2023
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.压测优化
parent
fe0d7933
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
88 additions
and
10 deletions
+88
-10
ControllerAop.java
...a/com/yeejoin/amos/boot/biz/common/aop/ControllerAop.java
+1
-0
CacheHelper.java
...a/com/yeejoin/amos/patrol/business/cache/CacheHelper.java
+14
-1
CheckController.java
...join/amos/patrol/business/controller/CheckController.java
+5
-3
CheckRecordDataConsumer.java
...in/amos/patrol/business/data/CheckRecordDataConsumer.java
+4
-2
EsEntity.java
...n/java/com/yeejoin/amos/patrol/business/dto/EsEntity.java
+27
-0
PlanTaskServiceImpl.java
...mos/patrol/business/service/impl/PlanTaskServiceImpl.java
+0
-0
ElasticSearchClientConfig.java
...yeejoin/amos/patrol/config/ElasticSearchClientConfig.java
+9
-0
ElasticSearchRestTemplateConfig.java
...n/amos/patrol/config/ElasticSearchRestTemplateConfig.java
+18
-0
application-dev.properties
...spatrol-biz/src/main/resources/application-dev.properties
+7
-2
application.properties
...e-tzspatrol-biz/src/main/resources/application.properties
+3
-2
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/aop/ControllerAop.java
View file @
f1eeb03d
...
...
@@ -116,6 +116,7 @@ public class ControllerAop {
urls
.
add
(
"/tcm/userInfo/getPersonType"
);
// urls.add("/patrol/api/check/checkCalendarForWx");
urls
.
add
(
"/patrol/api/check/saveRecordAll"
);
urls
.
add
(
"/patrol/api/check/saveRecordAll2"
);
urls
.
add
(
"/patrol/api/planTask/queryPlanTaskNew"
);
// 获取请求路径
for
(
String
uri
:
urls
)
{
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/cache/CacheHelper.java
View file @
f1eeb03d
...
...
@@ -24,10 +24,23 @@ public class CacheHelper {
@PostConstruct
public
void
init
()
{
List
<
InputItem
>
inputItems
=
iInputItemDao
.
findAll
();
inputItems
.
forEach
(
inputItem
->
redisUtils
.
hset
(
P_INPUT_ITEM_REDIS_KEY_PREFIX
,
String
.
valueOf
(
inputItem
.
getId
()),
inputItem
));
redisUtils
.
del
(
P_INPUT_ITEM_REDIS_KEY_PREFIX
);
inputItems
.
forEach
(
inputItem
->
redisUtils
.
hset
(
P_INPUT_ITEM_REDIS_KEY_PREFIX
,
String
.
valueOf
(
inputItem
.
getId
()),
inputItem
,
3600
));
}
public
InputItem
getInputItemCacheData
(
String
inputItemId
)
{
if
(
redisUtils
.
hHasKey
(
P_INPUT_ITEM_REDIS_KEY_PREFIX
,
inputItemId
)){
return
(
InputItem
)
redisUtils
.
hget
(
P_INPUT_ITEM_REDIS_KEY_PREFIX
,
inputItemId
);
}
else
{
synchronized
(
this
){
if
(
redisUtils
.
hHasKey
(
P_INPUT_ITEM_REDIS_KEY_PREFIX
,
inputItemId
)){
return
(
InputItem
)
redisUtils
.
hget
(
P_INPUT_ITEM_REDIS_KEY_PREFIX
,
inputItemId
);
}
else
{
List
<
InputItem
>
inputItems
=
iInputItemDao
.
findAll
();
inputItems
.
forEach
(
inputItem
->
redisUtils
.
hset
(
P_INPUT_ITEM_REDIS_KEY_PREFIX
,
String
.
valueOf
(
inputItem
.
getId
()),
inputItem
,
3600
));
return
(
InputItem
)
redisUtils
.
hget
(
P_INPUT_ITEM_REDIS_KEY_PREFIX
,
inputItemId
);
}
}
}
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/controller/CheckController.java
View file @
f1eeb03d
...
...
@@ -230,10 +230,11 @@ public class CheckController extends AbstractBaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"一键提交巡检任务"
,
notes
=
"一键提交巡检任务<font color='blue'>手机app</font>"
)
@RequestMapping
(
value
=
"/saveRecordAll"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/saveRecordAll
2
"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
ResponseModel
<
Object
>
saveCheckRecordAll
(
@RequestParam
String
ids
)
{
String
userId
=
RequestContext
.
getExeUserId
();
try
{
// 查询数据库和es 单线程串行执行
UserTransmittableUtils
.
setUser
();
planTaskService
.
handleAllBatch
(
ids
,
userId
);
}
catch
(
Exception
e
)
{
...
...
@@ -246,10 +247,11 @@ public class CheckController extends AbstractBaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"一键提交巡检任务"
,
notes
=
"一键提交巡检任务<font color='blue'>手机app</font>"
)
@RequestMapping
(
value
=
"/saveRecordAll
2
"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
ResponseModel
<
Object
>
saveCheckRecordAll
1
(
@RequestParam
String
ids
)
{
@RequestMapping
(
value
=
"/saveRecordAll"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
ResponseModel
<
Object
>
saveCheckRecordAll
2
(
@RequestParam
String
ids
)
{
String
userId
=
RequestContext
.
getExeUserId
();
try
{
// 查询数据库和es 多线程并行执行
UserTransmittableUtils
.
setUser
();
planTaskService
.
handleAllBatch2
(
ids
,
userId
);
}
catch
(
Exception
e
)
{
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/data/CheckRecordDataConsumer.java
View file @
f1eeb03d
...
...
@@ -96,8 +96,10 @@ public class CheckRecordDataConsumer implements Runnable {
}
private
AgencyUserModel
getAgencyUserModel
(
RequestContextModel
requestContextModel
)
{
List
<
AgencyUserModel
>
agencyUserModels
=
FeignUtil
.
remoteCall
(()->
Privilege
.
agencyUserClient
.
queryByIds
(
requestContextModel
.
getExcutedUserId
(),
false
));
return
agencyUserModels
.
get
(
0
);
// 记录暂时不用 注释掉
//List<AgencyUserModel> agencyUserModels = FeignUtil.remoteCall(()->Privilege.agencyUserClient.queryByIds(requestContextModel.getExcutedUserId(),false));
// return agencyUserModels.get(0);
return
null
;
}
private
void
setRequestContext
(){
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dto/EsEntity.java
0 → 100644
View file @
f1eeb03d
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
dto
;
import
lombok.Getter
;
import
lombok.Setter
;
/**
*
* @author LiuLin
* @date 2023年10月11日 09:31
*/
@Setter
@Getter
public
final
class
EsEntity
<
T
>
{
private
String
id
;
private
T
data
;
public
EsEntity
()
{
}
public
EsEntity
(
String
id
,
T
data
)
{
this
.
data
=
data
;
this
.
id
=
id
;
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/PlanTaskServiceImpl.java
View file @
f1eeb03d
This diff is collapsed.
Click to expand it.
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/config/ElasticSearchClientConfig.java
View file @
f1eeb03d
...
...
@@ -25,6 +25,13 @@ public class ElasticSearchClientConfig {
@Value
(
"${elasticsearch.password}"
)
private
String
password
;
@Value
(
"${elasticsearch.maxConnectNum:1000}"
)
private
int
maxConnectNum
;
@Value
(
"${elasticsearch.maxConnectPerRoute:1000}"
)
private
int
maxConnectPerRoute
;
@Bean
(
destroyMethod
=
"close"
)
public
RestHighLevelClient
restHighLevelClient
()
{
final
CredentialsProvider
credentialsProvider
=
new
BasicCredentialsProvider
();
...
...
@@ -36,6 +43,8 @@ public class ElasticSearchClientConfig {
RestClientBuilder
builder
=
RestClient
.
builder
(
httpHosts
);
builder
.
setHttpClientConfigCallback
(
httpClientBuilder
->
{
httpClientBuilder
.
disableAuthCaching
();
httpClientBuilder
.
setMaxConnTotal
(
maxConnectNum
);
httpClientBuilder
.
setMaxConnPerRoute
(
maxConnectPerRoute
);
return
httpClientBuilder
.
setDefaultCredentialsProvider
(
credentialsProvider
);
});
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/config/ElasticSearchRestTemplateConfig.java
0 → 100644
View file @
f1eeb03d
package
com
.
yeejoin
.
amos
.
patrol
.
config
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate
;
import
org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories
;
@Configuration
@EnableElasticsearchRepositories
(
basePackages
=
{
"com.yeejoin.amos.boot.module.common.biz.dao"
,
"com.yeejoin.amos.patrol.business.dao.repository"
})
public
class
ElasticSearchRestTemplateConfig
{
@Bean
public
ElasticsearchRestTemplate
elasticsearchTemplate
(
RestHighLevelClient
restHighLevelClient
)
{
return
new
ElasticsearchRestTemplate
(
restHighLevelClient
);
}
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/resources/application-dev.properties
View file @
f1eeb03d
...
...
@@ -26,7 +26,7 @@ spring.datasource.password=Yeejoin@2023
spring.datasource.type
=
com.zaxxer.hikari.HikariDataSource
spring.datasource.driver-class-name
=
cn.com.vastbase.Driver
spring.datasource.hikari.maxLifetime
=
1765000
spring.datasource.hikari.maximum-pool-size
=
1
00
spring.datasource.hikari.maximum-pool-size
=
2
00
spring.datasource.hikari.minimum-idle
=
15
spring.datasource.testWhileIdle
=
true
spring.datasource.validationQuery
=
SELECT 1
...
...
@@ -43,7 +43,7 @@ spring.redis.database=1
spring.redis.host
=
172.16.10.243
spring.redis.port
=
6379
spring.redis.password
=
yeejoin@2020
spring.redis.jedis.pool.max-active
=
2
00
spring.redis.jedis.pool.max-active
=
5
00
spring.redis.jedis.pool.max-wait
=
-1
spring.redis.jedis.pool.max-idle
=
10
spring.redis.jedis.pool.min-idle
=
0
...
...
@@ -112,6 +112,8 @@ fire-rescue=1432549862557130753
action.auto_create_index
:
true
elasticsearch.username
=
elastic
elasticsearch.password
=
a123456
elasticsearch.maxConnectNum
=
1000
elasticsearch.maxConnectPerRoute
=
1000
spring.elasticsearch.rest.uris
=
http://172.16.10.243:9200
## unit(h)
alertcall.es.synchrony.time
=
48
...
...
@@ -195,8 +197,11 @@ spring.jpa.properties.hibernate.order_updates =true
shardingsphere.create.tables.num
=
10
logging.level.com.zaxxer.hikari
=
DEBUG
logging.level.org.springframework.data.elasticsearch
=
error
logging.level.org.elasticsearch
=
error
amos.system.user.user-name
=
admin_tzs
amos.system.user.password
=
a1234560
amos.system.user.app-key
=
AMOS_STUDIO
amos.system.user.product
=
AMOS_STUDIO_WEB
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/resources/application.properties
View file @
f1eeb03d
spring.application.name
=
AMOS-PATROL
-LTW
spring.application.name
=
AMOS-PATROL
server.servlet.context-path
=
/patrol
server.port
=
8082
...
...
@@ -17,11 +17,12 @@ spring.jpa.show-sql = false
spring.jpa.hibernate.ddl-auto
=
none
spring.jpa.hibernate.naming-strategy
=
org.hibernate.cfg.ImprovedNamingStrategy
spring.jpa.database-platform
=
org.hibernate.dialect.MySQLDialect
mybatis.mapper-locations
=
classpath:db/mapper/*.xml
mybatis-plus.mapper-locations
=
classpath:db/mapper/*.xml
mybatis.type-aliases-package
=
com.yeejoin.amos.patrol.business.entity.mybatis
mybatis.configuration.mapUnderscoreToCamelCase
=
true
mybatis-plus.configuration.log-impl
=
org.apache.ibatis.logging.
stdout.StdOut
Impl
mybatis-plus.configuration.log-impl
=
org.apache.ibatis.logging.
nologging.NoLogging
Impl
mybatis-plus.global-config.db-config.update-strategy
=
ignored
spring.liquibase.change-log
=
classpath:/db/changelog/changelog-master.xml
...
...
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