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
2d508643
Commit
2d508643
authored
Dec 12, 2023
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、pom修改,引入ymt的api模块
2、监管-部分公共接口提交
parent
47fa6c8e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
294 additions
and
0 deletions
+294
-0
pom.xml
...m-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/pom.xml
+5
-0
EquipmentCategoryController.java
...module/jg/biz/controller/EquipmentCategoryController.java
+61
-0
IEquipmentCategoryService.java
...boot/module/jg/biz/service/IEquipmentCategoryService.java
+24
-0
EquipmentCategoryServiceImpl.java
...ule/jg/biz/service/impl/EquipmentCategoryServiceImpl.java
+204
-0
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/pom.xml
View file @
2d508643
...
@@ -18,6 +18,11 @@
...
@@ -18,6 +18,11 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
com.amosframework.boot
</groupId>
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-module-ymt-api
</artifactId>
<version>
1.0.0
</version>
</dependency>
<dependency>
<groupId>
com.amosframework.boot
</groupId>
<artifactId>
amos-boot-module-common-biz
</artifactId>
<artifactId>
amos-boot-module-common-biz
</artifactId>
<version>
${amos-biz-boot.version}
</version>
<version>
${amos-biz-boot.version}
</version>
</dependency>
</dependency>
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/EquipmentCategoryController.java
0 → 100644
View file @
2d508643
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
controller
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IEquipmentCategoryService
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.util.List
;
/**
* 装备分类
*
* @author system_generator
* @date 2021-10-20
*/
@RestController
@Api
(
tags
=
"装备分类Api"
)
@RequestMapping
(
value
=
"/equipment-category"
)
public
class
EquipmentCategoryController
extends
BaseController
{
@Autowired
IEquipmentCategoryService
equipmentCategoryService
;
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/getChildren"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"通过设备种类code获取设备类别"
,
notes
=
"通过设备种类code获取设备类别"
)
public
ResponseModel
<
List
<
EquipmentCategory
>>
getChildren
(
@RequestParam
(
value
=
"code"
)
String
code
,
@RequestParam
(
value
=
"type"
,
required
=
false
)
String
type
)
{
return
ResponseHelper
.
buildResponse
(
equipmentCategoryService
.
getEquipmentCategoryList
(
code
,
type
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/getRegion"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取行政区划"
,
notes
=
"获取行政区划"
)
public
ResponseModel
<
Object
>
getRegion
(
@RequestParam
(
value
=
"level"
,
required
=
false
)
String
level
,
@RequestParam
(
value
=
"parentId"
,
required
=
false
)
String
parentId
)
{
return
ResponseHelper
.
buildResponse
(
equipmentCategoryService
.
getRegion
(
level
,
parentId
));
}
/**
* 获取管辖分局树
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/creatTree"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取管辖分局树"
,
notes
=
"获取管辖分局树"
)
public
ResponseModel
<
Object
>
creatTree
()
{
return
ResponseHelper
.
buildResponse
(
equipmentCategoryService
.
getTree
());
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/IEquipmentCategoryService.java
0 → 100644
View file @
2d508643
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
/**
* 装备分类接口类
*
* @author system_generator
* @date 2021-10-20
*/
public
interface
IEquipmentCategoryService
{
List
<
EquipmentCategory
>
getEquipmentCategoryList
(
String
code
,
String
type
);
List
<
LinkedHashMap
>
getRegion
(
String
level
,
String
parentId
);
List
<
LinkedHashMap
>
getTree
();
List
<
LinkedHashMap
>
creatTree
();
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/EquipmentCategoryServiceImpl.java
0 → 100644
View file @
2d508643
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IEquipmentCategoryService
;
import
com.yeejoin.amos.boot.module.ymt.flc.api.feign.PrivilegeFeginService
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 装备分类服务实现类
*
* @author system_generator
* @date 2021-10-20
*/
@Service
@Slf4j
public
class
EquipmentCategoryServiceImpl
extends
BaseService
<
EquipmentCategoryDto
,
EquipmentCategory
,
EquipmentCategoryMapper
>
implements
IEquipmentCategoryService
{
@Autowired
EquipmentCategoryMapper
equipmentCategoryMapper
;
@Autowired
private
RedisUtils
redisUtils
;
//行政区划redis缓存key
private
static
final
String
PROVINCE
=
"PROVINCE"
;
private
static
final
String
CITY
=
"CITY"
;
private
static
final
String
REGION
=
"REGION"
;
private
static
final
String
STREET
=
"STREET"
;
//行政区划level
private
static
final
String
PROVINCE_LEVEL
=
"1"
;
private
static
final
String
CITY_LEVEL
=
"2"
;
private
static
final
String
REGION_LEVEL
=
"3"
;
private
static
final
String
STREET_LEVEL
=
"4"
;
//判断行政区划查询市还是区
private
static
final
String
END_CODE
=
"0000"
;
//判断行政区划查询街道
private
static
final
String
STREET_END_CODE
=
"00"
;
//管辖机构redis缓存key
private
static
final
String
REGULATOR_UNIT_TREE
=
"REGULATOR_UNIT_TREE"
;
@Value
(
"${regulator.unit.code}"
)
private
String
code
;
@Autowired
PrivilegeFeginService
privilegeFeginService
;
@Override
public
List
<
EquipmentCategory
>
getEquipmentCategoryList
(
String
code
,
String
type
)
{
List
<
EquipmentCategory
>
result
=
new
ArrayList
<>();
LambdaQueryWrapper
<
EquipmentCategory
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
EquipmentCategory:
:
getCode
,
code
);
EquipmentCategory
equipmentCategory
=
equipmentCategoryMapper
.
selectOne
(
wrapper
);
if
(
ObjectUtils
.
isEmpty
(
type
))
{
result
.
add
(
equipmentCategory
);
}
else
{
LambdaQueryWrapper
<
EquipmentCategory
>
wrapper2
=
new
LambdaQueryWrapper
<>();
wrapper2
.
eq
(
EquipmentCategory:
:
getParentId
,
equipmentCategory
.
getId
());
result
=
equipmentCategoryMapper
.
selectList
(
wrapper2
);
}
return
result
;
}
@Override
public
List
<
LinkedHashMap
>
getRegion
(
String
level
,
String
parentId
)
{
List
<
LinkedHashMap
>
list
=
new
ArrayList
<>();
if
(!
ObjectUtils
.
isEmpty
(
level
))
{
list
=
(
List
<
LinkedHashMap
>)
redisUtils
.
get
(
PROVINCE
);
return
ObjectUtils
.
isEmpty
(
list
)
?
getProvinceList
(
level
)
:
list
;
}
else
if
(!
ObjectUtils
.
isEmpty
(
parentId
))
{
String
regionCode
=
parentId
.
split
(
"_"
)[
0
];
//regionCode不是以00结尾查询街道,以0000结果查询市、否则查询区
if
(!
regionCode
.
endsWith
(
STREET_END_CODE
))
{
list
=
ObjectUtils
.
isEmpty
(
redisUtils
.
get
(
STREET
))
?
getProvinceList
(
STREET_LEVEL
)
:
(
List
<
LinkedHashMap
>)
redisUtils
.
get
(
STREET
);
}
else
if
(
regionCode
.
endsWith
(
END_CODE
))
{
list
=
ObjectUtils
.
isEmpty
(
redisUtils
.
get
(
CITY
))
?
getProvinceList
(
CITY_LEVEL
)
:
(
List
<
LinkedHashMap
>)
redisUtils
.
get
(
CITY
);
}
else
{
list
=
ObjectUtils
.
isEmpty
(
redisUtils
.
get
(
REGION
))
?
getProvinceList
(
REGION_LEVEL
)
:
(
List
<
LinkedHashMap
>)
redisUtils
.
get
(
REGION
);
}
return
list
.
stream
().
filter
(
r
->
regionCode
.
equals
(
r
.
get
(
"parentRegionCode"
).
toString
())).
collect
(
Collectors
.
toList
());
}
else
{
return
new
ArrayList
<>();
}
}
public
List
<
LinkedHashMap
>
getProvinceList
(
String
level
)
{
FeignClientResult
result
=
privilegeFeginService
.
getProvince
(
level
);
List
<
LinkedHashMap
>
list
=
(
List
<
LinkedHashMap
>)
result
.
getResult
();
for
(
LinkedHashMap
linkedHashMap
:
list
)
{
linkedHashMap
.
put
(
"sequenceNbr"
,
linkedHashMap
.
get
(
"regionCode"
));
}
switch
(
level
)
{
case
PROVINCE_LEVEL:
redisUtils
.
set
(
PROVINCE
,
list
);
break
;
case
CITY_LEVEL:
redisUtils
.
set
(
CITY
,
list
);
break
;
case
REGION_LEVEL:
redisUtils
.
set
(
REGION
,
list
);
break
;
case
STREET_LEVEL:
redisUtils
.
set
(
STREET
,
list
);
break
;
default
:
log
.
error
(
"不支持的行政区划:{}"
,
level
);
break
;
}
return
list
;
}
@Override
public
List
<
LinkedHashMap
>
getTree
()
{
List
<
LinkedHashMap
>
result
=
(
List
<
LinkedHashMap
>)
redisUtils
.
get
(
REGULATOR_UNIT_TREE
);
//判断redis是否存在管辖机构树
return
!
ObjectUtils
.
isEmpty
(
result
)
?
result
:
creatTree
();
}
@Override
public
List
<
LinkedHashMap
>
creatTree
()
{
FeignClientResult
tree
=
privilegeFeginService
.
tree
(
RequestContext
.
getToken
(),
RequestContext
.
getAppKey
(),
RequestContext
.
getProduct
());
List
<
LinkedHashMap
>
result
=
(
List
<
LinkedHashMap
>)
tree
.
getResult
();
List
<
LinkedHashMap
>
treeData
=
deleteRegulatorTreeData
(
result
);
List
<
LinkedHashMap
>
supervisionTree
=
treeData
.
stream
().
filter
(
e
->
code
.
equals
(
e
.
get
(
"orgCode"
))).
collect
(
Collectors
.
toList
());
List
<
LinkedHashMap
>
resultTree
=
updateNullChildren
(
supervisionTree
);
redisUtils
.
set
(
REGULATOR_UNIT_TREE
,
resultTree
);
return
resultTree
;
}
/**
* 将管辖机构树中children为[]的修改为null
*
* @param result
* @return
*/
private
List
<
LinkedHashMap
>
updateNullChildren
(
List
<
LinkedHashMap
>
result
)
{
Iterator
it
=
result
.
iterator
();
while
(
it
.
hasNext
())
{
LinkedHashMap
e
=
(
LinkedHashMap
)
it
.
next
();
//将管辖机构树中children为[]的修改为null
if
(
e
.
get
(
"children"
)
!=
null
)
{
if
(((
List
<
LinkedHashMap
>)
e
.
get
(
"children"
)).
size
()
==
0
)
{
e
.
put
(
"children"
,
null
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
e
.
get
(
"children"
)))
{
updateNullChildren
((
List
<
LinkedHashMap
>)
e
.
get
(
"children"
));
}
}
return
result
;
}
/**
* 删除管辖机构树中level为使用单位的数据
*
* @param result 管辖机构树
* @return 筛选过滤后不包含使用单位的管辖机构树
*/
private
List
<
LinkedHashMap
>
deleteRegulatorTreeData
(
List
<
LinkedHashMap
>
result
)
{
Iterator
it
=
result
.
iterator
();
while
(
it
.
hasNext
())
{
LinkedHashMap
e
=
(
LinkedHashMap
)
it
.
next
();
//删除使用单位
if
(
"company"
.
equals
(
e
.
get
(
"level"
)))
{
it
.
remove
();
}
if
(
e
.
get
(
"companyName"
).
toString
().
contains
(
"行政审批局"
))
{
it
.
remove
();
}
// 删除检验检测机构
if
(!
"company"
.
equals
(
e
.
get
(
"level"
))
&&
e
.
get
(
"companyType"
).
toString
().
contains
(
"检验检测机构"
))
{
it
.
remove
();
}
if
(!
ObjectUtils
.
isEmpty
(
e
.
get
(
"children"
)))
{
deleteRegulatorTreeData
((
List
<
LinkedHashMap
>)
e
.
get
(
"children"
));
}
}
return
result
;
}
}
\ 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