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
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
323 additions
and
38 deletions
+323
-38
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
+110
-35
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
...
...
@@ -44,6 +44,7 @@ import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import
com.yeejoin.amos.boot.module.jg.api.enums.PipelineEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.*
;
import
com.yeejoin.amos.boot.module.jg.biz.data.fix.service.EquipInsert2EsPatcher
;
import
com.yeejoin.amos.boot.module.jg.biz.data.fix.service.ReceiveOrgFixService
;
import
com.yeejoin.amos.boot.module.jg.biz.data.fix.service.WeatherTankFieldPatcher
;
import
com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher
;
...
...
@@ -68,9 +69,12 @@ import org.elasticsearch.action.search.SearchRequest;
import
org.elasticsearch.action.search.SearchResponse
;
import
org.elasticsearch.client.RequestOptions
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.elasticsearch.client.core.CountRequest
;
import
org.elasticsearch.client.core.CountResponse
;
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.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -150,7 +154,7 @@ public class DataHandlerServiceImpl {
private
final
JgChangeVehicleRegistrationUnitMapper
jgChangeVehicleRegistrationUnitMapper
;
private
final
JgChangeRegistrationTransferMapper
jgChangeRegistrationTransferMapper
;
private
final
JgUseRegistrationManageServiceImpl
jgUseRegistrationManageServiceImpl
;
private
final
JgChangeRegistrationReformMapper
jgChangeRegistrationReformMapper
;
private
final
JgChangeRegistrationReformMapper
jgChangeRegistrationReformMapper
;
private
final
JgReformNoticeMapper
jgReformNoticeMapper
;
...
...
@@ -175,6 +179,9 @@ public class DataHandlerServiceImpl {
private
final
StatisticsDataUpdateService
statisticsDataUpdateService
;
private
final
IdxBizJgRegisterInfoMapper
registerInfoMapper
;
private
final
IdxBizJgUseInfoServiceImpl
idxBizJgUseInfoServiceImpl
;
private
final
IdxBizJgSupervisionInfoMapper
idxBizJgSupervisionInfoMapper
;
private
final
IdxBizJgSupervisionInfoServiceImpl
idxBizJgSupervisionInfoServiceImpl
;
@Value
(
"${jyjc.open.online: true}"
)
private
Boolean
onlineJyjc
;
...
...
@@ -189,6 +196,7 @@ public class DataHandlerServiceImpl {
private
final
WeatherTankFieldPatcher
weatherTankFieldPatcher
;
private
final
EquipInsert2EsPatcher
equipInsert2EsPatcher
;
private
final
EventPublisher
eventPublisher
;
...
...
@@ -2341,7 +2349,7 @@ public class DataHandlerServiceImpl {
public
Integer
initTank2Es
()
{
return
weatherTankFieldPatcher
.
patchBatchData
();
return
weatherTankFieldPatcher
.
patchBatchData
(
null
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -2508,80 +2516,81 @@ public class DataHandlerServiceImpl {
/**
* 压力管道-已完成及作废状态的单据的历史数据管道长度补充
*
* @return 是否成功
*/
public
Long
pipeLenFix
()
{
cn
.
hutool
.
core
.
date
.
StopWatch
watch
=
new
cn
.
hutool
.
core
.
date
.
StopWatch
();
// 1.已完成及作废状态的安装告知
List
<
JgInstallationNotice
>
notices
=
installationNoticeService
.
list
(
new
LambdaQueryWrapper
<
JgInstallationNotice
>()
.
and
(
w
->
w
.
eq
(
JgInstallationNotice:
:
getNoticeStatus
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
()
+
""
)
.
or
().
eq
(
JgInstallationNotice:
:
getNoticeStatus
,
FlowStatusEnum
.
TO_BE_DISCARD
.
getCode
()
+
""
))
List
<
JgInstallationNotice
>
notices
=
installationNoticeService
.
list
(
new
LambdaQueryWrapper
<
JgInstallationNotice
>()
.
and
(
w
->
w
.
eq
(
JgInstallationNotice:
:
getNoticeStatus
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
()
+
""
)
.
or
().
eq
(
JgInstallationNotice:
:
getNoticeStatus
,
FlowStatusEnum
.
TO_BE_DISCARD
.
getCode
()
+
""
))
.
eq
(
JgInstallationNotice:
:
getEquListCode
,
EquipmentClassifityEnum
.
YLGD
.
getCode
())
.
select
(
BaseEntity:
:
getSequenceNbr
)
);
watch
.
start
(
"安装告知"
+
notices
.
size
());
notices
.
parallelStream
().
forEach
(
n
->
{
notices
.
parallelStream
().
forEach
(
n
->
{
JSONObject
jsonObject
=
commonServiceImpl
.
queryHistoryData
(
n
.
getSequenceNbr
());
if
(
jsonObject
!=
null
)
{
if
(
jsonObject
!=
null
)
{
JSONArray
jsonArray
=
jsonObject
.
getJSONArray
(
"deviceList"
);
List
<
JSONObject
>
pipelines
=
jsonArray
.
stream
().
map
(
e
->
{
List
<
JSONObject
>
pipelines
=
jsonArray
.
stream
().
map
(
e
->
{
JSONObject
pipeline
=
JSONObject
.
parseObject
(
e
.
toString
());
if
(!
pipeline
.
containsKey
(
BizCommonConstant
.
PIPE_LENGTH
))
{
if
(!
pipeline
.
containsKey
(
BizCommonConstant
.
PIPE_LENGTH
))
{
pipeline
.
put
(
BizCommonConstant
.
PIPE_LENGTH
,
pipeline
.
get
(
"pipeLength"
));
}
return
pipeline
;
}).
collect
(
Collectors
.
toList
());
jsonObject
.
put
(
"deviceList"
,
pipelines
);
commonServiceImpl
.
saveOrUpdateHistory
(
null
,
jsonObject
,
null
,
n
.
getSequenceNbr
()
+
""
);
commonServiceImpl
.
saveOrUpdateHistory
(
null
,
jsonObject
,
null
,
n
.
getSequenceNbr
()
+
""
);
}
});
watch
.
stop
();
// 2.已完成及作废状态的使用登记
List
<
JgUseRegistration
>
useRegistrations
=
useRegistrationService
.
list
(
new
LambdaQueryWrapper
<
JgUseRegistration
>()
.
and
(
w
->
w
.
eq
(
JgUseRegistration:
:
getStatus
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
()).
or
()
.
and
(
w
->
w
.
eq
(
JgUseRegistration:
:
getStatus
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
()).
or
()
.
eq
(
JgUseRegistration:
:
getStatus
,
FlowStatusEnum
.
TO_BE_DISCARD
.
getName
()))
.
ne
(
JgUseRegistration:
:
getProjectContraptionId
,
""
)
.
select
(
BaseEntity:
:
getSequenceNbr
));
watch
.
start
(
"使用登记"
+
useRegistrations
.
size
()
);
useRegistrations
.
parallelStream
().
forEach
(
u
->
{
watch
.
start
(
"使用登记"
+
useRegistrations
.
size
());
useRegistrations
.
parallelStream
().
forEach
(
u
->
{
JSONObject
jsonObject
=
commonServiceImpl
.
queryHistoryData
(
u
.
getSequenceNbr
());
if
(
jsonObject
!=
null
)
{
if
(
jsonObject
!=
null
)
{
String
pipelistKey
;
if
(
jsonObject
.
containsKey
(
"equipmentLists"
))
{
if
(
jsonObject
.
containsKey
(
"equipmentLists"
))
{
pipelistKey
=
"equipmentLists"
;
}
else
{
pipelistKey
=
"pipelineList"
;
}
JSONArray
jsonArray
=
jsonObject
.
getJSONArray
(
pipelistKey
);
Optional
.
ofNullable
(
jsonArray
).
ifPresent
(
d
->
{
List
<
JSONObject
>
pipelines
=
d
.
stream
().
map
(
e
->
{
Optional
.
ofNullable
(
jsonArray
).
ifPresent
(
d
->
{
List
<
JSONObject
>
pipelines
=
d
.
stream
().
map
(
e
->
{
JSONObject
pipeline
=
JSONObject
.
parseObject
(
e
.
toString
());
if
(!
pipeline
.
containsKey
(
BizCommonConstant
.
PIPE_LENGTH
))
{
if
(!
pipeline
.
containsKey
(
BizCommonConstant
.
PIPE_LENGTH
))
{
pipeline
.
put
(
BizCommonConstant
.
PIPE_LENGTH
,
pipeline
.
get
(
"pipeLength"
));
}
return
pipeline
;
}).
collect
(
Collectors
.
toList
());
jsonObject
.
put
(
pipelistKey
,
pipelines
);
commonServiceImpl
.
saveOrUpdateHistory
(
null
,
jsonObject
,
null
,
u
.
getSequenceNbr
()
+
""
);
commonServiceImpl
.
saveOrUpdateHistory
(
null
,
jsonObject
,
null
,
u
.
getSequenceNbr
()
+
""
);
});
}
});
watch
.
stop
();
// 3.已完成及作废状态的改造变更登记
List
<
JgChangeRegistrationReform
>
changeRegistrationReforms
=
jgChangeRegistrationReformMapper
.
selectList
(
new
LambdaQueryWrapper
<
JgChangeRegistrationReform
>()
.
and
(
w
->
w
.
eq
(
JgChangeRegistrationReform:
:
getStatus
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
()).
or
()
.
and
(
w
->
w
.
eq
(
JgChangeRegistrationReform:
:
getStatus
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
()).
or
()
.
eq
(
JgChangeRegistrationReform:
:
getStatus
,
FlowStatusEnum
.
TO_BE_DISCARD
.
getName
()))
.
ne
(
JgChangeRegistrationReform:
:
getProjectContraptionId
,
""
)
.
select
(
JgChangeRegistrationReform:
:
getApplyNo
));
watch
.
start
(
"改造变更登记"
+
changeRegistrationReforms
.
size
());
changeRegistrationReforms
.
parallelStream
().
forEach
(
u
->
{
changeRegistrationReforms
.
parallelStream
().
forEach
(
u
->
{
JSONObject
jsonObject
=
commonServiceImpl
.
queryHistoryData
(
u
.
getApplyNo
());
if
(
jsonObject
!=
null
)
{
if
(
jsonObject
!=
null
)
{
JSONArray
jsonArray
=
jsonObject
.
getJSONArray
(
"equipmentLists"
);
Optional
.
ofNullable
(
jsonArray
).
ifPresent
(
d
->
{
List
<
JSONObject
>
pipelines
=
d
.
stream
().
map
(
e
->
{
Optional
.
ofNullable
(
jsonArray
).
ifPresent
(
d
->
{
List
<
JSONObject
>
pipelines
=
d
.
stream
().
map
(
e
->
{
JSONObject
pipeline
=
JSONObject
.
parseObject
(
e
.
toString
());
if
(!
pipeline
.
containsKey
(
BizCommonConstant
.
PIPE_LENGTH
))
{
if
(!
pipeline
.
containsKey
(
BizCommonConstant
.
PIPE_LENGTH
))
{
pipeline
.
put
(
BizCommonConstant
.
PIPE_LENGTH
,
pipeline
.
get
(
"pipeLength"
));
}
return
pipeline
;
...
...
@@ -2594,31 +2603,31 @@ public class DataHandlerServiceImpl {
watch
.
stop
();
// 4.已完成及作废状态的改造告知
List
<
JgReformNotice
>
reformNotices
=
jgReformNoticeMapper
.
selectList
(
new
LambdaQueryWrapper
<
JgReformNotice
>()
.
and
(
w
->
w
.
eq
(
JgReformNotice:
:
getNoticeStatus
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
()
+
""
).
or
()
.
and
(
w
->
w
.
eq
(
JgReformNotice:
:
getNoticeStatus
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
()
+
""
).
or
()
.
eq
(
JgReformNotice:
:
getNoticeStatus
,
FlowStatusEnum
.
TO_BE_DISCARD
.
getCode
()
+
""
))
.
ne
(
JgReformNotice:
:
getProjectContraptionId
,
""
)
.
select
(
BaseEntity:
:
getSequenceNbr
));
watch
.
start
(
"改造告知"
+
reformNotices
.
size
());
reformNotices
.
parallelStream
().
forEach
(
u
->
{
reformNotices
.
parallelStream
().
forEach
(
u
->
{
JSONObject
jsonObject
=
commonServiceImpl
.
queryHistoryData
(
u
.
getSequenceNbr
());
if
(
jsonObject
!=
null
)
{
if
(
jsonObject
!=
null
)
{
JSONArray
jsonArray
=
jsonObject
.
getJSONArray
(
"deviceList"
);
Optional
.
ofNullable
(
jsonArray
).
ifPresent
(
d
->
{
List
<
JSONObject
>
pipelines
=
d
.
stream
().
map
(
e
->
{
Optional
.
ofNullable
(
jsonArray
).
ifPresent
(
d
->
{
List
<
JSONObject
>
pipelines
=
d
.
stream
().
map
(
e
->
{
JSONObject
pipeline
=
JSONObject
.
parseObject
(
e
.
toString
());
if
(!
pipeline
.
containsKey
(
BizCommonConstant
.
PIPE_LENGTH
))
{
if
(!
pipeline
.
containsKey
(
BizCommonConstant
.
PIPE_LENGTH
))
{
pipeline
.
put
(
BizCommonConstant
.
PIPE_LENGTH
,
pipeline
.
get
(
"pipeLength"
));
}
return
pipeline
;
}).
collect
(
Collectors
.
toList
());
jsonObject
.
put
(
"deviceList"
,
pipelines
);
commonServiceImpl
.
saveOrUpdateHistory
(
null
,
jsonObject
,
null
,
u
.
getSequenceNbr
()
+
""
);
commonServiceImpl
.
saveOrUpdateHistory
(
null
,
jsonObject
,
null
,
u
.
getSequenceNbr
()
+
""
);
});
}
});
watch
.
stop
();
int
num
=
notices
.
size
()
+
useRegistrations
.
size
()
+
reformNotices
.
size
()
+
changeRegistrationReforms
.
size
();
log
.
info
(
"压力管道业务单据补充字段pipeLengthText,总处理数量:{}, 耗时信息:{}"
,
num
,
watch
.
prettyPrint
(
TimeUnit
.
SECONDS
));
log
.
info
(
"压力管道业务单据补充字段pipeLengthText,总处理数量:{}, 耗时信息:{}"
,
num
,
watch
.
prettyPrint
(
TimeUnit
.
SECONDS
));
return
(
long
)
(
num
);
}
...
...
@@ -2667,7 +2676,7 @@ public class DataHandlerServiceImpl {
batchWatch
.
start
(
"批次"
+
batchIndex
.
get
());
int
currentIndex
=
batchIndex
.
getAndIncrement
();
log
.
info
(
"开始处理第 {} 个批次"
,
currentIndex
);
List
<
Map
<
String
,
Object
>>
batchData
=
idxBizJgUseInfoMapper
.
queryDetailBatch
(
batch
);
List
<
Map
<
String
,
Object
>>
batchData
=
idxBizJgUseInfoMapper
.
queryDetailBatch
(
batch
);
List
<
ESEquipmentCategoryDto
>
esEquipmentInfos
=
batchData
.
parallelStream
().
map
(
data
->
{
ESEquipmentCategoryDto
esEquipmentInfo
=
null
;
try
{
...
...
@@ -2697,7 +2706,7 @@ public class DataHandlerServiceImpl {
BoolQueryBuilder
boolQuery
=
QueryBuilders
.
boolQuery
();
if
(!
ValidationUtil
.
isEmpty
(
dataSource
))
{
boolQuery
=
QueryBuilders
.
boolQuery
()
.
must
(
QueryBuilders
.
termQuery
(
"DATA_SOURCE"
,
dataSource
));
.
must
(
QueryBuilders
.
termQuery
(
"DATA_SOURCE"
,
dataSource
));
}
// 线程安全的结果容器
List
<
String
>
esIds
=
Collections
.
synchronizedList
(
new
ArrayList
<>());
...
...
@@ -2729,4 +2738,70 @@ public class DataHandlerServiceImpl {
.
filter
(
element
->
!
bSet
.
contains
(
element
))
.
collect
(
Collectors
.
toList
());
}
public
Long
orgBranchCode2Db
(
String
equListCode
,
String
equCategoryCode
,
String
orgBranchCode
,
Integer
seq
)
{
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
trackTotalHits
(
true
);
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
boolMust
.
must
(
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
wildcardQuery
(
"ORG_BRANCH_CODE.keyword"
,
QueryParser
.
escape
(
orgBranchCode
)
+
"*"
)));
boolMust
.
must
(
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
termsQuery
(
"EQU_LIST_CODE"
,
equListCode
)));
if
(
StringUtils
.
isNotEmpty
(
equCategoryCode
))
{
boolMust
.
must
(
QueryBuilders
.
boolQuery
().
must
(
QueryBuilders
.
termsQuery
(
"EQU_CATEGORY_CODE"
,
equCategoryCode
)));
}
long
totalUpdate
=
0L
;
try
{
CountRequest
countRequest
=
new
CountRequest
();
countRequest
.
indices
(
IDX_BIZ_VIEW_JG_ALL
);
countRequest
.
query
(
boolMust
);
CountResponse
countResponse
=
restHighLevelClient
.
count
(
countRequest
,
RequestOptions
.
DEFAULT
);
long
total
=
countResponse
.
getCount
();
int
pageSize
=
1000
;
int
totalPage
=
Math
.
max
(
1
,
(
int
)
Math
.
ceil
((
double
)
total
/
pageSize
));
String
version
=
DateUtil
.
today
()
+
seq
;
builder
.
size
(
pageSize
);
SearchResponse
response
=
null
;
buildVersionFilter
(
version
,
boolMust
);
builder
.
query
(
boolMust
);
builder
.
sort
(
"REC_DATE"
,
SortOrder
.
DESC
);
SearchRequest
request
=
new
SearchRequest
();
request
.
indices
(
IDX_BIZ_VIEW_JG_ALL
);
for
(
int
i
=
1
;
i
<=
totalPage
;
i
++)
{
builder
.
from
((
i
-
1
)
*
pageSize
);
request
.
source
(
builder
);
response
=
restHighLevelClient
.
search
(
request
,
RequestOptions
.
DEFAULT
);
for
(
org
.
elasticsearch
.
search
.
SearchHit
hit
:
response
.
getHits
())
{
JSONObject
jsonObject
=
(
JSONObject
)
JSONObject
.
toJSON
(
hit
);
ESEquipmentCategoryDto
equipmentCategoryDto
=
JSONObject
.
toJavaObject
(
jsonObject
.
getJSONObject
(
"sourceAsMap"
),
ESEquipmentCategoryDto
.
class
);
boolean
exist
=
idxBizJgSupervisionInfoServiceImpl
.
lambdaUpdate
()
.
eq
(
IdxBizJgSupervisionInfo:
:
getRecord
,
equipmentCategoryDto
.
getSEQUENCE_NBR
())
.
set
(
IdxBizJgSupervisionInfo:
:
getOrgBranchCode
,
equipmentCategoryDto
.
getOrgBranchCode
())
.
set
(
IdxBizJgSupervisionInfo:
:
getOrgBranchName
,
equipmentCategoryDto
.
getORG_BRANCH_NAME
())
.
update
();
if
(
exist
)
{
totalUpdate
=
totalUpdate
+
1
;
}
equipmentCategoryDto
.
setVersion
(
version
);
esEquipmentCategory
.
save
(
equipmentCategoryDto
);
}
}
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
totalUpdate
;
}
private
static
void
buildVersionFilter
(
String
version
,
BoolQueryBuilder
boolMust
)
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
should
(
QueryBuilders
.
boolQuery
().
mustNot
(
QueryBuilders
.
termsQuery
(
"version"
,
version
)));
meBuilder
.
should
(
QueryBuilders
.
boolQuery
().
mustNot
(
QueryBuilders
.
existsQuery
(
"version"
)));
boolMust
.
must
(
meBuilder
);
}
public
Integer
synEquipFromDb2Es
(
String
equListCode
,
String
equCategoryCode
,
String
orgBranchCode
)
{
Map
<
String
,
Object
>
p
=
new
HashMap
<>();
p
.
put
(
"equListCode"
,
equListCode
);
p
.
put
(
"equCategoryCode"
,
equCategoryCode
);
p
.
put
(
"orgBranchCode"
,
orgBranchCode
);
return
equipInsert2EsPatcher
.
patchBatchData
(
p
);
}
}
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