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
feb43acc
Commit
feb43acc
authored
Jul 20, 2023
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、一码通总览bug修改
2、一码通行政区划查询重构 3、一码通生成重复码修改
parent
f261347d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
85 deletions
+77
-85
EquipmentCategoryServiceImpl.java
...le/ymt/biz/service/impl/EquipmentCategoryServiceImpl.java
+64
-85
SpringConfiguration.java
...n/amos/boot/module/ymt/biz/utils/SpringConfiguration.java
+13
-0
No files found.
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/service/impl/EquipmentCategoryServiceImpl.java
View file @
feb43acc
...
...
@@ -41,6 +41,7 @@ import org.elasticsearch.index.query.BoolQueryBuilder;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.elasticsearch.search.sort.SortOrder
;
import
org.springframework.aop.framework.AopContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.Resource
;
...
...
@@ -48,6 +49,7 @@ import org.springframework.http.HttpStatus;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.Assert
;
import
org.springframework.util.ObjectUtils
;
...
...
@@ -129,10 +131,18 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
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"
;
//西安行政区划code
private
static
final
String
XIAN
=
"610100"
;
//判断行政区划查询市还是区
private
static
final
String
END_CODE
=
"0000"
;
//判断行政区划查询街道
private
static
final
String
STREET_END_CODE
=
"00"
;
//一码通监督管理表单id
private
static
final
String
SUPERVISION_FROM_ID
=
"1627903532906602497"
;
...
...
@@ -262,10 +272,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
}
//生成码
Map
<
String
,
String
>
codeMap
;
synchronized
(
EquipmentCategoryServiceImpl
.
class
)
{
codeMap
=
creatCode
(
city
,
county
,
equipCategory
,
null
,
null
);
}
EquipmentCategoryServiceImpl
categoryService
=
(
EquipmentCategoryServiceImpl
)
AopContext
.
currentProxy
();
Map
<
String
,
String
>
codeMap
=
categoryService
.
creatCode
(
city
,
county
,
equipCategory
,
null
,
null
);
if
(
ObjectUtils
.
isEmpty
(
codeMap
))
{
return
new
HashMap
<>();
}
...
...
@@ -283,7 +291,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
elevatorCode
=
EquipmentCategoryEnum
.
BF
.
getCode
().
equals
(
equInfoDto
.
getEquState
())
?
null
:
codeMap
.
get
(
"code96333"
);
List
<
CategoryOtherInfo
>
categoryOtherInfo
=
categoryOtherInfoMapper
.
selectList
(
new
QueryWrapper
<
CategoryOtherInfo
>().
eq
(
"SUPERVISORY_CODE"
,
supervisorCode
));
if
(
categoryOtherInfo
.
size
()
>
0
)
{
// categoryOtherInfoMapper.updateCode(supervisorCode, equState);
supervisoryCodeInfoMapper
.
update
(
supervisoryCodeInfo
,
new
QueryWrapper
<
SupervisoryCodeInfo
>().
eq
(
"supervisory_code"
,
supervisoryCodeInfo
.
getSupervisoryCode
()));
}
else
{
supervisoryCodeInfo
.
setStatus
(
equState
);
...
...
@@ -365,57 +372,49 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Override
public
List
<
LinkedHashMap
>
getRegion
(
String
level
,
String
parentId
)
{
List
<
LinkedHashMap
>
list
;
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以0000结果查询市、否则查询区
Map
<
String
,
Object
>
map
=
regionCode
.
endsWith
(
END_CODE
)
?
(
Map
<
String
,
Object
>)
redisUtils
.
get
(
CITY
)
:
(
Map
<
String
,
Object
>)
redisUtils
.
get
(
REGION
);
if
(
ObjectUtils
.
isEmpty
(
map
))
{
map
=
getRegionList
();
//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
);
}
list
=
(
List
<
LinkedHashMap
>)
map
.
get
(
regionCode
);
return
list
;
return
list
.
stream
().
filter
(
r
->
regionCode
.
equals
(
r
.
get
(
"parentRegionCode"
).
toString
())).
collect
(
Collectors
.
toList
());
}
else
{
return
new
ArrayList
<>();
}
}
public
Map
<
String
,
Object
>
getRegionList
()
{
//查询省下所有的行政区划市,封装并存入redis
Map
<
String
,
Object
>
map1
=
new
HashMap
<>();
List
<
LinkedHashMap
>
cityList
;
FeignClientResult
tree
=
privilegeFeginService
.
getTree
();
List
<
LinkedHashMap
>
result
=
(
List
<
LinkedHashMap
>)
tree
.
getResult
();
//获取陕西省regionCode
String
regionCode
=
((
List
<
LinkedHashMap
>)
privilegeFeginService
.
getProvince
(
"1"
).
getResult
()).
get
(
0
).
get
(
"regionCode"
).
toString
();
cityList
=
deleteTreeData
(
result
,
regionCode
);
Map
<
String
,
Object
>
cityMap
=
new
HashMap
<>();
cityMap
.
put
(
regionCode
,
cityList
);
map1
.
put
(
regionCode
,
cityList
);
redisUtils
.
set
(
CITY
,
cityMap
);
//查询市下所有的行政区划区,封装并存入redis
if
(!
ObjectUtils
.
isEmpty
(
cityList
))
{
List
<
LinkedHashMap
>
region
=
(
List
<
LinkedHashMap
>)
privilegeFeginService
.
getTree
().
getResult
();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
for
(
LinkedHashMap
linkedHashMap
:
cityList
)
{
List
<
LinkedHashMap
>
regionList
=
deleteTreeData
(
region
,
linkedHashMap
.
get
(
"regionCode"
).
toString
());
map
.
put
(
linkedHashMap
.
get
(
"regionCode"
).
toString
(),
regionList
);
map1
.
put
(
linkedHashMap
.
get
(
"regionCode"
).
toString
(),
regionList
);
}
redisUtils
.
set
(
REGION
,
map
);
}
return
map1
;
}
public
List
<
LinkedHashMap
>
getProvinceList
(
String
level
)
{
List
<
LinkedHashMap
>
list
;
FeignClientResult
result
=
privilegeFeginService
.
getProvince
(
level
);
list
=
(
List
<
LinkedHashMap
>)
result
.
getResult
();
list
.
get
(
0
).
put
(
"sequenceNbr"
,
list
.
get
(
0
).
get
(
"regionCode"
));
redisUtils
.
set
(
PROVINCE
,
list
);
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
;
}
...
...
@@ -454,35 +453,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
/**
* 获取行政区划以市或区的list集合
*
* @param result 需要删除的源数据
* @param type 匹配行政区划的regionCode,获取市则需要传省的regionCode,获取区则需要传市的regionCode
* @return 对应市或区的list集合
*/
private
List
<
LinkedHashMap
>
deleteTreeData
(
List
<
LinkedHashMap
>
result
,
String
type
)
{
Iterator
it
=
result
.
iterator
();
List
<
LinkedHashMap
>
list
=
new
ArrayList
<>();
while
(
it
.
hasNext
())
{
LinkedHashMap
e
=
(
LinkedHashMap
)
it
.
next
();
//修改数据
if
(
type
.
equals
(
e
.
get
(
"parentRegionCode"
).
toString
()))
{
e
.
put
(
"children"
,
null
);
e
.
put
(
"sequenceNbr"
,
e
.
get
(
"regionCode"
));
list
.
add
(
e
);
}
if
(!
ObjectUtils
.
isEmpty
(
e
.
get
(
"children"
)))
{
List
<
LinkedHashMap
>
children
=
deleteTreeData
((
List
<
LinkedHashMap
>)
e
.
get
(
"children"
),
type
);
list
.
addAll
(
children
);
}
}
return
list
;
}
/**
* 具体生成监管码和电梯96333识别码逻辑
*/
private
synchronized
Map
<
String
,
String
>
creatCode
(
String
city
,
String
county
,
String
equipCategory
,
String
code96333
,
String
supervisionCode
)
{
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRES_NEW
)
public
synchronized
Map
<
String
,
String
>
creatCode
(
String
city
,
String
county
,
String
equipCategory
,
String
code96333
,
String
supervisionCode
)
{
Map
<
String
,
String
>
resultMap
=
new
HashMap
<>();
StringBuilder
supervisorCode
=
new
StringBuilder
();
StringBuilder
elevatorCode
=
new
StringBuilder
();
...
...
@@ -551,7 +525,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
* @param county 行政区划区
* @return 监管码
*/
p
rivate
String
createSupervisorCode
(
String
city
,
String
county
,
String
equipCategory
)
{
p
ublic
String
createSupervisorCode
(
String
city
,
String
county
,
String
equipCategory
)
{
StringBuilder
supervisorCode
=
new
StringBuilder
();
//生成监管码前缀
Map
<
String
,
Object
>
divisionMap
=
equipmentCategoryMapper
.
getAdministrativeDivision
(
EquipmentCategoryEnum
.
XZQH
.
getCode
(),
county
);
...
...
@@ -585,7 +559,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
* @param county 行政区划区
* @return 96333电梯识别码
*/
p
rivate
String
createElevatorCode
(
String
city
,
String
county
)
{
p
ublic
String
createElevatorCode
(
String
city
,
String
county
)
{
StringBuilder
elevatorCode
=
new
StringBuilder
();
//生成生成96333电梯码前缀
Map
<
String
,
Object
>
elevatorMap
=
equipmentCategoryMapper
.
getAdministrativeDivision
(
EquipmentCategoryEnum
.
XZQHDT
.
getCode
(),
county
);
...
...
@@ -870,7 +844,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
getCategoryData
(
null
,
null
);
}
private
List
<
EquipmentCategoryData
>
getCategoryData
(
List
<
String
>
unitCodes
,
List
<
String
>
orgBranchCodes
)
{
private
List
<
EquipmentCategoryData
>
getCategoryData
(
List
<
String
>
unitCodes
,
List
<
String
>
orgBranchCodes
)
{
StopWatch
stopWatch
=
new
StopWatch
();
stopWatch
.
start
();
List
<
EquipmentCategoryData
>
list
=
new
ArrayList
<>();
...
...
@@ -889,17 +863,19 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
equipmentCategoryData
.
setOrgBranchCode
(
map
.
get
(
"supervise_org_code"
).
toString
());
equipmentCategoryData
.
setUnitCode
(
map
.
get
(
USE_CODE
).
toString
());
// 指定单位的设备统计信息
List
<
UseUnitCreditCodeCategoryDto
>
unitEquipCountList
=
equipCountList
.
stream
().
filter
(
r
->
r
.
getUseUnitCreditCode
().
equals
(
map
.
get
(
USE_CODE
).
toString
())).
collect
(
Collectors
.
toList
());
unitEquipCountList
=
unitEquipCountList
.
stream
().
filter
(
r
->
r
.
getOrgBranchCode
().
equals
(
map
.
get
(
ORG_BRANCH_CODE
).
toString
())).
collect
(
Collectors
.
toList
());
for
(
EquipmentCategory
category
:
equipmentCategories
)
{
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"waitClaim"
,
unitEquipCountList
.
stream
().
filter
(
r
->
r
.
getEquList
().
equals
(
category
.
getCode
())
&&
EquipmentCategoryEnum
.
DRL
.
getName
().
equals
(
r
.
getClaimStatus
())).
collect
(
Collectors
.
summarizingLong
(
UseUnitCreditCodeCategoryDto:
:
getTotal
)).
getSum
());
data
.
put
(
"alreadyClaim"
,
unitEquipCountList
.
stream
().
filter
(
r
->
r
.
getEquList
().
equals
(
category
.
getCode
())
&&
EquipmentCategoryEnum
.
YRL
.
getName
().
equals
(
r
.
getClaimStatus
())).
collect
(
Collectors
.
summarizingLong
(
UseUnitCreditCodeCategoryDto:
:
getTotal
)).
getSum
());
data
.
put
(
"refuseClaim"
,
unitEquipCountList
.
stream
().
filter
(
r
->
r
.
getEquList
().
equals
(
category
.
getCode
())
&&
EquipmentCategoryEnum
.
YJL
.
getName
().
equals
(
r
.
getClaimStatus
())).
collect
(
Collectors
.
summarizingLong
(
UseUnitCreditCodeCategoryDto:
:
getTotal
)).
getSum
());
this
.
set8CategoryCountData
(
equipmentCategoryData
,
category
,
data
);
List
<
UseUnitCreditCodeCategoryDto
>
unitEquipCountList
=
equipCountList
.
stream
().
filter
(
r
->
map
.
get
(
USE_CODE
).
toString
().
equals
(
r
.
getUseUnitCreditCode
())).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
unitEquipCountList
))
{
unitEquipCountList
=
unitEquipCountList
.
stream
().
filter
(
r
->
map
.
get
(
ORG_BRANCH_CODE
).
toString
().
equals
(
r
.
getOrgBranchCode
())).
collect
(
Collectors
.
toList
());
for
(
EquipmentCategory
category
:
equipmentCategories
)
{
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"waitClaim"
,
unitEquipCountList
.
stream
().
filter
(
r
->
r
.
getEquList
().
equals
(
category
.
getCode
())
&&
EquipmentCategoryEnum
.
DRL
.
getName
().
equals
(
r
.
getClaimStatus
())).
collect
(
Collectors
.
summarizingLong
(
UseUnitCreditCodeCategoryDto:
:
getTotal
)).
getSum
());
data
.
put
(
"alreadyClaim"
,
unitEquipCountList
.
stream
().
filter
(
r
->
r
.
getEquList
().
equals
(
category
.
getCode
())
&&
EquipmentCategoryEnum
.
YRL
.
getName
().
equals
(
r
.
getClaimStatus
())).
collect
(
Collectors
.
summarizingLong
(
UseUnitCreditCodeCategoryDto:
:
getTotal
)).
getSum
());
data
.
put
(
"refuseClaim"
,
unitEquipCountList
.
stream
().
filter
(
r
->
r
.
getEquList
().
equals
(
category
.
getCode
())
&&
EquipmentCategoryEnum
.
YJL
.
getName
().
equals
(
r
.
getClaimStatus
())).
collect
(
Collectors
.
summarizingLong
(
UseUnitCreditCodeCategoryDto:
:
getTotal
)).
getSum
());
this
.
set8CategoryCountData
(
equipmentCategoryData
,
category
,
data
);
}
equipmentCategoryData
.
setRecDate
(
new
Date
());
list
.
add
(
equipmentCategoryData
);
}
equipmentCategoryData
.
setRecDate
(
new
Date
());
list
.
add
(
equipmentCategoryData
);
}
if
(!
ObjectUtils
.
isEmpty
(
unitCodes
)){
equipmentCategoryDataMapper
.
delete
(
new
QueryWrapper
<
EquipmentCategoryData
>().
in
(
"unit_code"
,
unitCodes
));
...
...
@@ -1034,8 +1010,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String
county
=
String
.
valueOf
(
superviseMap
.
get
(
"county"
));
String
equCategory
=
String
.
valueOf
(
superviseMap
.
get
(
"equCategory"
));
String
supervisionCode
=
String
.
valueOf
(
superviseMap
.
get
(
"supervisionCode"
));
EquipmentCategoryServiceImpl
categoryService
=
(
EquipmentCategoryServiceImpl
)
AopContext
.
currentProxy
();
//生成码
codeMap
=
creatCode
(
city
,
county
,
equCategory
,
code96333
,
supervisionCode
);
codeMap
=
c
ategoryService
.
c
reatCode
(
city
,
county
,
equCategory
,
code96333
,
supervisionCode
);
log
.
info
(
"已生成对应监管码或96333电梯识别码"
);
//删除map中的冗余数据,添加对应监管码和96333码调用idx多表单页提交接口吧保存数据
map
.
remove
(
"data"
);
...
...
@@ -1075,8 +1052,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
response
.
setStatus
(
HttpStatus
.
BAD_REQUEST
.
value
());
return
response
;
}
finally
{
log
.
info
(
"已生成对应监管码"
+
supervisionMap
.
get
(
"SUPERVISORY_CODE"
));
log
.
info
(
"已生成对应96333电梯识别码"
+
supervisionMap
.
get
(
"CODE96333"
));
updateEquipmentCategoryData
(
unitCode
,
orgBranchCode
);
supervisoryCodeInfoMapper
.
update
(
supervisoryCodeInfo
,
new
QueryWrapper
<
SupervisoryCodeInfo
>().
eq
(
"supervisory_code"
,
supervis
oryCodeInfo
.
getSupervisoryCode
(
)));
supervisoryCodeInfoMapper
.
update
(
supervisoryCodeInfo
,
new
QueryWrapper
<
SupervisoryCodeInfo
>().
eq
(
"supervisory_code"
,
supervis
ionMap
.
get
(
"SUPERVISORY_CODE"
)));
}
return
responseModel
;
}
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/utils/SpringConfiguration.java
0 → 100644
View file @
feb43acc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ymt
.
biz
.
utils
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.EnableAspectJAutoProxy
;
@Configuration
@ComponentScan
(
"com.yeejoin.amos.boot.module.ymt.biz.service.impl"
)
@EnableAspectJAutoProxy
(
exposeProxy
=
true
)
//开启spring注解aop配置的支持
public
class
SpringConfiguration
{
}
\ 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