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
238fe62a
Commit
238fe62a
authored
Jul 18, 2023
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.性能优化数据预热,异步调用
parent
7146b2b5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
163 additions
and
74 deletions
+163
-74
ControllerAop.java
...a/com/yeejoin/amos/boot/biz/common/aop/ControllerAop.java
+11
-11
BizCommonConstant.java
...in/amos/boot/module/tcm/api/common/BizCommonConstant.java
+5
-0
RegUnitInfoDto.java
...join/amos/boot/module/tcm/flc/api/dto/RegUnitInfoDto.java
+9
-3
IUnitInfoService.java
...mos/boot/module/tcm/flc/api/service/IUnitInfoService.java
+8
-0
AmosTcmApplication.java
...iz/src/main/java/com/yeejoin/amos/AmosTcmApplication.java
+28
-1
StartPlatformTokenService.java
...odule/tcm/biz/service/impl/StartPlatformTokenService.java
+41
-27
RedisUtil.java
...com/yeejoin/amos/boot/module/tcm/biz/utils/RedisUtil.java
+7
-0
UnitInfoController.java
...oot/module/tcm/flc/biz/controller/UnitInfoController.java
+2
-24
RegUnitInfoServiceImpl.java
...dule/tcm/flc/biz/service/impl/RegUnitInfoServiceImpl.java
+0
-0
UnitInfoServiceImpl.java
.../module/tcm/flc/biz/service/impl/UnitInfoServiceImpl.java
+52
-8
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/aop/ControllerAop.java
View file @
238fe62a
...
...
@@ -85,18 +85,18 @@ public class ControllerAop {
urls
.
add
(
"/api/user/save/curCompany"
);
urls
.
add
(
"/jcs/command/lookHtmlText"
);
urls
.
add
(
"^/jcs/common/duty-person/findByDutyAreaId/[A-Za-z0-9]+$"
);
urls
.
add
(
"/t
zs
/wechatBack"
);
urls
.
add
(
"/
tzs
/elevator/getElevatorInfo"
);
urls
.
add
(
"/t
cm
/wechatBack"
);
urls
.
add
(
"/
elevator
/elevator/getElevatorInfo"
);
urls
.
add
(
"/openapi/bizToken/applyToken"
);
urls
.
add
(
"/t
zs
/flc-unit-info/region/tree"
);
urls
.
add
(
"/t
zs
/reg-unit-info/management-unit/tree"
);
urls
.
add
(
"/t
zs
/reg-unit-info/unit-type/list"
);
urls
.
add
(
"^/t
zs
/flc-unit-info/hasExistPhone/[0-9]+$"
);
urls
.
add
(
"^/t
zs
/flc-unit-info/sendTelCode/[0-9]+$"
);
urls
.
add
(
"^/t
zs
/reg-unit-info/[A-Za-z0-9]+/check$"
);
urls
.
add
(
"^/t
zs
/flc-unit-info/verifyTelCode/[A-Za-z0-9]+/[A-Za-z0-9]+"
);
urls
.
add
(
"^/t
zs
/flc-unit-info/hasExistUser/[A-Za-z0-9_-]+"
);
urls
.
add
(
"/t
zs
/reg-unit-info/save"
);
urls
.
add
(
"/t
cm
/flc-unit-info/region/tree"
);
urls
.
add
(
"/t
cm
/reg-unit-info/management-unit/tree"
);
urls
.
add
(
"/t
cm
/reg-unit-info/unit-type/list"
);
urls
.
add
(
"^/t
cm
/flc-unit-info/hasExistPhone/[0-9]+$"
);
urls
.
add
(
"^/t
cm
/flc-unit-info/sendTelCode/[0-9]+$"
);
urls
.
add
(
"^/t
cm
/reg-unit-info/[A-Za-z0-9]+/check$"
);
urls
.
add
(
"^/t
cm
/flc-unit-info/verifyTelCode/[A-Za-z0-9]+/[A-Za-z0-9]+"
);
urls
.
add
(
"^/t
cm
/flc-unit-info/hasExistUser/[A-Za-z0-9_-]+"
);
urls
.
add
(
"/t
cm
/reg-unit-info/save"
);
// 获取请求路径
for
(
String
uri
:
urls
)
{
Pattern
p
=
Pattern
.
compile
(
uri
);
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/common/BizCommonConstant.java
View file @
238fe62a
...
...
@@ -11,4 +11,9 @@ public interface BizCommonConstant {
* 所有平台企业数据redisKey
*/
String
COMPANY_TREE_REDIS_KEY
=
"REGULATOR_UNIT_TREE"
;
/**
* 所有区划企业数据redisKey
*/
String
REGION_TREE_REDIS_KEY
=
"REGION_TREE_TCM"
;
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/flc/api/dto/RegUnitInfoDto.java
View file @
238fe62a
...
...
@@ -20,11 +20,11 @@ import java.util.List;
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ApiModel
(
value
=
"RegUnitInfoDto"
,
description
=
"单位注册信息表"
)
@ApiModel
(
value
=
"RegUnitInfoDto"
,
description
=
"单位注册信息表"
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
RegUnitInfoDto
extends
BaseDto
{
public
class
RegUnitInfoDto
extends
BaseDto
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"单位名称"
)
...
...
@@ -51,6 +51,12 @@ public class RegUnitInfoDto extends BaseDto {
@ApiModelProperty
(
value
=
"管辖单位id"
)
private
String
managementUnitId
;
@ApiModelProperty
(
value
=
"管辖单位编码"
)
private
String
managementUnitCompanyCode
;
@ApiModelProperty
(
value
=
"管辖单位orgCode"
)
private
String
managementUnitOrgCode
;
@ApiModelProperty
(
value
=
"区域编码"
)
private
String
regionCode
;
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/flc/api/service/IUnitInfoService.java
View file @
238fe62a
...
...
@@ -5,7 +5,9 @@ import com.yeejoin.amos.boot.module.tcm.flc.api.dto.UnitInfoApproveDto;
import
com.yeejoin.amos.boot.module.tcm.flc.api.dto.UnitInfoDto
;
import
com.yeejoin.amos.boot.module.tcm.flc.api.entity.UnitInfo
;
import
com.yeejoin.amos.boot.module.tcm.flc.api.entity.UnitInfoChange
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
java.util.Collection
;
import
java.util.List
;
/**
...
...
@@ -42,4 +44,10 @@ public interface IUnitInfoService {
List
<
UnitInfoDto
>
getUseUnit
(
String
unitType
,
String
address
,
String
orgName
,
String
organizationCode
);
Boolean
addQRcode
();
/**
* 单位树
* @return Collection<RegionModel>
*/
Collection
<
RegionModel
>
getRegionTree
(
Long
parentId
);
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/AmosTcmApplication.java
View file @
238fe62a
package
com
.
yeejoin
.
amos
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.biz.common.utils.oConvertUtils
;
import
com.yeejoin.amos.boot.module.tcm.biz.listener.BaseEnterpriseMqTtlListener
;
import
com.yeejoin.amos.boot.module.tcm.biz.listener.CarcylUnitInspectMqTtlListener
;
import
com.yeejoin.amos.boot.module.tcm.biz.listener.PrivilegeCompanyDeleteListener
;
import
com.yeejoin.amos.boot.module.tcm.biz.listener.PrivilegeCompanyUpdateAddListener
;
import
com.yeejoin.amos.boot.module.tcm.biz.service.impl.EquipmentCategoryServiceImpl
;
import
com.yeejoin.amos.boot.module.tcm.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.boot.module.tcm.biz.utils.RedisUtil
;
import
com.yeejoin.amos.boot.module.tcm.flc.api.service.IUnitInfoService
;
import
com.yeejoin.amos.boot.module.tcm.flc.biz.service.impl.UnitInfoServiceImpl
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.slf4j.Logger
;
...
...
@@ -30,6 +38,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
import
java.net.InetAddress
;
import
java.net.UnknownHostException
;
import
java.util.List
;
/**
* <pre>
...
...
@@ -76,6 +85,15 @@ public class AmosTcmApplication {
@Value
(
"${spring.application.name}"
)
private
String
applicationName
;
@Autowired
RedisUtil
redisUtil
;
@Autowired
EquipmentCategoryServiceImpl
equipmentCategoryService
;
@Autowired
UnitInfoServiceImpl
unitInfoService
;
public
static
void
main
(
String
[]
args
)
throws
UnknownHostException
{
ConfigurableApplicationContext
context
=
SpringApplication
.
run
(
AmosTcmApplication
.
class
,
args
);
...
...
@@ -103,8 +121,17 @@ public class AmosTcmApplication {
}
@Bean
public
void
initToken
()
{
public
void
init
()
{
//1.登录
startPlatformTokenService
.
getToken
();
//2.角色数据放redis缓存(依赖1)
FeignClientResult
<
List
<
RoleModel
>>
roleListResult
=
Privilege
.
roleClient
.
queryRoleList
(
null
,
null
);
List
<
RoleModel
>
roleModels
=
roleListResult
.
getResult
();
redisUtil
.
set
(
RedisUtil
.
ROLE_REDIS_KEY
,
JSONObject
.
toJSONString
(
roleModels
));
//3.管辖机构放redis缓存(依赖1)
equipmentCategoryService
.
creatTree
();
//4.区域放redis缓存(依赖1)
unitInfoService
.
getAllRegionTree
();
}
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/service/impl/StartPlatformTokenService.java
View file @
238fe62a
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.tcm.biz.utils.RedisUtil
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
com.yeejoin.amos.component.robot.AmosRequestContex
t
;
import
java.util.Lis
t
;
import
static
com
.
alibaba
.
fastjson
.
JSON
.
parseArray
;
/**
* requestContext设置
* @author Administrator
*/
@Service
public
class
StartPlatformTokenService
{
@Value
(
"${admin.product}"
)
String
product
;
@Autowired
AmosRequestContext
amosRequestContext
;
@Autowired
RedisUtil
redisUtil
;
@Value
(
"${admin.appkey}"
)
String
appkey
;
@Value
(
"${admin.user}"
)
String
user
;
public
void
getToken
()
{
RequestContext
.
setProduct
(
amosRequestContext
.
getProduct
());
RequestContext
.
setAppKey
(
amosRequestContext
.
getAppKey
());
RequestContext
.
setToken
(
amosRequestContext
.
getToken
());
}
@Value
(
"${admin.password}"
)
String
password
;
@Value
(
"${amos.secret.key}"
)
String
secretKey
;
public
void
setRequestContext
()
{
RequestContext
.
setProduct
(
amosRequestContext
.
getProduct
());
RequestContext
.
setAppKey
(
amosRequestContext
.
getAppKey
());
RequestContext
.
setToken
(
amosRequestContext
.
getToken
());
}
public
List
<
RoleModel
>
getAllRole
(){
List
<
RoleModel
>
roleModels
;
if
(
redisUtil
.
hasKey
(
RedisUtil
.
ROLE_REDIS_KEY
)){
roleModels
=
parseArray
(
redisUtil
.
get
(
RedisUtil
.
ROLE_REDIS_KEY
).
toString
(),
RoleModel
.
class
);
return
roleModels
;
}
else
{
FeignClientResult
<
List
<
RoleModel
>>
roleListResult
=
Privilege
.
roleClient
.
queryRoleList
(
null
,
null
);
roleModels
=
roleListResult
.
getResult
();
redisUtil
.
set
(
RedisUtil
.
ROLE_REDIS_KEY
,
JSONObject
.
toJSONString
(
roleModels
));
}
return
roleModels
;
}
@Autowired
RedisUtil
redisUtil
;
@Autowired
AmosRequestContext
amosRequestContext
;
public
void
getToken
()
{
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appkey
);
String
token
=
amosRequestContext
.
getToken
();
System
.
out
.
println
(
"token:"
+
token
);
RequestContext
.
setToken
(
token
);
redisUtil
.
set
(
"platform_token"
,
token
);
}
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/utils/RedisUtil.java
View file @
238fe62a
...
...
@@ -18,6 +18,13 @@ import java.util.concurrent.TimeUnit;
**/
@Component
public
class
RedisUtil
{
/**
* 单位注册,角色key
*/
public
static
String
ROLE_REDIS_KEY
=
"UNIT_REGISTER_ROLE_REDIS"
;
@Autowired
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/flc/biz/controller/UnitInfoController.java
View file @
238fe62a
...
...
@@ -102,32 +102,10 @@ public class UnitInfoController extends BaseController {
@GetMapping
(
value
=
"/region/tree"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取组织机构树"
,
notes
=
"获取组织机构树"
)
public
ResponseModel
<
Collection
<
RegionModel
>>
getRegionTree
(
@RequestParam
(
value
=
"parentId"
,
required
=
false
)
Long
parentId
)
{
tzsAuthServiceImpl
.
setRequestContext
();
Collection
<
RegionModel
>
result
=
null
;
if
(
parentId
==
null
)
{
result
=
Systemctl
.
regionClient
.
queryForTree
(
null
).
getResult
();
}
else
{
result
=
Systemctl
.
regionClient
.
querySubAgencyTree
(
parentId
).
getResult
();
}
despace
(
result
);
return
ResponseHelper
.
buildResponse
(
result
);
return
ResponseHelper
.
buildResponse
(
unitInfoServiceImpl
.
getRegionTree
(
parentId
));
}
/**
* 去区域树中level多余空格
* @param result
*/
public
void
despace
(
Collection
<
RegionModel
>
result
){
Iterator
<
RegionModel
>
iterator
=
result
.
iterator
();
while
(
iterator
.
hasNext
())
{
RegionModel
regionModel
=
iterator
.
next
();
regionModel
.
setLevel
(
regionModel
.
getLevel
().
trim
());
regionModel
.
setLevelName
(
regionModel
.
getLevelName
().
trim
());
if
(!
ValidationUtil
.
isEmpty
(
regionModel
.
getChildren
()))
{
despace
(
regionModel
.
getChildren
());
}
}
}
/**
* 获取管辖单位树
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/flc/biz/service/impl/RegUnitInfoServiceImpl.java
View file @
238fe62a
This diff is collapsed.
Click to expand it.
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/flc/biz/service/impl/UnitInfoServiceImpl.java
View file @
238fe62a
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tcm
.
flc
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.constants.CommonConstant
;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
...
...
@@ -12,12 +13,14 @@ import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import
com.yeejoin.amos.boot.module.common.api.service.ISourceFileService
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl
;
import
com.yeejoin.amos.boot.module.tcm.api.common.BizCommonConstant
;
import
com.yeejoin.amos.boot.module.tcm.api.dto.WechatMessageDto
;
import
com.yeejoin.amos.boot.module.tcm.api.entity.WechatRelation
;
import
com.yeejoin.amos.boot.module.tcm.api.enums.TzsCommonParam
;
import
com.yeejoin.amos.boot.module.tcm.biz.service.impl.TzsAuthServiceImpl
;
import
com.yeejoin.amos.boot.module.tcm.biz.service.impl.WechatRelationServiceImpl
;
import
com.yeejoin.amos.boot.module.tcm.biz.service.impl.WechatServiceImpl
;
import
com.yeejoin.amos.boot.module.tcm.biz.utils.RedisUtil
;
import
com.yeejoin.amos.boot.module.tcm.flc.api.dto.UnitInfoApproveDto
;
import
com.yeejoin.amos.boot.module.tcm.flc.api.dto.UnitInfoDto
;
import
com.yeejoin.amos.boot.module.tcm.flc.api.entity.UnitInfo
;
...
...
@@ -32,6 +35,7 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import
com.yeejoin.amos.feign.privilege.model.RoleModel
;
import
com.yeejoin.amos.feign.privilege.util.DesUtil
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -43,17 +47,11 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.UUID
;
import
java.util.*
;
/**
* 企业信息表服务实现类
...
...
@@ -100,6 +98,9 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
@Value
(
"${tzs.wechat.tempId.kr}"
)
private
String
CALLBACK_TEMP
;
@Autowired
private
RedisUtil
redisUtil
;
@Transactional
...
...
@@ -638,7 +639,49 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto, UnitInfo, Unit
}
@Override
public
Collection
<
RegionModel
>
getRegionTree
(
Long
parentId
)
{
tzsAuthServiceImpl
.
setRequestContext
();
Collection
<
RegionModel
>
result
=
null
;
if
(
parentId
==
null
)
{
result
=
this
.
getAllRegionTree
();
}
else
{
result
=
Systemctl
.
regionClient
.
querySubAgencyTree
(
parentId
).
getResult
();
}
despace
(
result
);
return
result
;
}
public
Collection
<
RegionModel
>
getAllRegionTree
(){
Collection
<
RegionModel
>
result
=
null
;
if
(
redisUtil
.
hasKey
(
BizCommonConstant
.
REGION_TREE_REDIS_KEY
)){
result
=
JSONObject
.
parseArray
(
redisUtil
.
get
(
BizCommonConstant
.
REGION_TREE_REDIS_KEY
).
toString
(),
RegionModel
.
class
);
}
else
{
result
=
Systemctl
.
regionClient
.
queryForTree
(
null
).
getResult
();
redisUtil
.
set
(
BizCommonConstant
.
REGION_TREE_REDIS_KEY
,
JSONObject
.
toJSONString
(
result
));
}
return
result
;
}
/**
* 去区域树中level多余空格
* @param result
*/
public
void
despace
(
Collection
<
RegionModel
>
result
){
Iterator
<
RegionModel
>
iterator
=
result
.
iterator
();
while
(
iterator
.
hasNext
())
{
RegionModel
regionModel
=
iterator
.
next
();
regionModel
.
setLevel
(
regionModel
.
getLevel
().
trim
());
regionModel
.
setLevelName
(
regionModel
.
getLevelName
().
trim
());
if
(!
ValidationUtil
.
isEmpty
(
regionModel
.
getChildren
()))
{
despace
(
regionModel
.
getChildren
());
}
}
}
@Override
public
List
<
UnitInfoDto
>
getAllUnit
()
{
return
baseMapper
.
getAllUnit
();
}
}
\ No newline at end of file
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