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
a4e4798a
Commit
a4e4798a
authored
Jul 21, 2025
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(amos-boot): 优化统计模块代码结构和功能
- 调整气瓶分类统计逻辑,优化数据完整性统计 - 修复部分统计模板解析错误,增加模板覆盖逻辑 - 优化 JSON 字段处理,添加新字段方法 - 调整隐患模板结构,增加关联设备和企业信息展示
parent
680950b3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
188 additions
and
2 deletions
+188
-2
JsonValueUtils.java
...om/yeejoin/amos/boot/biz/common/utils/JsonValueUtils.java
+59
-0
DPSubController.java
...boot/module/statistcs/biz/controller/DPSubController.java
+1
-0
ComprehensiveStatisticalAnalysisServiceImpl.java
...ice/impl/ComprehensiveStatisticalAnalysisServiceImpl.java
+0
-0
DPSubServiceImpl.java
...t/module/statistcs/biz/service/impl/DPSubServiceImpl.java
+19
-1
problem.json
...odule-statistics-biz/src/main/resources/json/problem.json
+1
-1
problem_9.json
...ule-statistics-biz/src/main/resources/json/problem_9.json
+108
-0
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/JsonValueUtils.java
View file @
a4e4798a
...
...
@@ -2,6 +2,11 @@ package com.yeejoin.amos.boot.biz.common.utils;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.node.ArrayNode
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
com.google.common.base.Strings
;
/**
...
...
@@ -11,6 +16,8 @@ import com.google.common.base.Strings;
*/
public
class
JsonValueUtils
{
private
static
final
ObjectMapper
objectMapper
=
new
ObjectMapper
();
public
static
Object
getValueByKey
(
Object
originObject
,
String
startKey
,
String
targetKeyExpression
)
{
if
(
Strings
.
isNullOrEmpty
(
startKey
))
{
...
...
@@ -71,4 +78,56 @@ public class JsonValueUtils {
String
a
=
"{\"agencyCode\":\"jcs\",\"agencyUserType\":\"NORMAL\",\"appCodes\":[\"AMOS_ADMIN\",\"studio_normalapp_3144441\",\"studio_normalapp_3157169\",\"studio_normalapp_3168830\",\"studio_normalapp_3206513\",\"studio_normalapp_3230377\"],\"companyDepartments\":{},\"companys\":[{\"agencyCode\":\"jcs\",\"companyName\":\"咸阳机场\",\"companyOrgCode\":49,\"level\":\"headquarter\",\"orgCode\":\"49\",\"parentId\":0,\"sequenceNbr\":1397143494413381633}],\"createTime\":1625058001000,\"lockStatus\":\"UNLOCK\",\"orgNames\":\"咸阳机场(admin\\\\idx_report_data\\\\idx_report_audit\\\\Safety_Supervision_Instruct_Report\\\\Safety_Supervision_Rectify_Report\\\\Safety_Supervision_Rectify_Affirm)\",\"orgRoleName\":{1397143494413381633:\"咸阳机场(admin\\\\idx_report_data\\\\idx_report_audit\\\\Safety_Supervision_Instruct_Report\\\\Safety_Supervision_Rectify_Report\\\\Safety_Supervision_Rectify_Affirm)\"},\"orgRoleSeqs\":{1397143494413381633:[1397143493910065153,1484425579646689281,1484425839416713217,1536242867071119362,1536243072738816002,1536243348623355905]},\"orgRoles\":{1397143494413381633:[{\"agencyCode\":\"jcs\",\"roleDesc\":\"admin\",\"roleName\":\"admin\",\"roleType\":\"admin\",\"sequenceNbr\":1397143493910065153},{\"agencyCode\":\"jcs\",\"roleDesc\":\"指标系统-数据填报\",\"roleName\":\"idx_report_data\",\"roleType\":\"admin\",\"sequenceNbr\":1484425579646689281},{\"agencyCode\":\"jcs\",\"roleDesc\":\"指标系统-数据审核\",\"roleName\":\"idx_report_audit\",\"roleType\":\"admin\",\"sequenceNbr\":1484425839416713217},{\"agencyCode\":\"jcs\",\"roleDesc\":\"安全监察-填报指令书\",\"roleName\":\"Safety_Supervision_Instruct_Report\",\"roleType\":\"admin\",\"sequenceNbr\":1536242867071119362},{\"agencyCode\":\"jcs\",\"roleDesc\":\"安全监察-企业整改\",\"roleName\":\"Safety_Supervision_Rectify_Report\",\"roleType\":\"admin\",\"sequenceNbr\":1536243072738816002},{\"agencyCode\":\"jcs\",\"roleDesc\":\"安全监察-整改确认\",\"roleName\":\"Safety_Supervision_Rectify_Affirm\",\"roleType\":\"admin\",\"sequenceNbr\":1536243348623355905}]},\"password\":\"1CABE8C68B956573D0709013FD61CA5F\",\"passwordReset\":false,\"realName\":\"邢磊\",\"sequenceNbr\":1410417876975759361,\"userId\":\"3187681\",\"userName\":\"jcs_xl\"}"
;
System
.
out
.
println
(
getValueByKey
(
JSONObject
.
parse
(
a
),
"companys"
,
"companys.0.sequenceNbr"
));
}
/**
* JSON字段添加
*
* @param jsonString JSON字符串 示例 {"a":{"b":{"c":1}}}
* @param keyPath 字段路径 示例 "a.b.c"
* @param field 字段名 示例 "name"
* @param value 字段值 示例 "张三"
* @return 修改后的JSON字符串 {"a":{"b":{"c":1,"name":"张三"}}}
*/
public
String
jsonFieldAdd
(
String
jsonString
,
String
keyPath
,
String
field
,
String
value
)
throws
JsonProcessingException
{
JsonNode
rootNode
=
objectMapper
.
readTree
(
jsonString
);
// 修复路径格式(添加前导/)
JsonNode
targetNode
=
rootNode
.
at
(
'/'
+
keyPath
.
replace
(
"."
,
"/"
));
if
(
targetNode
.
isArray
())
{
ArrayNode
arrayNode
=
(
ArrayNode
)
targetNode
;
// 替换现有字段或添加新字段
boolean
replaced
=
false
;
for
(
JsonNode
node
:
arrayNode
)
{
if
(
node
.
has
(
"key"
)
&&
node
.
get
(
"key"
).
asText
().
equals
(
field
))
{
((
ObjectNode
)
node
).
put
(
"label"
,
value
);
replaced
=
true
;
break
;
}
}
if
(!
replaced
)
{
addNewArrayField
(
arrayNode
,
field
,
value
);
}
}
else
if
(
targetNode
.
isObject
())
{
boolean
replaced
=
false
;
if
(
targetNode
.
has
(
"key"
)
&&
targetNode
.
get
(
"key"
).
asText
().
equals
(
field
))
{
((
ObjectNode
)
targetNode
).
put
(
"label"
,
value
);
replaced
=
true
;
}
if
(!
replaced
)
{
((
ObjectNode
)
targetNode
).
put
(
field
,
value
);
}
}
// 修复返回值:序列化修改后的rootNode
return
objectMapper
.
writeValueAsString
(
rootNode
);
}
// 添加新的 key-value 字段
private
static
void
addNewArrayField
(
ArrayNode
arrayNode
,
String
newKey
,
String
newLabel
)
{
ObjectNode
newField
=
objectMapper
.
createObjectNode
();
newField
.
put
(
"key"
,
newKey
);
newField
.
put
(
"label"
,
newLabel
);
arrayNode
.
add
(
newField
);
}
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/controller/DPSubController.java
View file @
a4e4798a
...
...
@@ -72,6 +72,7 @@ public class DPSubController {
param
.
put
(
"sequenceNbr"
,
param
.
get
(
"alertId"
));
}
Assert
.
notNull
(
param
.
get
(
"sequenceNbr"
),
"sequenceNbr不能为空"
);
template
=
subService
.
getOverrideTemplateName
(
template
,
(
String
)
param
.
get
(
"problemTypeCode"
));
}
else
if
(
template
.
equals
(
"registration"
))
{
// 登记证
Assert
.
notNull
(
param
.
get
(
"sequenceNbr"
),
"sequenceNbr不能为空"
);
}
else
if
(
template
.
equals
(
"inspection"
))
{
// 报检
...
...
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/service/impl/ComprehensiveStatisticalAnalysisServiceImpl.java
View file @
a4e4798a
This diff is collapsed.
Click to expand it.
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/service/impl/DPSubServiceImpl.java
View file @
a4e4798a
...
...
@@ -66,7 +66,7 @@ public class DPSubServiceImpl {
private
String
supervisionCodePrefix
;
public
JSONObject
commonQuery
(
String
template
,
@RequestBody
Map
<
String
,
Object
>
param
)
{
JSONObject
result
=
new
JSONObject
()
;
JSONObject
result
;
String
templateJson
=
DpSubUtils
.
getFileContent
(
template
+
".json"
);
//1、替换json中所有的变量
...
...
@@ -993,4 +993,22 @@ public class DPSubServiceImpl {
}
return
bizResult
;
}
public
String
getOverrideTemplateName
(
String
template
,
String
paramKey
)
{
try
{
String
overrideTemplate
=
template
+
"_"
+
paramKey
;
try
{
// 尝试先获取覆盖模板
DpSubUtils
.
getFileContent
(
overrideTemplate
+
".json"
);
return
overrideTemplate
;
}
catch
(
Exception
e
)
{
// 未获取到覆盖模板,则使用基础模板
return
template
;
}
}
catch
(
Exception
e
)
{
log
.
info
(
"获取解析模板错误:{}"
,
e
.
getMessage
());
}
return
template
;
}
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/resources/json/problem.json
View file @
a4e4798a
...
...
@@ -90,8 +90,8 @@
"keyParams"
:
[
{
"key"
:
"sourceType"
,
"label"
:
"隐患主体类型"
},
{
"key"
:
"problemType"
,
"label"
:
"隐患类型"
},
{
"key"
:
"problemTime"
,
"label"
:
"超期时间"
},
{
"key"
:
"problemDesc"
,
"label"
:
"隐患描述"
},
{
"key"
:
"problemTime"
,
"label"
:
"隐患时间"
},
{
"key"
:
"problemLevel"
,
"label"
:
"隐患等级"
,
"value"
:
"重大"
},
{
"key"
:
"principalUnit"
,
"label"
:
"主体单位"
},
{
"key"
:
"principalUnitType"
,
"label"
:
"单位类型"
},
...
...
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/resources/json/problem_9.json
0 → 100644
View file @
a4e4798a
{
"name"
:
"隐患模板"
,
"tabs"
:
[
{
"key"
:
"keyinfo"
,
"displayName"
:
"基本信息"
,
"renderType"
:
"keyinfo"
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/statistics/dp/jg/safety-problem-tracing/{sequenceNbr}"
,
"params"
:
{
"sequenceNbr"
:
"{sequenceNbr}"
}
}
}
},
{
"key"
:
"devtable"
,
"displayName"
:
"关联设备"
,
"renderType"
:
"table"
,
"useAloneApi"
:
true
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/statistics/dp/jg/safety-problem-tracing/equip/list"
,
"params"
:
{
"current"
:
1
,
"size"
:
10
,
"sequenceNbr"
:
"{sequenceNbr}"
}
}
},
"visualParams"
:
{
"rowKey"
:
"record"
,
"columns"
:
[
{
"dataRenderingMode"
:
"defaultText"
,
"dataIndex"
:
"problemStatusName"
,
"width"
:
150
,
"align"
:
"left"
,
"title"
:
"状态"
,
"key"
:
"1"
},
{
"dataRenderingMode"
:
"defaultText"
,
"dataIndex"
:
"equList"
,
"width"
:
200
,
"align"
:
"left"
,
"title"
:
"设备种类"
,
"key"
:
"2"
},
{
"dataRenderingMode"
:
"defaultText"
,
"dataIndex"
:
"equCategory"
,
"width"
:
300
,
"align"
:
"left"
,
"title"
:
"设备类别"
,
"key"
:
"3"
},
{
"dataRenderingMode"
:
"defaultText"
,
"dataIndex"
:
"supervisoryCode"
,
"width"
:
200
,
"align"
:
"left"
,
"title"
:
"监管码"
,
"key"
:
"4"
},
{
"dataRenderingMode"
:
"defaultText"
,
"dataIndex"
:
"code96333"
,
"width"
:
200
,
"align"
:
"left"
,
"title"
:
"96333码"
,
"key"
:
"5"
},
{
"dataRenderingMode"
:
"defaultText"
,
"dataIndex"
:
"useUnitName"
,
"width"
:
300
,
"align"
:
"left"
,
"title"
:
"主体单位"
,
"key"
:
"6"
},
{
"dataRenderingMode"
:
"actionDetailBtn"
,
"dataIndex"
:
"action"
,
"width"
:
60
,
"align"
:
"left"
,
"title"
:
"操作"
,
"key"
:
"7"
,
"conf"
:
{
"title"
:
"设备详情"
,
"linkModelKey"
:
"equip"
}}
]
}
},
{
"key"
:
"devtable1"
,
"displayName"
:
"关联企业"
,
"renderType"
:
"table"
,
"useAloneApi"
:
true
,
"dataConfig"
:
{
"api"
:
{
"httpMethod"
:
"GET"
,
"apiPath"
:
"/statistics/dp/jg/safety-problem-tracing/unit/list"
,
"params"
:
{
"current"
:
1
,
"size"
:
10
,
"sequenceNbr"
:
"{sequenceNbr}"
}
}
},
"visualParams"
:
{
"rowKey"
:
"sequenceNbr"
,
"columns"
:
[
{
"dataRenderingMode"
:
"defaultText"
,
"dataIndex"
:
"problemStatusName"
,
"width"
:
150
,
"align"
:
"left"
,
"title"
:
"状态"
,
"key"
:
"1"
},
{
"dataRenderingMode"
:
"defaultText"
,
"dataIndex"
:
"unitName"
,
"width"
:
300
,
"align"
:
"left"
,
"title"
:
"企业名称"
,
"key"
:
"2"
},
{
"dataRenderingMode"
:
"defaultText"
,
"dataIndex"
:
"unitType"
,
"width"
:
200
,
"align"
:
"left"
,
"title"
:
"企业类型"
,
"key"
:
"3"
},
{
"dataRenderingMode"
:
"defaultText"
,
"dataIndex"
:
"useUnitCode"
,
"width"
:
300
,
"align"
:
"left"
,
"title"
:
"企业统一信用代码"
,
"key"
:
"4"
},
{
"dataRenderingMode"
:
"defaultText"
,
"dataIndex"
:
"useContact"
,
"width"
:
200
,
"align"
:
"left"
,
"title"
:
"企业联系人"
,
"key"
:
"5"
},
{
"dataRenderingMode"
:
"defaultText"
,
"dataIndex"
:
"contactPhone"
,
"width"
:
200
,
"align"
:
"left"
,
"title"
:
"联系电话"
,
"key"
:
"6"
},
{
"dataRenderingMode"
:
"actionDetailBtn"
,
"dataIndex"
:
"action"
,
"width"
:
60
,
"align"
:
"left"
,
"title"
:
"操作"
,
"key"
:
"7"
,
"conf"
:
{
"title"
:
"企业详情"
,
"linkModelKey"
:
"company"
}}
]
}
}
],
"content"
:
{
"keyinfo"
:
{
"title"
:
"{principalUnit}"
,
"qrcode"
:
{
"title"
:
""
,
"problem"
:
[],
"picUrl"
:
{
"red"
:
"/upload/tzs/dpscreen/images/安全守护-红.png"
,
"grey"
:
"/upload/tzs/dpscreen/images/安全守护-灰.png"
,
"orange"
:
"/upload/tzs/dpscreen/images/安全守护-橙.png"
,
"green"
:
"/upload/tzs/dpscreen/images/安全守护-绿.png"
}
},
"keyParams"
:
[
{
"key"
:
"sourceType"
,
"label"
:
"隐患主体类型"
},
{
"key"
:
"problemType"
,
"label"
:
"隐患类型"
},
{
"key"
:
"userName"
,
"label"
:
"人员名称"
},
{
"key"
:
"problemTime"
,
"label"
:
"超期时间"
},
{
"key"
:
"problemDesc"
,
"label"
:
"隐患描述"
},
{
"key"
:
"problemLevel"
,
"label"
:
"隐患等级"
,
"value"
:
"重大"
},
{
"key"
:
"principalUnit"
,
"label"
:
"主体单位"
},
{
"key"
:
"principalUnitType"
,
"label"
:
"单位类型"
},
{
"key"
:
"governingBody"
,
"label"
:
"管辖机构"
},
{
"key"
:
"governingBodyCode"
,
"label"
:
"所属区域"
},
{
"key"
:
"problemStatus"
,
"label"
:
"隐患状态"
},
{
"key"
:
"equipSuperviseCode"
,
"label"
:
"监管码"
},
{
"key"
:
"equipList"
,
"label"
:
"设备种类"
}
]
}
}
}
\ 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