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
520238cc
Commit
520238cc
authored
Jan 04, 2026
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(jg): 西安数据核对
1.核对数据同步接口初稿
parent
9c929954
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
213 additions
and
3 deletions
+213
-3
ESEquipmentCategoryDto.java
...os/boot/module/common/api/dto/ESEquipmentCategoryDto.java
+6
-0
DataHandlerController.java
.../boot/module/jg/biz/controller/DataHandlerController.java
+22
-0
BatchDataPatcher.java
...boot/module/jg/biz/data/fix/patcher/BatchDataPatcher.java
+2
-1
BatchDataPatcherWithFilter.java
...e/jg/biz/data/fix/patcher/BatchDataPatcherWithFilter.java
+55
-0
HistoricalDataPatcher.java
...module/jg/biz/data/fix/patcher/HistoricalDataPatcher.java
+3
-1
EquipInsert2EsPatcher.java
...module/jg/biz/data/fix/service/EquipInsert2EsPatcher.java
+74
-0
DataHandlerServiceImpl.java
...ot/module/jg/biz/service/impl/DataHandlerServiceImpl.java
+0
-0
JyjcInspectionResultServiceImpl.java
...yjc/biz/service/impl/JyjcInspectionResultServiceImpl.java
+5
-1
IdxBizJgUseInfoMapper.java
...mos/boot/module/ymt/api/mapper/IdxBizJgUseInfoMapper.java
+4
-0
IdxBizJgUseInfoMapper.xml
...t-api/src/main/resources/mapper/IdxBizJgUseInfoMapper.xml
+42
-0
No files found.
amos-boot-system-tzs/amos-boot-module-common/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/dto/ESEquipmentCategoryDto.java
View file @
520238cc
...
...
@@ -219,4 +219,10 @@ public class ESEquipmentCategoryDto {
*/
@Field
(
type
=
FieldType
.
Keyword
)
private
String
whetherSphericalTank
;
/**
* 版本号
*/
@Field
(
type
=
FieldType
.
Keyword
)
private
String
version
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/DataHandlerController.java
View file @
520238cc
...
...
@@ -421,4 +421,25 @@ public class DataHandlerController extends BaseController {
dataHandlerService
.
addDbData2EsBatch
(
paramMap
);
return
ResponseHelper
.
buildResponse
(
true
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/orgBranchCode2Db"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"属地监管部门以es老索引为准刷数据库"
,
notes
=
"属地监管部门以es为准刷数据库"
)
public
ResponseModel
<
Long
>
orgBranchCode2Db
(
@ApiParam
(
value
=
"设备种类code"
)
@RequestParam
String
equListCode
,
@ApiParam
(
value
=
"设备类别code"
)
@RequestParam
(
required
=
false
)
String
equCategoryCode
,
@ApiParam
(
value
=
"属地code"
)
@RequestParam
String
orgBranchCode
,
@ApiParam
(
value
=
"序列号,不能重复"
)
@RequestParam
Integer
seq
)
{
return
ResponseHelper
.
buildResponse
(
dataHandlerService
.
orgBranchCode2Db
(
equListCode
,
equCategoryCode
,
orgBranchCode
,
seq
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/synEquipFromDb2Es"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"同步设备数据到es新旧索引"
,
notes
=
"同步设备数据到es新旧索引"
)
public
ResponseModel
<
Integer
>
synEquipFromDb2Es
(
@ApiParam
(
value
=
"设备种类code"
)
@RequestParam
String
equListCode
,
@ApiParam
(
value
=
"设备类别code"
)
@RequestParam
(
required
=
false
)
String
equCategoryCode
,
@ApiParam
(
value
=
"属地code"
)
@RequestParam
String
orgBranchCode
)
{
return
ResponseHelper
.
buildResponse
(
dataHandlerService
.
synEquipFromDb2Es
(
equListCode
,
equCategoryCode
,
orgBranchCode
));
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/data/fix/patcher/BatchDataPatcher.java
View file @
520238cc
...
...
@@ -6,6 +6,7 @@ import org.springframework.context.ApplicationContext;
import
org.springframework.util.StopWatch
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
public
abstract
class
BatchDataPatcher
implements
HistoricalDataPatcher
{
...
...
@@ -17,7 +18,7 @@ public abstract class BatchDataPatcher implements HistoricalDataPatcher {
}
@Override
public
Integer
patchBatchData
()
{
public
Integer
patchBatchData
(
Map
<
String
,
Object
>
params
)
{
StopWatch
watch
=
new
StopWatch
();
watch
.
start
();
IdxBizJgUseInfoServiceImpl
useInfoService
=
applicationContext
.
getBean
(
IdxBizJgUseInfoServiceImpl
.
class
);
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/data/fix/patcher/BatchDataPatcherWithFilter.java
0 → 100644
View file @
520238cc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
data
.
fix
.
patcher
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.util.StopWatch
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
public
abstract
class
BatchDataPatcherWithFilter
implements
HistoricalDataPatcher
{
private
final
ApplicationContext
applicationContext
;
protected
BatchDataPatcherWithFilter
(
ApplicationContext
applicationContext
)
{
this
.
applicationContext
=
applicationContext
;
}
@Override
public
Integer
patchBatchData
(
Map
<
String
,
Object
>
params
)
{
StopWatch
watch
=
new
StopWatch
();
watch
.
start
();
IdxBizJgUseInfoServiceImpl
useInfoService
=
applicationContext
.
getBean
(
IdxBizJgUseInfoServiceImpl
.
class
);
Integer
maxVersion
=
useInfoService
.
getBaseMapper
().
selectMaxVersionWithParams
(
buildFilter
(
params
));
Integer
nextVersion
=
maxVersion
+
1
;
List
<
String
>
refreshRecords
=
useInfoService
.
getBaseMapper
().
selectUseInfoOfOneVersionWithParams
(
nextVersion
,
buildFilter
(
params
));
while
(!
refreshRecords
.
isEmpty
())
{
refreshRecords
.
parallelStream
().
forEach
(
record
->
{
try
{
beforePatching
(
record
);
patchSingleRecord
(
record
);
afterPatching
(
record
);
}
catch
(
Exception
e
)
{
// 异常数据跳过
log
.
error
(
"数据修补失败,设备:{}"
,
record
,
e
);
}
});
useInfoService
.
getBaseMapper
().
updateVersionBatch
(
refreshRecords
,
nextVersion
);
refreshRecords
=
useInfoService
.
getBaseMapper
().
selectUseInfoOfOneVersionAll
(
nextVersion
);
}
watch
.
stop
();
log
.
info
(
"数据修补完成,共处理{}条记录,耗时: {}秒"
,
refreshRecords
,
watch
.
getTotalTimeSeconds
());
return
null
;
}
protected
abstract
Map
<
String
,
Object
>
buildFilter
(
Map
<
String
,
Object
>
params
);
protected
abstract
void
beforePatching
(
String
record
);
protected
abstract
void
patchSingleRecord
(
String
record
);
protected
abstract
void
afterPatching
(
String
record
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/data/fix/patcher/HistoricalDataPatcher.java
View file @
520238cc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
data
.
fix
.
patcher
;
import
java.util.Map
;
public
interface
HistoricalDataPatcher
{
/**
* 执行批量修补
* @return 处理成功的记录数,如果不可计算则返回null
*/
Integer
patchBatchData
();
Integer
patchBatchData
(
Map
<
String
,
Object
>
params
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/data/fix/service/EquipInsert2EsPatcher.java
0 → 100644
View file @
520238cc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
data
.
fix
.
service
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.TzsDataRefreshMessage
;
import
com.yeejoin.amos.boot.module.common.biz.refresh.DataRefreshEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.data.fix.patcher.BatchDataPatcherWithFilter
;
import
com.yeejoin.amos.boot.module.jg.biz.refresh.StatisticsDataUpdateService
;
import
com.yeejoin.amos.boot.module.jg.biz.refresh.handler.EquipmentRefreshHandler
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.stereotype.Component
;
import
java.util.Map
;
import
java.util.Optional
;
@Component
@Slf4j
public
class
EquipInsert2EsPatcher
extends
BatchDataPatcherWithFilter
{
private
final
ESEquipmentCategory
equipmentCategory
;
private
final
EquipmentRefreshHandler
refreshHandler
;
private
final
IdxBizJgUseInfoMapper
idxBizJgUseInfoMapper
;
protected
EquipInsert2EsPatcher
(
ApplicationContext
applicationContext
,
ESEquipmentCategory
equipmentCategory
,
EquipmentRefreshHandler
refreshHandler
,
IdxBizJgUseInfoMapper
idxBizJgUseInfoMapper
)
{
super
(
applicationContext
);
this
.
equipmentCategory
=
equipmentCategory
;
this
.
refreshHandler
=
refreshHandler
;
this
.
idxBizJgUseInfoMapper
=
idxBizJgUseInfoMapper
;
}
@Override
protected
Map
<
String
,
Object
>
buildFilter
(
Map
<
String
,
Object
>
params
)
{
return
params
;
}
@Override
protected
void
beforePatching
(
String
record
)
{
}
@Override
protected
void
patchSingleRecord
(
String
record
)
{
Optional
<
ESEquipmentCategoryDto
>
op
=
equipmentCategory
.
findById
(
record
);
// 插入旧索引
if
(!
op
.
isPresent
())
{
try
{
Map
<
String
,
Object
>
detail
=
idxBizJgUseInfoMapper
.
queryDetail
(
record
);
ESEquipmentCategoryDto
esEquipmentInfo
=
new
ESEquipmentCategoryDto
();
StatisticsDataUpdateService
.
formatUseDate
(
detail
);
BeanUtil
.
copyProperties
(
detail
,
esEquipmentInfo
,
true
);
equipmentCategory
.
save
(
esEquipmentInfo
);
}
catch
(
Exception
e
)
{
log
.
error
(
"老设备索引插入处理失败:{}"
,
record
,
e
);
}
}
// 插入或者新索引
try
{
refreshHandler
.
doRefresh
(
new
TzsDataRefreshMessage
().
setDataId
(
record
).
setOperation
(
DataRefreshEvent
.
Operation
.
INSERT
.
name
()));
}
catch
(
Exception
e
)
{
log
.
error
(
"新设备索引插入处理失败:{}"
,
record
,
e
);
}
}
@Override
protected
void
afterPatching
(
String
record
)
{
}
}
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/DataHandlerServiceImpl.java
View file @
520238cc
This diff is collapsed.
Click to expand it.
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/service/impl/JyjcInspectionResultServiceImpl.java
View file @
520238cc
...
...
@@ -457,7 +457,11 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
* @return null or 非空的字符串
*/
private
String
nullIfNullOrEmpty
(
String
str
)
{
return
CompareUtils
.
isNullOrEmpty
(
str
)
?
null
:
str
;
return
CompareUtils
.
isNullOrEmpty
(
str
)
?
null
:
trimNoIllegalChar
(
str
);
}
private
String
trimNoIllegalChar
(
String
str
)
{
return
"\\"
.
equals
(
str
)
||
"/"
.
equals
(
str
)
?
null
:
str
;
}
private
String
getTableName
(
String
paramType
)
{
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/mapper/IdxBizJgUseInfoMapper.java
View file @
520238cc
...
...
@@ -29,6 +29,8 @@ public interface IdxBizJgUseInfoMapper extends CustomBaseMapper<IdxBizJgUseInfo>
Integer
selectMaxVersion
();
Integer
selectMaxVersionWithParams
(
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
void
updateDataQualityScoreBatch
(
@Param
(
"equips"
)
List
<
EquipWaitRefreshDataQualityScore
>
refreshDataQualityScores
,
@Param
(
"version"
)
int
version
);
void
updateVersionBatch
(
@Param
(
"records"
)
List
<
String
>
records
,
@Param
(
"version"
)
int
version
);
...
...
@@ -52,4 +54,6 @@ public interface IdxBizJgUseInfoMapper extends CustomBaseMapper<IdxBizJgUseInfo>
List
<
IdxBizJgOtherInfo
>
selectOneMockRecord
(
@Param
(
"equList"
)
String
equList
,
@Param
(
"equCategory"
)
String
equCategory
,
@Param
(
"equDefine"
)
String
equDefine
,
@Param
(
"useUnitCode"
)
String
useUnitCode
,
@Param
(
"size"
)
Integer
size
);
List
<
String
>
selectEquipsClaimStatus
();
List
<
String
>
selectUseInfoOfOneVersionWithParams
(
@Param
(
"nextVersion"
)
Integer
nextVersion
,
@Param
(
"params"
)
Map
<
String
,
Object
>
params
);
}
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/resources/mapper/IdxBizJgUseInfoMapper.xml
View file @
520238cc
...
...
@@ -59,11 +59,53 @@
ui.VERSION
<![CDATA[ <> ]]>
#{version} or ui.VERSION is null
limit 10000
</select>
<select
id=
"selectUseInfoOfOneVersionWithParams"
resultType=
"java.lang.String"
>
SELECT
u.record
from
"idx_biz_jg_use_info" u
"idx_biz_jg_supervision_info" s,
idx_biz_jg_register_info r
where
u.VERSION
<![CDATA[ <> ]]>
#{version} or u.VERSION is null
and u."RECORD" = r."RECORD"
and s."RECORD" = r."RECORD"
<if
test=
"params.equListCode != null and params.equListCode != ''"
>
and r."EQU_LIST" = '3000'
</if>
<if
test=
"params.equCategoryCode != null and params.equCategoryCode != ''"
>
and r."EQU_CATEGORY" = #{params.equListCode}
</if>
<if
test=
"params.orgBranchCode != null and params.orgBranchCode != ''"
>
and s."ORG_BRANCH_CODE" like concat(#{params.orgBranchCode},'%')
</if>
limit 10000
</select>
<select
id=
"selectMaxVersion"
resultType=
"java.lang.Integer"
>
SELECT
COALESCE(MAX(version),0) as version
FROM "idx_biz_jg_use_info"
</select>
<select
id=
"selectMaxVersionWithParams"
resultType=
"java.lang.Integer"
>
SELECT
COALESCE(MAX(version),0) as version
FROM
"idx_biz_jg_use_info" u
"idx_biz_jg_supervision_info" s,
idx_biz_jg_register_info r
where
u."RECORD" = r."RECORD"
and s."RECORD" = r."RECORD"
<if
test=
"params.equListCode != null and params.equListCode != ''"
>
and r."EQU_LIST" = '3000'
</if>
<if
test=
"params.equCategoryCode != null and params.equCategoryCode != ''"
>
and r."EQU_CATEGORY" = #{params.equListCode}
</if>
<if
test=
"params.orgBranchCode != null and params.orgBranchCode != ''"
>
and s."ORG_BRANCH_CODE" like concat(#{params.orgBranchCode},'%')
</if>
</select>
<select
id=
"queryDetail"
resultType=
"java.util.Map"
>
<include
refid=
"equip-detail-es"
/>
WHERE
...
...
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