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
4e3f0c3b
Commit
4e3f0c3b
authored
Apr 30, 2025
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(amos-boot-module-jg): 优化生成登记证号逻辑
- 新增 getCityCode 方法,根据监管单位代码获取对应地市代码 - 修改生成登记证号逻辑,使用新的地市代码获取区域字典 - 优化代码结构,引入枚举类统一管理
parent
c18cb166
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
5 deletions
+55
-5
CommonServiceImpl.java
...os/boot/module/jg/biz/service/impl/CommonServiceImpl.java
+55
-5
No files found.
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/CommonServiceImpl.java
View file @
4e3f0c3b
...
...
@@ -54,10 +54,7 @@ import com.yeejoin.amos.boot.module.jg.biz.utils.JsonUtils;
import
com.yeejoin.amos.boot.module.jg.biz.utils.WordTemplateUtils
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.*
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentCategoryEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.*
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.*
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.feign.utils.FeignUtil
;
...
...
@@ -1935,7 +1932,9 @@ public class CommonServiceImpl implements ICommonService {
if
(!
ValidationUtil
.
isEmpty
(
specialRegionCode
))
{
// 特殊的区域
city
=
specialRegionCode
.
getName
();
}
else
{
// 普通的地市
DataDictionary
regionCodeDict
=
equipmentCategoryMapper
.
getOneDictByTypeAndExtend
(
EquipmentCategoryEnum
.
XZQH
.
getCode
(),
supervisoryCompanyCode
);
// 根据接收机构查询对应父级地市code,用于生成登记证号
String
cityCode
=
getCityCode
(
supervisoryCompanyCode
);
DataDictionary
regionCodeDict
=
equipmentCategoryMapper
.
getOneDictByTypeAndExtend
(
EquipmentCategoryEnum
.
XZQH
.
getCode
(),
cityCode
);
city
=
regionCodeDict
.
getCode
();
}
}
...
...
@@ -1945,6 +1944,57 @@ public class CommonServiceImpl implements ICommonService {
return
null
;
}
public
String
getCityCode
(
String
supervisoryCompanyCode
)
{
LinkedHashMap
<
String
,
Object
>
root
=
getCreatTree
().
get
(
0
);
// 根据supervisoryCompanyCode递归匹配regulatorUnitTree,并从中记录级别等于prefecture-level的节点,返回其code
return
findPrefectureLevelInTree
(
root
,
supervisoryCompanyCode
);
}
private
String
findPrefectureLevelInTree
(
LinkedHashMap
<
String
,
Object
>
node
,
String
targetCode
)
{
// 使用栈实现DFS遍历
// 节点栈
Deque
<
LinkedHashMap
<
String
,
Object
>>
nodeStack
=
new
ArrayDeque
<>();
// 路径栈
Deque
<
List
<
LinkedHashMap
<
String
,
Object
>>>
pathStack
=
new
ArrayDeque
<>();
nodeStack
.
push
(
node
);
pathStack
.
push
(
new
ArrayList
<>());
while
(!
nodeStack
.
isEmpty
())
{
LinkedHashMap
<
String
,
Object
>
current
=
nodeStack
.
pop
();
List
<
LinkedHashMap
<
String
,
Object
>>
currentPath
=
pathStack
.
pop
();
// 更新当前路径
List
<
LinkedHashMap
<
String
,
Object
>>
newPath
=
new
ArrayList
<>(
currentPath
);
newPath
.
add
(
current
);
// 命中目标节点
if
(
targetCode
.
equals
(
current
.
get
(
"companyCode"
)))
{
return
findPrefectureInPath
(
newPath
);
}
// 处理子节点
List
<
LinkedHashMap
<
String
,
Object
>>
children
=
(
List
<
LinkedHashMap
<
String
,
Object
>>)
current
.
get
(
"children"
);
if
(!
CollectionUtils
.
isEmpty
(
children
))
{
for
(
int
i
=
children
.
size
()-
1
;
i
>=
0
;
i
--)
{
// 保持原顺序需逆序压栈
nodeStack
.
push
(
children
.
get
(
i
));
pathStack
.
push
(
new
ArrayList
<>(
newPath
));
}
}
}
return
null
;
}
private
String
findPrefectureInPath
(
List
<
LinkedHashMap
<
String
,
Object
>>
path
)
{
// 逆序查找最近的地级节点
for
(
int
i
=
path
.
size
()-
1
;
i
>=
0
;
i
--)
{
LinkedHashMap
<
String
,
Object
>
node
=
path
.
get
(
i
);
if
(
CompanyLevelEnum
.
PREFECTURE_LEVEL
.
getCode
().
equals
(
node
.
get
(
"level"
)))
{
return
(
String
)
node
.
get
(
"companyCode"
);
}
}
return
null
;
}
/**
* 生成唯一使用登记编号
...
...
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