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
9bbcb8de
Commit
9bbcb8de
authored
Aug 05, 2025
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(statistics): 新增根据传入code及limit修改ORG_BRANCH_CODE为50*X综合搜索数据
parent
aaaa0b2a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
140 additions
and
3 deletions
+140
-3
TzsCustomFilterMapper.java
...t/module/statistics/api/mapper/TzsCustomFilterMapper.java
+9
-1
TzsCustomFilterMapper.xml
...s-api/src/main/resources/mapper/TzsCustomFilterMapper.xml
+53
-1
ComprehensiveStatisticalAnalysisController.java
...ontroller/ComprehensiveStatisticalAnalysisController.java
+12
-0
ComprehensiveStatisticalAnalysisServiceImpl.java
...ice/impl/ComprehensiveStatisticalAnalysisServiceImpl.java
+66
-1
No files found.
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-api/src/main/java/com/yeejoin/amos/boot/module/statistics/api/mapper/TzsCustomFilterMapper.java
View file @
9bbcb8de
...
@@ -25,7 +25,15 @@ public interface TzsCustomFilterMapper extends BaseMapper<TzsCustomFilter> {
...
@@ -25,7 +25,15 @@ public interface TzsCustomFilterMapper extends BaseMapper<TzsCustomFilter> {
JSONArray
queryEquCategory
(
@Param
(
"type"
)
String
type
,
@Param
(
"description"
)
String
description
);
JSONArray
queryEquCategory
(
@Param
(
"type"
)
String
type
,
@Param
(
"description"
)
String
description
);
Page
<
String
>
selectRecords
(
Page
<
String
>
page
);
Page
<
String
>
selectGasRecords
(
Page
<
String
>
page
);
List
<
String
>
selectRecords
(
@Param
(
"code"
)
String
code
,
@Param
(
"limit"
)
long
limit
);
void
addGas
(
@Param
(
"refreshRecords"
)
List
<
String
>
refreshRecords
);
void
addGas
(
@Param
(
"refreshRecords"
)
List
<
String
>
refreshRecords
);
Integer
selectRecordCount
(
String
code
);
void
setOrgBranchCodeIsNullByRecords
(
@Param
(
"records"
)
List
<
String
>
records
);
void
updateOrgBranchCodeByRecords
(
@Param
(
"dataList"
)
List
<
Map
<
String
,
Object
>>
dataList
);
}
}
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-api/src/main/resources/mapper/TzsCustomFilterMapper.xml
View file @
9bbcb8de
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
<select
id=
"selectEquipmentCategoryCountByParentId"
resultType=
"java.lang.Integer"
>
<select
id=
"selectEquipmentCategoryCountByParentId"
resultType=
"java.lang.Integer"
>
select count(1) from tz_equipment_category where is_delete = 0 and parent_id = #{parentId}
select count(1) from tz_equipment_category where is_delete = 0 and parent_id = #{parentId}
</select>
</select>
<select
id=
"selectRecords"
resultType=
"java.lang.String"
>
<select
id=
"select
Gas
Records"
resultType=
"java.lang.String"
>
SELECT
SELECT
ibjui."RECORD"
ibjui."RECORD"
FROM
FROM
...
@@ -50,6 +50,58 @@
...
@@ -50,6 +50,58 @@
AND "CLAIM_STATUS" = '已认领'
AND "CLAIM_STATUS" = '已认领'
order by ibjui."RECORD" desc
order by ibjui."RECORD" desc
</select>
</select>
<select
id=
"selectRecords"
resultType=
"java.lang.String"
>
SELECT
ibjsi."RECORD"
FROM
amos_tzs_biz.idx_biz_jg_supervision_info ibjsi
LEFT JOIN amos_tzs_biz.idx_biz_jg_register_info ibjri ON ibjsi."RECORD" = ibjri."RECORD"
WHERE
"ORG_BRANCH_CODE" = '50*X'
<if
test=
"code != '2300'"
>
AND ibjri."EQU_LIST" = #{code}
<if
test=
"code == '2000'"
>
AND ibjri."EQU_CATEGORY" != '2300'
</if>
</if>
<if
test=
"code == '2300'"
>
AND ibjri."EQU_CATEGORY" = #{code}
</if>
limit #{limit}
</select>
<select
id=
"selectRecordCount"
resultType=
"java.lang.Integer"
>
SELECT
count(1)
FROM
amos_tzs_biz.idx_biz_jg_supervision_info ibjsi
LEFT JOIN amos_tzs_biz.idx_biz_jg_register_info ibjri ON ibjsi."RECORD" = ibjri."RECORD"
WHERE
"ORG_BRANCH_CODE" = '50*X'
<if
test=
"code != '2300'"
>
AND ibjri."EQU_LIST" = #{code}
<if
test=
"code == '2000'"
>
AND ibjri."EQU_CATEGORY" != '2300'
</if>
</if>
<if
test=
"code == '2300'"
>
AND ibjri."EQU_CATEGORY" = #{code}
</if>
</select>
<update
id=
"setOrgBranchCodeIsNullByRecords"
>
update amos_tzs_biz.idx_biz_jg_supervision_info set "ORG_BRANCH_CODE" = null where "RECORD" in
<foreach
collection=
"records"
separator=
","
item=
"record"
open=
"("
close=
");"
>
#{record}
</foreach>
</update>
<update
id=
"updateOrgBranchCodeByRecords"
>
<foreach
collection=
"dataList"
item=
"data"
separator=
";"
>
update amos_tzs_biz.idx_biz_jg_supervision_info
set "ORG_BRANCH_CODE" = #{data.orgBranchCode}
where "RECORD" = #{data.record}
</foreach>
</update>
<insert
id=
"addGas"
>
<insert
id=
"addGas"
>
INSERT INTO "amos_tzs_biz"."idx_biz_jg_supervision_info" ("SEQUENCE_NBR", "RECORD")
INSERT INTO "amos_tzs_biz"."idx_biz_jg_supervision_info" ("SEQUENCE_NBR", "RECORD")
...
...
amos-boot-system-tzs/amos-boot-module-statistics/amos-boot-module-statistics-biz/src/main/java/com/yeejoin/amos/boot/module/statistcs/biz/controller/ComprehensiveStatisticalAnalysisController.java
View file @
9bbcb8de
...
@@ -496,4 +496,16 @@ public class ComprehensiveStatisticalAnalysisController extends BaseController {
...
@@ -496,4 +496,16 @@ public class ComprehensiveStatisticalAnalysisController extends BaseController {
public
ResponseModel
<
JSONArray
>
queryInspectionDate
()
{
public
ResponseModel
<
JSONArray
>
queryInspectionDate
()
{
return
ResponseHelper
.
buildResponse
(
statisticalAnalysisService
.
queryInspectionDate
());
return
ResponseHelper
.
buildResponse
(
statisticalAnalysisService
.
queryInspectionDate
());
}
}
/**
* @param
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/updateDataByOrgBranchCode"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"修改ORG_BRANCH_CODE为50*X综合搜索数据-设备"
,
notes
=
"修改ORG_BRANCH_CODE为50*X综合搜索数据-设备"
)
public
ResponseModel
<
Object
>
updateDataByOrgBranchCode
(
@RequestParam
(
value
=
"code"
)
String
code
,
@RequestParam
(
value
=
"limit"
)
Integer
limit
)
{
return
ResponseHelper
.
buildResponse
(
statisticalAnalysisService
.
updateDataByOrgBranchCode
(
code
,
limit
));
}
}
}
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 @
9bbcb8de
...
@@ -17,6 +17,7 @@ import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
...
@@ -17,6 +17,7 @@ import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RequestContextWrapper
;
import
com.yeejoin.amos.boot.biz.common.utils.RequestContextWrapper
;
import
com.yeejoin.amos.boot.module.common.api.dao.EsEquipmentDao
;
import
com.yeejoin.amos.boot.module.common.api.dto.TechParamItem
;
import
com.yeejoin.amos.boot.module.common.api.dto.TechParamItem
;
import
com.yeejoin.amos.boot.module.common.api.entity.ESEquipmentInfo
;
import
com.yeejoin.amos.boot.module.common.api.entity.ESEquipmentInfo
;
import
com.yeejoin.amos.boot.module.common.biz.utils.TechParamUtil
;
import
com.yeejoin.amos.boot.module.common.biz.utils.TechParamUtil
;
...
@@ -125,6 +126,8 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
...
@@ -125,6 +126,8 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
private
final
String
or
=
"or"
;
private
final
String
or
=
"or"
;
private
final
String
and
=
"and"
;
private
final
String
and
=
"and"
;
private
final
EsEquipmentDao
esEquipmentDao
;
private
final
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
Runtime
.
getRuntime
().
availableProcessors
());
private
final
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
Runtime
.
getRuntime
().
availableProcessors
());
...
@@ -4039,7 +4042,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
...
@@ -4039,7 +4042,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
for
(
int
j
=
0
;
j
<=
times
;
j
++)
{
for
(
int
j
=
0
;
j
<=
times
;
j
++)
{
recordDtoPage
.
setCurrent
(
j
+
1
);
recordDtoPage
.
setCurrent
(
j
+
1
);
recordDtoPage
.
setSize
(
5000
);
recordDtoPage
.
setSize
(
5000
);
Page
<
String
>
refreshRecords
=
tzsCustomFilterMapper
.
selectRecords
(
recordDtoPage
);
Page
<
String
>
refreshRecords
=
tzsCustomFilterMapper
.
select
Gas
Records
(
recordDtoPage
);
if
(!
ObjectUtils
.
isEmpty
(
refreshRecords
)
&&
refreshRecords
.
getRecords
().
size
()
>
0
)
{
if
(!
ObjectUtils
.
isEmpty
(
refreshRecords
)
&&
refreshRecords
.
getRecords
().
size
()
>
0
)
{
total
+=
refreshRecords
.
getRecords
().
size
();
total
+=
refreshRecords
.
getRecords
().
size
();
tzsCustomFilterMapper
.
addGas
(
refreshRecords
.
getRecords
());
tzsCustomFilterMapper
.
addGas
(
refreshRecords
.
getRecords
());
...
@@ -4047,4 +4050,65 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
...
@@ -4047,4 +4050,65 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
}
}
return
total
;
return
total
;
}
}
public
Object
updateDataByOrgBranchCode
(
String
code
,
Integer
limit
)
{
SearchRequest
request
=
new
SearchRequest
();
request
.
indices
(
StatisticalAnalysisEnum
.
equip
.
getKey
());
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
trackTotalHits
(
true
);
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
// 1、从数据库查询对应设备类型下50*X得数据record
Integer
count
=
tzsCustomFilterMapper
.
selectRecordCount
(
code
);
if
(
count
==
0
)
{
return
"数据库中该数据分类下无需要修改的数据"
;
}
limit
=
count
>
limit
?
limit
:
count
;
List
<
String
>
records
=
tzsCustomFilterMapper
.
selectRecords
(
code
,
limit
);
// 2、从es中查询对应record的数据
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"SEQUENCE_NBR.keyword"
,
records
));
builder
.
query
(
boolMust
);
builder
.
from
(
0
);
builder
.
size
(
limit
);
request
.
source
(
builder
);
// 数据库和es中都为50*X的数据集合
List
<
String
>
allNotDateList
=
new
ArrayList
<>();
// 数据库中为50*X的数据集合,但es中不为50*X的数据集合
List
<
Map
<
String
,
Object
>>
dataList
=
new
ArrayList
<>();
try
{
SearchResponse
response
=
restHighLevelClient
.
search
(
request
,
RequestOptions
.
DEFAULT
);
for
(
SearchHit
hit
:
response
.
getHits
().
getHits
())
{
JSONObject
jsonObject
=
(
JSONObject
)
JSONObject
.
toJSON
(
hit
);
JSONObject
dto
=
jsonObject
.
getJSONObject
(
"sourceAsMap"
);
if
(
dto
.
containsKey
(
"ORG_BRANCH_CODE"
))
{
//3、判断查询回来的数据中是否为50*X,如果是50*X,则记录下来进行做置空处理/如果不为50*X,则记录下来进行数据库修复
if
(
"50*X"
.
equals
(
dto
.
getString
(
"ORG_BRANCH_CODE"
)))
{
allNotDateList
.
add
(
dto
.
getString
(
"SEQUENCE_NBR"
));
}
else
{
Map
<
String
,
Object
>
dataMap
=
new
HashMap
<>();
dataMap
.
put
(
"record"
,
dto
.
getString
(
"SEQUENCE_NBR"
));
dataMap
.
put
(
"orgBranchCode"
,
dto
.
getString
(
"ORG_BRANCH_CODE"
));
dataList
.
add
(
dataMap
);
}
}
}
//4、是50*X的进行es和数据库的双向修改/不是50*X的只需要做数据库修改
if
(!
ObjectUtils
.
isEmpty
(
allNotDateList
)){
tzsCustomFilterMapper
.
setOrgBranchCodeIsNullByRecords
(
allNotDateList
);
Iterable
<
ESEquipmentInfo
>
allById
=
esEquipmentDao
.
findAllById
(
allNotDateList
);
if
(!
ObjectUtils
.
isEmpty
(
allById
)){
for
(
ESEquipmentInfo
esEquipmentInfo
:
allById
)
{
esEquipmentInfo
.
setORG_BRANCH_CODE
(
""
);
}
}
esEquipmentDao
.
saveAll
(
allById
);
}
// 修改为es中的数据
if
(!
ObjectUtils
.
isEmpty
(
dataList
)){
tzsCustomFilterMapper
.
updateOrgBranchCodeByRecords
(
dataList
);
}
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
records
;
}
}
}
\ 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