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
0d10d721
Commit
0d10d721
authored
May 12, 2025
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(大编辑):代码重构
1.公共编辑接口 2.公共详情接口
parent
41b6903e
Hide whitespace changes
Inline
Side-by-side
Showing
53 changed files
with
2555 additions
and
1435 deletions
+2555
-1435
FieldDisplayDefine.java
...n/amos/boot/biz/common/annotation/FieldDisplayDefine.java
+2
-0
IBaseChangeData.java
...join/amos/boot/module/common/api/dto/IBaseChangeData.java
+4
-0
BizRelationDataDto.java
...ejoin/amos/boot/module/jg/api/dto/BizRelationDataDto.java
+6
-1
EquipDesignChangeDataDto.java
...amos/boot/module/jg/api/dto/EquipDesignChangeDataDto.java
+3
-1
EquipInspectChangeDataDto.java
...mos/boot/module/jg/api/dto/EquipInspectChangeDataDto.java
+45
-0
EquipRegisterChangeDataDto.java
...os/boot/module/jg/api/dto/EquipRegisterChangeDataDto.java
+3
-0
FieldChangeMeta.java
.../yeejoin/amos/boot/module/jg/api/dto/FieldChangeMeta.java
+52
-0
RequestChangeData.java
...eejoin/amos/boot/module/jg/api/dto/RequestChangeData.java
+24
-8
IBizDataChangeHandleStrategy.java
...t/module/jg/api/service/IBizDataChangeHandleStrategy.java
+0
-43
IJgBizChangeLogService.java
...os/boot/module/jg/api/service/IJgBizChangeLogService.java
+5
-0
BizDataHandleStrategyContext.java
...t/module/jg/biz/context/BizDataHandleStrategyContext.java
+1
-1
EquipDataProcessStrategyContext.java
...odule/jg/biz/context/EquipDataProcessStrategyContext.java
+7
-7
BizDataChangeController.java
...oot/module/jg/biz/controller/BizDataChangeController.java
+64
-16
BizDataChangeServiceImpl.java
...mos/boot/module/jg/biz/edit/BizDataChangeServiceImpl.java
+20
-7
DefaultEventPublisher.java
...s/boot/module/jg/biz/edit/core/DefaultEventPublisher.java
+25
-0
EventPublisherMapping.java
...s/boot/module/jg/biz/edit/core/EventPublisherMapping.java
+12
-0
IEventPublisher.java
...in/amos/boot/module/jg/biz/edit/core/IEventPublisher.java
+7
-0
RouterEventPublisher.java
...os/boot/module/jg/biz/edit/core/RouterEventPublisher.java
+38
-0
SubClassFinder.java
...oin/amos/boot/module/jg/biz/edit/core/SubClassFinder.java
+22
-0
BaseBizDataChangeEvent.java
...boot/module/jg/biz/edit/event/BaseBizDataChangeEvent.java
+13
-7
ChangeLogInsertListener.java
...e/jg/biz/edit/event/listener/ChangeLogInsertListener.java
+16
-15
DefaultBizDataChangeHandler.java
.../jg/biz/edit/process/biz/DefaultBizDataChangeHandler.java
+102
-0
InstallNoticeDataChangeHandler.java
...ess/biz/installNotice/InstallNoticeDataChangeHandler.java
+55
-0
IBizDataChangeHandleStrategy.java
...it/process/biz/strategy/IBizDataChangeHandleStrategy.java
+115
-0
UseRegisterDataChangeHandler.java
...process/biz/useRegister/UseRegisterDataChangeHandler.java
+92
-0
UseRegisterUpdateService.java
...dit/process/biz/useRegister/UseRegisterUpdateService.java
+77
-0
CommonEquipDataProcessService.java
...biz/edit/process/equip/CommonEquipDataProcessService.java
+864
-0
EquipChangeDataUpdateServiceImpl.java
.../edit/process/equip/EquipChangeDataUpdateServiceImpl.java
+289
-0
PieLineDataChangeServiceImpl.java
.../biz/edit/process/equip/PieLineDataChangeServiceImpl.java
+84
-0
SingleCylinderChangeProcess.java
...g/biz/edit/process/equip/SingleCylinderChangeProcess.java
+52
-0
SingleEquipChangeProcess.java
...e/jg/biz/edit/process/equip/SingleEquipChangeProcess.java
+52
-0
SingleProjectEquipChangeProcess.java
...z/edit/process/equip/SingleProjectEquipChangeProcess.java
+95
-0
IEquipChangeDataProcessStrategy.java
...ocess/equip/strategy/IEquipChangeDataProcessStrategy.java
+25
-0
ReflectiveFieldAccessor.java
...oot/module/jg/biz/edit/utils/ReflectiveFieldAccessor.java
+23
-0
IChangeEventBizHandler.java
...t/module/jg/biz/event/handler/IChangeEventBizHandler.java
+0
-9
InstallNoticeChangeEventHandler.java
...jg/biz/event/handler/InstallNoticeChangeEventHandler.java
+0
-90
MaintenanceContractChangeEventHandler.java
.../event/handler/MaintenanceContractChangeEventHandler.java
+0
-91
UseRegisterChangeEventHandler.java
...e/jg/biz/event/handler/UseRegisterChangeEventHandler.java
+0
-93
RelationBizApplyUpdateListener.java
...jg/biz/event/listener/RelationBizApplyUpdateListener.java
+0
-69
CommonEquipDataProcessService.java
...le/jg/biz/service/impl/CommonEquipDataProcessService.java
+0
-575
IdxBizJgRegisterInfoServiceImpl.java
.../jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
+3
-3
JgBizChangeLogServiceImpl.java
...module/jg/biz/service/impl/JgBizChangeLogServiceImpl.java
+8
-0
JgUseRegistrationServiceImpl.java
...ule/jg/biz/service/impl/JgUseRegistrationServiceImpl.java
+6
-1
SingleDataChangeProcessStrategy.java
.../jg/biz/service/impl/SingleDataChangeProcessStrategy.java
+0
-168
SingleManageEquipEditHandleImpl.java
.../jg/biz/service/impl/SingleManageEquipEditHandleImpl.java
+15
-18
UseRegisterDataChangeHandleImpl.java
.../jg/biz/service/impl/UseRegisterDataChangeHandleImpl.java
+0
-91
IdxBizJgConstructionInfo.java
.../boot/module/ymt/api/entity/IdxBizJgConstructionInfo.java
+24
-14
IdxBizJgFactoryInfo.java
.../amos/boot/module/ymt/api/entity/IdxBizJgFactoryInfo.java
+17
-0
IdxBizJgInspectionDetectionInfo.java
...odule/ymt/api/entity/IdxBizJgInspectionDetectionInfo.java
+28
-15
IdxBizJgMaintenanceRecordInfo.java
.../module/ymt/api/entity/IdxBizJgMaintenanceRecordInfo.java
+35
-19
IdxBizJgRegisterInfo.java
...amos/boot/module/ymt/api/entity/IdxBizJgRegisterInfo.java
+41
-26
IdxBizJgSupervisionInfo.java
...s/boot/module/ymt/api/entity/IdxBizJgSupervisionInfo.java
+19
-12
IdxBizJgUseInfo.java
...join/amos/boot/module/ymt/api/entity/IdxBizJgUseInfo.java
+65
-35
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/annotation/FieldDisplayDefine.java
View file @
0d10d721
...
...
@@ -18,6 +18,8 @@ public @interface FieldDisplayDefine {
Class
<?>
type
()
default
String
.
class
;
String
format
()
default
"yyyy-MM-dd"
;
boolean
isExist
()
default
true
;
}
amos-boot-system-tzs/amos-boot-module-common/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/dto/IBaseChangeData.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
dto
;
public
interface
IBaseChangeData
{
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/dto/BizRelationDataDto.java
View file @
0d10d721
...
...
@@ -34,7 +34,12 @@ public class BizRelationDataDto {
private
String
changeAttachment
;
/**
* 变更的设备
* 变更的设备
集合
*/
private
Set
<
String
>
records
;
/**
* 变更的装置集合
*/
private
Set
<
String
>
projectContraptionIds
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/dto/EquipDesignChangeDataDto.java
View file @
0d10d721
...
...
@@ -6,6 +6,8 @@ import com.yeejoin.amos.boot.biz.common.annotation.Group;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@Group
(
value
=
"equip_design_info"
)
...
...
@@ -24,7 +26,7 @@ public class EquipDesignChangeDataDto extends BaseChangeDataDto {
private
String
designUseDate
;
@FieldDisplayDefine
(
value
=
"设计日期"
)
private
String
designDate
;
private
Date
designDate
;
@FieldDisplayDefine
(
value
=
"总图图号"
)
private
String
drawingDo
;
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/dto/EquipInspectChangeDataDto.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
dto
;
import
com.alibaba.fastjson.JSON
;
import
com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine
;
import
com.yeejoin.amos.boot.biz.common.annotation.Group
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@Group
(
value
=
"jg_inspection_detection_info"
)
public
class
EquipInspectChangeDataDto
extends
BaseChangeDataDto
{
@FieldDisplayDefine
(
value
=
"设计单位统一社会信用代码"
)
private
String
designUnitCreditCode
;
@FieldDisplayDefine
(
value
=
"检验类型"
)
private
String
inspectType
;
@FieldDisplayDefine
(
value
=
"检验机构名称"
)
private
String
inspectOrgName
;
@FieldDisplayDefine
(
value
=
"检验报告"
,
type
=
JSON
.
class
)
private
String
inspectReport
;
@FieldDisplayDefine
(
value
=
"检验日期"
)
private
Date
inspectDate
;
@FieldDisplayDefine
(
value
=
"检验结论"
)
private
String
inspectConclusion
;
@FieldDisplayDefine
(
value
=
"下次检验日期"
)
private
Date
nextInspectDate
;
@FieldDisplayDefine
(
value
=
"检验机构统一信用代码"
)
private
String
inspectOrgCode
;
@FieldDisplayDefine
(
value
=
"检验报告编号"
)
private
String
inspectReportNo
;
@FieldDisplayDefine
(
value
=
"检验流水唯一主键"
,
isExist
=
false
)
private
String
jySeq
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/dto/EquipRegisterChangeDataDto.java
View file @
0d10d721
...
...
@@ -42,4 +42,7 @@ public class EquipRegisterChangeDataDto extends BaseChangeDataDto {
@FieldDisplayDefine
(
value
=
"其他附件"
,
type
=
JSON
.
class
)
private
String
otherAccessoriesReg
;
@FieldDisplayDefine
(
value
=
"安装资料是否完整齐全"
)
private
String
installationIsComplete
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/dto/FieldChangeMeta.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
@ApiModel
(
value
=
"变化的数据"
)
public
class
FieldChangeMeta
implements
Serializable
{
/**
* 必须字段-字段key
*/
private
String
columnKey
;
/**
* 必须字段-字段描述
*/
private
String
columnLabel
;
/**
* 必须字段-字段原始值
*/
private
String
columnOldValue
;
/**
* 必须字段-字段新值
*/
private
String
columnNewValue
;
/**
* 非必须字段-变化的数据id(设备的record、或者业务的id),持使用登记的设备信息变更、不同业务流程的业务数据变更
*/
private
String
changeId
;
/**
* 非必须字段-业务数据分类:如使用登记、安装告知等
*/
private
String
bizType
;
/**
* 非必须字段-变更数据的分类:如使用信息、制造信息、设计信息、技术参数 - key
*/
private
String
columnFamily
;
/**
* 非必须字段-字段类型-扩展使用
*/
private
String
columnType
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/dto/RequestChangeData.java
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
dto
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.api.service.IBizDataChangeHandleStrategy
;
import
java.util.HashMap
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
public
class
RequestChangeData
extends
JSONObject
{
/**
* 批量编辑时表格key-公共使用
*/
public
static
final
String
multiDataKey
=
"tableData"
;
public
IBizDataChangeHandleStrategy
.
ModelType
getModelType
()
{
if
(!
this
.
containsKey
(
multiDataKey
))
{
return
IBizDataChangeHandleStrategy
.
ModelType
.
single
;
/**
* 删除的数据表格key-管道使用
*/
public
static
final
String
deletedDataKey
=
"deleteData"
;
/**
* 变更说明
*/
public
static
final
String
changeReasonKey
=
"changeReason"
;
/**
* 变更说明附件
*/
public
static
final
String
changeReasonAttachmentKey
=
"changeAttachment"
;
public
void
validated
()
{
if
(!
this
.
containsKey
(
changeReasonKey
)
||
!
this
.
containsKey
(
changeReasonAttachmentKey
))
{
throw
new
BadRequest
(
"变更说明和变更说明附件不能为空!"
);
}
return
IBizDataChangeHandleStrategy
.
ModelType
.
batch
;
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/service/IBizDataChangeHandleStrategy.java
deleted
100644 → 0
View file @
41b6903e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
service
;
import
java.util.Map
;
public
interface
IBizDataChangeHandleStrategy
{
/**
* 可处理的业务类型(使用登记等)
*
* @return 业务类型
*/
String
canHandleBizType
();
/**
* 获取变更信息详情
*
* @param applyNo 单据编号
* @param model single, batch
* @param bizId 设备record
* @return 变更信息详情
*/
Map
<
String
,
?>
getDetail
(
String
applyNo
,
ModelType
model
,
String
bizId
);
/**
* 保存
*
* @param applyNo 单据编号
* @param model single, batch
* @param changeData 变更数据
*/
void
doSave
(
String
applyNo
,
ModelType
model
,
Map
<
String
,
Object
>
changeData
);
/**
* 单据方式:单个处理、批量处理
*/
enum
ModelType
{
single
,
batch
}
String
DEFAULT_VALUE
=
"default"
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/service/IJgBizChangeLogService.java
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
java.util.Set
;
/**
* 接口类
*
...
...
@@ -9,4 +13,5 @@ package com.yeejoin.amos.boot.module.jg.api.service;
*/
public
interface
IJgBizChangeLogService
{
IPage
<?>
queryPageListByChangeIds
(
Set
<
String
>
changeIds
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/context/BizDataHandleStrategyContext.java
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
context
;
import
com.yeejoin.amos.boot.module.jg.
api.service
.IBizDataChangeHandleStrategy
;
import
com.yeejoin.amos.boot.module.jg.
biz.edit.process.biz.strategy
.IBizDataChangeHandleStrategy
;
import
org.springframework.beans.BeansException
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/context/DataProcessStrategyContext.java
→
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/context/
Equip
DataProcessStrategyContext.java
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
context
;
import
com.yeejoin.amos.boot.module.jg.biz.
service.IChangeDataProcessStrategy
;
import
com.yeejoin.amos.boot.module.jg.
api.service.IBizDataChangeHandle
Strategy
;
import
com.yeejoin.amos.boot.module.jg.biz.
edit.process.biz.DefaultBizDataChangeHandler
;
import
com.yeejoin.amos.boot.module.jg.
biz.edit.process.equip.strategy.IEquipChangeDataProcess
Strategy
;
import
org.springframework.beans.BeansException
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
...
...
@@ -15,22 +15,22 @@ import java.util.Optional;
* @author Administrator
*/
@Component
public
class
DataProcessStrategyContext
implements
ApplicationContextAware
{
public
class
Equip
DataProcessStrategyContext
implements
ApplicationContextAware
{
private
static
final
Map
<
IBizDataChangeHandleStrategy
.
ModelType
,
I
ChangeDataProcessStrategy
>
dataProcessStrategyHashMap
=
new
HashMap
<>();
private
static
final
Map
<
DefaultBizDataChangeHandler
.
ModelType
,
IEquip
ChangeDataProcessStrategy
>
dataProcessStrategyHashMap
=
new
HashMap
<>();
public
static
I
ChangeDataProcessStrategy
getStrategy
(
IBizDataChangeHandleStrategy
.
ModelType
modelType
)
{
public
static
I
EquipChangeDataProcessStrategy
getStrategy
(
DefaultBizDataChangeHandler
.
ModelType
modelType
)
{
return
Optional
.
ofNullable
(
dataProcessStrategyHashMap
.
get
(
modelType
)).
orElseThrow
(()
->
new
RuntimeException
(
String
.
format
(
"not found %s type strategy"
,
modelType
)));
}
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
Map
<
String
,
I
ChangeDataProcessStrategy
>
strategyBeans
=
applicationContext
.
getBeansOfType
(
I
ChangeDataProcessStrategy
.
class
);
Map
<
String
,
I
EquipChangeDataProcessStrategy
>
strategyBeans
=
applicationContext
.
getBeansOfType
(
IEquip
ChangeDataProcessStrategy
.
class
);
if
(
strategyBeans
.
isEmpty
())
{
return
;
}
for
(
IChangeDataProcessStrategy
strategy
:
strategyBeans
.
values
())
{
for
(
I
Equip
ChangeDataProcessStrategy
strategy
:
strategyBeans
.
values
())
{
dataProcessStrategyHashMap
.
put
(
strategy
.
canHandleMode
(),
strategy
);
}
}
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/BizDataChangeController.java
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.module.jg.api.dto.RequestChangeData
;
import
com.yeejoin.amos.boot.module.jg.api.service.IBizDataChangeHandleStrategy
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.BizDataChangeServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.BizDataChangeServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.SingleManageEquipEditHandleImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
...
...
@@ -16,33 +21,76 @@ import java.util.Map;
@RestController
@RequestMapping
(
value
=
"/data-change"
)
@Api
(
tags
=
"业务数据变化处理控制器"
)
@RequiredArgsConstructor
public
class
BizDataChangeController
{
public
enum
DetailType
{
equip
,
project
}
private
final
BizDataChangeServiceImpl
bizDataChangeService
;
public
BizDataChangeController
(
BizDataChangeServiceImpl
bizDataChangeService
)
{
this
.
bizDataChangeService
=
bizDataChangeService
;
}
private
final
SingleManageEquipEditHandleImpl
singleManageEquipEditHandle
;
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/
{bizType}
/save"
)
@ApiOperation
(
value
=
"业务数据变更保存"
,
httpMethod
=
"POST"
)
@PostMapping
(
value
=
"/
v1/singleManageEquipEdit
/save"
)
@ApiOperation
(
value
=
"业务数据变更保存
--西安专用
"
,
httpMethod
=
"POST"
)
public
ResponseModel
<
String
>
save
(
@RequestParam
String
applyNo
,
@PathVariable
String
bizType
,
@RequestBody
RequestChangeData
changeData
)
{
bizDataChangeService
.
save
(
applyNo
,
bizType
,
changeData
);
singleManageEquipEditHandle
.
doSave
(
applyNo
,
changeData
);
return
ResponseHelper
.
buildResponse
(
"success"
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/{bizType}/detail"
)
@ApiOperation
(
value
=
"查询可业务变更的字段及默认值"
,
httpMethod
=
"GET"
)
public
ResponseModel
<
Map
<
String
,
?>>
getDetail
(
@RequestParam
(
required
=
false
)
String
applyNo
,
@PathVariable
String
bizType
,
IBizDataChangeHandleStrategy
.
ModelType
model
,
@RequestParam
(
required
=
false
)
String
bizId
)
{
return
ResponseHelper
.
buildResponse
(
bizDataChangeService
.
queryDetail
(
applyNo
,
bizType
,
model
,
bizId
));
@GetMapping
(
value
=
"/v1/singleManageEquipEdit/detail"
)
@ApiOperation
(
value
=
"查询可业务变更的字段及默认值--西安专用"
,
httpMethod
=
"GET"
)
public
ResponseModel
<
Map
<
String
,
?>>
getDetailV1
(
@RequestParam
(
required
=
false
)
String
applyNo
,
@RequestParam
(
required
=
false
)
String
bizId
)
{
return
ResponseHelper
.
buildResponse
(
singleManageEquipEditHandle
.
getDetail
(
applyNo
,
bizId
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/v2/{bizType}/detail"
)
@ApiOperation
(
value
=
"编辑一级页面详情查询--通用"
,
httpMethod
=
"GET"
)
public
ResponseModel
<
IPage
<?>>
getDetailV2
(
@RequestParam
String
applyNo
,
@PathVariable
String
bizType
,
@RequestParam
DetailType
type
,
@RequestParam
JSONObject
searchParams
)
{
return
ResponseHelper
.
buildResponse
(
bizDataChangeService
.
queryDetail
(
applyNo
,
bizType
,
type
,
searchParams
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/v2/{bizType}/sub-detail"
)
@ApiOperation
(
value
=
"编辑二级页面详情查询--通用"
,
httpMethod
=
"GET"
)
public
ResponseModel
<
Map
<
String
,
?>>
getSubDetailV2
(
@RequestParam
String
bizId
,
@RequestParam
(
required
=
false
)
String
applyNo
,
@RequestParam
DetailType
type
,
@PathVariable
String
bizType
)
{
return
ResponseHelper
.
buildResponse
(
bizDataChangeService
.
querySubDetail
(
applyNo
,
bizId
,
bizType
,
type
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/v2/{bizType}/save"
)
@ApiOperation
(
value
=
"编辑保存--通用"
,
httpMethod
=
"POST"
)
public
ResponseModel
<
String
>
saveV2
(
@ApiParam
(
required
=
true
,
value
=
"单据编号或者record"
)
@RequestParam
String
applyNo
,
@ApiParam
(
required
=
true
,
value
=
"业务类型"
)
@PathVariable
String
bizType
,
@ApiParam
(
required
=
true
,
value
=
"设备处理器类型"
)
@RequestParam
IBizDataChangeHandleStrategy
.
ModelType
modelType
,
@RequestBody
RequestChangeData
changeData
)
{
// 基础数据校验
changeData
.
validated
();
bizDataChangeService
.
save
(
applyNo
,
bizType
,
modelType
,
changeData
);
return
ResponseHelper
.
buildResponse
(
"success"
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/v2/{bizType}/change-logs"
)
@ApiOperation
(
value
=
"编辑二级页面详情查询--通用"
,
httpMethod
=
"GET"
)
public
ResponseModel
<
IPage
<?>>
getChangeLogPage
(
@RequestParam
String
bizId
,
@PathVariable
String
bizType
)
{
return
ResponseHelper
.
buildResponse
(
bizDataChangeService
.
getChangeLogPage
(
bizId
,
bizType
));
}
}
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
/BizDataChangeServiceImpl.java
→
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/
edit
/BizDataChangeServiceImpl.java
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jg.api.dto.RequestChangeData
;
import
com.yeejoin.amos.boot.module.jg.api.service.IBizDataChangeHandleStrategy
;
import
com.yeejoin.amos.boot.module.jg.biz.context.BizDataHandleStrategyContext
;
import
com.yeejoin.amos.boot.module.jg.biz.controller.BizDataChangeController
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -17,20 +21,29 @@ public class BizDataChangeServiceImpl {
*
* @param applyNo 单据编号
* @param bizType 业务类型
* @param modelType 处理器类型
* @param changeData 变化后的数据
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
save
(
String
applyNo
,
String
bizType
,
RequestChangeData
changeData
)
{
IBizDataChangeHandleStrategy
.
ModelType
model
=
changeData
.
getModelType
();
IBizDataChangeHandleStrategy
.
ModelType
modelType
,
RequestChangeData
changeData
)
{
IBizDataChangeHandleStrategy
handleStrategy
=
BizDataHandleStrategyContext
.
getStrategy
(
bizType
);
handleStrategy
.
doSave
(
applyNo
,
model
,
changeData
);
handleStrategy
.
doSave
(
applyNo
,
model
Type
,
changeData
);
}
public
Map
<
String
,
?>
queryDetail
(
String
applyNo
,
String
bizType
,
IBizDataChangeHandleStrategy
.
ModelType
model
,
String
bizId
)
{
public
IPage
<?>
queryDetail
(
String
applyNo
,
String
bizType
,
BizDataChangeController
.
DetailType
type
,
JSONObject
searchParams
)
{
IBizDataChangeHandleStrategy
handleStrategy
=
BizDataHandleStrategyContext
.
getStrategy
(
bizType
);
return
handleStrategy
.
getDetail
(
applyNo
,
model
,
bizId
);
return
handleStrategy
.
getDetail
(
applyNo
,
type
,
searchParams
);
}
public
Map
<
String
,
?>
querySubDetail
(
String
applyNo
,
String
bizId
,
String
bizType
,
BizDataChangeController
.
DetailType
type
)
{
IBizDataChangeHandleStrategy
handleStrategy
=
BizDataHandleStrategyContext
.
getStrategy
(
bizType
);
return
handleStrategy
.
getSubDetail
(
applyNo
,
bizId
,
type
);
}
public
IPage
<?>
getChangeLogPage
(
String
bizId
,
String
bizType
)
{
IBizDataChangeHandleStrategy
handleStrategy
=
BizDataHandleStrategyContext
.
getStrategy
(
bizType
);
return
handleStrategy
.
getChangeLogs
(
bizId
);
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/core/DefaultEventPublisher.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
core
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.event.BaseBizDataChangeEvent
;
import
lombok.Getter
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.context.ApplicationEventPublisherAware
;
import
org.springframework.stereotype.Component
;
@Getter
@Component
(
"defaultEventPublisher"
)
public
class
DefaultEventPublisher
implements
IEventPublisher
<
BaseBizDataChangeEvent
>,
ApplicationEventPublisherAware
{
private
ApplicationEventPublisher
publisher
;
@Override
public
void
publish
(
BaseBizDataChangeEvent
event
)
{
publisher
.
publishEvent
(
event
);
}
@Override
public
void
setApplicationEventPublisher
(
ApplicationEventPublisher
applicationEventPublisher
)
{
this
.
publisher
=
applicationEventPublisher
;
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/core/EventPublisherMapping.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
core
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
(
ElementType
.
TYPE
)
public
@interface
EventPublisherMapping
{
String
value
()
default
"defaultEventPublisher"
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/core/IEventPublisher.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
core
;
import
org.springframework.context.ApplicationEvent
;
public
interface
IEventPublisher
<
T
extends
ApplicationEvent
>
{
void
publish
(
T
event
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/core/RouterEventPublisher.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
core
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.event.BaseBizDataChangeEvent
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.stereotype.Component
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.concurrent.ConcurrentHashMap
;
@Component
@RequiredArgsConstructor
public
class
RouterEventPublisher
implements
IEventPublisher
<
BaseBizDataChangeEvent
>
{
private
final
ApplicationContext
applicationContext
;
private
final
Map
<
Class
<?>,
String
>
publisherCache
=
new
ConcurrentHashMap
<>();
@Override
public
void
publish
(
BaseBizDataChangeEvent
event
)
{
String
publisherName
=
resolvePublisherName
(
event
.
getClass
());
IEventPublisher
<
BaseBizDataChangeEvent
>
publisher
=
applicationContext
.
getBean
(
publisherName
,
IEventPublisher
.
class
);
Optional
.
ofNullable
(
publisher
).
orElseGet
(
this
::
getDefaultPublisher
).
publish
(
event
);
}
private
String
resolvePublisherName
(
Class
<?>
eventClass
)
{
return
publisherCache
.
computeIfAbsent
(
eventClass
,
clz
->
{
EventPublisherMapping
annotation
=
clz
.
getAnnotation
(
EventPublisherMapping
.
class
);
return
(
annotation
!=
null
)
?
annotation
.
value
()
:
"defaultEventPublisher"
;
});
}
private
IEventPublisher
<
BaseBizDataChangeEvent
>
getDefaultPublisher
()
{
return
applicationContext
.
getBean
(
"defaultEventPublisher"
,
IEventPublisher
.
class
);
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/core/SubClassFinder.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
core
;
import
com.yeejoin.amos.boot.module.common.api.dto.IBaseChangeData
;
import
org.reflections.Reflections
;
import
java.util.HashSet
;
import
java.util.Set
;
public
class
SubClassFinder
{
private
static
final
Set
<
Class
<?
extends
IBaseChangeData
>>
subClasses
;
static
{
//▼ 指定扫描包路径(根据实际项目调整)
Reflections
reflections
=
new
Reflections
(
"com.yeejoin.amos.boot.module.jg.api.dto"
,
"com.yeejoin.amos.boot.module.ymt.api.entity"
);
//▼ 获取所有继承BaseChangeDataDto的类
subClasses
=
reflections
.
getSubTypesOf
(
IBaseChangeData
.
class
);
}
public
static
Set
<
Class
<?
extends
IBaseChangeData
>>
getAllSubClasses
()
{
return
new
HashSet
<>(
subClasses
);
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/e
vent/ChangeData
Event.java
→
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/e
dit/event/BaseBizDataChange
Event.java
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
event
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
e
dit
.
e
vent
;
import
com.yeejoin.amos.boot.module.jg.api.dto.BizRelationDataDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.core.EventPublisherMapping
;
import
lombok.Getter
;
import
org.springframework.context.ApplicationEvent
;
import
org.typroject.tyboot.core.foundation.context.RequestContextModel
;
...
...
@@ -12,15 +13,20 @@ import java.util.List;
* @author Administrator
*/
@Getter
public
class
ChangeDataEvent
extends
ApplicationEvent
{
@EventPublisherMapping
public
class
BaseBizDataChangeEvent
extends
ApplicationEvent
{
private
final
List
<
ChangeDataDto
>
data
;
private
List
<
FieldChangeMeta
>
data
;
private
final
RequestContextModel
requestContext
;
private
RequestContextModel
requestContext
;
private
final
BizRelationDataDto
bizRelationData
;
public
BaseBizDataChangeEvent
(
Object
source
)
{
super
(
source
);
}
private
BizRelationDataDto
bizRelationData
;
public
ChangeDataEvent
(
Object
source
,
BizRelationDataDto
bizRelationData
,
List
<
ChangeDataDto
>
data
,
RequestContextModel
requestContext
)
{
public
BaseBizDataChangeEvent
(
Object
source
,
BizRelationDataDto
bizRelationData
,
List
<
FieldChangeMeta
>
data
,
RequestContextModel
requestContext
)
{
super
(
source
);
this
.
data
=
data
;
this
.
bizRelationData
=
bizRelationData
;
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/event/listener/ChangeLogInsertListener.java
→
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/e
dit/e
vent/listener/ChangeLogInsertListener.java
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
event
.
listener
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
e
dit
.
e
vent
.
listener
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ESDataChangeLogDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgBizChangeLog
;
import
com.yeejoin.amos.boot.module.jg.biz.dao.ESDataChangeLogDao
;
import
com.yeejoin.amos.boot.module.jg.biz.e
vent.ChangeData
Event
;
import
com.yeejoin.amos.boot.module.jg.biz.e
dit.event.BaseBizDataChange
Event
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgBizChangeLogServiceImpl
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -41,10 +41,11 @@ public class ChangeLogInsertListener {
static
{
bizTypeTableMap
.
put
(
"useRegister"
,
"tzs_jg_use_registration"
);
bizTypeTableMap
.
put
(
"installationNotice"
,
"tzs_jg_installation_notice"
);
bizTypeTableMap
.
put
(
"singleManageEquipEdit"
,
"idx_biz_jg_use_info"
);
}
@Value
(
"${change.
data
.deal.thread.number:1}"
)
@Value
(
"${change.
log
.deal.thread.number:1}"
)
private
int
threadNumber
;
private
final
ESDataChangeLogDao
esDataChangeLogDao
;
...
...
@@ -52,13 +53,13 @@ public class ChangeLogInsertListener {
private
final
JgBizChangeLogServiceImpl
bizChangeLogService
;
private
final
BlockingQueue
<
ChangeData
Event
>
queue
=
new
LinkedBlockingQueue
<>();
private
final
BlockingQueue
<
BaseBizDataChange
Event
>
queue
=
new
LinkedBlockingQueue
<>();
@TransactionalEventListener
(
value
=
ChangeData
Event
.
class
)
@TransactionalEventListener
(
value
=
BaseBizDataChange
Event
.
class
)
@Async
public
void
handleTransactionalEvent
(
ChangeData
Event
event
)
{
log
.
info
(
"
收到用户
变更业务数据消息:{}"
,
JSONObject
.
toJSONString
(
event
));
public
void
handleTransactionalEvent
(
BaseBizDataChange
Event
event
)
{
log
.
info
(
"
日志处理器,收到
变更业务数据消息:{}"
,
JSONObject
.
toJSONString
(
event
));
queue
.
add
(
event
);
}
...
...
@@ -69,7 +70,7 @@ public class ChangeLogInsertListener {
executorService
.
execute
(()
->
{
while
(
true
)
{
try
{
ChangeData
Event
event
=
queue
.
take
();
BaseBizDataChange
Event
event
=
queue
.
take
();
processEvent
(
event
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
...
...
@@ -79,19 +80,19 @@ public class ChangeLogInsertListener {
});
}
private
void
processEvent
(
ChangeData
Event
event
)
{
List
<
ChangeDataDto
>
changeDataDto
s
=
event
.
getData
();
private
void
processEvent
(
BaseBizDataChange
Event
event
)
{
List
<
FieldChangeMeta
>
fieldChangeMeta
s
=
event
.
getData
();
RequestContextModel
requestContextModel
=
event
.
getRequestContext
();
Date
date
=
new
Date
();
// 1.主表保存
JgBizChangeLog
changeLog
=
saveLog
(
event
);
// 2.子表字段保存
List
<
ESDataChangeLogDto
>
logs
=
saveColumnsChange2Es
(
changeDataDto
s
,
requestContextModel
,
date
,
changeLog
);
List
<
ESDataChangeLogDto
>
logs
=
saveColumnsChange2Es
(
fieldChangeMeta
s
,
requestContextModel
,
date
,
changeLog
);
log
.
info
(
"es 操作日志数据入库成功:{}条"
,
logs
.
size
());
}
private
List
<
ESDataChangeLogDto
>
saveColumnsChange2Es
(
List
<
ChangeDataDto
>
changeDataDto
s
,
RequestContextModel
requestContextModel
,
Date
date
,
JgBizChangeLog
changeLog
)
{
List
<
ESDataChangeLogDto
>
logs
=
changeDataDto
s
.
parallelStream
().
map
(
changeDataDto
->
{
private
List
<
ESDataChangeLogDto
>
saveColumnsChange2Es
(
List
<
FieldChangeMeta
>
fieldChangeMeta
s
,
RequestContextModel
requestContextModel
,
Date
date
,
JgBizChangeLog
changeLog
)
{
List
<
ESDataChangeLogDto
>
logs
=
fieldChangeMeta
s
.
parallelStream
().
map
(
changeDataDto
->
{
ESDataChangeLogDto
changeLogDto
=
new
ESDataChangeLogDto
();
changeLogDto
.
setColumnKey
(
changeDataDto
.
getColumnKey
());
changeLogDto
.
setColumnKeyLabel
(
changeDataDto
.
getColumnLabel
());
...
...
@@ -112,7 +113,7 @@ public class ChangeLogInsertListener {
return
logs
;
}
private
JgBizChangeLog
saveLog
(
ChangeData
Event
event
)
{
private
JgBizChangeLog
saveLog
(
BaseBizDataChange
Event
event
)
{
JgBizChangeLog
changeLog
=
new
JgBizChangeLog
();
BeanUtil
.
copyProperties
(
event
.
getBizRelationData
(),
changeLog
);
changeLog
.
setBizTable
(
bizTypeTableMap
.
get
(
changeLog
.
getBizType
()));
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/process/biz/DefaultBizDataChangeHandler.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
process
.
biz
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.module.jg.api.dto.BizRelationDataDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta
;
import
com.yeejoin.amos.boot.module.jg.biz.context.EquipDataProcessStrategyContext
;
import
com.yeejoin.amos.boot.module.jg.biz.controller.BizDataChangeController
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.core.IEventPublisher
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.event.BaseBizDataChangeEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.CommonEquipDataProcessService
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgBizChangeLogServiceImpl
;
import
org.springframework.context.ApplicationContext
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
public
abstract
class
DefaultBizDataChangeHandler
<
U
extends
BaseBizDataChangeEvent
>
implements
IBizDataChangeHandleStrategy
{
private
final
IEventPublisher
<
BaseBizDataChangeEvent
>
eventPublisher
;
private
final
ApplicationContext
applicationContext
;
protected
DefaultBizDataChangeHandler
(
IEventPublisher
<
BaseBizDataChangeEvent
>
eventPublisher
,
ApplicationContext
applicationContext
)
{
this
.
eventPublisher
=
eventPublisher
;
this
.
applicationContext
=
applicationContext
;
}
@Override
public
final
void
doSave
(
String
applyNo
,
ModelType
model
,
Map
<
String
,
Object
>
changeData
)
{
if
(
beforeCheck
(
applyNo
,
model
,
changeData
))
{
JSONObject
oData
=
new
JSONObject
(
changeData
);
// 删除原始提交的变更说明及附件放置后续存放到json
changeData
.
remove
(
"changeReason"
);
changeData
.
remove
(
"changeAttachment"
);
IEquipChangeDataProcessStrategy
dataProcessor
=
EquipDataProcessStrategyContext
.
getStrategy
(
model
);
List
<
FieldChangeMeta
>
allChangeColumns
=
dataProcessor
.
handle
(
changeData
,
applyNo
);
List
<
FieldChangeMeta
>
bizEditColumns
=
updBizData
(
applyNo
,
model
,
changeData
);
allChangeColumns
.
addAll
(
bizEditColumns
);
if
(
bizIsFinished
(
applyNo
,
model
,
changeData
))
{
List
<
FieldChangeMeta
>
equipColumns
=
updCertDataIfBizFin
(
applyNo
,
model
,
changeData
);
allChangeColumns
.
addAll
(
equipColumns
);
}
// 发送数据变更消息
publish2OtherBiz
(
allChangeColumns
,
applyNo
,
oData
);
}
}
private
void
publish2OtherBiz
(
List
<
FieldChangeMeta
>
allChangeColumns
,
String
applyNo
,
JSONObject
changeData
)
{
if
(!
allChangeColumns
.
isEmpty
())
{
BizRelationDataDto
bizRelationDataDto
=
new
BizRelationDataDto
();
bizRelationDataDto
.
setBizId
(
applyNo
);
bizRelationDataDto
.
setBizType
(
canHandleBizType
());
bizRelationDataDto
.
setRecords
(
getEqs
(
applyNo
));
bizRelationDataDto
.
setChangeReason
(
changeData
.
getString
(
"changeReason"
));
bizRelationDataDto
.
setChangeAttachment
(
JSONObject
.
toJSONString
(
changeData
.
get
(
"changeAttachment"
)));
bizRelationDataDto
.
setProjectContraptionIds
(
getProjectContraptionIds
(
applyNo
));
eventPublisher
.
publish
(
new
BaseBizDataChangeEvent
(
this
,
bizRelationDataDto
,
allChangeColumns
,
RequestContext
.
cloneRequestContext
()));
}
}
@Override
public
IPage
<?>
getDetail
(
String
applyNo
,
BizDataChangeController
.
DetailType
type
,
JSONObject
searchParams
)
{
CommonEquipDataProcessService
service
=
applicationContext
.
getBean
(
CommonEquipDataProcessService
.
class
);
switch
(
type
)
{
case
equip:
return
service
.
getEquListByRecords
(
getEqs
(
applyNo
),
searchParams
);
case
project:
return
service
.
getProjectContraptionsBySeqs
(
getProjectContraptionIds
(
applyNo
),
searchParams
);
default
:
throw
new
BadRequest
(
"unknown type for getDetail"
);
}
}
@Override
public
Map
<
String
,
?>
getSubDetail
(
String
applyNo
,
String
bizId
,
BizDataChangeController
.
DetailType
type
)
{
CommonEquipDataProcessService
service
=
applicationContext
.
getBean
(
CommonEquipDataProcessService
.
class
);
switch
(
type
)
{
case
equip:
return
service
.
getEquipDetailByRecord
(
bizId
);
case
project:
return
service
.
getProjectContraptionBySeq
(
bizId
,
getEqs
(
applyNo
));
default
:
throw
new
BadRequest
(
"unknown type for getSubDetail"
);
}
}
@Override
public
IPage
<?>
getChangeLogs
(
String
bizId
)
{
Set
<
String
>
changeIds
=
new
HashSet
<>();
changeIds
.
addAll
(
getEqs
(
bizId
));
changeIds
.
addAll
(
getProjectContraptionIds
(
bizId
));
JgBizChangeLogServiceImpl
service
=
applicationContext
.
getBean
(
JgBizChangeLogServiceImpl
.
class
);
return
service
.
queryPageListByChangeIds
(
changeIds
);
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/process/biz/installNotice/InstallNoticeDataChangeHandler.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
process
.
biz
.
installNotice
;
import
com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.core.RouterEventPublisher
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.event.BaseBizDataChangeEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.DefaultBizDataChangeHandler
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.stereotype.Component
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
@Component
public
class
InstallNoticeDataChangeHandler
extends
DefaultBizDataChangeHandler
<
BaseBizDataChangeEvent
>
{
protected
InstallNoticeDataChangeHandler
(
RouterEventPublisher
routerEventPublisher
,
ApplicationContext
applicationContext
)
{
super
(
routerEventPublisher
,
applicationContext
);
}
@Override
public
String
canHandleBizType
()
{
return
"installationNotice"
;
}
@Override
public
List
<
FieldChangeMeta
>
updBizData
(
String
applyNo
,
ModelType
model
,
Map
<
String
,
Object
>
changeData
)
{
return
Collections
.
emptyList
();
}
@Override
public
Boolean
beforeCheck
(
String
applyNo
,
ModelType
model
,
Map
<
String
,
Object
>
changeData
)
{
return
null
;
}
@Override
public
Set
<
String
>
getEqs
(
String
applyNo
)
{
return
Collections
.
emptySet
();
}
@Override
public
List
<
FieldChangeMeta
>
updCertDataIfBizFin
(
String
applyNo
,
ModelType
model
,
Map
<
String
,
Object
>
changeData
)
{
return
Collections
.
emptyList
();
}
@Override
public
Boolean
bizIsFinished
(
String
applyNo
,
ModelType
model
,
Map
<
String
,
Object
>
changeData
)
{
return
null
;
}
@Override
public
Set
<
String
>
getProjectContraptionIds
(
String
applyNo
)
{
return
Collections
.
emptySet
();
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/process/biz/strategy/IBizDataChangeHandleStrategy.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
process
.
biz
.
strategy
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta
;
import
com.yeejoin.amos.boot.module.jg.biz.controller.BizDataChangeController
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
public
interface
IBizDataChangeHandleStrategy
{
/**
* 可处理的业务类型(使用登记等)
*
* @return 业务类型
*/
String
canHandleBizType
();
/**
* 获取变更信息详情-二级详情
* @param applyNo 单据或者设备唯一,单据编辑时用来查询eq表
* @param bizId 设备record
* @param type 编辑的资源的类型:设备、装置
* @return 变更信息详情
*/
Map
<
String
,
?>
getSubDetail
(
String
applyNo
,
String
bizId
,
BizDataChangeController
.
DetailType
type
);
/**
* 获取变更信息详情-一级详情
*
* @param applyNo 单据编号
* @param type 编辑的资源的类型:设备、装置
* @param searchParams 查询参数
* @return 变更信息详情
*/
IPage
<?>
getDetail
(
String
applyNo
,
BizDataChangeController
.
DetailType
type
,
JSONObject
searchParams
);
/**
* 保存
*
* @param applyNo 单据编号
* @param model @see ModelType
* @param changeData 变更数据
*/
List
<
FieldChangeMeta
>
updBizData
(
String
applyNo
,
ModelType
model
,
Map
<
String
,
Object
>
changeData
);
/**
* 前置校验 如业务字段的重复性检验
*
* @param applyNo 单据编号
* @param model 类型
* @param changeData 数据
* @return 是否通过前置校验
*/
Boolean
beforeCheck
(
String
applyNo
,
ModelType
model
,
Map
<
String
,
Object
>
changeData
);
/**
* 单据方式:单个处理、批量处理
*/
enum
ModelType
{
singleProject
,
singleEquip
,
singleCylinder
}
void
doSave
(
String
applyNo
,
ModelType
model
,
Map
<
String
,
Object
>
changeData
);
/**
* 获取子表的设备或者使用登记证
*
* @param applyNo 单据编号
* @return 设备record或者证数组
*/
Set
<
String
>
getEqs
(
String
applyNo
);
/**
* 在业务单位状态为已完成时进行证表的更新
*
* @param applyNo 单据编号
* @param model 类型
* @param changeData 数据
* @return 更新的字段
*/
List
<
FieldChangeMeta
>
updCertDataIfBizFin
(
String
applyNo
,
ModelType
model
,
Map
<
String
,
Object
>
changeData
);
/**
* 单据是否已经审核完成
*
* @param applyNo 单据编号
* @param model 类型
* @param changeData 数据
* @return true-完成;false-未完成
*/
Boolean
bizIsFinished
(
String
applyNo
,
ModelType
model
,
Map
<
String
,
Object
>
changeData
);
/**
* 获取变更的装置ids
*
* @param applyNo 单据编号
* @return 装置id集合
*/
Set
<
String
>
getProjectContraptionIds
(
String
applyNo
);
/**
* 查询变更日志
* @param bizId 业务id
* @return 分页数据
*/
IPage
<?>
getChangeLogs
(
String
bizId
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/process/biz/useRegister/UseRegisterDataChangeHandler.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
process
.
biz
.
useRegister
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistration
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationEq
;
import
com.yeejoin.amos.boot.module.jg.biz.controller.BizDataChangeController
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.core.RouterEventPublisher
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.event.BaseBizDataChangeEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.DefaultBizDataChangeHandler
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
public
class
UseRegisterDataChangeHandler
extends
DefaultBizDataChangeHandler
<
BaseBizDataChangeEvent
>
{
private
final
UseRegisterUpdateService
useRegisterUpdateService
;
protected
UseRegisterDataChangeHandler
(
RouterEventPublisher
routerEventPublisher
,
UseRegisterUpdateService
useRegisterUpdateService
,
ApplicationContext
applicationContext
)
{
super
(
routerEventPublisher
,
applicationContext
);
this
.
useRegisterUpdateService
=
useRegisterUpdateService
;
}
@Override
public
String
canHandleBizType
()
{
return
"useRegistration"
;
}
/**
* 保存
*
* @param applyNo 单据编号
* @param model single, batch
* @param changeData 前端不支持分组-目前为平铺数据结构
*/
@Override
public
List
<
FieldChangeMeta
>
updBizData
(
String
applyNo
,
ModelType
model
,
Map
<
String
,
Object
>
changeData
)
{
List
<
FieldChangeMeta
>
bizEditColumns
=
new
ArrayList
<>();
// 1.流程中时-更新单据-业务冗余的字段
this
.
updateBizInfo
(
changeData
);
return
bizEditColumns
;
}
private
void
updateBizInfo
(
Map
<
String
,
Object
>
changeData
)
{
useRegisterUpdateService
.
updateBizInfo
(
changeData
);
}
@Override
public
Boolean
beforeCheck
(
String
applyNo
,
ModelType
model
,
Map
<
String
,
Object
>
changeData
)
{
return
true
;
}
@Override
public
Set
<
String
>
getEqs
(
String
applyNo
)
{
JgUseRegistration
useRegistration
=
useRegisterUpdateService
.
getJgUseRegistrationService
().
getOne
(
new
LambdaQueryWrapper
<
JgUseRegistration
>().
select
(
BaseEntity:
:
getSequenceNbr
).
eq
(
JgUseRegistration:
:
getApplyNo
,
applyNo
));
List
<
JgUseRegistrationEq
>
eqs
=
useRegisterUpdateService
.
getUseRegistrationEqService
().
list
(
new
LambdaQueryWrapper
<
JgUseRegistrationEq
>().
select
(
JgUseRegistrationEq:
:
getEquId
).
eq
(
JgUseRegistrationEq:
:
getEquipTransferId
,
useRegistration
.
getSequenceNbr
()));
return
eqs
.
stream
().
map
(
JgUseRegistrationEq:
:
getEquId
).
collect
(
Collectors
.
toSet
());
}
@Override
public
List
<
FieldChangeMeta
>
updCertDataIfBizFin
(
String
applyNo
,
ModelType
model
,
Map
<
String
,
Object
>
changeData
)
{
// 更新设备/装置的使用信息
return
useRegisterUpdateService
.
updCertDataIfBizFin
(
applyNo
,
new
JSONObject
(
changeData
));
}
@Override
public
Boolean
bizIsFinished
(
String
applyNo
,
ModelType
model
,
Map
<
String
,
Object
>
changeData
)
{
JgUseRegistration
useRegistration
=
useRegisterUpdateService
.
getJgUseRegistrationService
().
getOne
(
new
LambdaQueryWrapper
<
JgUseRegistration
>().
eq
(
JgUseRegistration:
:
getApplyNo
,
applyNo
));
return
useRegistration
.
getStatus
().
equals
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
());
}
@Override
public
Set
<
String
>
getProjectContraptionIds
(
String
applyNo
)
{
JgUseRegistration
useRegistration
=
useRegisterUpdateService
.
getJgUseRegistrationService
().
getOne
(
new
LambdaQueryWrapper
<
JgUseRegistration
>().
select
(
BaseEntity:
:
getSequenceNbr
,
JgUseRegistration:
:
getApplyNo
,
JgUseRegistration:
:
getProjectContraptionId
).
eq
(
JgUseRegistration:
:
getApplyNo
,
applyNo
));
Set
<
String
>
projectContraptionIds
=
new
HashSet
<>();
projectContraptionIds
.
add
(
useRegistration
.
getProjectContraptionId
());
projectContraptionIds
.
remove
(
null
);
projectContraptionIds
.
remove
(
""
);
return
projectContraptionIds
;
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/process/biz/useRegister/UseRegisterUpdateService.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
process
.
biz
.
useRegister
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.CommonEquipDataProcessService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgProjectContraptionServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationEqServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper
;
import
lombok.Getter
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.function.Function
;
@Service
@RequiredArgsConstructor
@Getter
@Slf4j
public
class
UseRegisterUpdateService
{
private
final
IdxBizJgRegisterInfoMapper
idxBizJgRegisterInfoMapper
;
private
final
IdxBizJgProjectContraptionServiceImpl
idxBizJgProjectContraptionService
;
private
final
RedisUtils
redisUtils
;
private
final
JgUseRegistrationServiceImpl
jgUseRegistrationService
;
private
final
Map
<
String
,
Function
<
JSONObject
,
Boolean
>>
bizHandlers
=
new
ConcurrentHashMap
<>();
private
final
CommonEquipDataProcessService
commonEquipDataProcessService
;
private
final
CommonMapper
commonMapper
;
private
final
JgUseRegistrationEqServiceImpl
useRegistrationEqService
;
public
void
convertStringToJsonObject
(
Object
obj
,
String
[]
jsonFields
)
{
if
(
obj
instanceof
JSONObject
)
{
JSONObject
jsonObject
=
(
JSONObject
)
obj
;
for
(
String
field
:
jsonFields
)
{
if
(
jsonObject
.
get
(
field
)
!=
null
&&
jsonObject
.
get
(
field
)
instanceof
String
)
{
jsonObject
.
put
(
field
,
JSON
.
parse
(
JSONObject
.
toJSONString
(
jsonObject
.
get
(
field
))));
}
}
}
else
if
(
obj
instanceof
Map
)
{
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
obj
;
for
(
String
field
:
jsonFields
)
{
if
(
map
.
containsKey
(
field
)
&&
map
.
get
(
field
)
instanceof
String
)
{
map
.
put
(
field
,
JSON
.
parse
((
String
)
map
.
get
(
field
)));
}
}
}
else
{
// 处理其他类型
System
.
out
.
println
(
"Unsupported Object Type"
);
}
}
public
void
updateBizInfo
(
Map
<
String
,
Object
>
changeData
)
{
}
public
List
<
FieldChangeMeta
>
updCertDataIfBizFin
(
String
applyNo
,
JSONObject
data
)
{
// 更新证信息
return
new
ArrayList
<>();
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/process/equip/CommonEquipDataProcessService.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
process
.
equip
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.text.CharSequenceUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine
;
import
com.yeejoin.amos.boot.biz.common.annotation.Group
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.module.common.api.dto.IBaseChangeData
;
import
com.yeejoin.amos.boot.module.jg.api.dto.*
;
import
com.yeejoin.amos.boot.module.jg.api.enums.EquipSourceEnum
;
import
com.yeejoin.amos.boot.module.jg.biz.service.*
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgProjectContraptionServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.*
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgDesignInfoMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgFactoryInfoMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgOtherInfoMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.lucene.queryparser.classic.QueryParser
;
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.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.SearchHit
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.elasticsearch.search.sort.SortOrder
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
javax.annotation.PostConstruct
;
import
java.io.IOException
;
import
java.lang.reflect.Field
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
core
.
SubClassFinder
.
getAllSubClasses
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
utils
.
ReflectiveFieldAccessor
.
getAllFields
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
.
IdxBizJgProjectContraptionServiceImpl
.
PROJECT_CONTRAPTION
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
.
IdxBizJgProjectContraptionServiceImpl
.
PROJECT_CONTRAPTION_NO
;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
.
IdxBizJgRegisterInfoServiceImpl
.*;
import
static
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
.
JgCertificateReplenishServiceImpl
.
SEQUENCE_NBR
;
@Component
@RequiredArgsConstructor
@Slf4j
public
class
CommonEquipDataProcessService
{
private
final
IdxBizJgDesignInfoMapper
idxBizJgDesignInfoMapper
;
private
final
IdxBizJgFactoryInfoMapper
jgFactoryInfoMapper
;
private
final
IdxBizJgRegisterInfoMapper
idxBizJgRegisterInfoMapper
;
private
final
IIdxBizJgTechParamsElevatorService
iIdxBizJgTechParamsElevatorService
;
private
final
IIdxBizJgTechParamsVehicleService
iIdxBizJgTechParamsVehicleService
;
private
final
IIdxBizJgTechParamsRopewayService
iIdxBizJgTechParamsRopewayService
;
private
final
IIdxBizJgTechParamsRidesService
iIdxBizJgTechParamsRidesService
;
private
final
IIdxBizJgTechParamsBoilerService
iIdxBizJgTechParamsBoilerService
;
private
final
IIdxBizJgTechParamsVesselService
iIdxBizJgTechParamsVesselService
;
private
final
IIdxBizJgTechParamsPipelineService
iIdxBizJgTechParamsPipelineService
;
private
final
IIdxBizJgTechParamsLiftingService
iIdxBizJgTechParamsLiftingService
;
private
final
EquipChangeDataUpdateServiceImpl
equipChangeDataUpdateServiceImpl
;
private
final
IdxBizJgUseInfoServiceImpl
idxBizJgUseInfoService
;
private
final
List
<
String
>
jsonFields
=
new
ArrayList
<>();
private
final
IdxBizJgOtherInfoMapper
idxBizJgOtherInfoMapper
;
private
final
RestHighLevelClient
restHighLevelClient
;
private
final
IdxBizJgProjectContraptionServiceImpl
idxBizJgProjectContraptionServiceImpl
;
private
final
JgUseRegistrationServiceImpl
jgUseRegistrationService
;
@PostConstruct
public
void
init
()
{
Set
<
Class
<?
extends
IBaseChangeData
>>
subClasses
=
getAllSubClasses
();
for
(
Class
<?
extends
IBaseChangeData
>
subClass
:
subClasses
)
{
Field
[]
fields
=
subClass
.
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
field
.
setAccessible
(
true
);
FieldDisplayDefine
fieldDisplayDefine
=
field
.
getAnnotation
(
FieldDisplayDefine
.
class
);
if
(
fieldDisplayDefine
!=
null
&&
fieldDisplayDefine
.
type
()
==
JSON
.
class
)
{
jsonFields
.
add
(
field
.
getName
());
}
}
}
}
public
static
<
T
extends
BaseChangeDataDto
>
T
castMap2Bean
(
Map
<
String
,
Object
>
map
,
Class
<
T
>
clazz
)
{
try
{
T
t
=
clazz
.
newInstance
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
map
)),
t
,
true
);
return
t
;
}
catch
(
InstantiationException
|
IllegalAccessException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
public
void
checkValidField
(
String
record
,
BaseChangeDataDto
changeDataDto
,
String
equList
,
String
equCategory
,
String
equDefine
)
{
// 注册信息
if
(
changeDataDto
instanceof
EquipRegisterChangeDataDto
)
{
EquipRegisterChangeDataDto
registerChangeDataDto
=
(
EquipRegisterChangeDataDto
)
changeDataDto
;
equipChangeDataUpdateServiceImpl
.
checkRegisterChangeData
(
record
,
registerChangeDataDto
);
}
// 制造信息
if
(
changeDataDto
instanceof
EquipFactoryChangeDataDto
)
{
EquipFactoryChangeDataDto
equipFactoryChangeDataDto
=
(
EquipFactoryChangeDataDto
)
changeDataDto
;
equipChangeDataUpdateServiceImpl
.
checkFactoryChangeData
(
record
,
equipFactoryChangeDataDto
,
equList
,
equCategory
,
equDefine
);
}
// 设计信息
if
(
changeDataDto
instanceof
EquipDesignChangeDataDto
)
{
EquipDesignChangeDataDto
equipDesignChangeDataDto
=
(
EquipDesignChangeDataDto
)
changeDataDto
;
equipChangeDataUpdateServiceImpl
.
checkDesignChangeData
(
record
,
equipDesignChangeDataDto
);
}
}
public
void
buildChangeFields
(
String
record
,
EquipDesignChangeDataDto
equipDesignChangeDataDto
,
EquipFactoryChangeDataDto
equipFactoryChangeDataDto
,
EquipRegisterChangeDataDto
registerChangeDataDto
,
EquipOtherInfoChangeDataDto
otherInfoChangeDataDto
,
EquipUseInfoChangeDataDto
useInfoChangeDataDto
,
List
<
FieldChangeMeta
>
allChangeColumns
)
{
// 构造新对象行转列
List
<
FieldChangeMeta
>
designInfoNew
=
this
.
buildDesignInfoNew
(
equipDesignChangeDataDto
,
record
);
List
<
FieldChangeMeta
>
factoryInfoNew
=
this
.
buildFactoryInfoNew
(
equipFactoryChangeDataDto
,
record
);
List
<
FieldChangeMeta
>
registerInfoNew
=
this
.
buildRegisterInfoNew
(
registerChangeDataDto
,
record
);
if
(
useInfoChangeDataDto
!=
null
)
{
List
<
FieldChangeMeta
>
useInfoNew
=
convertBeanField2Column2
(
useInfoChangeDataDto
,
record
);
List
<
FieldChangeMeta
>
useInfoOld
=
this
.
buildUseInfoOld
(
record
);
allChangeColumns
.
addAll
(
mergeChangeFields
(
useInfoNew
,
useInfoOld
));
}
if
(
otherInfoChangeDataDto
!=
null
)
{
List
<
FieldChangeMeta
>
otherInfoNew
=
convertBeanField2Column2
(
otherInfoChangeDataDto
,
record
);
List
<
FieldChangeMeta
>
otherInfoOld
=
this
.
buildOtherInfoOld
(
record
);
allChangeColumns
.
addAll
(
mergeChangeFields
(
otherInfoNew
,
otherInfoOld
));
}
// 老数据查询行转列
List
<
FieldChangeMeta
>
designInfoOld
=
this
.
buildDesignInfoOld
(
record
);
List
<
FieldChangeMeta
>
factoryInfoOld
=
this
.
buildFactoryInfoOld
(
record
);
List
<
FieldChangeMeta
>
registerInfoOld
=
this
.
buildRegisterInfoOld
(
record
);
allChangeColumns
.
addAll
(
mergeChangeFields
(
designInfoNew
,
designInfoOld
));
allChangeColumns
.
addAll
(
mergeChangeFields
(
factoryInfoNew
,
factoryInfoOld
));
allChangeColumns
.
addAll
(
mergeChangeFields
(
registerInfoNew
,
registerInfoOld
));
}
public
void
buildChangeFields
(
String
record
,
EquipDesignChangeDataDto
equipDesignChangeDataDto
,
EquipFactoryChangeDataDto
equipFactoryChangeDataDto
,
EquipRegisterChangeDataDto
registerChangeDataDto
,
EquipUseInfoChangeDataDto
useInfoChangeDataDto
,
List
<
FieldChangeMeta
>
allChangeColumns
)
{
// 构造新对象行转列
List
<
FieldChangeMeta
>
designInfoNew
=
convertBeanField2Column2
(
equipDesignChangeDataDto
,
record
);
List
<
FieldChangeMeta
>
factoryInfoNew
=
convertBeanField2Column2
(
equipFactoryChangeDataDto
,
record
);
List
<
FieldChangeMeta
>
registerInfoNew
=
convertBeanField2Column2
(
registerChangeDataDto
,
record
);
List
<
FieldChangeMeta
>
useInfoChangeNew
=
convertBeanField2Column2
(
useInfoChangeDataDto
,
record
);
// 老数据查询行转列
List
<
FieldChangeMeta
>
designInfoOld
=
this
.
buildDesignInfoOld
(
record
);
List
<
FieldChangeMeta
>
factoryInfoOld
=
this
.
buildFactoryInfoOld
(
record
);
List
<
FieldChangeMeta
>
registerInfoOld
=
this
.
buildRegisterInfoOld
(
record
);
List
<
FieldChangeMeta
>
useInfoOld
=
this
.
buildUseInfoOld
(
record
);
allChangeColumns
.
addAll
(
mergeChangeFields
(
designInfoNew
,
designInfoOld
));
allChangeColumns
.
addAll
(
mergeChangeFields
(
factoryInfoNew
,
factoryInfoOld
));
allChangeColumns
.
addAll
(
mergeChangeFields
(
registerInfoNew
,
registerInfoOld
));
allChangeColumns
.
addAll
(
mergeChangeFields
(
useInfoChangeNew
,
useInfoOld
));
}
/**
* 业务处理-业务对象
*
* @param record 设备主键
* @param changeDataDto 变更后数据
*/
public
void
dealBizDataForEquip
(
String
record
,
BaseChangeDataDto
changeDataDto
)
{
// 注册信息
if
(
changeDataDto
instanceof
EquipRegisterChangeDataDto
)
{
EquipRegisterChangeDataDto
registerChangeDataDto
=
(
EquipRegisterChangeDataDto
)
changeDataDto
;
equipChangeDataUpdateServiceImpl
.
updateRegisterChangeData
(
record
,
registerChangeDataDto
);
}
// 制造信息
if
(
changeDataDto
instanceof
EquipFactoryChangeDataDto
)
{
EquipFactoryChangeDataDto
equipFactoryChangeDataDto
=
(
EquipFactoryChangeDataDto
)
changeDataDto
;
equipChangeDataUpdateServiceImpl
.
updateFactoryChangeData
(
record
,
equipFactoryChangeDataDto
);
}
// 设计信息
if
(
changeDataDto
instanceof
EquipDesignChangeDataDto
)
{
EquipDesignChangeDataDto
equipDesignChangeDataDto
=
(
EquipDesignChangeDataDto
)
changeDataDto
;
equipChangeDataUpdateServiceImpl
.
updateDesignChangeData
(
record
,
equipDesignChangeDataDto
);
}
// 使用信息
if
(
changeDataDto
instanceof
EquipUseInfoChangeDataDto
)
{
EquipUseInfoChangeDataDto
equipUseInfoChangeDataDto
=
(
EquipUseInfoChangeDataDto
)
changeDataDto
;
equipChangeDataUpdateServiceImpl
.
updateUseInfoChangeData
(
record
,
equipUseInfoChangeDataDto
);
}
// 检验信息
if
(
changeDataDto
instanceof
EquipInspectChangeDataDto
)
{
EquipInspectChangeDataDto
equipUseInfoChangeDataDto
=
(
EquipInspectChangeDataDto
)
changeDataDto
;
equipChangeDataUpdateServiceImpl
.
updateOrSaveInspectInfo
(
record
,
equipUseInfoChangeDataDto
);
}
// 气瓶钢印信息
if
(
changeDataDto
instanceof
EquipOtherInfoChangeDataDto
)
{
EquipOtherInfoChangeDataDto
otherInfoChangeDataDto
=
(
EquipOtherInfoChangeDataDto
)
changeDataDto
;
equipChangeDataUpdateServiceImpl
.
updateOtherInfoChangeData
(
record
,
otherInfoChangeDataDto
);
}
}
private
String
buildTableName
(
Class
<?>
clazz
)
{
Group
group
=
clazz
.
getAnnotation
(
Group
.
class
);
return
String
.
format
(
"\"%s_%s\""
,
"idx_biz_jg"
,
group
.
value
());
}
public
static
List
<
FieldChangeMeta
>
mergeChangeFields
(
List
<
FieldChangeMeta
>
changeDataNew
,
List
<
FieldChangeMeta
>
changeDataOld
)
{
Map
<
String
,
FieldChangeMeta
>
oldKv
=
changeDataOld
.
stream
().
collect
(
Collectors
.
toMap
(
FieldChangeMeta:
:
getColumnKey
,
Function
.
identity
()));
changeDataNew
.
forEach
(
o
->
{
// 正常不会出现此情况,old数据 大于等于 new 数据的key
if
(
oldKv
.
get
(
o
.
getColumnKey
())
!=
null
)
{
o
.
setColumnOldValue
(
oldKv
.
get
(
o
.
getColumnKey
()).
getColumnOldValue
());
}
});
return
changeDataNew
.
stream
().
filter
(
n
->
!
StringUtils
.
equals
(
n
.
getColumnNewValue
(),
n
.
getColumnOldValue
())).
collect
(
Collectors
.
toList
());
}
private
static
TechParamsBoilerChangeFieldDto
getTechParamsBoilerChangeField
(
Map
<
String
,
Object
>
changeData
)
{
TechParamsBoilerChangeFieldDto
newBoiler
=
new
TechParamsBoilerChangeFieldDto
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
changeData
)),
newBoiler
,
true
);
return
newBoiler
;
}
private
TechParamsBoilerChangeFieldDto
getTechParamsBoilerChangeField
(
String
record
)
{
IdxBizJgTechParamsBoiler
boiler
=
iIdxBizJgTechParamsBoilerService
.
getOneData
(
record
);
TechParamsBoilerChangeFieldDto
oldBoiler
=
new
TechParamsBoilerChangeFieldDto
();
BeanUtil
.
copyProperties
(
boiler
,
oldBoiler
);
return
oldBoiler
;
}
BaseTechParamsFieldDto
buildTechParamInfo
(
EquipRegisterChangeDataDto
equipRegisterChangeDataDto
,
String
record
)
{
return
getBaseTechParamsFieldDto
(
record
,
equipRegisterChangeDataDto
.
getEquList
());
}
BaseTechParamsFieldDto
buildTechParamInfo
(
IdxBizJgRegisterInfo
registerInfo
,
String
record
)
{
return
getBaseTechParamsFieldDto
(
record
,
registerInfo
.
getEquList
());
}
private
BaseTechParamsFieldDto
getBaseTechParamsFieldDto
(
String
record
,
String
equList
)
{
EquipmentClassifityEnum
equipmentClassifityEnum
=
EquipmentClassifityEnum
.
getOne
(
equList
);
switch
(
Objects
.
requireNonNull
(
equipmentClassifityEnum
))
{
case
GL:
// 锅炉
IdxBizJgTechParamsBoiler
boiler
=
iIdxBizJgTechParamsBoilerService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
return
BeanUtil
.
copyProperties
(
boiler
,
TechParamsBoilerChangeFieldDto
.
class
);
case
YLRQ:
// 压力容器
IdxBizJgTechParamsVessel
techParamsVessel
=
iIdxBizJgTechParamsVesselService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
return
BeanUtil
.
copyProperties
(
techParamsVessel
,
TechParamsVesselChangeFieldDto
.
class
);
case
DT:
// 电梯
IdxBizJgTechParamsElevator
techParamsElevator
=
iIdxBizJgTechParamsElevatorService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
return
BeanUtil
.
copyProperties
(
techParamsElevator
,
TechParamsElevatorChangeFieldDto
.
class
);
case
QZJX:
// 起重机械
IdxBizJgTechParamsLifting
techParamsLifting
=
iIdxBizJgTechParamsLiftingService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
return
BeanUtil
.
copyProperties
(
techParamsLifting
,
TechParamsLiftingChangeFieldDto
.
class
);
case
CC:
// 场(厂)内专用机动车辆
IdxBizJgTechParamsVehicle
techParamsVehicle
=
iIdxBizJgTechParamsVehicleService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
return
BeanUtil
.
copyProperties
(
techParamsVehicle
,
TechParamsVehicleChangeFieldDto
.
class
);
case
YLSS:
// 大型游乐设施
IdxBizJgTechParamsRides
techParamsRides
=
iIdxBizJgTechParamsRidesService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
return
BeanUtil
.
copyProperties
(
techParamsRides
,
TechParamsRidesChangeFieldDto
.
class
);
case
YLGD:
// 压力管道
IdxBizJgTechParamsPipeline
techParamsPipeline
=
iIdxBizJgTechParamsPipelineService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
return
BeanUtil
.
copyProperties
(
techParamsPipeline
,
TechParamsPipelineChangeFieldDto
.
class
);
case
KYSD:
// 客运索道
IdxBizJgTechParamsRopeway
techParamsRopeway
=
iIdxBizJgTechParamsRopewayService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
return
BeanUtil
.
copyProperties
(
techParamsRopeway
,
TechParamsRopewayChangeFieldDto
.
class
);
default
:
break
;
}
return
null
;
}
void
updateTechParamInfo
(
EquipRegisterChangeDataDto
equipRegisterChangeDataDto
,
String
record
,
Map
<
String
,
Object
>
changeData
,
List
<
FieldChangeMeta
>
allChange
)
{
EquipmentClassifityEnum
equipmentClassifityEnum
=
EquipmentClassifityEnum
.
getOne
(
equipRegisterChangeDataDto
.
getEquList
());
switch
(
Objects
.
requireNonNull
(
equipmentClassifityEnum
))
{
case
GL:
// 锅炉
TechParamsBoilerChangeFieldDto
newBoiler
=
getTechParamsBoilerChangeField
(
changeData
);
TechParamsBoilerChangeFieldDto
oldBoiler
=
getTechParamsBoilerChangeField
(
record
);
// 字段行转列
List
<
FieldChangeMeta
>
boilerChangeDataNew
=
convertBeanField2Column2
(
newBoiler
,
record
);
List
<
FieldChangeMeta
>
boilerChangeDataOld
=
convertBeanField2Column2
(
oldBoiler
,
record
);
// 比对
List
<
FieldChangeMeta
>
boilerChangeFields
=
mergeChangeFields
(
boilerChangeDataNew
,
boilerChangeDataOld
);
// 业务处理
equipChangeDataUpdateServiceImpl
.
updateTechParamByRecord
(
this
.
buildTableName
(
TechParamsBoilerChangeFieldDto
.
class
),
record
,
boilerChangeFields
);
// 日志数据记录
allChange
.
addAll
(
boilerChangeDataNew
);
break
;
case
YLRQ:
// 压力容器
TechParamsVesselChangeFieldDto
newVessel
=
new
TechParamsVesselChangeFieldDto
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
changeData
)),
newVessel
,
true
);
IdxBizJgTechParamsVessel
techParamsVessel
=
iIdxBizJgTechParamsVesselService
.
getOneData
(
record
);
TechParamsVesselChangeFieldDto
oldVessel
=
BeanUtil
.
copyProperties
(
techParamsVessel
,
TechParamsVesselChangeFieldDto
.
class
);
// 字段行转列
List
<
FieldChangeMeta
>
newVesselChangeData
=
convertBeanField2Column2
(
newVessel
,
record
);
List
<
FieldChangeMeta
>
oldVesselChangeData
=
convertBeanField2Column2
(
oldVessel
,
record
);
// 比对
List
<
FieldChangeMeta
>
vesselChangeFields
=
mergeChangeFields
(
newVesselChangeData
,
oldVesselChangeData
);
// 业务处理
equipChangeDataUpdateServiceImpl
.
updateTechParamByRecord
(
this
.
buildTableName
(
TechParamsVesselChangeFieldDto
.
class
),
record
,
vesselChangeFields
);
// 日志数据记录
allChange
.
addAll
(
vesselChangeFields
);
break
;
case
DT:
// 电梯
TechParamsElevatorChangeFieldDto
newElevator
=
new
TechParamsElevatorChangeFieldDto
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
changeData
)),
newElevator
,
true
);
IdxBizJgTechParamsElevator
techParamsElevator
=
iIdxBizJgTechParamsElevatorService
.
getOneData
(
record
);
TechParamsElevatorChangeFieldDto
oldElevator
=
BeanUtil
.
copyProperties
(
techParamsElevator
,
TechParamsElevatorChangeFieldDto
.
class
);
// 字段行转列
List
<
FieldChangeMeta
>
newElevatorChangeData
=
convertBeanField2Column2
(
newElevator
,
record
);
List
<
FieldChangeMeta
>
oldElevatorChangeData
=
convertBeanField2Column2
(
oldElevator
,
record
);
// 比对
List
<
FieldChangeMeta
>
elevatorChangeFields
=
mergeChangeFields
(
newElevatorChangeData
,
oldElevatorChangeData
);
// 业务处理
equipChangeDataUpdateServiceImpl
.
updateTechParamByRecord
(
this
.
buildTableName
(
TechParamsElevatorChangeFieldDto
.
class
),
record
,
elevatorChangeFields
);
// 日志数据记录
allChange
.
addAll
(
elevatorChangeFields
);
break
;
case
QZJX:
// 起重机械
TechParamsLiftingChangeFieldDto
newLifting
=
new
TechParamsLiftingChangeFieldDto
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
changeData
)),
newLifting
,
true
);
IdxBizJgTechParamsLifting
techParamsLifting
=
iIdxBizJgTechParamsLiftingService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
TechParamsLiftingChangeFieldDto
oldLifting
=
BeanUtil
.
copyProperties
(
techParamsLifting
,
TechParamsLiftingChangeFieldDto
.
class
);
// 字段行转列
List
<
FieldChangeMeta
>
newLiftingChangeData
=
convertBeanField2Column2
(
newLifting
,
record
);
List
<
FieldChangeMeta
>
oldLiftingChangeData
=
convertBeanField2Column2
(
oldLifting
,
record
);
// 比对
List
<
FieldChangeMeta
>
liftingChangeFields
=
mergeChangeFields
(
newLiftingChangeData
,
oldLiftingChangeData
);
// 业务处理
equipChangeDataUpdateServiceImpl
.
updateTechParamByRecord
(
this
.
buildTableName
(
TechParamsLiftingChangeFieldDto
.
class
),
record
,
liftingChangeFields
);
// 日志数据记录
allChange
.
addAll
(
liftingChangeFields
);
break
;
case
CC:
// 场(厂)内专用机动车辆
TechParamsVehicleChangeFieldDto
newVehicle
=
new
TechParamsVehicleChangeFieldDto
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
changeData
)),
newVehicle
,
true
);
IdxBizJgTechParamsVehicle
techParamsVehicle
=
iIdxBizJgTechParamsVehicleService
.
getOneData
(
record
);
TechParamsVehicleChangeFieldDto
oldVehicle
=
BeanUtil
.
copyProperties
(
techParamsVehicle
,
TechParamsVehicleChangeFieldDto
.
class
);
// 字段行转列
List
<
FieldChangeMeta
>
newVehicleChangeData
=
convertBeanField2Column2
(
newVehicle
,
record
);
List
<
FieldChangeMeta
>
oldVehicleChangeData
=
convertBeanField2Column2
(
oldVehicle
,
record
);
// 比对
List
<
FieldChangeMeta
>
vehicleChangeFields
=
mergeChangeFields
(
newVehicleChangeData
,
oldVehicleChangeData
);
// 业务处理
equipChangeDataUpdateServiceImpl
.
updateTechParamByRecord
(
this
.
buildTableName
(
TechParamsVehicleChangeFieldDto
.
class
),
record
,
vehicleChangeFields
);
// 日志数据记录
allChange
.
addAll
(
vehicleChangeFields
);
break
;
case
YLSS:
// 大型游乐设施
TechParamsRidesChangeFieldDto
newRides
=
new
TechParamsRidesChangeFieldDto
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
changeData
)),
newRides
,
true
);
IdxBizJgTechParamsRides
techParamsRides
=
iIdxBizJgTechParamsRidesService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
TechParamsRidesChangeFieldDto
oldRides
=
BeanUtil
.
copyProperties
(
techParamsRides
,
TechParamsRidesChangeFieldDto
.
class
);
// 字段行转列
List
<
FieldChangeMeta
>
newRidesChangeData
=
convertBeanField2Column2
(
newRides
,
record
);
List
<
FieldChangeMeta
>
oldRidesChangeData
=
convertBeanField2Column2
(
oldRides
,
record
);
// 比对
List
<
FieldChangeMeta
>
ridesChangeFields
=
mergeChangeFields
(
newRidesChangeData
,
oldRidesChangeData
);
// 业务处理
equipChangeDataUpdateServiceImpl
.
updateTechParamByRecord
(
this
.
buildTableName
(
TechParamsRidesChangeFieldDto
.
class
),
record
,
ridesChangeFields
);
// 日志数据记录
allChange
.
addAll
(
ridesChangeFields
);
break
;
case
YLGD:
// 压力管道
TechParamsPipelineChangeFieldDto
newPipeline
=
new
TechParamsPipelineChangeFieldDto
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
changeData
)),
newPipeline
,
true
);
savePieLineTechParam
(
record
,
allChange
,
newPipeline
);
break
;
case
KYSD:
// 客运索道
TechParamsRopewayChangeFieldDto
newRopeway
=
new
TechParamsRopewayChangeFieldDto
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
changeData
)),
newRopeway
,
true
);
IdxBizJgTechParamsRopeway
techParamsRopeway
=
iIdxBizJgTechParamsRopewayService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
TechParamsRopewayChangeFieldDto
oldRopeway
=
BeanUtil
.
copyProperties
(
techParamsRopeway
,
TechParamsRopewayChangeFieldDto
.
class
);
// 字段行转列
List
<
FieldChangeMeta
>
newRopewayChangeData
=
convertBeanField2Column2
(
newRopeway
,
record
);
List
<
FieldChangeMeta
>
oldRopewayChangeData
=
convertBeanField2Column2
(
oldRopeway
,
record
);
// 比对
List
<
FieldChangeMeta
>
ropewayChangeFields
=
mergeChangeFields
(
newRopewayChangeData
,
oldRopewayChangeData
);
// 业务处理
equipChangeDataUpdateServiceImpl
.
updateTechParamByRecord
(
this
.
buildTableName
(
TechParamsRopewayChangeFieldDto
.
class
),
record
,
ropewayChangeFields
);
// 日志数据记录
allChange
.
addAll
(
ropewayChangeFields
);
break
;
default
:
break
;
}
}
public
void
savePieLineTechParam
(
String
record
,
List
<
FieldChangeMeta
>
allChange
,
TechParamsPipelineChangeFieldDto
newPipeline
)
{
IdxBizJgTechParamsPipeline
techParamsPipeline
=
iIdxBizJgTechParamsPipelineService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
TechParamsPipelineChangeFieldDto
oldPipeline
=
BeanUtil
.
copyProperties
(
techParamsPipeline
,
TechParamsPipelineChangeFieldDto
.
class
);
// 字段行转列
List
<
FieldChangeMeta
>
newPipelineChangeData
=
convertBeanField2Column2
(
newPipeline
,
record
);
List
<
FieldChangeMeta
>
oldPipelineChangeData
=
convertBeanField2Column2
(
oldPipeline
,
record
);
// 比对
List
<
FieldChangeMeta
>
pipelineChangeFields
=
mergeChangeFields
(
newPipelineChangeData
,
oldPipelineChangeData
);
// 业务处理
equipChangeDataUpdateServiceImpl
.
updateTechParamByRecord
(
this
.
buildTableName
(
TechParamsPipelineChangeFieldDto
.
class
),
record
,
pipelineChangeFields
);
// 日志数据记录
allChange
.
addAll
(
pipelineChangeFields
);
}
public
static
List
<
FieldChangeMeta
>
convertBeanField2Column2
(
Object
beanData
,
String
changeId
)
{
List
<
FieldChangeMeta
>
changeData
=
new
ArrayList
<>();
Group
group
=
beanData
.
getClass
().
getAnnotation
(
Group
.
class
);
Field
[]
fields
=
beanData
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
field
.
setAccessible
(
true
);
FieldDisplayDefine
displayDefine
=
field
.
getAnnotation
(
FieldDisplayDefine
.
class
);
try
{
if
(
displayDefine
!=
null
&&
displayDefine
.
isExist
())
{
String
fieldName
=
displayDefine
.
value
();
FieldChangeMeta
fieldChangeMeta
=
new
FieldChangeMeta
();
fieldChangeMeta
.
setColumnKey
(
field
.
getName
());
fieldChangeMeta
.
setColumnFamily
(
group
.
value
());
fieldChangeMeta
.
setColumnLabel
(
fieldName
);
fieldChangeMeta
.
setChangeId
(
changeId
);
Object
oV
=
field
.
get
(
beanData
);
if
(
oV
instanceof
String
)
{
String
value
=
(
String
)
field
.
get
(
beanData
);
fieldChangeMeta
.
setColumnNewValue
(
value
);
fieldChangeMeta
.
setColumnOldValue
(
value
);
}
else
if
(
oV
instanceof
Number
)
{
String
value
=
String
.
valueOf
(
field
.
get
(
beanData
));
fieldChangeMeta
.
setColumnNewValue
(
value
);
fieldChangeMeta
.
setColumnOldValue
(
value
);
}
else
if
(
oV
instanceof
Date
)
{
String
value
=
DateUtil
.
format
((
Date
)
oV
,
displayDefine
.
format
());
fieldChangeMeta
.
setColumnNewValue
(
value
);
fieldChangeMeta
.
setColumnOldValue
(
value
);
}
changeData
.
add
(
fieldChangeMeta
);
}
}
catch
(
IllegalAccessException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
return
changeData
;
}
public
List
<
FieldChangeMeta
>
buildDesignInfoNew
(
Object
changeDataDto
,
String
record
)
{
return
convertBeanField2Column2
(
changeDataDto
,
record
);
}
private
List
<
FieldChangeMeta
>
buildFactoryInfoNew
(
EquipFactoryChangeDataDto
changeDataDto
,
String
record
)
{
return
convertBeanField2Column2
(
changeDataDto
,
record
);
}
private
List
<
FieldChangeMeta
>
buildRegisterInfoNew
(
EquipRegisterChangeDataDto
changeDataDto
,
String
record
)
{
return
convertBeanField2Column2
(
changeDataDto
,
record
);
}
public
List
<
FieldChangeMeta
>
buildDesignInfoOld
(
String
record
)
{
EquipDesignChangeDataDto
changeDataDto
=
new
EquipDesignChangeDataDto
();
IdxBizJgDesignInfo
designInfo
=
idxBizJgDesignInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgDesignInfo
>().
eq
(
IdxBizJgDesignInfo:
:
getRecord
,
record
));
BeanUtil
.
copyProperties
(
designInfo
,
changeDataDto
);
changeDataDto
.
setDesignDate
(
designInfo
.
getDesignDate
());
return
convertBeanField2Column2
(
changeDataDto
,
record
);
}
private
List
<
FieldChangeMeta
>
buildFactoryInfoOld
(
String
record
)
{
EquipFactoryChangeDataDto
changeDataDto
=
new
EquipFactoryChangeDataDto
();
IdxBizJgFactoryInfo
factoryInfo
=
jgFactoryInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgFactoryInfo
>().
eq
(
IdxBizJgFactoryInfo:
:
getRecord
,
record
));
BeanUtil
.
copyProperties
(
factoryInfo
,
changeDataDto
);
changeDataDto
.
setProduceDate
(
DateUtil
.
formatDate
(
factoryInfo
.
getProduceDate
()));
return
convertBeanField2Column2
(
changeDataDto
,
record
);
}
private
List
<
FieldChangeMeta
>
buildRegisterInfoOld
(
String
record
)
{
EquipRegisterChangeDataDto
changeDataDto
=
new
EquipRegisterChangeDataDto
();
IdxBizJgRegisterInfo
registerInfo
=
idxBizJgRegisterInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgRegisterInfo
>().
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
record
));
BeanUtil
.
copyProperties
(
registerInfo
,
changeDataDto
);
return
convertBeanField2Column2
(
changeDataDto
,
record
);
}
private
List
<
FieldChangeMeta
>
buildUseInfoOld
(
String
record
)
{
EquipUseInfoChangeDataDto
changeDataDto
=
new
EquipUseInfoChangeDataDto
();
IdxBizJgUseInfo
useInfo
=
idxBizJgUseInfoService
.
getOneData
(
record
);
BeanUtil
.
copyProperties
(
useInfo
,
changeDataDto
);
return
convertBeanField2Column2
(
changeDataDto
,
record
);
}
public
Map
<
String
,
Object
>
cast2UnderCase
(
Map
<
String
,
Object
>
re
)
{
// 由于历史遗留问题,和前端保存统一,要转成大写下滑线驼峰
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
re
.
forEach
((
k
,
v
)
->
{
result
.
put
(
CharSequenceUtil
.
toUnderlineCase
(
k
).
toUpperCase
(),
v
);
});
return
result
;
}
public
void
castJsonFields
(
Map
<
String
,
Object
>
re
)
{
jsonFields
.
forEach
(
field
->
{
if
(
re
.
containsKey
(
field
)
&&
re
.
get
(
field
)
instanceof
String
)
{
re
.
put
(
field
,
JSON
.
parse
((
String
)
re
.
get
(
field
)));
}
});
}
public
EquipDesignChangeDataDto
buildDesignInfo
(
String
record
)
{
EquipDesignChangeDataDto
changeDataDto
=
new
EquipDesignChangeDataDto
();
IdxBizJgDesignInfo
designInfo
=
idxBizJgDesignInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgDesignInfo
>().
eq
(
IdxBizJgDesignInfo:
:
getRecord
,
record
));
BeanUtil
.
copyProperties
(
designInfo
,
changeDataDto
);
changeDataDto
.
setDesignDate
(
designInfo
.
getDesignDate
());
return
changeDataDto
;
}
public
EquipFactoryChangeDataDto
buildFactoryInfo
(
String
record
)
{
EquipFactoryChangeDataDto
changeDataDto
=
new
EquipFactoryChangeDataDto
();
IdxBizJgFactoryInfo
factoryInfo
=
jgFactoryInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgFactoryInfo
>().
eq
(
IdxBizJgFactoryInfo:
:
getRecord
,
record
));
BeanUtil
.
copyProperties
(
factoryInfo
,
changeDataDto
);
changeDataDto
.
setProduceDate
(
DateUtil
.
formatDate
(
factoryInfo
.
getProduceDate
()));
return
changeDataDto
;
}
public
EquipRegisterChangeDataDto
buildRegisterInfo
(
String
record
)
{
EquipRegisterChangeDataDto
changeDataDto
=
new
EquipRegisterChangeDataDto
();
IdxBizJgRegisterInfo
registerInfo
=
idxBizJgRegisterInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgRegisterInfo
>().
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
record
));
BeanUtil
.
copyProperties
(
registerInfo
,
changeDataDto
);
return
changeDataDto
;
}
public
EquipUseInfoChangeDataDto
buildUseInfo
(
String
record
)
{
EquipUseInfoChangeDataDto
changeDataDto
=
new
EquipUseInfoChangeDataDto
();
IdxBizJgUseInfo
useInfo
=
idxBizJgUseInfoService
.
getOneData
(
record
);
BeanUtil
.
copyProperties
(
useInfo
,
changeDataDto
);
return
changeDataDto
;
}
private
List
<
FieldChangeMeta
>
buildOtherInfoOld
(
String
record
)
{
EquipOtherInfoChangeDataDto
changeDataDto
=
new
EquipOtherInfoChangeDataDto
();
IdxBizJgOtherInfo
otherInfo
=
idxBizJgOtherInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgOtherInfo
>().
eq
(
IdxBizJgOtherInfo:
:
getRecord
,
record
));
BeanUtil
.
copyProperties
(
otherInfo
,
changeDataDto
);
return
convertBeanField2Column2
(
changeDataDto
,
record
);
}
/**
* 简化版字段对比更新工具
* 要求:对象字段名与数据库列名一致(驼峰转下划线自动处理)
*
* @param mapper MyBatis-Plus 的 Mapper 实例(直接传入)
* @param oldObj 旧对象(必须有id字段)
* @param newObj 新对象(必须与旧对象同一类型)
*/
public
<
T
>
List
<
FieldChangeMeta
>
simpleTrackAndUpdate
(
BaseMapper
<
T
>
mapper
,
T
oldObj
,
T
newObj
,
String
changeId
,
String
whereKey
,
String
whereValue
)
{
List
<
FieldChangeMeta
>
changeData
=
new
ArrayList
<>();
// 基础校验
if
(
oldObj
==
null
||
newObj
==
null
)
{
throw
new
IllegalArgumentException
(
"新旧对象不能为空"
);
}
if
(!
oldObj
.
getClass
().
equals
(
newObj
.
getClass
()))
{
throw
new
IllegalArgumentException
(
"对象类型不一致"
);
}
Group
group
=
newObj
.
getClass
().
getAnnotation
(
Group
.
class
);
Class
<?>
clazz
=
oldObj
.
getClass
();
UpdateWrapper
<
T
>
wrapper
=
new
UpdateWrapper
<>();
// 遍历所有字段(包含父类)
for
(
Field
field
:
getAllFields
(
clazz
))
{
try
{
field
.
setAccessible
(
true
);
Object
oldVal
=
field
.
get
(
oldObj
);
Object
newVal
=
field
.
get
(
newObj
);
FieldDisplayDefine
displayDefine
=
field
.
getAnnotation
(
FieldDisplayDefine
.
class
);
TableField
tableField
=
field
.
getAnnotation
(
TableField
.
class
);
// 对比逻辑
if
(!
Objects
.
equals
(
oldVal
,
newVal
))
{
if
(
displayDefine
!=
null
&&
displayDefine
.
isExist
())
{
String
columnName
=
tableField
.
value
();
wrapper
.
set
(
columnName
,
newVal
);
String
fieldName
=
displayDefine
.
value
();
FieldChangeMeta
fieldChangeMeta
=
new
FieldChangeMeta
();
fieldChangeMeta
.
setColumnKey
(
field
.
getName
());
fieldChangeMeta
.
setColumnFamily
(
group
.
value
());
fieldChangeMeta
.
setColumnLabel
(
fieldName
);
fieldChangeMeta
.
setChangeId
(
changeId
);
if
(
newVal
instanceof
String
)
{
fieldChangeMeta
.
setColumnOldValue
((
String
)
oldVal
);
fieldChangeMeta
.
setColumnNewValue
((
String
)
newVal
);
}
else
if
(
newVal
instanceof
Number
)
{
fieldChangeMeta
.
setColumnOldValue
(
String
.
valueOf
(
oldVal
));
fieldChangeMeta
.
setColumnNewValue
(
String
.
valueOf
(
newVal
));
}
else
if
(
newVal
instanceof
Date
)
{
fieldChangeMeta
.
setColumnOldValue
(
DateUtil
.
formatDate
((
Date
)
oldVal
));
fieldChangeMeta
.
setColumnNewValue
(
DateUtil
.
formatDate
((
Date
)
newVal
));
}
else
if
(
newVal
instanceof
Boolean
)
{
fieldChangeMeta
.
setColumnOldValue
(
Boolean
.
toString
((
Boolean
)
oldVal
));
fieldChangeMeta
.
setColumnNewValue
(
Boolean
.
toString
((
Boolean
)
newVal
));
}
changeData
.
add
(
fieldChangeMeta
);
}
}
}
catch
(
IllegalAccessException
e
)
{
System
.
err
.
println
(
"字段访问失败: "
+
field
.
getName
());
}
}
// 执行更新
if
(!
changeData
.
isEmpty
())
{
wrapper
.
eq
(
whereKey
,
whereValue
);
mapper
.
update
(
null
,
wrapper
);
}
return
changeData
;
}
public
Map
<
String
,
?>
getEquipDetailByRecord
(
String
record
)
{
Map
<
String
,
Object
>
re
=
new
HashMap
<>();
IdxBizJgRegisterInfo
registerInfo
=
jgUseRegistrationService
.
getIdxBizJgRegisterInfoService
().
getOne
(
new
LambdaQueryWrapper
<
IdxBizJgRegisterInfo
>().
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
record
));
IdxBizJgFactoryInfo
factoryInfo
=
jgFactoryInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgFactoryInfo
>().
eq
(
IdxBizJgFactoryInfo:
:
getRecord
,
record
));
IdxBizJgUseInfo
useInfo
=
jgUseRegistrationService
.
getUseInfoMapper
().
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgUseInfo
>().
eq
(
IdxBizJgUseInfo:
:
getRecord
,
record
));
IdxBizJgDesignInfo
designInfo
=
idxBizJgDesignInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgDesignInfo
>().
eq
(
IdxBizJgDesignInfo:
:
getRecord
,
record
));
IdxBizJgOtherInfo
otherInfo
=
idxBizJgOtherInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgOtherInfo
>().
eq
(
IdxBizJgOtherInfo:
:
getRecord
,
record
));
IdxBizJgSupervisionInfo
idxBizJgSupervisionInfo
=
jgUseRegistrationService
.
getIdxBizJgSupervisionInfoMapper
().
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgSupervisionInfo
>().
eq
(
IdxBizJgSupervisionInfo:
:
getRecord
,
record
));
IdxBizJgInspectionDetectionInfo
inspectionDetectionInfo
=
jgUseRegistrationService
.
getInspectionDetectionInfoService
().
queryNewestDetailByRecord
(
record
);
IdxBizJgMaintenanceRecordInfo
idxBizJgMaintenanceRecordInfo
=
jgUseRegistrationService
.
getIdxBizJgMaintenanceRecordInfoService
().
queryNewestDetailByRecord
(
record
);
IdxBizJgConstructionInfo
constructionInfo
=
jgUseRegistrationService
.
getIdxBizJgConstructionInfoService
().
queryNewestDetailByRecord
(
record
);
BaseTechParamsFieldDto
techParamsFieldDto
=
this
.
buildTechParamInfo
(
registerInfo
,
record
);
re
.
putAll
(
BeanUtil
.
beanToMap
(
useInfo
));
re
.
putAll
(
BeanUtil
.
beanToMap
(
registerInfo
));
re
.
putAll
(
BeanUtil
.
beanToMap
(
factoryInfo
));
re
.
putAll
(
BeanUtil
.
beanToMap
(
otherInfo
));
re
.
putAll
(
BeanUtil
.
beanToMap
(
designInfo
));
re
.
putAll
(
BeanUtil
.
beanToMap
(
idxBizJgSupervisionInfo
));
re
.
putAll
(
BeanUtil
.
beanToMap
(
inspectionDetectionInfo
));
re
.
putAll
(
BeanUtil
.
beanToMap
(
idxBizJgMaintenanceRecordInfo
));
re
.
putAll
(
BeanUtil
.
beanToMap
(
constructionInfo
));
re
.
putAll
(
BeanUtil
.
beanToMap
(
techParamsFieldDto
));
// 转json
this
.
castJsonFields
(
re
);
// 转下滑线大写下划线
this
.
cast2UnderCase
(
re
);
// 流水主键赋值 用于后续的更新
re
.
put
(
"jySeq"
,
inspectionDetectionInfo
!=
null
?
inspectionDetectionInfo
.
getSequenceNbr
()
:
null
);
re
.
put
(
"maintenanceSeq"
,
idxBizJgMaintenanceRecordInfo
!=
null
?
idxBizJgMaintenanceRecordInfo
.
getSequenceNbr
()
:
null
);
re
.
put
(
"constructionInfoSeq"
,
constructionInfo
!=
null
?
constructionInfo
.
getSequenceNbr
()
:
null
);
return
re
;
}
public
IPage
<?>
getEquListByRecords
(
Set
<
String
>
eqs
,
JSONObject
map
)
{
if
(
map
.
containsKey
(
"flag"
)
&&
!
map
.
containsKey
(
"USE_UNIT_CREDIT_CODE"
))
{
return
new
Page
<>();
}
int
pageNumber
=
ObjectUtils
.
isEmpty
(
map
.
getInteger
(
"number"
))
?
1
:
map
.
getInteger
(
"number"
);
int
size
=
ObjectUtils
.
isEmpty
(
map
.
getInteger
(
"size"
))
?
20
:
map
.
getInteger
(
"size"
);
Page
<
JSONObject
>
result
=
new
Page
<>(
pageNumber
,
size
);
SearchRequest
request
=
new
SearchRequest
();
request
.
indices
(
"idx_biz_view_jg_all"
);
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
trackTotalHits
(
true
);
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
seqBuilder
=
QueryBuilders
.
boolQuery
();
seqBuilder
.
must
(
QueryBuilders
.
termsQuery
(
"SEQUENCE_NBR.keyword"
,
eqs
));
boolMust
.
must
(
seqBuilder
);
// 设备代码模糊查询
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
EQU_CODE
)))
{
BoolQueryBuilder
pBuilder
=
QueryBuilders
.
boolQuery
();
String
test
=
QueryParser
.
escape
(
map
.
getString
(
EQU_CODE
));
pBuilder
.
must
(
QueryBuilders
.
wildcardQuery
(
EQU_CODE
,
"*"
+
QueryParser
.
escape
(
test
.
toLowerCase
())
+
"*"
));
boolMust
.
must
(
pBuilder
);
}
// 单位内部编号模糊查询
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"USE_INNER_CODE"
)))
{
BoolQueryBuilder
pBuilder
=
QueryBuilders
.
boolQuery
();
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"USE_INNER_CODE"
));
pBuilder
.
must
(
QueryBuilders
.
wildcardQuery
(
"USE_INNER_CODE"
,
"*"
+
QueryParser
.
escape
(
test
.
toLowerCase
())
+
"*"
));
boolMust
.
must
(
pBuilder
);
}
// 出厂编号/产品编码模糊查询
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
FACTORY_NUM
)))
{
BoolQueryBuilder
pBuilder
=
QueryBuilders
.
boolQuery
();
String
test
=
QueryParser
.
escape
(
map
.
getString
(
FACTORY_NUM
));
pBuilder
.
must
(
QueryBuilders
.
wildcardQuery
(
FACTORY_NUM
,
"*"
+
QueryParser
.
escape
(
test
.
toLowerCase
())
+
"*"
));
boolMust
.
must
(
pBuilder
);
}
builder
.
query
(
boolMust
);
builder
.
sort
(
"REC_DATE"
,
SortOrder
.
DESC
);
builder
.
from
((
pageNumber
-
1
)
*
size
);
builder
.
size
(
size
);
request
.
source
(
builder
);
List
<
JSONObject
>
list
=
new
LinkedList
<>();
long
totle
=
0
;
if
(
log
.
isDebugEnabled
())
{
log
.
debug
(
"查询es 的查询条件: {}"
,
request
);
}
try
{
SearchResponse
response
=
restHighLevelClient
.
search
(
request
,
RequestOptions
.
DEFAULT
);
for
(
SearchHit
hit
:
response
.
getHits
().
getHits
())
{
System
.
out
.
println
(
hit
);
JSONObject
jsonObject
=
(
JSONObject
)
JSONObject
.
toJSON
(
hit
);
JSONObject
dto2
=
jsonObject
.
getJSONObject
(
"sourceAsMap"
);
if
(!
ValidationUtil
.
isEmpty
(
dto2
.
get
(
EQUSTATE
)))
{
Integer
integer
=
Integer
.
valueOf
(
dto2
.
get
(
EQUSTATE
).
toString
());
String
status
=
EquimentEnum
.
getName
.
get
(
integer
);
dto2
.
put
(
EQUSTATE
,
status
);
}
if
(!
ValidationUtil
.
isEmpty
(
dto2
.
get
(
DATA_SOURCE
)))
{
String
s
=
dto2
.
get
(
DATA_SOURCE
).
toString
();
dto2
.
put
(
DATA_SOURCE
,
s
);
dto2
.
put
(
DATA_SOURCE_NAME
,
EquipSourceEnum
.
getDataSourceName
(
s
));
}
dto2
.
put
(
"record"
,
dto2
.
get
(
SEQUENCE_NBR
));
list
.
add
(
dto2
);
}
// 获取所有设备的Id
List
<
String
>
equIds
=
null
;
if
(!
ValidationUtil
.
isEmpty
(
list
))
{
equIds
=
list
.
stream
().
map
(
item
->
item
.
get
(
SEQUENCE_NBR
).
toString
()).
collect
(
Collectors
.
toList
());
}
if
(!
ValidationUtil
.
isEmpty
(
equIds
))
{
// 查询设备地址
List
<
IdxBizJgUseInfo
>
useInfoListByEquIds
=
idxBizJgUseInfoService
.
getUseInfoListByEquIds
(
equIds
);
Map
<
String
,
String
>
equAddressMap
=
new
HashMap
<>();
if
(!
ValidationUtil
.
isEmpty
(
useInfoListByEquIds
))
{
equAddressMap
=
useInfoListByEquIds
.
stream
().
collect
(
Collectors
.
toMap
(
IdxBizJgUseInfo:
:
getRecord
,
useInfo
->
{
String
fulladdress
=
""
;
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getProvinceName
()))
{
fulladdress
+=
useInfo
.
getProvinceName
();
}
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getCityName
()))
{
fulladdress
+=
useInfo
.
getCityName
();
}
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getCountyName
()))
{
fulladdress
+=
useInfo
.
getCountyName
();
}
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getStreetName
()))
{
fulladdress
+=
useInfo
.
getStreetName
();
}
if
(!
ValidationUtil
.
isEmpty
(
useInfo
.
getAddress
()))
{
fulladdress
+=
useInfo
.
getAddress
();
}
return
fulladdress
;
}
)
);
}
// 更新设备使用情况和设备地址
for
(
JSONObject
item
:
list
)
{
String
fullAddress
=
equAddressMap
.
get
(
item
.
getString
(
SEQUENCE_NBR
));
item
.
put
(
"ADDRESS"
,
!
ValidationUtil
.
isEmpty
(
fullAddress
)
?
fullAddress
:
""
);
}
}
totle
=
Objects
.
requireNonNull
(
response
.
getInternalResponse
().
hits
().
getTotalHits
()).
value
;
result
.
setRecords
(
list
);
result
.
setTotal
(
totle
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
result
;
}
public
Map
<
String
,
?>
getProjectContraptionBySeq
(
String
projectContraptionId
,
Set
<
String
>
records
)
{
JSONObject
jsonObject
=
new
JSONObject
();
IdxBizJgProjectContraption
projectContraption
=
idxBizJgProjectContraptionServiceImpl
.
getById
(
projectContraptionId
);
jsonObject
.
put
(
"pipelineLength"
,
projectContraption
.
getPipelineLength
());
jsonObject
.
put
(
"projectContraption"
,
projectContraption
.
getProjectContraption
());
jsonObject
.
put
(
"projectContraptionNo"
,
projectContraption
.
getProjectContraptionNo
());
List
<
Map
<
String
,
Object
>>
equList
=
jgUseRegistrationService
.
getBaseMapper
().
queryForUnitPipelineEquipment
(
new
ArrayList
<>(
records
));
// 检验报告数据格式化 转json
equList
.
stream
().
filter
(
e
->
e
.
get
(
"inspectReport"
)
!=
null
).
forEach
(
item
->
item
.
put
(
"inspectReport"
,
JSON
.
parse
(
item
.
get
(
"inspectReport"
).
toString
())));
jsonObject
.
put
(
"tableData"
,
equList
);
return
jsonObject
;
}
public
IPage
<?>
getProjectContraptionsBySeqs
(
Set
<
String
>
projectContraptionIds
,
JSONObject
params
)
{
Page
<
IdxBizJgProjectContraption
>
page
=
new
Page
<>();
page
.
setCurrent
(
params
.
getLong
(
"current"
));
page
.
setSize
(
params
.
getLong
(
"size"
));
// 工程装置名称
String
projectContraption
=
params
.
getString
(
PROJECT_CONTRAPTION
);
// 工程装置编号
String
projectContraptionNo
=
params
.
getString
(
PROJECT_CONTRAPTION_NO
);
IPage
<
IdxBizJgProjectContraption
>
pageList
=
idxBizJgProjectContraptionServiceImpl
.
lambdaQuery
()
.
like
(!
ValidationUtil
.
isEmpty
(
projectContraption
),
IdxBizJgProjectContraption:
:
getProjectContraption
,
projectContraption
)
.
like
(!
ValidationUtil
.
isEmpty
(
projectContraptionNo
),
IdxBizJgProjectContraption:
:
getProjectContraptionNo
,
projectContraptionNo
)
.
isNull
(
IdxBizJgProjectContraption:
:
getProjectContraptionParentId
)
.
in
(
BaseEntity:
:
getSequenceNbr
,
projectContraptionIds
)
.
orderByDesc
(
IdxBizJgProjectContraption:
:
getRecDate
)
.
page
(
page
);
if
(!
ValidationUtil
.
isEmpty
(
pageList
.
getRecords
()))
{
pageList
.
getRecords
().
forEach
(
record
->
{
BigDecimal
pipelineLength
=
BigDecimal
.
valueOf
(
record
.
getPipelineLength
());
BigDecimal
roundedValue
=
pipelineLength
.
setScale
(
3
,
RoundingMode
.
HALF_UP
);
BigDecimal
strippedValue
=
roundedValue
.
stripTrailingZeros
();
record
.
setPipelineLength
(
Double
.
valueOf
(
strippedValue
.
toPlainString
()));
record
.
setDataSourceName
(
EquipSourceEnum
.
getDataSourceName
(
record
.
getDataSource
()));
record
.
setFullAddress
(
Stream
.
of
(
record
.
getProvinceName
(),
record
.
getCityName
(),
record
.
getCountyName
(),
record
.
getStreetName
(),
record
.
getAddress
())
.
map
(
value
->
value
==
null
?
""
:
value
)
.
collect
(
Collectors
.
joining
())
);
});
}
return
pageList
;
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/process/equip/EquipChangeDataUpdateServiceImpl.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
process
.
equip
;
import
cn.hutool.core.date.DatePattern
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil
;
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.jg.api.dto.*
;
import
com.yeejoin.amos.boot.module.jg.api.enums.CylinderTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.*
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquCodeTypeEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.*
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
@Service
@RequiredArgsConstructor
public
class
EquipChangeDataUpdateServiceImpl
{
private
final
ESEquipmentCategory
esEquipmentCategory
;
private
final
IdxBizJgDesignInfoMapper
idxBizJgDesignInfoMapper
;
private
final
IdxBizJgFactoryInfoMapper
jgFactoryInfoMapper
;
private
final
IdxBizJgRegisterInfoMapper
idxBizJgRegisterInfoMapper
;
private
final
IdxBizJgOtherInfoMapper
idxBizJgOtherInfoMapper
;
private
final
CommonMapper
commonMapper
;
private
final
EquipmentCategoryMapper
equipmentCategoryMapper
;
private
final
IdxBizJgUseInfoServiceImpl
idxBizJgUseInfoService
;
private
final
InspectionDetectionInfoMapper
inspectionDetectionInfoMapper
;
private
final
SnowflakeIdUtil
sequence
;
public
void
updateRegisterChangeData
(
String
record
,
EquipRegisterChangeDataDto
registerChangeDataDto
)
{
LambdaUpdateWrapper
<
IdxBizJgRegisterInfo
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
record
);
updateWrapper
.
set
(
IdxBizJgRegisterInfo:
:
getEquCode
,
registerChangeDataDto
.
getEquCode
());
updateWrapper
.
set
(
IdxBizJgRegisterInfo:
:
getEquCategory
,
registerChangeDataDto
.
getEquCategory
());
updateWrapper
.
set
(
IdxBizJgRegisterInfo:
:
getEquDefine
,
registerChangeDataDto
.
getEquDefine
());
updateWrapper
.
set
(
IdxBizJgRegisterInfo:
:
getProductName
,
registerChangeDataDto
.
getProductName
());
updateWrapper
.
set
(
IdxBizJgRegisterInfo:
:
getEquType
,
registerChangeDataDto
.
getEquType
());
updateWrapper
.
set
(
IdxBizJgRegisterInfo:
:
getEquPrice
,
registerChangeDataDto
.
getEquPrice
());
updateWrapper
.
set
(
IdxBizJgRegisterInfo:
:
getProductPhoto
,
registerChangeDataDto
.
getProductPhoto
());
updateWrapper
.
set
(
IdxBizJgRegisterInfo:
:
getOtherAccessoriesReg
,
registerChangeDataDto
.
getOtherAccessoriesReg
());
updateWrapper
.
set
(
IdxBizJgRegisterInfo:
:
getInstallationIsComplete
,
registerChangeDataDto
.
getInstallationIsComplete
());
idxBizJgRegisterInfoMapper
.
update
(
null
,
updateWrapper
);
updateRegisterEsData
(
record
,
registerChangeDataDto
);
}
public
void
updateDesignChangeData
(
String
record
,
EquipDesignChangeDataDto
equipDesignChangeDataDto
)
{
LambdaUpdateWrapper
<
IdxBizJgDesignInfo
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
IdxBizJgDesignInfo:
:
getRecord
,
record
);
updateWrapper
.
set
(
IdxBizJgDesignInfo:
:
getDesignDate
,
equipDesignChangeDataDto
.
getDesignDate
());
updateWrapper
.
set
(
IdxBizJgDesignInfo:
:
getDesignDoc
,
equipDesignChangeDataDto
.
getDesignDoc
());
updateWrapper
.
set
(
IdxBizJgDesignInfo:
:
getDesignUnitCreditCode
,
equipDesignChangeDataDto
.
getDesignUnitCreditCode
());
updateWrapper
.
set
(
IdxBizJgDesignInfo:
:
getDesignUnitName
,
equipDesignChangeDataDto
.
getDesignUnitName
());
updateWrapper
.
set
(
IdxBizJgDesignInfo:
:
getDesignUseDate
,
equipDesignChangeDataDto
.
getDesignUseDate
());
updateWrapper
.
set
(
IdxBizJgDesignInfo:
:
getDesignLicenseNum
,
equipDesignChangeDataDto
.
getDesignLicenseNum
());
updateWrapper
.
set
(
IdxBizJgDesignInfo:
:
getAppraisalUnit
,
equipDesignChangeDataDto
.
getAppraisalUnit
());
updateWrapper
.
set
(
IdxBizJgDesignInfo:
:
getOtherAccessoriesDes
,
equipDesignChangeDataDto
.
getOtherAccessoriesDes
());
updateWrapper
.
set
(
IdxBizJgDesignInfo:
:
getAppraisalDate
,
equipDesignChangeDataDto
.
getAppraisalDate
());
updateWrapper
.
set
(
IdxBizJgDesignInfo:
:
getDrawingDo
,
equipDesignChangeDataDto
.
getDrawingDo
());
updateWrapper
.
set
(
IdxBizJgDesignInfo:
:
getDesignStandard
,
equipDesignChangeDataDto
.
getDesignStandard
());
updateWrapper
.
set
(
equipDesignChangeDataDto
.
getDesignIsComplete
()
!=
null
,
IdxBizJgDesignInfo:
:
getDesignIsComplete
,
equipDesignChangeDataDto
.
getDesignIsComplete
());
idxBizJgDesignInfoMapper
.
update
(
null
,
updateWrapper
);
}
public
void
updateFactoryChangeData
(
String
record
,
EquipFactoryChangeDataDto
equipFactoryChangeDataDto
)
{
LambdaUpdateWrapper
<
IdxBizJgFactoryInfo
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
IdxBizJgFactoryInfo:
:
getRecord
,
record
);
// 影响设备代码的生成
updateWrapper
.
set
(
IdxBizJgFactoryInfo:
:
getProduceDate
,
StringUtils
.
isNotEmpty
(
equipFactoryChangeDataDto
.
getProduceDate
())
?
DateUtil
.
parse
(
equipFactoryChangeDataDto
.
getProduceDate
(),
"yyyy-MM-dd"
)
:
null
);
updateWrapper
.
set
(
IdxBizJgFactoryInfo:
:
getProduceUnitName
,
equipFactoryChangeDataDto
.
getProduceUnitName
());
updateWrapper
.
set
(
IdxBizJgFactoryInfo:
:
getProduceCountry
,
equipFactoryChangeDataDto
.
getProduceCountry
());
updateWrapper
.
set
(
IdxBizJgFactoryInfo:
:
getProduceUnitCreditCode
,
equipFactoryChangeDataDto
.
getProduceUnitCreditCode
());
updateWrapper
.
set
(
IdxBizJgFactoryInfo:
:
getProduceLicenseNum
,
equipFactoryChangeDataDto
.
getProduceLicenseNum
());
updateWrapper
.
set
(
IdxBizJgFactoryInfo:
:
getProductQualityYieldProve
,
equipFactoryChangeDataDto
.
getProductQualityYieldProve
());
updateWrapper
.
set
(
IdxBizJgFactoryInfo:
:
getFactoryStandard
,
equipFactoryChangeDataDto
.
getFactoryStandard
());
updateWrapper
.
set
(
IdxBizJgFactoryInfo:
:
getFactoryNum
,
equipFactoryChangeDataDto
.
getFactoryNum
());
updateWrapper
.
set
(
IdxBizJgFactoryInfo:
:
getFactSupervisionInspectionReport
,
equipFactoryChangeDataDto
.
getFactSupervisionInspectionReport
());
updateWrapper
.
set
(
IdxBizJgFactoryInfo:
:
getOtherAccessoriesFact
,
equipFactoryChangeDataDto
.
getOtherAccessoriesFact
());
updateWrapper
.
set
(
IdxBizJgFactoryInfo:
:
getImported
,
equipFactoryChangeDataDto
.
getImported
());
updateWrapper
.
set
(
IdxBizJgFactoryInfo:
:
getInsUseMaintainExplain
,
equipFactoryChangeDataDto
.
getInsUseMaintainExplain
());
updateWrapper
.
set
(
IdxBizJgFactoryInfo:
:
getBoilerEnergyEfficiencyCertificate
,
equipFactoryChangeDataDto
.
getBoilerEnergyEfficiencyCertificate
());
updateWrapper
.
set
(
equipFactoryChangeDataDto
.
getFactoryIsComplete
()
!=
null
,
IdxBizJgFactoryInfo:
:
getFactoryIsComplete
,
equipFactoryChangeDataDto
.
getFactoryIsComplete
());
jgFactoryInfoMapper
.
update
(
null
,
updateWrapper
);
this
.
updateFactoryEsData
(
record
,
equipFactoryChangeDataDto
);
}
private
void
updateFactoryEsData
(
String
record
,
EquipFactoryChangeDataDto
equipFactoryChangeDataDto
)
{
// es 数据更新
Optional
<
ESEquipmentCategoryDto
>
optional
=
esEquipmentCategory
.
findById
(
record
);
if
(
optional
.
isPresent
())
{
ESEquipmentCategoryDto
esEquipmentCategoryDto
=
optional
.
get
();
esEquipmentCategoryDto
.
setPRODUCE_DATE
(
equipFactoryChangeDataDto
.
getProduceDate
());
esEquipmentCategoryDto
.
setFACTORY_NUM
(
equipFactoryChangeDataDto
.
getFactoryNum
());
esEquipmentCategoryDto
.
setPRODUCE_UNIT_NAME
(
equipFactoryChangeDataDto
.
getProduceUnitName
());
esEquipmentCategory
.
save
(
esEquipmentCategoryDto
);
}
}
private
void
updateRegisterEsData
(
String
record
,
EquipRegisterChangeDataDto
registerChangeDataDto
)
{
// es 数据更新
Optional
<
ESEquipmentCategoryDto
>
optional
=
esEquipmentCategory
.
findById
(
record
);
if
(
optional
.
isPresent
())
{
ESEquipmentCategoryDto
esEquipmentCategoryDto
=
optional
.
get
();
esEquipmentCategoryDto
.
setPRODUCT_NAME
(
registerChangeDataDto
.
getProductName
());
esEquipmentCategoryDto
.
setEQU_CODE
(
registerChangeDataDto
.
getEquCode
());
esEquipmentCategoryDto
.
setEQU_TYPE
(
registerChangeDataDto
.
getEquType
());
esEquipmentCategoryDto
.
setEQU_CATEGORY_CODE
(
registerChangeDataDto
.
getEquCategory
());
esEquipmentCategoryDto
.
setEQU_DEFINE_CODE
(
registerChangeDataDto
.
getEquDefine
());
// 冗余设备类别名称
if
(
StringUtils
.
isEmpty
(
registerChangeDataDto
.
getEquCategory
()))
{
esEquipmentCategoryDto
.
setEQU_CATEGORY
(
null
);
}
else
{
EquipmentCategory
category
=
getEquipmentCategory
(
registerChangeDataDto
.
getEquCategory
());
if
(
category
!=
null
)
{
esEquipmentCategoryDto
.
setEQU_CATEGORY
(
category
.
getName
());
}
}
// 冗余设备品种名称
if
(
StringUtils
.
isEmpty
(
registerChangeDataDto
.
getEquDefine
()))
{
esEquipmentCategoryDto
.
setEQU_DEFINE
(
null
);
}
else
{
EquipmentCategory
category
=
getEquipmentCategory
(
registerChangeDataDto
.
getEquDefine
());
if
(
category
!=
null
)
{
esEquipmentCategoryDto
.
setEQU_DEFINE
(
category
.
getName
());
}
}
esEquipmentCategory
.
save
(
esEquipmentCategoryDto
);
}
}
public
void
updateRegisterEsDataPieLine
(
ProjectContraptionChangeDataDto
registerChangeDataDto
)
{
// es 数据更新
List
<
ESEquipmentCategoryDto
>
pieLines
=
esEquipmentCategory
.
findAllByProjectContraptionId
(
registerChangeDataDto
.
getProjectContraptionId
());
for
(
ESEquipmentCategoryDto
esEquipmentCategoryDto
:
pieLines
)
{
esEquipmentCategoryDto
.
setPROJECT_CONTRAPTION
(
registerChangeDataDto
.
getProjectContraption
());
}
if
(!
pieLines
.
isEmpty
())
{
esEquipmentCategory
.
saveAll
(
pieLines
);
}
}
private
EquipmentCategory
getEquipmentCategory
(
String
categoryCode
)
{
return
equipmentCategoryMapper
.
selectOne
(
new
LambdaQueryWrapper
<
EquipmentCategory
>().
eq
(
EquipmentCategory:
:
getCode
,
categoryCode
));
}
public
void
updateTechParamByRecord
(
String
tableName
,
String
record
,
List
<
FieldChangeMeta
>
fieldChangeMetas
)
{
List
<
DynamicColumnDto
>
columns
=
fieldChangeMetas
.
stream
().
map
(
c
->
{
DynamicColumnDto
columnDto
=
new
DynamicColumnDto
();
columnDto
.
setColumnName
(
String
.
format
(
"\"%s\""
,
StrUtil
.
toUnderlineCase
(
c
.
getColumnKey
()).
toUpperCase
()));
columnDto
.
setColumnValue
(
c
.
getColumnNewValue
());
return
columnDto
;
}).
collect
(
Collectors
.
toList
());
// sql 动态构建入库
commonMapper
.
updateTechParamDynamic
(
tableName
,
record
,
columns
);
}
public
void
checkFactoryChangeData
(
String
record
,
EquipFactoryChangeDataDto
equipFactoryChangeDataDto
,
String
equList
,
String
equCategory
,
String
equDefine
)
{
// 气瓶时检验出厂编号-普通气瓶,车用气瓶不再此范围内
if
(
CylinderTypeEnum
.
CYLINDER
.
getCode
().
equals
(
equCategory
)
&&
StringUtils
.
isNotEmpty
(
equipFactoryChangeDataDto
.
getFactoryNum
()))
{
boolean
isUsed
=
this
.
checkFactoryNumUnique
(
equipFactoryChangeDataDto
.
getFactoryNum
(),
record
,
equipFactoryChangeDataDto
.
getProduceUnitCreditCode
());
if
(
isUsed
)
{
throw
new
BadRequest
(
"出厂编号/产品编码在该企业中已存在!"
);
}
}
}
/**
* 普通气瓶检验-同制造单位下唯一
*
* @param factoryNum 出厂编号
* @param produceUnitCreditCode 制造单位编码
* @return 是否被占用
*/
private
boolean
checkFactoryNumUnique
(
String
factoryNum
,
String
record
,
String
produceUnitCreditCode
)
{
return
commonMapper
.
checkFactoryNumUnique
(
factoryNum
,
record
,
produceUnitCreditCode
)
>
0
;
}
public
void
checkRegisterChangeData
(
String
record
,
EquipRegisterChangeDataDto
registerChangeDataDto
)
{
// 自行输入时,检验设备代码的全局唯一性
if
(
registerChangeDataDto
.
getEquCodeType
().
equals
(
EquCodeTypeEnum
.
INPUT
.
getCode
())
&&
StringUtils
.
isNotEmpty
(
registerChangeDataDto
.
getEquCode
()))
{
Boolean
isUsed
=
this
.
checkEquCodeUniqueness
(
registerChangeDataDto
.
getEquCode
(),
record
);
if
(
isUsed
)
{
throw
new
BadRequest
(
"设备代码:"
+
registerChangeDataDto
.
getEquCode
()
+
"在系统中已存在!"
);
}
}
}
private
Boolean
checkEquCodeUniqueness
(
String
equCode
,
String
record
)
{
// 根据设备代码检查唯一性
return
idxBizJgRegisterInfoMapper
.
selectByEquCodeAndClaimStatus
(
equCode
,
""
,
record
)
>
0
;
}
public
void
checkDesignChangeData
(
String
record
,
EquipDesignChangeDataDto
equipDesignChangeDataDto
)
{
}
public
void
updatePieLineDesignData
(
String
record
,
PieLineDesignChangeDataDto
equipDesignChangeDataDto
)
{
LambdaUpdateWrapper
<
IdxBizJgDesignInfo
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
IdxBizJgDesignInfo:
:
getRecord
,
record
);
updateWrapper
.
set
(
IdxBizJgDesignInfo:
:
getDesignUnitName
,
equipDesignChangeDataDto
.
getDesignUnitName
());
updateWrapper
.
set
(
IdxBizJgDesignInfo:
:
getRecDate
,
new
Date
());
idxBizJgDesignInfoMapper
.
update
(
null
,
updateWrapper
);
}
public
void
updateUseInfoChangeData
(
String
record
,
EquipUseInfoChangeDataDto
equipUseInfoChangeDataDto
)
{
LambdaUpdateWrapper
<
IdxBizJgUseInfo
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
IdxBizJgUseInfo:
:
getRecord
,
record
);
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getUseUnitCreditCode
,
equipUseInfoChangeDataDto
.
getUseUnitCreditCode
());
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getUseUnitName
,
equipUseInfoChangeDataDto
.
getUseUnitName
());
updateWrapper
.
set
(
IdxBizJgUseInfo:
:
getUseInnerCode
,
equipUseInfoChangeDataDto
.
getUseInnerCode
());
idxBizJgUseInfoService
.
update
(
updateWrapper
);
this
.
updateUseInfoEsData
(
record
,
equipUseInfoChangeDataDto
);
}
private
void
updateUseInfoEsData
(
String
record
,
EquipUseInfoChangeDataDto
equipUseInfoChangeDataDto
)
{
// es 数据更新
Optional
<
ESEquipmentCategoryDto
>
optional
=
esEquipmentCategory
.
findById
(
record
);
if
(
optional
.
isPresent
())
{
ESEquipmentCategoryDto
esEquipmentCategoryDto
=
optional
.
get
();
esEquipmentCategoryDto
.
setUSE_UNIT_CREDIT_CODE
(
equipUseInfoChangeDataDto
.
getUseUnitCreditCode
());
esEquipmentCategoryDto
.
setUSC_UNIT_NAME
(
equipUseInfoChangeDataDto
.
getUseUnitName
());
esEquipmentCategoryDto
.
setUSE_INNER_CODE
(
equipUseInfoChangeDataDto
.
getUseInnerCode
());
esEquipmentCategory
.
save
(
esEquipmentCategoryDto
);
}
}
public
void
updateOrSaveInspectInfo
(
String
record
,
EquipInspectChangeDataDto
equipUseInfoChangeDataDto
)
{
if
(
equipUseInfoChangeDataDto
.
getJySeq
()
!=
null
)
{
// 更新逻辑
InspectionDetectionInfo
inspectionDetectionInfoDb
=
inspectionDetectionInfoMapper
.
selectById
(
equipUseInfoChangeDataDto
.
getJySeq
());
String
inspectionSeq
=
inspectionDetectionInfoDb
.
getSequenceNbr
();
Bean
.
copyExistPropertis
(
equipUseInfoChangeDataDto
,
inspectionDetectionInfoDb
);
inspectionDetectionInfoDb
.
setSequenceNbr
(
inspectionSeq
);
inspectionDetectionInfoDb
.
setRecord
(
record
);
inspectionDetectionInfoDb
.
setRecDate
(
new
Date
());
inspectionDetectionInfoMapper
.
updateById
(
inspectionDetectionInfoDb
);
}
else
{
// 插入逻辑
InspectionDetectionInfo
inspectionDetectionInfo
=
new
InspectionDetectionInfo
();
Bean
.
copyExistPropertis
(
equipUseInfoChangeDataDto
,
inspectionDetectionInfo
);
inspectionDetectionInfo
.
setRecord
(
record
);
inspectionDetectionInfo
.
setRecDate
(
new
Date
());
inspectionDetectionInfo
.
setSequenceNbr
(
sequence
.
nextId
()
+
""
);
inspectionDetectionInfoMapper
.
insert
(
inspectionDetectionInfo
);
}
// es 数据更新
Optional
<
ESEquipmentCategoryDto
>
optional
=
esEquipmentCategory
.
findById
(
record
);
if
(
optional
.
isPresent
())
{
ESEquipmentCategoryDto
esEquipmentCategoryDto
=
optional
.
get
();
esEquipmentCategoryDto
.
setNEXT_INSPECT_DATE
(
DateUtil
.
parse
(
DateUtil
.
format
(
equipUseInfoChangeDataDto
.
getNextInspectDate
(),
DatePattern
.
NORM_DATE_PATTERN
)).
getTime
());
esEquipmentCategory
.
save
(
esEquipmentCategoryDto
);
}
}
public
void
updateOtherInfoChangeData
(
String
record
,
EquipOtherInfoChangeDataDto
otherInfoChangeDataDto
)
{
LambdaUpdateWrapper
<
IdxBizJgOtherInfo
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
IdxBizJgOtherInfo:
:
getRecord
,
record
);
updateWrapper
.
set
(
IdxBizJgOtherInfo:
:
getInformationManageCode
,
otherInfoChangeDataDto
.
getInformationManageCode
());
updateWrapper
.
set
(
IdxBizJgOtherInfo:
:
getCylinderStampAttachment
,
otherInfoChangeDataDto
.
getCylinderStampAttachment
());
updateWrapper
.
set
(
IdxBizJgOtherInfo:
:
getInformationSituation
,
otherInfoChangeDataDto
.
getInformationSituation
());
idxBizJgOtherInfoMapper
.
update
(
null
,
updateWrapper
);
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/process/equip/PieLineDataChangeServiceImpl.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
process
.
equip
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta
;
import
com.yeejoin.amos.boot.module.jg.api.dto.PieLineDesignChangeDataDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.PipelineChangeItemDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ProjectContraptionChangeDataDto
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgProjectContraptionServiceImpl
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgProjectContraption
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
@Component
public
class
PieLineDataChangeServiceImpl
{
private
final
CommonEquipDataProcessService
commonEquipDataProcessService
;
private
final
IdxBizJgProjectContraptionServiceImpl
idxBizJgProjectContraptionServiceImpl
;
private
final
EquipChangeDataUpdateServiceImpl
equipChangeDataUpdateServiceImpl
;
public
PieLineDataChangeServiceImpl
(
CommonEquipDataProcessService
commonEquipDataProcessService
,
IdxBizJgProjectContraptionServiceImpl
idxBizJgProjectContraptionServiceImpl
,
EquipChangeDataUpdateServiceImpl
equipChangeDataUpdateServiceImpl
)
{
this
.
commonEquipDataProcessService
=
commonEquipDataProcessService
;
this
.
idxBizJgProjectContraptionServiceImpl
=
idxBizJgProjectContraptionServiceImpl
;
this
.
equipChangeDataUpdateServiceImpl
=
equipChangeDataUpdateServiceImpl
;
}
public
void
update
(
ProjectContraptionChangeDataDto
projectContraptionChangeDataDtoNew
,
List
<
FieldChangeMeta
>
allChangeColumns
)
{
// 原有对象行转列
ProjectContraptionChangeDataDto
projectContraptionChangeDataDtoOld
=
getOldProjectContraptionData
(
projectContraptionChangeDataDtoNew
);
List
<
FieldChangeMeta
>
newProjectContraptionChangeData
=
commonEquipDataProcessService
.
convertBeanField2Column2
(
projectContraptionChangeDataDtoNew
,
projectContraptionChangeDataDtoNew
.
getProjectContraptionId
());
// 新对象构造行转列
List
<
FieldChangeMeta
>
oldProjectContraptionChangeData
=
commonEquipDataProcessService
.
convertBeanField2Column2
(
projectContraptionChangeDataDtoOld
,
projectContraptionChangeDataDtoNew
.
getProjectContraptionId
());
// 数据比对记录变化字段列表
allChangeColumns
.
addAll
(
commonEquipDataProcessService
.
mergeChangeFields
(
newProjectContraptionChangeData
,
oldProjectContraptionChangeData
));
// 数据入库
LambdaUpdateWrapper
<
IdxBizJgProjectContraption
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
BaseEntity:
:
getSequenceNbr
,
projectContraptionChangeDataDtoNew
.
getProjectContraptionId
());
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getProjectContraption
,
projectContraptionChangeDataDtoNew
.
getProjectContraption
());
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getProjectContraptionNo
,
projectContraptionChangeDataDtoNew
.
getProjectContraptionNo
());
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getPipelineLength
,
projectContraptionChangeDataDtoNew
.
getPipelineLength
());
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getProductPhoto
,
projectContraptionChangeDataDtoNew
.
getProductPhoto
());
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getOtherAccessories
,
projectContraptionChangeDataDtoNew
.
getOtherAccessories
());
updateWrapper
.
set
(
IdxBizJgProjectContraption:
:
getProductQualificationCertificate
,
projectContraptionChangeDataDtoNew
.
getProductQualificationCertificate
());
idxBizJgProjectContraptionServiceImpl
.
update
(
null
,
updateWrapper
);
}
private
ProjectContraptionChangeDataDto
getOldProjectContraptionData
(
ProjectContraptionChangeDataDto
projectContraptionChangeDataDtoNew
)
{
IdxBizJgProjectContraption
projectContraption
=
idxBizJgProjectContraptionServiceImpl
.
getById
(
projectContraptionChangeDataDtoNew
.
getProjectContraptionId
());
return
BeanUtil
.
copyProperties
(
projectContraption
,
ProjectContraptionChangeDataDto
.
class
);
}
public
void
saveDesignForPieLine
(
String
record
,
List
<
FieldChangeMeta
>
allChangeColumns
,
PipelineChangeItemDto
pipelineChangeItemDto
)
{
// 1.记录变化的数据对象
PieLineDesignChangeDataDto
pieLineDesignChangeDataDto
=
BeanUtil
.
copyProperties
(
pipelineChangeItemDto
,
PieLineDesignChangeDataDto
.
class
);
// 构造新对象行转列
List
<
FieldChangeMeta
>
designInfoNew
=
commonEquipDataProcessService
.
convertBeanField2Column2
(
pieLineDesignChangeDataDto
,
record
);
// 老数据查询行转列
List
<
FieldChangeMeta
>
designInfoOld
=
commonEquipDataProcessService
.
buildDesignInfoOld
(
record
);
allChangeColumns
.
addAll
(
commonEquipDataProcessService
.
mergeChangeFields
(
designInfoNew
,
designInfoOld
));
// 2.更新管道的设计单位名称
equipChangeDataUpdateServiceImpl
.
updatePieLineDesignData
(
record
,
pieLineDesignChangeDataDto
);
}
public
void
updateEs
(
ProjectContraptionChangeDataDto
projectContraptionChangeDataDto
)
{
equipChangeDataUpdateServiceImpl
.
updateRegisterEsDataPieLine
(
projectContraptionChangeDataDto
);
}
public
void
deletePieLineBatch
(
List
<
PipelineChangeItemDto
>
deletedPieLines
,
List
<
FieldChangeMeta
>
allChangeColumns
,
String
applyNo
)
{
// todo 构建日志 allChangeColumns afterData = null
// todo 数据库管道删除
// todo es管道删除
}
void
newPieLine
(
String
projectContraptionId
,
PipelineChangeItemDto
it
,
List
<
FieldChangeMeta
>
allChangeColumns
,
String
applyNo
)
{
// todo 创建管道的设备几张表
// todo 创建道的es
// todo 构建变更流水 beforeData = null
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/process/equip/SingleCylinderChangeProcess.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
process
.
equip
;
import
com.yeejoin.amos.boot.module.jg.api.dto.*
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.DefaultBizDataChangeHandler
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
/**
* 批量维护气瓶-策略实现类
*/
@Component
@RequiredArgsConstructor
public
class
SingleCylinderChangeProcess
implements
IEquipChangeDataProcessStrategy
{
private
final
CommonEquipDataProcessService
commonEquipDataProcessService
;
@Override
public
List
<
FieldChangeMeta
>
handle
(
Map
<
String
,
Object
>
changeData
,
String
record
)
{
List
<
FieldChangeMeta
>
allChangeColumns
=
new
ArrayList
<>();
// 新数据解析
EquipRegisterChangeDataDto
registerChangeDataDto
=
CommonEquipDataProcessService
.
castMap2Bean
(
changeData
,
EquipRegisterChangeDataDto
.
class
);
EquipFactoryChangeDataDto
factoryChangeDataDto
=
CommonEquipDataProcessService
.
castMap2Bean
(
changeData
,
EquipFactoryChangeDataDto
.
class
);
EquipDesignChangeDataDto
designChangeDataDto
=
CommonEquipDataProcessService
.
castMap2Bean
(
changeData
,
EquipDesignChangeDataDto
.
class
);
EquipUseInfoChangeDataDto
useInfoChangeDataDto
=
CommonEquipDataProcessService
.
castMap2Bean
(
changeData
,
EquipUseInfoChangeDataDto
.
class
);
commonEquipDataProcessService
.
buildChangeFields
(
record
,
designChangeDataDto
,
factoryChangeDataDto
,
registerChangeDataDto
,
useInfoChangeDataDto
,
allChangeColumns
);
// 前置校验
commonEquipDataProcessService
.
checkValidField
(
record
,
registerChangeDataDto
,
null
,
null
,
null
);
commonEquipDataProcessService
.
checkValidField
(
record
,
factoryChangeDataDto
,
registerChangeDataDto
.
getEquList
(),
registerChangeDataDto
.
getEquCategory
(),
registerChangeDataDto
.
getEquDefine
());
commonEquipDataProcessService
.
checkValidField
(
record
,
designChangeDataDto
,
registerChangeDataDto
.
getEquList
(),
registerChangeDataDto
.
getEquCategory
(),
registerChangeDataDto
.
getEquDefine
());
// 设备制造、设计、注册信息业务处理落库
commonEquipDataProcessService
.
dealBizDataForEquip
(
record
,
registerChangeDataDto
);
commonEquipDataProcessService
.
dealBizDataForEquip
(
record
,
factoryChangeDataDto
);
commonEquipDataProcessService
.
dealBizDataForEquip
(
record
,
designChangeDataDto
);
commonEquipDataProcessService
.
dealBizDataForEquip
(
record
,
useInfoChangeDataDto
);
// 设备技术参数入库处理
commonEquipDataProcessService
.
updateTechParamInfo
(
registerChangeDataDto
,
record
,
changeData
,
allChangeColumns
);
return
allChangeColumns
;
}
@Override
public
IBizDataChangeHandleStrategy
.
ModelType
canHandleMode
()
{
return
DefaultBizDataChangeHandler
.
ModelType
.
singleCylinder
;
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/process/equip/SingleEquipChangeProcess.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
process
.
equip
;
import
com.yeejoin.amos.boot.module.jg.api.dto.*
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.DefaultBizDataChangeHandler
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
/**
* 单个维护设备-策略实现类
*/
@Component
@RequiredArgsConstructor
public
class
SingleEquipChangeProcess
implements
IEquipChangeDataProcessStrategy
{
private
final
CommonEquipDataProcessService
commonEquipDataProcessService
;
@Override
public
List
<
FieldChangeMeta
>
handle
(
Map
<
String
,
Object
>
changeData
,
String
record
)
{
List
<
FieldChangeMeta
>
allChangeColumns
=
new
ArrayList
<>();
// 新数据解析
EquipRegisterChangeDataDto
registerChangeDataDto
=
CommonEquipDataProcessService
.
castMap2Bean
(
changeData
,
EquipRegisterChangeDataDto
.
class
);
EquipFactoryChangeDataDto
factoryChangeDataDto
=
CommonEquipDataProcessService
.
castMap2Bean
(
changeData
,
EquipFactoryChangeDataDto
.
class
);
EquipDesignChangeDataDto
designChangeDataDto
=
CommonEquipDataProcessService
.
castMap2Bean
(
changeData
,
EquipDesignChangeDataDto
.
class
);
EquipUseInfoChangeDataDto
useInfoChangeDataDto
=
CommonEquipDataProcessService
.
castMap2Bean
(
changeData
,
EquipUseInfoChangeDataDto
.
class
);
commonEquipDataProcessService
.
buildChangeFields
(
record
,
designChangeDataDto
,
factoryChangeDataDto
,
registerChangeDataDto
,
useInfoChangeDataDto
,
allChangeColumns
);
// 前置校验
commonEquipDataProcessService
.
checkValidField
(
record
,
registerChangeDataDto
,
null
,
null
,
null
);
commonEquipDataProcessService
.
checkValidField
(
record
,
factoryChangeDataDto
,
registerChangeDataDto
.
getEquList
(),
registerChangeDataDto
.
getEquCategory
(),
registerChangeDataDto
.
getEquDefine
());
commonEquipDataProcessService
.
checkValidField
(
record
,
designChangeDataDto
,
registerChangeDataDto
.
getEquList
(),
registerChangeDataDto
.
getEquCategory
(),
registerChangeDataDto
.
getEquDefine
());
// 设备制造、设计、注册信息业务处理落库
commonEquipDataProcessService
.
dealBizDataForEquip
(
record
,
registerChangeDataDto
);
commonEquipDataProcessService
.
dealBizDataForEquip
(
record
,
factoryChangeDataDto
);
commonEquipDataProcessService
.
dealBizDataForEquip
(
record
,
designChangeDataDto
);
commonEquipDataProcessService
.
dealBizDataForEquip
(
record
,
useInfoChangeDataDto
);
// 设备技术参数入库处理
commonEquipDataProcessService
.
updateTechParamInfo
(
registerChangeDataDto
,
record
,
changeData
,
allChangeColumns
);
return
allChangeColumns
;
}
@Override
public
IBizDataChangeHandleStrategy
.
ModelType
canHandleMode
()
{
return
DefaultBizDataChangeHandler
.
ModelType
.
singleEquip
;
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/process/equip/SingleProjectEquipChangeProcess.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
process
.
equip
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.text.CharSequenceUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta
;
import
com.yeejoin.amos.boot.module.jg.api.dto.PipelineChangeItemDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ProjectContraptionChangeDataDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.TechParamsPipelineChangeFieldDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.RequestChangeData
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.DefaultBizDataChangeHandler
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.equip.strategy.IEquipChangeDataProcessStrategy
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 单个装置维护-策略实现类
*/
@Component
@RequiredArgsConstructor
public
class
SingleProjectEquipChangeProcess
implements
IEquipChangeDataProcessStrategy
{
private
final
CommonEquipDataProcessService
commonEquipDataProcessService
;
private
final
PieLineDataChangeServiceImpl
pieLineDataChangeService
;
@Override
public
List
<
FieldChangeMeta
>
handle
(
Map
<
String
,
Object
>
changeData
,
String
defaultChangeId
)
{
JSONObject
data
=
(
JSONObject
)
changeData
;
// 新增编辑的管道------------------tableData
JSONArray
insertOrEditPieLines
=
data
.
getJSONArray
(
RequestChangeData
.
multiDataKey
);
// 删除的管道---------------------deleteData
JSONArray
deletedPieLines
=
data
.
getJSONArray
(
RequestChangeData
.
deletedDataKey
);
List
<
FieldChangeMeta
>
allChangeColumns
=
new
ArrayList
<>();
List
<
PipelineChangeItemDto
>
items
=
insertOrEditPieLines
.
toJavaList
(
PipelineChangeItemDto
.
class
);
// 1.设备技术参数入库前校验,约束:同一个装置下的管道编号不能重复
if
(
items
.
size
()
!=
items
.
stream
().
map
(
TechParamsPipelineChangeFieldDto:
:
getPipelineNumber
).
distinct
().
count
())
{
throw
new
BadRequest
(
"同一工程装置下管道编号不能重复!"
);
}
if
(
deletedPieLines
!=
null
&&
!
deletedPieLines
.
isEmpty
())
{
List
<
PipelineChangeItemDto
>
deletedPieLinesJavaList
=
deletedPieLines
.
toJavaList
(
PipelineChangeItemDto
.
class
);
pieLineDataChangeService
.
deletePieLineBatch
(
deletedPieLinesJavaList
,
allChangeColumns
,
defaultChangeId
);
}
// 2.装置基本信息校验、保存(前端返回的装置信息为大写 需注意)
ProjectContraptionChangeDataDto
projectContraptionChangeDataDto
=
CommonEquipDataProcessService
.
castMap2Bean
(
changeData
,
ProjectContraptionChangeDataDto
.
class
);
this
.
calTotalPieLineLength
(
projectContraptionChangeDataDto
,
items
);
pieLineDataChangeService
.
update
(
projectContraptionChangeDataDto
,
allChangeColumns
);
// 3.管道信息入库保存
items
.
forEach
(
item
->
{
String
record
=
item
.
getRecord
();
if
(
record
==
null
)
{
// 新增的管道逻辑
pieLineDataChangeService
.
newPieLine
(
projectContraptionChangeDataDto
.
getProjectContraptionId
(),
item
,
allChangeColumns
,
defaultChangeId
);
}
else
{
// 更新逻辑
// 设计信息更新
pieLineDataChangeService
.
saveDesignForPieLine
(
record
,
allChangeColumns
,
item
);
// 技术参数入库保存
TechParamsPipelineChangeFieldDto
paramsPipelineChangeFieldDto
=
new
TechParamsPipelineChangeFieldDto
();
BeanUtil
.
copyProperties
(
item
,
paramsPipelineChangeFieldDto
,
false
);
commonEquipDataProcessService
.
savePieLineTechParam
(
record
,
allChangeColumns
,
paramsPipelineChangeFieldDto
);
}
});
// 4.更新所有管道的的冗余的管道名称字段(重点注意包括本次没做使用登记的管道也要更新)
pieLineDataChangeService
.
updateEs
(
projectContraptionChangeDataDto
);
return
allChangeColumns
;
}
private
void
calTotalPieLineLength
(
ProjectContraptionChangeDataDto
projectContraptionChangeDataDto
,
List
<
PipelineChangeItemDto
>
items
)
{
projectContraptionChangeDataDto
.
setPipelineLength
(
items
.
stream
().
filter
(
i
->
i
.
getPipeLength
()
!=
null
).
mapToDouble
(
TechParamsPipelineChangeFieldDto:
:
getPipeLength
).
sum
());
}
private
Map
<
String
,
Object
>
cast2UnderCase
(
Map
<
String
,
Object
>
re
)
{
// 由于历史遗留问题,和前端保存统一,要转成大写下滑线驼峰
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
re
.
forEach
((
k
,
v
)
->
{
result
.
put
(
CharSequenceUtil
.
toUnderlineCase
(
k
).
toUpperCase
(),
v
);
});
return
result
;
}
@Override
public
IBizDataChangeHandleStrategy
.
ModelType
canHandleMode
()
{
return
DefaultBizDataChangeHandler
.
ModelType
.
singleProject
;
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/process/equip/strategy/IEquipChangeDataProcessStrategy.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
process
.
equip
.
strategy
;
import
com.yeejoin.amos.boot.module.jg.api.dto.FieldChangeMeta
;
import
com.yeejoin.amos.boot.module.jg.biz.edit.process.biz.strategy.IBizDataChangeHandleStrategy
;
import
java.util.List
;
import
java.util.Map
;
/**
* 处理监策略类
*/
public
interface
IEquipChangeDataProcessStrategy
{
/**
* 处理
*/
List
<
FieldChangeMeta
>
handle
(
Map
<
String
,
Object
>
changeData
,
String
defaultChangeId
);
/**
* 可处理类型
*
* @return 可处理的类型
*/
IBizDataChangeHandleStrategy
.
ModelType
canHandleMode
();
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/utils/ReflectiveFieldAccessor.java
0 → 100644
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
edit
.
utils
;
import
java.lang.reflect.Field
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
public
class
ReflectiveFieldAccessor
{
private
static
final
Map
<
Class
<?>,
List
<
Field
>>
fieldCache
=
new
ConcurrentHashMap
<>();
public
static
List
<
Field
>
getAllFields
(
Class
<?>
clazz
)
{
return
fieldCache
.
computeIfAbsent
(
clazz
,
k
->
{
Class
<?>
clazz1
=
clazz
;
List
<
Field
>
fields
=
new
ArrayList
<>();
while
(
clazz1
!=
null
&&
clazz1
!=
Object
.
class
)
{
fields
.
addAll
(
Arrays
.
asList
(
clazz1
.
getDeclaredFields
()));
clazz1
=
clazz1
.
getSuperclass
();
// 递归向上获取父类
}
return
Collections
.
unmodifiableList
(
fields
);
});
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/event/handler/IChangeEventBizHandler.java
deleted
100644 → 0
View file @
41b6903e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
event
.
handler
;
import
org.springframework.context.ApplicationEvent
;
public
interface
IChangeEventBizHandler
<
T
extends
ApplicationEvent
>
{
void
handle
(
T
event
);
Boolean
supports
(
T
event
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/event/handler/InstallNoticeChangeEventHandler.java
deleted
100644 → 0
View file @
41b6903e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
event
.
handler
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ESDataChangeLogDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgBizChangeLog
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgInstallationNotice
;
import
com.yeejoin.amos.boot.module.jg.biz.event.ChangeDataEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgBizChangeLogServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.UseRegisterDataChangeHandleImpl
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.Set
;
@Component
@RequiredArgsConstructor
@Slf4j
public
class
InstallNoticeChangeEventHandler
implements
IChangeEventBizHandler
<
ChangeDataEvent
>
{
private
final
JgInstallationNoticeServiceImpl
jgInstallationNoticeService
;
private
final
JgBizChangeLogServiceImpl
jgBizChangeLogService
;
@Override
@Async
public
void
handle
(
ChangeDataEvent
event
)
{
log
.
info
(
"开始更新安装告知json数据:{}"
,
event
);
// 查询关联的单据-未删除且已完成状态
Set
<
Long
>
installationNoticeIds
=
this
.
getRelationInstallNoticeList
(
event
);
// 更新历史json
installationNoticeIds
.
forEach
(
seq
->
{
// 更新json
JgInstallationNotice
installationNotice
=
jgInstallationNoticeService
.
getById
(
seq
);
// 查询之前数据json
JSONObject
beforeData
=
jgInstallationNoticeService
.
getHisData
(
installationNotice
);
jgInstallationNoticeService
.
saveHisDataBeforeUpdate
(
installationNotice
);
// 查询之后数据json
JSONObject
afterData
=
jgInstallationNoticeService
.
getHisData
(
installationNotice
);
// es记录日志
this
.
log2es
(
beforeData
,
afterData
,
installationNotice
,
event
);
});
log
.
info
(
"更新安装告知的单据数量:{}"
,
installationNoticeIds
.
size
());
}
private
void
log2es
(
JSONObject
beforeData
,
JSONObject
afterData
,
JgInstallationNotice
installationNotice
,
ChangeDataEvent
event
)
{
Date
date
=
DateUtil
.
date
();
JgBizChangeLog
changeLog
=
new
JgBizChangeLog
();
BeanUtil
.
copyProperties
(
event
.
getBizRelationData
(),
changeLog
);
changeLog
.
setBizTable
(
"tzs_jg_installation_notice"
);
changeLog
.
setRecDate
(
date
);
changeLog
.
setBizId
(
installationNotice
.
getApplyNo
());
// todo 与原始编辑进行关联
changeLog
.
setOId
(
event
.
getRequestContext
().
getTraceId
());
changeLog
.
setBizType
(
"installationNotice"
);
changeLog
.
setRecUserId
(
event
.
getRequestContext
().
getExcutedUserId
());
ESDataChangeLogDto
esDataChangeLogDto
=
new
ESDataChangeLogDto
();
esDataChangeLogDto
.
setColumnKey
(
"changeData"
);
esDataChangeLogDto
.
setColumnKeyLabel
(
"历史json数据"
);
esDataChangeLogDto
.
setBeforeData
(
beforeData
.
toJSONString
());
esDataChangeLogDto
.
setAfterData
(
afterData
.
toJSONString
());
esDataChangeLogDto
.
setUserId
(
event
.
getRequestContext
().
getExcutedUserId
());
esDataChangeLogDto
.
setCreateDate
(
date
.
getTime
());
esDataChangeLogDto
.
setRequestDate
(
DateUtil
.
formatDateTime
(
date
));
esDataChangeLogDto
.
setChangeId
(
installationNotice
.
getApplyNo
());
esDataChangeLogDto
.
setColumnFamily
(
"tzs_jg_installation_notice"
);
esDataChangeLogDto
.
setBizType
(
changeLog
.
getBizType
());
jgBizChangeLogService
.
save2DbAndEs
(
changeLog
,
Collections
.
singletonList
(
esDataChangeLogDto
));
}
private
Set
<
Long
>
getRelationInstallNoticeList
(
ChangeDataEvent
event
)
{
// 变化的设备
Set
<
String
>
records
=
event
.
getBizRelationData
().
getRecords
();
// 查询关联的单据-已完成时更新其json
return
jgInstallationNoticeService
.
getBaseMapper
().
queryListByEqsAndStatus
(
records
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getCode
()
+
""
);
}
@Override
public
Boolean
supports
(
ChangeDataEvent
event
)
{
return
UseRegisterDataChangeHandleImpl
.
BIZ_TYPE
.
equals
(
event
.
getBizRelationData
().
getBizType
());
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/event/handler/MaintenanceContractChangeEventHandler.java
deleted
100644 → 0
View file @
41b6903e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
event
.
handler
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ESDataChangeLogDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgBizChangeLog
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgMaintenanceContract
;
import
com.yeejoin.amos.boot.module.jg.biz.event.ChangeDataEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgBizChangeLogServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgMaintenanceContractServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.UseRegisterDataChangeHandleImpl
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.Set
;
@Component
@RequiredArgsConstructor
@Slf4j
public
class
MaintenanceContractChangeEventHandler
implements
IChangeEventBizHandler
<
ChangeDataEvent
>
{
private
final
JgMaintenanceContractServiceImpl
jgMaintenanceContractService
;
private
final
JgBizChangeLogServiceImpl
jgBizChangeLogService
;
@Override
@Async
public
void
handle
(
ChangeDataEvent
event
)
{
log
.
info
(
"开始更新维保备案json数据:{}"
,
event
);
// 查询关联的单据-未删除且已完成状态
Set
<
Long
>
maintenanceContractList
=
this
.
getRelationMaintenanceContractList
(
event
);
// 更新历史json
maintenanceContractList
.
forEach
(
seq
->
{
// 更新json
JgMaintenanceContract
maintenanceContract
=
jgMaintenanceContractService
.
getById
(
seq
);
// 查询之前数据json
JSONArray
beforeData
=
jgMaintenanceContractService
.
getHisData
(
maintenanceContract
);
jgMaintenanceContractService
.
updateHisDataAfterEquipEdit
(
maintenanceContract
);
// 查询之后数据json
JSONArray
afterData
=
jgMaintenanceContractService
.
getHisData
(
maintenanceContract
);
// es记录日志
this
.
log2es
(
beforeData
,
afterData
,
maintenanceContract
,
event
);
});
log
.
info
(
"更新维保备案的单据数量:{}"
,
maintenanceContractList
.
size
());
}
private
Set
<
Long
>
getRelationMaintenanceContractList
(
ChangeDataEvent
event
)
{
// 变化的设备
Set
<
String
>
records
=
event
.
getBizRelationData
().
getRecords
();
// 查询关联的单据-已完成时更新其json
return
jgMaintenanceContractService
.
getBaseMapper
().
queryListByEqsAndStatus
(
records
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
());
}
@Override
public
Boolean
supports
(
ChangeDataEvent
event
)
{
return
UseRegisterDataChangeHandleImpl
.
BIZ_TYPE
.
equals
(
event
.
getBizRelationData
().
getBizType
());
}
private
void
log2es
(
JSON
beforeData
,
JSON
afterData
,
JgMaintenanceContract
maintenanceContract
,
ChangeDataEvent
event
)
{
Date
date
=
DateUtil
.
date
();
JgBizChangeLog
changeLog
=
new
JgBizChangeLog
();
BeanUtil
.
copyProperties
(
event
.
getBizRelationData
(),
changeLog
);
changeLog
.
setBizTable
(
"tzs_jg_maintenance_contract"
);
changeLog
.
setRecDate
(
date
);
changeLog
.
setBizId
(
maintenanceContract
.
getApplyNo
());
// todo 与原始编辑进行关联
changeLog
.
setOId
(
event
.
getRequestContext
().
getTraceId
());
changeLog
.
setBizType
(
"maintenanceContract"
);
changeLog
.
setRecUserId
(
event
.
getRequestContext
().
getExcutedUserId
());
ESDataChangeLogDto
esDataChangeLogDto
=
new
ESDataChangeLogDto
();
esDataChangeLogDto
.
setColumnKey
(
"changeData"
);
esDataChangeLogDto
.
setColumnKeyLabel
(
"历史json数据"
);
esDataChangeLogDto
.
setBeforeData
(
beforeData
.
toJSONString
());
esDataChangeLogDto
.
setAfterData
(
afterData
.
toJSONString
());
esDataChangeLogDto
.
setUserId
(
event
.
getRequestContext
().
getExcutedUserId
());
esDataChangeLogDto
.
setCreateDate
(
date
.
getTime
());
esDataChangeLogDto
.
setRequestDate
(
DateUtil
.
formatDateTime
(
date
));
esDataChangeLogDto
.
setChangeId
(
maintenanceContract
.
getApplyNo
());
esDataChangeLogDto
.
setColumnFamily
(
"tzs_jg_maintenance_contract"
);
esDataChangeLogDto
.
setBizType
(
changeLog
.
getBizType
());
jgBizChangeLogService
.
save2DbAndEs
(
changeLog
,
Collections
.
singletonList
(
esDataChangeLogDto
));
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/event/handler/UseRegisterChangeEventHandler.java
deleted
100644 → 0
View file @
41b6903e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
event
.
handler
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ESDataChangeLogDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgBizChangeLog
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistration
;
import
com.yeejoin.amos.boot.module.jg.biz.event.ChangeDataEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgBizChangeLogServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgUseRegistrationServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.UseRegisterDataChangeHandleImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.UseRegisterUpdateService
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.Set
;
@Component
@RequiredArgsConstructor
@Slf4j
public
class
UseRegisterChangeEventHandler
implements
IChangeEventBizHandler
<
ChangeDataEvent
>
{
private
final
JgUseRegistrationServiceImpl
jgUseRegistrationService
;
private
final
JgBizChangeLogServiceImpl
jgBizChangeLogService
;
private
final
UseRegisterUpdateService
registerUpdateService
;
@Override
@Async
public
void
handle
(
ChangeDataEvent
event
)
{
log
.
info
(
"开始更新使用登记json数据:{}"
,
event
);
// 查询关联的单据-未删除且已完成状态-不包括原始使用登记的修改
Set
<
Long
>
useRegistrationIds
=
this
.
getRelationUseRegisterList
(
event
);
// 更新历史json
useRegistrationIds
.
forEach
(
seq
->
{
// 更新json
JgUseRegistration
useRegistration
=
jgUseRegistrationService
.
getById
(
seq
);
// 查询之前数据json
JSONObject
beforeData
=
jgUseRegistrationService
.
getHisData
(
useRegistration
);
registerUpdateService
.
updateHisData
(
useRegistration
.
getApplyNo
());
// 查询之后数据json
JSONObject
afterData
=
jgUseRegistrationService
.
getHisData
(
useRegistration
);
// es记录日志
this
.
log2es
(
beforeData
,
afterData
,
useRegistration
,
event
);
});
log
.
info
(
"更新使用登记的单据数量:{}"
,
useRegistrationIds
.
size
());
}
private
void
log2es
(
JSONObject
beforeData
,
JSONObject
afterData
,
JgUseRegistration
jgUseRegistration
,
ChangeDataEvent
event
)
{
Date
date
=
DateUtil
.
date
();
JgBizChangeLog
changeLog
=
new
JgBizChangeLog
();
BeanUtil
.
copyProperties
(
event
.
getBizRelationData
(),
changeLog
);
changeLog
.
setRecDate
(
date
);
changeLog
.
setBizId
(
jgUseRegistration
.
getApplyNo
());
// todo 与原始编辑进行关联
changeLog
.
setOId
(
event
.
getRequestContext
().
getTraceId
());
changeLog
.
setBizType
(
changeLog
.
getBizType
());
changeLog
.
setBizTable
(
"tzs_jg_use_registration"
);
changeLog
.
setRecUserId
(
event
.
getRequestContext
().
getExcutedUserId
());
ESDataChangeLogDto
esDataChangeLogDto
=
new
ESDataChangeLogDto
();
esDataChangeLogDto
.
setColumnKey
(
"changeData"
);
esDataChangeLogDto
.
setColumnKeyLabel
(
"历史json数据"
);
esDataChangeLogDto
.
setBeforeData
(
beforeData
.
toJSONString
());
esDataChangeLogDto
.
setAfterData
(
afterData
.
toJSONString
());
esDataChangeLogDto
.
setUserId
(
event
.
getRequestContext
().
getExcutedUserId
());
esDataChangeLogDto
.
setCreateDate
(
date
.
getTime
());
esDataChangeLogDto
.
setRequestDate
(
DateUtil
.
formatDateTime
(
date
));
esDataChangeLogDto
.
setChangeId
(
jgUseRegistration
.
getApplyNo
());
esDataChangeLogDto
.
setColumnFamily
(
changeLog
.
getBizTable
());
esDataChangeLogDto
.
setBizType
(
changeLog
.
getBizType
());
jgBizChangeLogService
.
save2DbAndEs
(
changeLog
,
Collections
.
singletonList
(
esDataChangeLogDto
));
}
private
Set
<
Long
>
getRelationUseRegisterList
(
ChangeDataEvent
event
)
{
// 变化的设备
Set
<
String
>
records
=
event
.
getBizRelationData
().
getRecords
();
String
applyNo
=
event
.
getBizRelationData
().
getBizId
();
// 查询设备关联的已完成状态的单据-来更新其json
return
jgUseRegistrationService
.
getBaseMapper
().
queryListByEqsAndStatus
(
records
,
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
(),
applyNo
);
}
@Override
public
Boolean
supports
(
ChangeDataEvent
event
)
{
return
UseRegisterDataChangeHandleImpl
.
BIZ_TYPE
.
equals
(
event
.
getBizRelationData
().
getBizType
());
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/event/listener/RelationBizApplyUpdateListener.java
deleted
100644 → 0
View file @
41b6903e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
event
.
listener
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.biz.event.ChangeDataEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.event.handler.IChangeEventBizHandler
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.ApplicationEvent
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.event.TransactionalEventListener
;
import
javax.annotation.PostConstruct
;
import
java.util.List
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.stream.IntStream
;
/**
* @author Administrator
*/
@Component
@Slf4j
@RequiredArgsConstructor
public
class
RelationBizApplyUpdateListener
{
@Value
(
"${relation.data.deal.thread.number:1}"
)
private
int
threadNumber
;
private
final
List
<
IChangeEventBizHandler
<
ApplicationEvent
>>
changeUpdateHandlers
;
private
final
BlockingQueue
<
ChangeDataEvent
>
queue
=
new
LinkedBlockingQueue
<>();
@TransactionalEventListener
(
value
=
ChangeDataEvent
.
class
)
@Async
public
void
handleTransactionalEvent
(
ChangeDataEvent
event
)
{
log
.
info
(
"收到用户变更业务数据消息:{}"
,
JSONObject
.
toJSONString
(
event
));
queue
.
add
(
event
);
}
@PostConstruct
public
void
init
()
{
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
threadNumber
);
IntStream
.
range
(
0
,
threadNumber
).
forEach
(
i
->
{
executorService
.
execute
(()
->
{
while
(
true
)
{
try
{
ChangeDataEvent
event
=
queue
.
take
();
processEvent
(
event
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
});
});
}
private
void
processEvent
(
ChangeDataEvent
event
)
{
changeUpdateHandlers
.
stream
().
filter
(
h
->
h
.
supports
(
event
)).
forEach
(
h
->
{
log
.
info
(
"处理器:{}"
,
JSONObject
.
toJSONString
(
h
));
h
.
handle
(
event
);
});
}
}
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/CommonEquipDataProcessService.java
deleted
100644 → 0
View file @
41b6903e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.text.CharSequenceUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine
;
import
com.yeejoin.amos.boot.biz.common.annotation.Group
;
import
com.yeejoin.amos.boot.module.jg.api.dto.*
;
import
com.yeejoin.amos.boot.module.jg.biz.service.*
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.*
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.*
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.lang.reflect.Field
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
@Component
@RequiredArgsConstructor
public
class
CommonEquipDataProcessService
{
private
final
IdxBizJgDesignInfoMapper
idxBizJgDesignInfoMapper
;
private
final
IdxBizJgFactoryInfoMapper
jgFactoryInfoMapper
;
private
final
IdxBizJgRegisterInfoMapper
idxBizJgRegisterInfoMapper
;
private
final
IIdxBizJgTechParamsElevatorService
iIdxBizJgTechParamsElevatorService
;
private
final
IIdxBizJgTechParamsVehicleService
iIdxBizJgTechParamsVehicleService
;
private
final
IIdxBizJgTechParamsRopewayService
iIdxBizJgTechParamsRopewayService
;
private
final
IIdxBizJgTechParamsRidesService
iIdxBizJgTechParamsRidesService
;
private
final
IIdxBizJgTechParamsBoilerService
iIdxBizJgTechParamsBoilerService
;
private
final
IIdxBizJgTechParamsVesselService
iIdxBizJgTechParamsVesselService
;
private
final
IIdxBizJgTechParamsPipelineService
iIdxBizJgTechParamsPipelineService
;
private
final
IIdxBizJgTechParamsLiftingService
iIdxBizJgTechParamsLiftingService
;
private
final
EquipChangeDataUpdateService
equipChangeDataUpdateService
;
private
final
IdxBizJgUseInfoServiceImpl
idxBizJgUseInfoService
;
private
final
List
<
String
>
jsonFields
=
new
ArrayList
<>();
private
final
IdxBizJgOtherInfoMapper
idxBizJgOtherInfoMapper
;
@PostConstruct
public
void
init
()
{
Field
[]
fields1
=
EquipRegisterChangeDataDto
.
class
.
getDeclaredFields
();
for
(
Field
field
:
fields1
)
{
field
.
setAccessible
(
true
);
FieldDisplayDefine
fieldDisplayDefine
=
field
.
getAnnotation
(
FieldDisplayDefine
.
class
);
if
(
fieldDisplayDefine
!=
null
&&
fieldDisplayDefine
.
type
()
==
JSON
.
class
)
{
jsonFields
.
add
(
field
.
getName
());
}
}
Field
[]
fields2
=
EquipFactoryChangeDataDto
.
class
.
getDeclaredFields
();
for
(
Field
field
:
fields2
)
{
field
.
setAccessible
(
true
);
FieldDisplayDefine
fieldDisplayDefine
=
field
.
getAnnotation
(
FieldDisplayDefine
.
class
);
if
(
fieldDisplayDefine
!=
null
&&
fieldDisplayDefine
.
type
()
==
JSON
.
class
)
{
jsonFields
.
add
(
field
.
getName
());
}
}
// 设计信息构建
Field
[]
fields3
=
EquipDesignChangeDataDto
.
class
.
getDeclaredFields
();
for
(
Field
field
:
fields3
)
{
field
.
setAccessible
(
true
);
FieldDisplayDefine
fieldDisplayDefine
=
field
.
getAnnotation
(
FieldDisplayDefine
.
class
);
if
(
fieldDisplayDefine
!=
null
&&
fieldDisplayDefine
.
type
()
==
JSON
.
class
)
{
jsonFields
.
add
(
field
.
getName
());
}
}
// 技术参数附件
Field
[]
fields4
=
TechParamsLiftingChangeFieldDto
.
class
.
getDeclaredFields
();
for
(
Field
field
:
fields4
)
{
field
.
setAccessible
(
true
);
FieldDisplayDefine
fieldDisplayDefine
=
field
.
getAnnotation
(
FieldDisplayDefine
.
class
);
if
(
fieldDisplayDefine
!=
null
&&
fieldDisplayDefine
.
type
()
==
JSON
.
class
)
{
jsonFields
.
add
(
field
.
getName
());
}
}
Field
[]
fields5
=
TechParamsPipelineChangeFieldDto
.
class
.
getDeclaredFields
();
for
(
Field
field
:
fields5
)
{
field
.
setAccessible
(
true
);
FieldDisplayDefine
fieldDisplayDefine
=
field
.
getAnnotation
(
FieldDisplayDefine
.
class
);
if
(
fieldDisplayDefine
!=
null
&&
fieldDisplayDefine
.
type
()
==
JSON
.
class
)
{
jsonFields
.
add
(
field
.
getName
());
}
}
Field
[]
fields6
=
EquipOtherInfoChangeDataDto
.
class
.
getDeclaredFields
();
for
(
Field
field
:
fields6
)
{
field
.
setAccessible
(
true
);
FieldDisplayDefine
fieldDisplayDefine
=
field
.
getAnnotation
(
FieldDisplayDefine
.
class
);
if
(
fieldDisplayDefine
!=
null
&&
fieldDisplayDefine
.
type
()
==
JSON
.
class
)
{
jsonFields
.
add
(
field
.
getName
());
}
}
}
public
<
T
extends
BaseChangeDataDto
>
T
castMap2Bean
(
Map
<
String
,
Object
>
map
,
Class
<
T
>
clazz
)
{
try
{
T
t
=
clazz
.
newInstance
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
map
)),
t
,
true
);
return
t
;
}
catch
(
InstantiationException
|
IllegalAccessException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
public
void
checkValidField
(
String
record
,
BaseChangeDataDto
changeDataDto
,
String
equList
,
String
equCategory
,
String
equDefine
)
{
// 注册信息
if
(
changeDataDto
instanceof
EquipRegisterChangeDataDto
)
{
EquipRegisterChangeDataDto
registerChangeDataDto
=
(
EquipRegisterChangeDataDto
)
changeDataDto
;
equipChangeDataUpdateService
.
checkRegisterChangeData
(
record
,
registerChangeDataDto
);
}
// 制造信息
if
(
changeDataDto
instanceof
EquipFactoryChangeDataDto
)
{
EquipFactoryChangeDataDto
equipFactoryChangeDataDto
=
(
EquipFactoryChangeDataDto
)
changeDataDto
;
equipChangeDataUpdateService
.
checkFactoryChangeData
(
record
,
equipFactoryChangeDataDto
,
equList
,
equCategory
,
equDefine
);
}
// 设计信息
if
(
changeDataDto
instanceof
EquipDesignChangeDataDto
)
{
EquipDesignChangeDataDto
equipDesignChangeDataDto
=
(
EquipDesignChangeDataDto
)
changeDataDto
;
equipChangeDataUpdateService
.
checkDesignChangeData
(
record
,
equipDesignChangeDataDto
);
}
}
void
buildChangeFields
(
String
record
,
EquipDesignChangeDataDto
equipDesignChangeDataDto
,
EquipFactoryChangeDataDto
equipFactoryChangeDataDto
,
EquipRegisterChangeDataDto
registerChangeDataDto
,
EquipOtherInfoChangeDataDto
otherInfoChangeDataDto
,
EquipUseInfoChangeDataDto
useInfoChangeDataDto
,
List
<
ChangeDataDto
>
allChangeColumns
)
{
// 构造新对象行转列
List
<
ChangeDataDto
>
designInfoNew
=
this
.
buildDesignInfoNew
(
equipDesignChangeDataDto
,
record
);
List
<
ChangeDataDto
>
factoryInfoNew
=
this
.
buildFactoryInfoNew
(
equipFactoryChangeDataDto
,
record
);
List
<
ChangeDataDto
>
registerInfoNew
=
this
.
buildRegisterInfoNew
(
registerChangeDataDto
,
record
);
if
(
useInfoChangeDataDto
!=
null
)
{
List
<
ChangeDataDto
>
useInfoNew
=
this
.
convertBeanField2Column2
(
useInfoChangeDataDto
,
record
);
List
<
ChangeDataDto
>
useInfoOld
=
this
.
buildUseInfoOld
(
record
);
allChangeColumns
.
addAll
(
this
.
mergeChangeFields
(
useInfoNew
,
useInfoOld
));
}
if
(
otherInfoChangeDataDto
!=
null
){
List
<
ChangeDataDto
>
otherInfoNew
=
this
.
convertBeanField2Column2
(
otherInfoChangeDataDto
,
record
);
List
<
ChangeDataDto
>
otherInfoOld
=
this
.
buildOtherInfoOld
(
record
);
allChangeColumns
.
addAll
(
this
.
mergeChangeFields
(
otherInfoNew
,
otherInfoOld
));
}
// 老数据查询行转列
List
<
ChangeDataDto
>
designInfoOld
=
this
.
buildDesignInfoOld
(
record
);
List
<
ChangeDataDto
>
factoryInfoOld
=
this
.
buildFactoryInfoOld
(
record
);
List
<
ChangeDataDto
>
registerInfoOld
=
this
.
buildRegisterInfoOld
(
record
);
allChangeColumns
.
addAll
(
this
.
mergeChangeFields
(
designInfoNew
,
designInfoOld
));
allChangeColumns
.
addAll
(
this
.
mergeChangeFields
(
factoryInfoNew
,
factoryInfoOld
));
allChangeColumns
.
addAll
(
this
.
mergeChangeFields
(
registerInfoNew
,
registerInfoOld
));
}
private
List
<
ChangeDataDto
>
buildOtherInfoOld
(
String
record
)
{
EquipOtherInfoChangeDataDto
changeDataDto
=
new
EquipOtherInfoChangeDataDto
();
IdxBizJgOtherInfo
otherInfo
=
idxBizJgOtherInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgOtherInfo
>().
eq
(
IdxBizJgOtherInfo:
:
getRecord
,
record
));
BeanUtil
.
copyProperties
(
otherInfo
,
changeDataDto
);
return
this
.
convertBeanField2Column2
(
changeDataDto
,
record
);
}
EquipOtherInfoChangeDataDto
buildOtherInfo
(
String
record
)
{
EquipOtherInfoChangeDataDto
changeDataDto
=
new
EquipOtherInfoChangeDataDto
();
IdxBizJgOtherInfo
otherInfo
=
idxBizJgOtherInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgOtherInfo
>().
eq
(
IdxBizJgOtherInfo:
:
getRecord
,
record
));
BeanUtil
.
copyProperties
(
otherInfo
,
changeDataDto
);
return
changeDataDto
;
}
/**
* 业务处理-业务对象
*
* @param record 设备主键
* @param changeDataDto 变更后数据
*/
void
dealBizDataForEquip
(
String
record
,
BaseChangeDataDto
changeDataDto
)
{
// 注册信息
if
(
changeDataDto
instanceof
EquipRegisterChangeDataDto
)
{
EquipRegisterChangeDataDto
registerChangeDataDto
=
(
EquipRegisterChangeDataDto
)
changeDataDto
;
equipChangeDataUpdateService
.
updateRegisterChangeData
(
record
,
registerChangeDataDto
);
}
// 制造信息
if
(
changeDataDto
instanceof
EquipFactoryChangeDataDto
)
{
EquipFactoryChangeDataDto
equipFactoryChangeDataDto
=
(
EquipFactoryChangeDataDto
)
changeDataDto
;
equipChangeDataUpdateService
.
updateFactoryChangeData
(
record
,
equipFactoryChangeDataDto
);
}
// 设计信息
if
(
changeDataDto
instanceof
EquipDesignChangeDataDto
)
{
EquipDesignChangeDataDto
equipDesignChangeDataDto
=
(
EquipDesignChangeDataDto
)
changeDataDto
;
equipChangeDataUpdateService
.
updateDesignChangeData
(
record
,
equipDesignChangeDataDto
);
}
// 使用信息
if
(
changeDataDto
instanceof
EquipUseInfoChangeDataDto
)
{
EquipUseInfoChangeDataDto
equipUseInfoChangeDataDto
=
(
EquipUseInfoChangeDataDto
)
changeDataDto
;
equipChangeDataUpdateService
.
updateUseInfoChangeData
(
record
,
equipUseInfoChangeDataDto
);
}
// 气瓶钢印信息
if
(
changeDataDto
instanceof
EquipOtherInfoChangeDataDto
)
{
EquipOtherInfoChangeDataDto
otherInfoChangeDataDto
=
(
EquipOtherInfoChangeDataDto
)
changeDataDto
;
equipChangeDataUpdateService
.
updateOtherInfoChangeData
(
record
,
otherInfoChangeDataDto
);
}
}
private
String
buildTableName
(
Class
<?>
clazz
)
{
Group
group
=
clazz
.
getAnnotation
(
Group
.
class
);
return
String
.
format
(
"\"%s_%s\""
,
"idx_biz_jg"
,
group
.
value
());
}
public
List
<
ChangeDataDto
>
mergeChangeFields
(
List
<
ChangeDataDto
>
changeDataNew
,
List
<
ChangeDataDto
>
changeDataOld
)
{
Map
<
String
,
ChangeDataDto
>
oldKv
=
changeDataOld
.
stream
().
collect
(
Collectors
.
toMap
(
ChangeDataDto:
:
getColumnKey
,
Function
.
identity
()));
changeDataNew
.
forEach
(
o
->
{
// 正常不会出现此情况,old数据 大于等于 new 数据的key
if
(
oldKv
.
get
(
o
.
getColumnKey
())
!=
null
)
{
o
.
setColumnOldValue
(
oldKv
.
get
(
o
.
getColumnKey
()).
getColumnOldValue
());
}
});
return
changeDataNew
.
stream
().
filter
(
n
->
!
StringUtils
.
equals
(
n
.
getColumnNewValue
(),
n
.
getColumnOldValue
())).
collect
(
Collectors
.
toList
());
}
private
static
TechParamsBoilerChangeFieldDto
getTechParamsBoilerChangeField
(
Map
<
String
,
Object
>
changeData
)
{
TechParamsBoilerChangeFieldDto
newBoiler
=
new
TechParamsBoilerChangeFieldDto
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
changeData
)),
newBoiler
,
true
);
return
newBoiler
;
}
private
TechParamsBoilerChangeFieldDto
getTechParamsBoilerChangeField
(
String
record
)
{
IdxBizJgTechParamsBoiler
boiler
=
iIdxBizJgTechParamsBoilerService
.
getOneData
(
record
);
TechParamsBoilerChangeFieldDto
oldBoiler
=
new
TechParamsBoilerChangeFieldDto
();
BeanUtil
.
copyProperties
(
boiler
,
oldBoiler
);
return
oldBoiler
;
}
BaseTechParamsFieldDto
buildTechParamInfo
(
EquipRegisterChangeDataDto
equipRegisterChangeDataDto
,
String
record
)
{
EquipmentClassifityEnum
equipmentClassifityEnum
=
EquipmentClassifityEnum
.
getOne
(
equipRegisterChangeDataDto
.
getEquList
());
switch
(
Objects
.
requireNonNull
(
equipmentClassifityEnum
))
{
case
GL:
// 锅炉
IdxBizJgTechParamsBoiler
boiler
=
iIdxBizJgTechParamsBoilerService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
return
BeanUtil
.
copyProperties
(
boiler
,
TechParamsBoilerChangeFieldDto
.
class
);
case
YLRQ:
// 压力容器
IdxBizJgTechParamsVessel
techParamsVessel
=
iIdxBizJgTechParamsVesselService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
return
BeanUtil
.
copyProperties
(
techParamsVessel
,
TechParamsVesselChangeFieldDto
.
class
);
case
DT:
// 电梯
IdxBizJgTechParamsElevator
techParamsElevator
=
iIdxBizJgTechParamsElevatorService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
return
BeanUtil
.
copyProperties
(
techParamsElevator
,
TechParamsElevatorChangeFieldDto
.
class
);
case
QZJX:
// 起重机械
IdxBizJgTechParamsLifting
techParamsLifting
=
iIdxBizJgTechParamsLiftingService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
return
BeanUtil
.
copyProperties
(
techParamsLifting
,
TechParamsLiftingChangeFieldDto
.
class
);
case
CC:
// 场(厂)内专用机动车辆
IdxBizJgTechParamsVehicle
techParamsVehicle
=
iIdxBizJgTechParamsVehicleService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
return
BeanUtil
.
copyProperties
(
techParamsVehicle
,
TechParamsVehicleChangeFieldDto
.
class
);
case
YLSS:
// 大型游乐设施
IdxBizJgTechParamsRides
techParamsRides
=
iIdxBizJgTechParamsRidesService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
return
BeanUtil
.
copyProperties
(
techParamsRides
,
TechParamsRidesChangeFieldDto
.
class
);
case
YLGD:
// 压力管道
IdxBizJgTechParamsPipeline
techParamsPipeline
=
iIdxBizJgTechParamsPipelineService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
return
BeanUtil
.
copyProperties
(
techParamsPipeline
,
TechParamsPipelineChangeFieldDto
.
class
);
case
KYSD:
// 客运索道
IdxBizJgTechParamsRopeway
techParamsRopeway
=
iIdxBizJgTechParamsRopewayService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
return
BeanUtil
.
copyProperties
(
techParamsRopeway
,
TechParamsRopewayChangeFieldDto
.
class
);
default
:
break
;
}
return
null
;
}
void
updateTechParamInfo
(
EquipRegisterChangeDataDto
equipRegisterChangeDataDto
,
String
record
,
Map
<
String
,
Object
>
changeData
,
List
<
ChangeDataDto
>
allChange
)
{
EquipmentClassifityEnum
equipmentClassifityEnum
=
EquipmentClassifityEnum
.
getOne
(
equipRegisterChangeDataDto
.
getEquList
());
switch
(
Objects
.
requireNonNull
(
equipmentClassifityEnum
))
{
case
GL:
// 锅炉
TechParamsBoilerChangeFieldDto
newBoiler
=
getTechParamsBoilerChangeField
(
changeData
);
TechParamsBoilerChangeFieldDto
oldBoiler
=
getTechParamsBoilerChangeField
(
record
);
// 字段行转列
List
<
ChangeDataDto
>
boilerChangeDataNew
=
this
.
convertBeanField2Column2
(
newBoiler
,
record
);
List
<
ChangeDataDto
>
boilerChangeDataOld
=
this
.
convertBeanField2Column2
(
oldBoiler
,
record
);
// 比对
List
<
ChangeDataDto
>
boilerChangeFields
=
this
.
mergeChangeFields
(
boilerChangeDataNew
,
boilerChangeDataOld
);
// 业务处理
equipChangeDataUpdateService
.
updateTechParamByRecord
(
this
.
buildTableName
(
TechParamsBoilerChangeFieldDto
.
class
),
record
,
boilerChangeFields
);
// 日志数据记录
allChange
.
addAll
(
boilerChangeDataNew
);
break
;
case
YLRQ:
// 压力容器
TechParamsVesselChangeFieldDto
newVessel
=
new
TechParamsVesselChangeFieldDto
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
changeData
)),
newVessel
,
true
);
IdxBizJgTechParamsVessel
techParamsVessel
=
iIdxBizJgTechParamsVesselService
.
getOneData
(
record
);
TechParamsVesselChangeFieldDto
oldVessel
=
BeanUtil
.
copyProperties
(
techParamsVessel
,
TechParamsVesselChangeFieldDto
.
class
);
// 字段行转列
List
<
ChangeDataDto
>
newVesselChangeData
=
this
.
convertBeanField2Column2
(
newVessel
,
record
);
List
<
ChangeDataDto
>
oldVesselChangeData
=
this
.
convertBeanField2Column2
(
oldVessel
,
record
);
// 比对
List
<
ChangeDataDto
>
vesselChangeFields
=
this
.
mergeChangeFields
(
newVesselChangeData
,
oldVesselChangeData
);
// 业务处理
equipChangeDataUpdateService
.
updateTechParamByRecord
(
this
.
buildTableName
(
TechParamsVesselChangeFieldDto
.
class
),
record
,
vesselChangeFields
);
// 日志数据记录
allChange
.
addAll
(
vesselChangeFields
);
break
;
case
DT:
// 电梯
TechParamsElevatorChangeFieldDto
newElevator
=
new
TechParamsElevatorChangeFieldDto
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
changeData
)),
newElevator
,
true
);
IdxBizJgTechParamsElevator
techParamsElevator
=
iIdxBizJgTechParamsElevatorService
.
getOneData
(
record
);
TechParamsElevatorChangeFieldDto
oldElevator
=
BeanUtil
.
copyProperties
(
techParamsElevator
,
TechParamsElevatorChangeFieldDto
.
class
);
// 字段行转列
List
<
ChangeDataDto
>
newElevatorChangeData
=
this
.
convertBeanField2Column2
(
newElevator
,
record
);
List
<
ChangeDataDto
>
oldElevatorChangeData
=
this
.
convertBeanField2Column2
(
oldElevator
,
record
);
// 比对
List
<
ChangeDataDto
>
elevatorChangeFields
=
this
.
mergeChangeFields
(
newElevatorChangeData
,
oldElevatorChangeData
);
// 业务处理
equipChangeDataUpdateService
.
updateTechParamByRecord
(
this
.
buildTableName
(
TechParamsElevatorChangeFieldDto
.
class
),
record
,
elevatorChangeFields
);
// 日志数据记录
allChange
.
addAll
(
elevatorChangeFields
);
break
;
case
QZJX:
// 起重机械
TechParamsLiftingChangeFieldDto
newLifting
=
new
TechParamsLiftingChangeFieldDto
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
changeData
)),
newLifting
,
true
);
IdxBizJgTechParamsLifting
techParamsLifting
=
iIdxBizJgTechParamsLiftingService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
TechParamsLiftingChangeFieldDto
oldLifting
=
BeanUtil
.
copyProperties
(
techParamsLifting
,
TechParamsLiftingChangeFieldDto
.
class
);
// 字段行转列
List
<
ChangeDataDto
>
newLiftingChangeData
=
this
.
convertBeanField2Column2
(
newLifting
,
record
);
List
<
ChangeDataDto
>
oldLiftingChangeData
=
this
.
convertBeanField2Column2
(
oldLifting
,
record
);
// 比对
List
<
ChangeDataDto
>
liftingChangeFields
=
this
.
mergeChangeFields
(
newLiftingChangeData
,
oldLiftingChangeData
);
// 业务处理
equipChangeDataUpdateService
.
updateTechParamByRecord
(
this
.
buildTableName
(
TechParamsLiftingChangeFieldDto
.
class
),
record
,
liftingChangeFields
);
// 日志数据记录
allChange
.
addAll
(
liftingChangeFields
);
break
;
case
CC:
// 场(厂)内专用机动车辆
TechParamsVehicleChangeFieldDto
newVehicle
=
new
TechParamsVehicleChangeFieldDto
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
changeData
)),
newVehicle
,
true
);
IdxBizJgTechParamsVehicle
techParamsVehicle
=
iIdxBizJgTechParamsVehicleService
.
getOneData
(
record
);
TechParamsVehicleChangeFieldDto
oldVehicle
=
BeanUtil
.
copyProperties
(
techParamsVehicle
,
TechParamsVehicleChangeFieldDto
.
class
);
// 字段行转列
List
<
ChangeDataDto
>
newVehicleChangeData
=
this
.
convertBeanField2Column2
(
newVehicle
,
record
);
List
<
ChangeDataDto
>
oldVehicleChangeData
=
this
.
convertBeanField2Column2
(
oldVehicle
,
record
);
// 比对
List
<
ChangeDataDto
>
vehicleChangeFields
=
this
.
mergeChangeFields
(
newVehicleChangeData
,
oldVehicleChangeData
);
// 业务处理
equipChangeDataUpdateService
.
updateTechParamByRecord
(
this
.
buildTableName
(
TechParamsVehicleChangeFieldDto
.
class
),
record
,
vehicleChangeFields
);
// 日志数据记录
allChange
.
addAll
(
vehicleChangeFields
);
break
;
case
YLSS:
// 大型游乐设施
TechParamsRidesChangeFieldDto
newRides
=
new
TechParamsRidesChangeFieldDto
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
changeData
)),
newRides
,
true
);
IdxBizJgTechParamsRides
techParamsRides
=
iIdxBizJgTechParamsRidesService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
TechParamsRidesChangeFieldDto
oldRides
=
BeanUtil
.
copyProperties
(
techParamsRides
,
TechParamsRidesChangeFieldDto
.
class
);
// 字段行转列
List
<
ChangeDataDto
>
newRidesChangeData
=
this
.
convertBeanField2Column2
(
newRides
,
record
);
List
<
ChangeDataDto
>
oldRidesChangeData
=
this
.
convertBeanField2Column2
(
oldRides
,
record
);
// 比对
List
<
ChangeDataDto
>
ridesChangeFields
=
this
.
mergeChangeFields
(
newRidesChangeData
,
oldRidesChangeData
);
// 业务处理
equipChangeDataUpdateService
.
updateTechParamByRecord
(
this
.
buildTableName
(
TechParamsRidesChangeFieldDto
.
class
),
record
,
ridesChangeFields
);
// 日志数据记录
allChange
.
addAll
(
ridesChangeFields
);
break
;
case
YLGD:
// 压力管道
TechParamsPipelineChangeFieldDto
newPipeline
=
new
TechParamsPipelineChangeFieldDto
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
changeData
)),
newPipeline
,
true
);
savePieLineTechParam
(
record
,
allChange
,
newPipeline
);
break
;
case
KYSD:
// 客运索道
TechParamsRopewayChangeFieldDto
newRopeway
=
new
TechParamsRopewayChangeFieldDto
();
BeanUtil
.
copyProperties
(
JSON
.
parse
(
JSONObject
.
toJSONString
(
changeData
)),
newRopeway
,
true
);
IdxBizJgTechParamsRopeway
techParamsRopeway
=
iIdxBizJgTechParamsRopewayService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
TechParamsRopewayChangeFieldDto
oldRopeway
=
BeanUtil
.
copyProperties
(
techParamsRopeway
,
TechParamsRopewayChangeFieldDto
.
class
);
// 字段行转列
List
<
ChangeDataDto
>
newRopewayChangeData
=
this
.
convertBeanField2Column2
(
newRopeway
,
record
);
List
<
ChangeDataDto
>
oldRopewayChangeData
=
this
.
convertBeanField2Column2
(
oldRopeway
,
record
);
// 比对
List
<
ChangeDataDto
>
ropewayChangeFields
=
this
.
mergeChangeFields
(
newRopewayChangeData
,
oldRopewayChangeData
);
// 业务处理
equipChangeDataUpdateService
.
updateTechParamByRecord
(
this
.
buildTableName
(
TechParamsRopewayChangeFieldDto
.
class
),
record
,
ropewayChangeFields
);
// 日志数据记录
allChange
.
addAll
(
ropewayChangeFields
);
break
;
default
:
break
;
}
}
public
void
savePieLineTechParam
(
String
record
,
List
<
ChangeDataDto
>
allChange
,
TechParamsPipelineChangeFieldDto
newPipeline
)
{
IdxBizJgTechParamsPipeline
techParamsPipeline
=
iIdxBizJgTechParamsPipelineService
.
getOneData
(
record
);
// 技术参数对象转换为全部技术参数 ,其他无用字段去掉
TechParamsPipelineChangeFieldDto
oldPipeline
=
BeanUtil
.
copyProperties
(
techParamsPipeline
,
TechParamsPipelineChangeFieldDto
.
class
);
// 字段行转列
List
<
ChangeDataDto
>
newPipelineChangeData
=
this
.
convertBeanField2Column2
(
newPipeline
,
record
);
List
<
ChangeDataDto
>
oldPipelineChangeData
=
this
.
convertBeanField2Column2
(
oldPipeline
,
record
);
// 比对
List
<
ChangeDataDto
>
pipelineChangeFields
=
this
.
mergeChangeFields
(
newPipelineChangeData
,
oldPipelineChangeData
);
// 业务处理
equipChangeDataUpdateService
.
updateTechParamByRecord
(
this
.
buildTableName
(
TechParamsPipelineChangeFieldDto
.
class
),
record
,
pipelineChangeFields
);
// 日志数据记录
allChange
.
addAll
(
pipelineChangeFields
);
}
public
List
<
ChangeDataDto
>
convertBeanField2Column2
(
Object
beanData
,
String
changeId
)
{
List
<
ChangeDataDto
>
changeData
=
new
ArrayList
<>();
Group
group
=
beanData
.
getClass
().
getAnnotation
(
Group
.
class
);
Field
[]
fields
=
beanData
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
field
.
setAccessible
(
true
);
FieldDisplayDefine
displayDefine
=
field
.
getAnnotation
(
FieldDisplayDefine
.
class
);
try
{
if
(
displayDefine
!=
null
&&
displayDefine
.
isExist
())
{
String
fieldName
=
displayDefine
.
value
();
ChangeDataDto
changeDataDto
=
new
ChangeDataDto
();
changeDataDto
.
setColumnKey
(
field
.
getName
());
changeDataDto
.
setColumnFamily
(
group
.
value
());
changeDataDto
.
setColumnLabel
(
fieldName
);
changeDataDto
.
setChangeId
(
changeId
);
Object
oV
=
field
.
get
(
beanData
);
if
(
oV
instanceof
String
)
{
String
value
=
(
String
)
field
.
get
(
beanData
);
changeDataDto
.
setColumnNewValue
(
value
);
changeDataDto
.
setColumnOldValue
(
value
);
}
else
if
(
oV
instanceof
Number
)
{
String
value
=
String
.
valueOf
(
field
.
get
(
beanData
));
changeDataDto
.
setColumnNewValue
(
value
);
changeDataDto
.
setColumnOldValue
(
value
);
}
changeData
.
add
(
changeDataDto
);
}
}
catch
(
IllegalAccessException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
return
changeData
;
}
public
List
<
ChangeDataDto
>
buildDesignInfoNew
(
Object
changeDataDto
,
String
record
)
{
return
this
.
convertBeanField2Column2
(
changeDataDto
,
record
);
}
private
List
<
ChangeDataDto
>
buildFactoryInfoNew
(
EquipFactoryChangeDataDto
changeDataDto
,
String
record
)
{
return
this
.
convertBeanField2Column2
(
changeDataDto
,
record
);
}
private
List
<
ChangeDataDto
>
buildRegisterInfoNew
(
EquipRegisterChangeDataDto
changeDataDto
,
String
record
)
{
return
this
.
convertBeanField2Column2
(
changeDataDto
,
record
);
}
public
List
<
ChangeDataDto
>
buildDesignInfoOld
(
String
record
)
{
EquipDesignChangeDataDto
changeDataDto
=
new
EquipDesignChangeDataDto
();
IdxBizJgDesignInfo
designInfo
=
idxBizJgDesignInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgDesignInfo
>().
eq
(
IdxBizJgDesignInfo:
:
getRecord
,
record
));
BeanUtil
.
copyProperties
(
designInfo
,
changeDataDto
);
changeDataDto
.
setDesignDate
(
DateUtil
.
formatDate
(
designInfo
.
getDesignDate
()));
return
this
.
convertBeanField2Column2
(
changeDataDto
,
record
);
}
private
List
<
ChangeDataDto
>
buildFactoryInfoOld
(
String
record
)
{
EquipFactoryChangeDataDto
changeDataDto
=
new
EquipFactoryChangeDataDto
();
IdxBizJgFactoryInfo
factoryInfo
=
jgFactoryInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgFactoryInfo
>().
eq
(
IdxBizJgFactoryInfo:
:
getRecord
,
record
));
BeanUtil
.
copyProperties
(
factoryInfo
,
changeDataDto
);
changeDataDto
.
setProduceDate
(
DateUtil
.
formatDate
(
factoryInfo
.
getProduceDate
()));
return
this
.
convertBeanField2Column2
(
changeDataDto
,
record
);
}
private
List
<
ChangeDataDto
>
buildRegisterInfoOld
(
String
record
)
{
EquipRegisterChangeDataDto
changeDataDto
=
new
EquipRegisterChangeDataDto
();
IdxBizJgRegisterInfo
registerInfo
=
idxBizJgRegisterInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgRegisterInfo
>().
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
record
));
BeanUtil
.
copyProperties
(
registerInfo
,
changeDataDto
);
return
this
.
convertBeanField2Column2
(
changeDataDto
,
record
);
}
private
List
<
ChangeDataDto
>
buildUseInfoOld
(
String
record
)
{
EquipUseInfoChangeDataDto
changeDataDto
=
new
EquipUseInfoChangeDataDto
();
IdxBizJgUseInfo
useInfo
=
idxBizJgUseInfoService
.
getOneData
(
record
);
BeanUtil
.
copyProperties
(
useInfo
,
changeDataDto
);
return
this
.
convertBeanField2Column2
(
changeDataDto
,
record
);
}
Map
<
String
,
Object
>
cast2UnderCase
(
Map
<
String
,
Object
>
re
)
{
// 由于历史遗留问题,和前端保存统一,要转成大写下滑线驼峰
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
re
.
forEach
((
k
,
v
)
->
{
result
.
put
(
CharSequenceUtil
.
toUnderlineCase
(
k
).
toUpperCase
(),
v
);
});
return
result
;
}
void
castJsonFields
(
Map
<
String
,
Object
>
re
)
{
jsonFields
.
forEach
(
field
->
{
if
(
re
.
containsKey
(
field
)
&&
re
.
get
(
field
)
instanceof
String
)
{
re
.
put
(
field
,
JSON
.
parse
((
String
)
re
.
get
(
field
)));
}
});
}
EquipDesignChangeDataDto
buildDesignInfo
(
String
record
)
{
EquipDesignChangeDataDto
changeDataDto
=
new
EquipDesignChangeDataDto
();
IdxBizJgDesignInfo
designInfo
=
idxBizJgDesignInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgDesignInfo
>().
eq
(
IdxBizJgDesignInfo:
:
getRecord
,
record
));
BeanUtil
.
copyProperties
(
designInfo
,
changeDataDto
);
changeDataDto
.
setDesignDate
(
DateUtil
.
formatDate
(
designInfo
.
getDesignDate
()));
return
changeDataDto
;
}
EquipFactoryChangeDataDto
buildFactoryInfo
(
String
record
)
{
EquipFactoryChangeDataDto
changeDataDto
=
new
EquipFactoryChangeDataDto
();
IdxBizJgFactoryInfo
factoryInfo
=
jgFactoryInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgFactoryInfo
>().
eq
(
IdxBizJgFactoryInfo:
:
getRecord
,
record
));
BeanUtil
.
copyProperties
(
factoryInfo
,
changeDataDto
);
changeDataDto
.
setProduceDate
(
DateUtil
.
formatDate
(
factoryInfo
.
getProduceDate
()));
return
changeDataDto
;
}
EquipRegisterChangeDataDto
buildRegisterInfo
(
String
record
)
{
EquipRegisterChangeDataDto
changeDataDto
=
new
EquipRegisterChangeDataDto
();
IdxBizJgRegisterInfo
registerInfo
=
idxBizJgRegisterInfoMapper
.
selectOne
(
new
LambdaQueryWrapper
<
IdxBizJgRegisterInfo
>().
eq
(
IdxBizJgRegisterInfo:
:
getRecord
,
record
));
BeanUtil
.
copyProperties
(
registerInfo
,
changeDataDto
);
return
changeDataDto
;
}
EquipUseInfoChangeDataDto
buildUseInfo
(
String
record
)
{
EquipUseInfoChangeDataDto
changeDataDto
=
new
EquipUseInfoChangeDataDto
();
IdxBizJgUseInfo
useInfo
=
idxBizJgUseInfoService
.
getOneData
(
record
);
BeanUtil
.
copyProperties
(
useInfo
,
changeDataDto
);
return
changeDataDto
;
}
}
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/IdxBizJgRegisterInfoServiceImpl.java
View file @
0d10d721
...
...
@@ -157,7 +157,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private
static
final
String
EQUIP_MAINPARTS_FORM_ID
=
"mainParts"
;
// 安全附件
private
static
final
String
EQUIP_PROTECTIONDEVICES_FORM_ID
=
"protectionDevices"
;
p
rivate
static
final
String
EQUSTATE
=
"EQU_STATE"
;
p
ublic
static
final
String
EQUSTATE
=
"EQU_STATE"
;
private
static
final
String
CONSTRUCTIONTYPE
=
"CONSTRUCTION_TYPE"
;
// 新增修改标识
private
static
final
String
OPERATESAVE
=
"save"
;
...
...
@@ -172,12 +172,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private
static
final
String
RECORD
=
"RECORD"
;
private
static
final
String
MANAGE_TYPE
=
"manageType"
;
// 设备代码
p
rivate
static
final
String
EQU_CODE
=
"EQU_CODE"
;
p
ublic
static
final
String
EQU_CODE
=
"EQU_CODE"
;
// 96333识别码
private
static
final
String
CODE96333
=
"CODE96333"
;
private
static
final
String
SEQUENCE_NBR
=
"SEQUENCE_NBR"
;
private
static
final
String
OTHERINFO_SEQ
=
"OTHERINFO_SEQ"
;
p
rivate
static
final
String
FACTORY_NUM
=
"FACTORY_NUM"
;
p
ublic
static
final
String
FACTORY_NUM
=
"FACTORY_NUM"
;
// 新增设备是否复制而来
private
static
final
String
IS_COPY
=
"isCopy"
;
private
static
final
String
ATTACHMENT_UPLOAD
=
"attachmentUpload"
;
...
...
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/JgBizChangeLogServiceImpl.java
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ESDataChangeLogDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgBizChangeLogDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgBizChangeLog
;
...
...
@@ -11,6 +12,7 @@ import org.springframework.stereotype.Service;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
java.util.List
;
import
java.util.Set
;
/**
* 服务实现类
...
...
@@ -34,4 +36,9 @@ public class JgBizChangeLogServiceImpl extends BaseService<JgBizChangeLogDto, Jg
esDataChangeLogDao
.
saveAll
(
esDataChangeLogDtos
);
}
}
@Override
public
IPage
<?>
queryPageListByChangeIds
(
Set
<
String
>
changeIds
)
{
return
null
;
}
}
\ 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/service/impl/JgUseRegistrationServiceImpl.java
View file @
0d10d721
...
...
@@ -63,6 +63,7 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import
com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO
;
import
com.yeejoin.amos.feign.workflow.model.TaskResultDTO
;
import
io.seata.spring.annotation.GlobalTransactional
;
import
lombok.Getter
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.compress.utils.Lists
;
...
...
@@ -121,6 +122,7 @@ import static java.util.stream.Collectors.toSet;
*/
@Service
@Slf4j
@Getter
public
class
JgUseRegistrationServiceImpl
extends
BaseService
<
JgUseRegistrationDto
,
JgUseRegistration
,
JgUseRegistrationMapper
>
implements
IJgUseRegistrationService
,
ICompensateFlowDataOfRedis
<
JgUseRegistration
>,
ApplicationContextAware
{
private
static
final
String
DEFINITION_KEY
=
"useRegistration"
;
...
...
@@ -242,6 +244,9 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
@Autowired
private
CommonMapper
commonMapper
;
@Autowired
private
IdxBizJgInspectionDetectionInfoServiceImpl
inspectionDetectionInfoService
;
/**
* @param auditPassDate 通过时间
...
...
@@ -2383,7 +2388,7 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
return
record
;
}
p
rivate
Map
<
String
,
Object
>
getInspectDetail
(
String
record
)
{
p
ublic
Map
<
String
,
Object
>
getInspectDetail
(
String
record
)
{
// 去掉约束
return
this
.
baseMapper
.
getInspectDetail
(
record
,
null
);
}
...
...
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/SingleDataChangeProcessStrategy.java
deleted
100644 → 0
View file @
41b6903e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.module.jg.api.dto.*
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistration
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationEq
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationEqMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgUseRegistrationManageMapper
;
import
com.yeejoin.amos.boot.module.jg.api.service.IBizDataChangeHandleStrategy
;
import
com.yeejoin.amos.boot.module.jg.biz.service.*
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.FlowStatusEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.*
;
/**
* 单个维护使用登记策略实现类
*/
@Component
public
class
SingleDataChangeProcessStrategy
implements
IChangeDataProcessStrategy
{
private
final
JgUseRegistrationServiceImpl
useRegistrationService
;
private
final
JgUseRegistrationEqMapper
jgRelationEquipMapper
;
private
final
CommonEquipDataProcessService
commonEquipDataProcessService
;
private
final
JgUseRegistrationManageMapper
registrationManageMapper
;
private
final
EquipmentCategoryMapper
equipmentCategoryMapper
;
public
SingleDataChangeProcessStrategy
(
JgUseRegistrationServiceImpl
useRegistrationService
,
JgUseRegistrationEqMapper
jgRelationEquipMapper
,
CommonEquipDataProcessService
commonEquipDataProcessService
,
JgUseRegistrationManageMapper
registrationManageMapper
,
EquipmentCategoryMapper
equipmentCategoryMapper
)
{
this
.
useRegistrationService
=
useRegistrationService
;
this
.
jgRelationEquipMapper
=
jgRelationEquipMapper
;
this
.
commonEquipDataProcessService
=
commonEquipDataProcessService
;
this
.
registrationManageMapper
=
registrationManageMapper
;
this
.
equipmentCategoryMapper
=
equipmentCategoryMapper
;
}
@Override
public
List
<
ChangeDataDto
>
handle
(
Map
<
String
,
Object
>
changeData
,
String
defaultChangeId
)
{
String
record
=
this
.
getRecord
(
defaultChangeId
);
List
<
ChangeDataDto
>
allChangeColumns
=
new
ArrayList
<>();
// 新数据解析
EquipRegisterChangeDataDto
registerChangeDataDto
=
commonEquipDataProcessService
.
castMap2Bean
(
changeData
,
EquipRegisterChangeDataDto
.
class
);
EquipFactoryChangeDataDto
factoryChangeDataDto
=
commonEquipDataProcessService
.
castMap2Bean
(
changeData
,
EquipFactoryChangeDataDto
.
class
);
EquipDesignChangeDataDto
designChangeDataDto
=
commonEquipDataProcessService
.
castMap2Bean
(
changeData
,
EquipDesignChangeDataDto
.
class
);
EquipUseInfoChangeDataDto
useInfoChangeDataDto
=
commonEquipDataProcessService
.
castMap2Bean
(
changeData
,
EquipUseInfoChangeDataDto
.
class
);
commonEquipDataProcessService
.
buildChangeFields
(
record
,
designChangeDataDto
,
factoryChangeDataDto
,
registerChangeDataDto
,
null
,
useInfoChangeDataDto
,
allChangeColumns
);
// 前置校验
commonEquipDataProcessService
.
checkValidField
(
record
,
registerChangeDataDto
,
null
,
null
,
null
);
commonEquipDataProcessService
.
checkValidField
(
record
,
factoryChangeDataDto
,
registerChangeDataDto
.
getEquList
(),
registerChangeDataDto
.
getEquCategory
(),
registerChangeDataDto
.
getEquDefine
());
commonEquipDataProcessService
.
checkValidField
(
record
,
designChangeDataDto
,
registerChangeDataDto
.
getEquList
(),
registerChangeDataDto
.
getEquCategory
(),
registerChangeDataDto
.
getEquDefine
());
// 设备制造、设计、注册信息业务处理落库
commonEquipDataProcessService
.
dealBizDataForEquip
(
record
,
registerChangeDataDto
);
commonEquipDataProcessService
.
dealBizDataForEquip
(
record
,
factoryChangeDataDto
);
commonEquipDataProcessService
.
dealBizDataForEquip
(
record
,
designChangeDataDto
);
commonEquipDataProcessService
.
dealBizDataForEquip
(
record
,
useInfoChangeDataDto
);
// 设备技术参数入库处理
commonEquipDataProcessService
.
updateTechParamInfo
(
registerChangeDataDto
,
record
,
changeData
,
allChangeColumns
);
// 更新单据对应的证信息
this
.
updateManagerCertInfo
(
defaultChangeId
,
record
,
registerChangeDataDto
);
return
allChangeColumns
;
}
private
void
updateManagerCertInfo
(
String
applyNo
,
String
record
,
EquipRegisterChangeDataDto
registerChangeDataDto
)
{
JgUseRegistration
jgUseRegistration
=
useRegistrationService
.
getOne
(
new
LambdaQueryWrapper
<
JgUseRegistration
>()
.
eq
(
JgUseRegistration:
:
getApplyNo
,
applyNo
).
select
(
BaseEntity:
:
getSequenceNbr
,
JgUseRegistration:
:
getStatus
,
JgUseRegistration:
:
getUseRegistrationCode
));
if
(
FlowStatusEnum
.
TO_BE_FINISHED
.
getName
().
equals
(
jgUseRegistration
.
getStatus
()))
{
LambdaQueryWrapper
<
JgUseRegistrationManage
>
queryWrapper
=
new
LambdaQueryWrapper
<
JgUseRegistrationManage
>()
.
eq
(
JgUseRegistrationManage:
:
getUseRegistrationCode
,
jgUseRegistration
.
getUseRegistrationCode
())
.
eq
(
JgUseRegistrationManage:
:
getIsDelete
,
0
).
select
(
BaseEntity:
:
getSequenceNbr
,
JgUseRegistrationManage:
:
getVersion
);
JgUseRegistrationManage
jgUseRegistrationManage
=
registrationManageMapper
.
selectOne
(
queryWrapper
);
if
(
jgUseRegistrationManage
!=
null
&&
!
StringUtils
.
equals
(
jgUseRegistrationManage
.
getEquDefineCode
(),
registerChangeDataDto
.
getEquDefine
()))
{
LambdaUpdateWrapper
<
JgUseRegistrationManage
>
updateWrapper
=
new
LambdaUpdateWrapper
<>();
updateWrapper
.
eq
(
BaseEntity:
:
getSequenceNbr
,
jgUseRegistrationManage
.
getSequenceNbr
());
if
(
StringUtils
.
isNotEmpty
(
registerChangeDataDto
.
getEquDefine
()))
{
EquipmentCategory
equipmentCategory
=
getEquipmentCategory
(
registerChangeDataDto
);
updateWrapper
.
set
(
JgUseRegistrationManage:
:
getEquDefineCode
,
registerChangeDataDto
.
getEquDefine
());
updateWrapper
.
set
(
JgUseRegistrationManage:
:
getEquDefine
,
equipmentCategory
.
getName
());
}
else
{
updateWrapper
.
set
(
JgUseRegistrationManage:
:
getEquDefineCode
,
null
);
updateWrapper
.
set
(
JgUseRegistrationManage:
:
getEquDefine
,
null
);
}
updateWrapper
.
set
(
JgUseRegistrationManage:
:
getVersion
,
jgUseRegistrationManage
.
getVersion
()
+
1
);
updateWrapper
.
set
(
JgUseRegistrationManage:
:
getRecDate
,
new
Date
());
updateWrapper
.
set
(
JgUseRegistrationManage:
:
getChangeReason
,
"设备信息变更"
);
registrationManageMapper
.
update
(
null
,
updateWrapper
);
}
}
}
private
EquipmentCategory
getEquipmentCategory
(
EquipRegisterChangeDataDto
registerChangeDataDto
)
{
return
equipmentCategoryMapper
.
selectOne
(
new
LambdaQueryWrapper
<
EquipmentCategory
>().
eq
(
EquipmentCategory:
:
getCode
,
registerChangeDataDto
.
getEquDefine
()));
}
@Override
public
Map
<
String
,
Object
>
getDetail
(
String
applyNo
,
String
bizId
)
{
if
(
StringUtils
.
isEmpty
(
applyNo
)
&&
StringUtils
.
isEmpty
(
bizId
))
{
throw
new
BadRequest
(
"applyNo and bizId can't be empty"
);
}
if
(
StringUtils
.
isNotEmpty
(
applyNo
))
{
return
this
.
getDetailByApplyNo
(
applyNo
);
}
else
{
return
this
.
getDetailByBizId
(
bizId
);
}
}
private
Map
<
String
,
Object
>
getDetailByBizId
(
String
record
)
{
Map
<
String
,
Object
>
re
=
new
HashMap
<>();
// 注册信息(基本信息)构建
EquipRegisterChangeDataDto
equipRegisterChangeDataDto
=
commonEquipDataProcessService
.
buildRegisterInfo
(
record
);
// 制造信息构建
EquipFactoryChangeDataDto
factoryChangeDataDto
=
commonEquipDataProcessService
.
buildFactoryInfo
(
record
);
// 设计信息构建
EquipDesignChangeDataDto
designChangeDataDto
=
commonEquipDataProcessService
.
buildDesignInfo
(
record
);
// 技术参数构建
BaseTechParamsFieldDto
techParamsFieldDto
=
commonEquipDataProcessService
.
buildTechParamInfo
(
equipRegisterChangeDataDto
,
record
);
// 其他信息:目前为气瓶的信息化情况
EquipOtherInfoChangeDataDto
otherInfoChangeDataDto
=
commonEquipDataProcessService
.
buildOtherInfo
(
record
);
// 使用信息
EquipUseInfoChangeDataDto
equipUseInfoChangeDataDto
=
commonEquipDataProcessService
.
buildUseInfo
(
record
);
re
.
putAll
(
BeanUtil
.
beanToMap
(
equipRegisterChangeDataDto
));
re
.
putAll
(
BeanUtil
.
beanToMap
(
factoryChangeDataDto
));
re
.
putAll
(
BeanUtil
.
beanToMap
(
designChangeDataDto
));
re
.
putAll
(
BeanUtil
.
beanToMap
(
techParamsFieldDto
));
re
.
putAll
(
BeanUtil
.
beanToMap
(
otherInfoChangeDataDto
));
re
.
putAll
(
BeanUtil
.
beanToMap
(
equipUseInfoChangeDataDto
));
commonEquipDataProcessService
.
castJsonFields
(
re
);
return
commonEquipDataProcessService
.
cast2UnderCase
(
re
);
}
public
Map
<
String
,
Object
>
getDetailByApplyNo
(
String
bizId
)
{
String
record
=
this
.
getRecord
(
bizId
);
return
getDetailByBizId
(
record
);
}
public
String
getRecord
(
String
applyNo
)
{
JgUseRegistration
jgUseRegistration
=
useRegistrationService
.
getOne
(
new
LambdaQueryWrapper
<
JgUseRegistration
>()
.
eq
(
JgUseRegistration:
:
getApplyNo
,
applyNo
).
select
(
BaseEntity:
:
getSequenceNbr
));
LambdaQueryWrapper
<
JgUseRegistrationEq
>
eq
=
new
QueryWrapper
<
JgUseRegistrationEq
>().
lambda
()
.
eq
(
JgUseRegistrationEq:
:
getEquipTransferId
,
jgUseRegistration
.
getSequenceNbr
())
.
eq
(
JgUseRegistrationEq:
:
getIsDelete
,
false
).
select
(
JgUseRegistrationEq:
:
getEquId
);
JgUseRegistrationEq
jgUseRegistrationEq
=
jgRelationEquipMapper
.
selectOne
(
eq
);
return
jgUseRegistrationEq
.
getEquId
();
}
@Override
public
IBizDataChangeHandleStrategy
.
ModelType
canHandleMode
()
{
return
IBizDataChangeHandleStrategy
.
ModelType
.
single
;
}
}
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/SingleManageEquipEditHandleImpl.java
View file @
0d10d721
...
...
@@ -2,8 +2,8 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
com.yeejoin.amos.boot.module.jg.api.dto.*
;
import
com.yeejoin.amos.boot.module.jg.
api.service.IBizDataChangeHandleStrategy
;
import
com.yeejoin.amos.boot.module.jg.biz.e
vent.ChangeDataEvent
;
import
com.yeejoin.amos.boot.module.jg.
biz.edit.event.BaseBizDataChangeEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.e
dit.process.equip.CommonEquipDataProcessService
;
import
com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Component
;
...
...
@@ -17,18 +17,14 @@ import java.util.Map;
@Component
@RequiredArgsConstructor
public
class
SingleManageEquipEditHandleImpl
implements
IBizDataChangeHandleStrategy
{
public
class
SingleManageEquipEditHandleImpl
{
private
final
CommonEquipDataProcessService
commonEquipDataProcessService
;
private
final
EventPublisher
publisher
;
@Override
public
String
canHandleBizType
()
{
return
"singleManageEquipEdit"
;
}
public
static
final
String
BIZ_TYPE
=
"singleManageEquipEdit"
;
@Override
public
Map
<
String
,
?>
getDetail
(
String
applyNo
,
ModelType
model
,
String
bizId
)
{
public
Map
<
String
,
?>
getDetail
(
String
applyNo
,
String
bizId
)
{
return
this
.
getDetailByBizId
(
bizId
);
}
...
...
@@ -50,10 +46,10 @@ public class SingleManageEquipEditHandleImpl implements IBizDataChangeHandleStra
return
commonEquipDataProcessService
.
cast2UnderCase
(
re
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
doSave
(
String
record
,
M
odelType
model
,
M
ap
<
String
,
Object
>
changeData
)
{
List
<
ChangeDataDto
>
allChangeColumns
=
this
.
update
(
record
,
changeData
);
public
void
doSave
(
String
record
,
Map
<
String
,
Object
>
changeData
)
{
List
<
FieldChangeMeta
>
allChangeColumns
=
this
.
update
(
record
,
changeData
);
// 记录流水
if
(!
allChangeColumns
.
isEmpty
())
{
// 更新历史的JSON的数据
...
...
@@ -63,16 +59,17 @@ public class SingleManageEquipEditHandleImpl implements IBizDataChangeHandleStra
}
}
private
void
publishEvent2Logger
(
String
record
,
List
<
ChangeDataDto
>
allChangeColumns
)
{
private
void
publishEvent2Logger
(
String
record
,
List
<
FieldChangeMeta
>
allChangeColumns
)
{
BizRelationDataDto
relationDataDto
=
new
BizRelationDataDto
();
relationDataDto
.
setBizId
(
record
);
relationDataDto
.
setBizType
(
canHandleBizType
()
);
relationDataDto
.
setBizType
(
BIZ_TYPE
);
// 异步记录日志
publisher
.
publish
(
new
ChangeData
Event
(
this
,
relationDataDto
,
allChangeColumns
,
RequestContext
.
cloneRequestContext
()));
publisher
.
publish
(
new
BaseBizDataChange
Event
(
this
,
relationDataDto
,
allChangeColumns
,
RequestContext
.
cloneRequestContext
()));
}
private
List
<
ChangeDataDto
>
update
(
String
record
,
Map
<
String
,
Object
>
changeData
)
{
List
<
ChangeDataDto
>
allChangeColumns
=
new
ArrayList
<>();
private
List
<
FieldChangeMeta
>
update
(
String
record
,
Map
<
String
,
Object
>
changeData
)
{
List
<
FieldChangeMeta
>
allChangeColumns
=
new
ArrayList
<>();
// 新数据解析
EquipRegisterChangeDataDto
registerChangeDataDto
=
commonEquipDataProcessService
.
castMap2Bean
(
changeData
,
EquipRegisterChangeDataDto
.
class
);
EquipFactoryChangeDataDto
factoryChangeDataDto
=
commonEquipDataProcessService
.
castMap2Bean
(
changeData
,
EquipFactoryChangeDataDto
.
class
);
...
...
@@ -92,7 +89,7 @@ public class SingleManageEquipEditHandleImpl implements IBizDataChangeHandleStra
}
private
void
buildLogData
(
List
<
ChangeDataDto
>
allChangeColumns
)
{
private
void
buildLogData
(
List
<
FieldChangeMeta
>
allChangeColumns
)
{
allChangeColumns
.
forEach
(
column
->
{
column
.
setBizType
(
"监管端编辑设备信息"
);
});
...
...
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/UseRegisterDataChangeHandleImpl.java
deleted
100644 → 0
View file @
41b6903e
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
import
com.yeejoin.amos.boot.module.jg.api.dto.BizRelationDataDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ChangeDataDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationEqDto
;
import
com.yeejoin.amos.boot.module.jg.api.service.IBizDataChangeHandleStrategy
;
import
com.yeejoin.amos.boot.module.jg.biz.context.DataProcessStrategyContext
;
import
com.yeejoin.amos.boot.module.jg.biz.event.ChangeDataEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IChangeDataProcessStrategy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Service
public
class
UseRegisterDataChangeHandleImpl
implements
IBizDataChangeHandleStrategy
{
private
final
EventPublisher
publisher
;
private
final
UseRegisterUpdateService
useRegisterUpdateService
;
public
final
static
String
BIZ_TYPE
=
"useRegister"
;
public
UseRegisterDataChangeHandleImpl
(
EventPublisher
publisher
,
UseRegisterUpdateService
useRegisterUpdateService
)
{
this
.
publisher
=
publisher
;
this
.
useRegisterUpdateService
=
useRegisterUpdateService
;
}
@Override
public
String
canHandleBizType
()
{
return
BIZ_TYPE
;
}
/**
* 保存
*
* @param applyNo 单据编号
* @param model single, batch
* @param changeData 前端不支持分组-目前为平铺数据结构
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
doSave
(
String
applyNo
,
ModelType
model
,
Map
<
String
,
Object
>
changeData
)
{
// 选择是台套、还是单位办理的方式,进行分类数据的解析
IChangeDataProcessStrategy
dataProcessor
=
DataProcessStrategyContext
.
getStrategy
(
model
);
List
<
ChangeDataDto
>
allChangeColumns
=
dataProcessor
.
handle
(
changeData
,
applyNo
);
if
(!
allChangeColumns
.
isEmpty
())
{
// 更新历史的JSON的数据
this
.
updateHistoryJson
(
applyNo
);
this
.
buildLogData
(
allChangeColumns
);
publishEvent2Logger
(
applyNo
,
allChangeColumns
);
}
}
private
void
publishEvent2Logger
(
String
applyNo
,
List
<
ChangeDataDto
>
allChangeColumns
)
{
List
<
JgUseRegistrationEqDto
>
eqDtos
=
useRegisterUpdateService
.
useRegistrationEqService
.
getBaseMapper
().
queryEqListByApplyNo
(
applyNo
);
BizRelationDataDto
bizRelationDataDto
=
new
BizRelationDataDto
();
bizRelationDataDto
.
setBizId
(
applyNo
);
bizRelationDataDto
.
setBizType
(
canHandleBizType
());
bizRelationDataDto
.
setRecords
(
eqDtos
.
stream
().
map
(
JgUseRegistrationEqDto:
:
getEquId
).
collect
(
Collectors
.
toSet
()));
// 异步记录日志
publisher
.
publish
(
new
ChangeDataEvent
(
this
,
bizRelationDataDto
,
allChangeColumns
,
RequestContext
.
cloneRequestContext
()));
}
private
void
updateHistoryJson
(
String
applyNo
)
{
useRegisterUpdateService
.
updateHisData
(
applyNo
);
}
private
void
buildLogData
(
List
<
ChangeDataDto
>
allChangeColumns
)
{
allChangeColumns
.
forEach
(
column
->
{
column
.
setBizType
(
"使用登记"
);
});
}
@Override
public
Map
<
String
,
?>
getDetail
(
String
applyNo
,
ModelType
model
,
String
bizId
)
{
IChangeDataProcessStrategy
dataProcessor
=
DataProcessStrategyContext
.
getStrategy
(
model
);
// 兼容:台套类打开变更详情(使用applyNo) 和 单位办理批量时选择单个设备打开详情(使用record)
return
dataProcessor
.
getDetail
(
applyNo
,
bizId
);
}
}
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/entity/IdxBizJgConstructionInfo.java
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ymt
.
api
.
entity
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine
;
import
com.yeejoin.amos.boot.biz.common.annotation.Group
;
import
com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity
;
import
com.yeejoin.amos.boot.module.common.api.dto.IBaseChangeData
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
/**
...
...
@@ -19,56 +23,58 @@ import java.util.Date;
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"idx_biz_jg_construction_info"
)
public
class
IdxBizJgConstructionInfo
extends
TzsBaseEntity
{
@Group
(
"idx_biz_jg_construction_info"
)
public
class
IdxBizJgConstructionInfo
extends
TzsBaseEntity
implements
IBaseChangeData
{
/**
*
*/
@TableField
(
"\"RECORD\""
)
@TableField
(
"\"RECORD\""
)
private
String
record
;
/**
*
*/
@TableField
(
"\"INSTANCE_ID\""
)
@TableField
(
"\"INSTANCE_ID\""
)
private
String
instanceId
;
/**
*
*/
@TableField
(
"\"STATUS\""
)
@TableField
(
"\"STATUS\""
)
private
String
status
;
/**
*
*/
@TableField
(
"\"CONSTRUCTION_TYPE\""
)
@TableField
(
"\"CONSTRUCTION_TYPE\""
)
private
String
constructionType
;
/**
*
*/
@TableField
(
"\"USC_UNIT_CREDIT_CODE\""
)
@TableField
(
"\"USC_UNIT_CREDIT_CODE\""
)
private
String
uscUnitCreditCode
;
/**
* 施工单位名称
*/
@TableField
(
"\"USC_UNIT_NAME\""
)
@TableField
(
"\"USC_UNIT_NAME\""
)
@FieldDisplayDefine
(
value
=
"施工单位名称"
)
private
String
uscUnitName
;
/**
* 施工
时间
* 施工
日期
*/
@TableField
(
"\"USC_DATE\""
)
@TableField
(
"\"USC_DATE\""
)
@FieldDisplayDefine
(
value
=
"施工日期"
)
private
Date
uscDate
;
/**
*
*/
@TableField
(
"\"SEQUENCE_CODE\""
)
@TableField
(
"\"SEQUENCE_CODE\""
)
private
String
sequenceCode
;
@TableField
(
exist
=
false
)
...
...
@@ -98,31 +104,35 @@ public class IdxBizJgConstructionInfo extends TzsBaseEntity {
* 施工负责人
*/
@TableField
(
value
=
"\"CONSTRUCTION_LEADER_NAME\""
)
@FieldDisplayDefine
(
value
=
"施工负责人"
)
private
String
constructionLeaderName
;
/**
* 施工负责人手机
*/
@TableField
(
value
=
"\"CONSTRUCTION_LEADER_PHONE\""
)
@FieldDisplayDefine
(
value
=
"施工负责人手机"
)
private
String
constructionLeaderPhone
;
/**
* 施工委托书
图片
* 施工委托书
附件
*/
@TableField
(
value
=
"\"PROXY_STATEMENT_ATTACHMENT\""
)
@FieldDisplayDefine
(
value
=
"施工委托书附件"
,
type
=
JSON
.
class
)
private
String
proxyStatementAttachment
;
/**
* 施工合同照片
*/
@TableField
(
value
=
"\"CONSTRUCTION_CONTRACT_ATTACHMENT\""
)
@FieldDisplayDefine
(
value
=
"施工合同附件"
,
type
=
JSON
.
class
)
private
String
constructionContractAttachment
;
/**
* 其他附件
*/
@FieldDisplayDefine
(
value
=
"其他附件"
,
type
=
JSON
.
class
)
@TableField
(
value
=
"\"CONSTRUCTION_OTHER_ACCESSORIES\""
)
private
String
constructionOtherAccessories
;
}
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/entity/IdxBizJgFactoryInfo.java
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ymt
.
api
.
entity
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
...
...
@@ -7,6 +8,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine
;
import
com.yeejoin.amos.boot.biz.common.annotation.Group
;
import
com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
...
...
@@ -25,6 +28,7 @@ import java.util.Date;
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"idx_biz_jg_factory_info"
)
@Group
(
value
=
"idx_biz_jg_factory_info"
)
public
class
IdxBizJgFactoryInfo
extends
TzsBaseEntity
{
...
...
@@ -51,60 +55,70 @@ public class IdxBizJgFactoryInfo extends TzsBaseEntity {
*
*/
@TableField
(
"\"PRODUCE_UNIT_CREDIT_CODE\""
)
@FieldDisplayDefine
(
value
=
"制造单位统一社会信用代码"
)
private
String
produceUnitCreditCode
;
/**
*
*/
@TableField
(
"\"PRODUCE_UNIT_NAME\""
)
@FieldDisplayDefine
(
value
=
"制造单位名称"
)
private
String
produceUnitName
;
/**
*
*/
@TableField
(
"\"PRODUCE_LICENSE_NUM\""
)
@FieldDisplayDefine
(
value
=
"制造许可编号"
)
private
String
produceLicenseNum
;
/**
*
*/
@TableField
(
"\"FACTORY_NUM\""
)
@FieldDisplayDefine
(
value
=
"出厂编号/产品编号"
)
private
String
factoryNum
;
/**
*
*/
@TableField
(
"\"PRODUCE_DATE\""
)
@FieldDisplayDefine
(
value
=
"制造日期"
)
private
Date
produceDate
;
/**
*
*/
@TableField
(
"\"IMPORTED\""
)
@FieldDisplayDefine
(
value
=
"是否进口"
)
private
String
imported
;
/**
*
*/
@TableField
(
"\"PRODUCE_COUNTRY\""
)
@FieldDisplayDefine
(
value
=
"制造国"
)
private
String
produceCountry
;
/**
*
*/
@TableField
(
"\"FACTORY_STANDARD\""
)
@FieldDisplayDefine
(
value
=
"制造标准"
,
type
=
JSON
.
class
)
private
String
factoryStandard
;
/**
*
*/
@TableField
(
"\"PRODUCT_QUALITY_YIELD_PROVE\""
)
@FieldDisplayDefine
(
value
=
"产品质量合格证"
,
type
=
JSON
.
class
)
private
String
productQualityYieldProve
;
/**
*
*/
@TableField
(
"\"INS_USE_MAINTAIN_EXPLAIN\""
)
@FieldDisplayDefine
(
value
=
"安装及使用维护保养说明"
,
type
=
JSON
.
class
)
private
String
insUseMaintainExplain
;
/**
...
...
@@ -132,6 +146,7 @@ public class IdxBizJgFactoryInfo extends TzsBaseEntity {
* */
@TableField
(
value
=
"\"FACT_SUPERVISION_INSPECTION_REPORT\""
)
@FieldDisplayDefine
(
value
=
"制造监督检验报告"
,
type
=
JSON
.
class
)
private
String
factSupervisionInspectionReport
;
...
...
@@ -140,6 +155,7 @@ public class IdxBizJgFactoryInfo extends TzsBaseEntity {
*/
@TableField
(
value
=
"\"BOILER_ENERGY_EFFICIENCY_CERTIFICATE\""
)
@FieldDisplayDefine
(
value
=
"锅炉能效证明文件"
,
type
=
JSON
.
class
)
private
String
boilerEnergyEfficiencyCertificate
;
...
...
@@ -147,6 +163,7 @@ public class IdxBizJgFactoryInfo extends TzsBaseEntity {
* 资料是否完整齐全:1-齐全;2-不齐全【历史无证设备需要】
*/
@TableField
(
"\"FACTORY_IS_COMPLETE\""
)
@FieldDisplayDefine
(
value
=
"制造资料是否完整齐全"
)
private
String
factoryIsComplete
;
}
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/entity/IdxBizJgInspectionDetectionInfo.java
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ymt
.
api
.
entity
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine
;
import
com.yeejoin.amos.boot.biz.common.annotation.Group
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity
;
import
com.yeejoin.amos.boot.module.common.api.dto.IBaseChangeData
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
...
...
@@ -19,98 +23,107 @@ import java.util.Date;
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"idx_biz_jg_inspection_detection_info"
)
public
class
IdxBizJgInspectionDetectionInfo
extends
TzsBaseEntity
{
@Group
(
"idx_biz_jg_inspection_detection_info"
)
public
class
IdxBizJgInspectionDetectionInfo
extends
TzsBaseEntity
implements
IBaseChangeData
{
/**
*
*/
@TableField
(
"\"RECORD\""
)
@TableField
(
"\"RECORD\""
)
private
String
record
;
/**
*
*/
@TableField
(
"\"INSTANCE_ID\""
)
@TableField
(
"\"INSTANCE_ID\""
)
private
String
instanceId
;
/**
*
*/
@TableField
(
"\"STATUS\""
)
@TableField
(
"\"STATUS\""
)
private
String
status
;
/**
*
*/
@TableField
(
"\"INSPECT_TYPE\""
)
@TableField
(
"\"INSPECT_TYPE\""
)
@FieldDisplayDefine
(
value
=
"检验类型"
)
private
String
inspectType
;
/**
*
*/
@TableField
(
"\"INSPECT_ORG_CODE\""
)
@FieldDisplayDefine
(
value
=
"检验机构统一信用代码"
)
private
String
inspectOrgCode
;
/**
*
*/
@TableField
(
"\"INSPECT_ORG_NAME\""
)
@TableField
(
"\"INSPECT_ORG_NAME\""
)
@FieldDisplayDefine
(
value
=
"检验机构名称"
)
private
String
inspectOrgName
;
/**
*
*/
@TableField
(
"\"INSPECT_REPORT\""
)
@TableField
(
"\"INSPECT_REPORT\""
)
@FieldDisplayDefine
(
value
=
"检验报告"
,
type
=
JSON
.
class
)
private
String
inspectReport
;
/**
*
*/
@TableField
(
"\"INSPECT_STAFF\""
)
@TableField
(
"\"INSPECT_STAFF\""
)
private
String
inspectStaff
;
/**
*
*/
@TableField
(
"\"INSPECT_DATE\""
)
@TableField
(
"\"INSPECT_DATE\""
)
@FieldDisplayDefine
(
value
=
"检验日期"
)
private
Date
inspectDate
;
/**
*
*/
@TableField
(
"\"INSPECT_CONCLUSION\""
)
@TableField
(
"\"INSPECT_CONCLUSION\""
)
@FieldDisplayDefine
(
value
=
"检验结论"
)
private
String
inspectConclusion
;
/**
*
*/
@TableField
(
"\"SAFETY_LEVEL\""
)
@TableField
(
"\"SAFETY_LEVEL\""
)
private
String
safetyLevel
;
/**
*
*/
@TableField
(
"\"PROBLEM_REMARK\""
)
@TableField
(
"\"PROBLEM_REMARK\""
)
private
String
problemRemark
;
/**
*
*/
@TableField
(
"\"NEXT_INSPECT_DATE\""
)
@TableField
(
"\"NEXT_INSPECT_DATE\""
)
@FieldDisplayDefine
(
value
=
"下次检验日期"
)
private
Date
nextInspectDate
;
/**
*
*/
@TableField
(
"\"SEQUENCE_CODE\""
)
@TableField
(
"\"SEQUENCE_CODE\""
)
private
String
sequenceCode
;
/**
*
*/
@TableField
(
"\"INSPECT_REPORT_NO\""
)
@FieldDisplayDefine
(
value
=
"检验报告编号"
)
private
String
inspectReportNo
;
@TableField
(
exist
=
false
)
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/entity/IdxBizJgMaintenanceRecordInfo.java
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ymt
.
api
.
entity
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine
;
import
com.yeejoin.amos.boot.biz.common.annotation.Group
;
import
com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity
;
import
com.yeejoin.amos.boot.module.common.api.dto.IBaseChangeData
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
...
...
@@ -19,78 +23,87 @@ import java.util.Date;
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"idx_biz_jg_maintenance_record_info"
)
public
class
IdxBizJgMaintenanceRecordInfo
extends
TzsBaseEntity
{
@Group
(
"idx_biz_jg_maintenance_record_info"
)
public
class
IdxBizJgMaintenanceRecordInfo
extends
TzsBaseEntity
implements
IBaseChangeData
{
/**
*
*/
@TableField
(
"\"RECORD\""
)
@TableField
(
"\"RECORD\""
)
private
String
record
;
/**
*
*/
@TableField
(
"\"INSTANCE_ID\""
)
@TableField
(
"\"INSTANCE_ID\""
)
private
String
instanceId
;
/**
*
*/
@TableField
(
"\"STATUS\""
)
@TableField
(
"\"STATUS\""
)
private
String
status
;
/**
*
*/
@TableField
(
"\"ME_UNIT_CREDIT_CODE\""
)
@TableField
(
"\"ME_UNIT_CREDIT_CODE\""
)
@FieldDisplayDefine
(
value
=
"维保单位统一信用代码"
)
private
String
meUnitCreditCode
;
/**
*
*/
@TableField
(
"\"ME_UNIT_NAME\""
)
@TableField
(
"\"ME_UNIT_NAME\""
)
@FieldDisplayDefine
(
value
=
"维保单位名称"
)
private
String
meUnitName
;
/**
* 维保备案合同
*/
@TableField
(
"\"REPAIR_INFORM\""
)
@TableField
(
"\"REPAIR_INFORM\""
)
@FieldDisplayDefine
(
value
=
"维保备案合同附件"
,
type
=
JSON
.
class
)
private
String
repairInform
;
/**
* 维保合同开始日期
*/
@TableField
(
"\"INFORM_START\""
)
@TableField
(
"\"INFORM_START\""
)
@FieldDisplayDefine
(
value
=
"维保合同开始日期"
)
private
Date
informStart
;
/**
* 维保合同结束日期
*/
@TableField
(
"\"INFORM_END\""
)
@TableField
(
"\"INFORM_END\""
)
@FieldDisplayDefine
(
value
=
"维保合同结束日期"
)
private
Date
informEnd
;
/**
*维保负责人1姓名
*/
@TableField
(
"\"ME_MASTER\""
)
@TableField
(
"\"ME_MASTER\""
)
@FieldDisplayDefine
(
value
=
"维保负责人1姓名"
)
private
String
meMaster
;
/**
*维保负责人1身份证
*/
@TableField
(
"\"ME_MASTER_ID\""
)
@TableField
(
"\"ME_MASTER_ID\""
)
@FieldDisplayDefine
(
value
=
"维保负责人1身份证"
)
private
String
meMasterId
;
/**
*维保负责人1电话
*/
@TableField
(
"\"ME_MASTER_PHONE\""
)
@TableField
(
"\"ME_MASTER_PHONE\""
)
@FieldDisplayDefine
(
value
=
"维保负责人1电话"
)
private
String
meMasterPhone
;
...
...
@@ -98,6 +111,7 @@ public class IdxBizJgMaintenanceRecordInfo extends TzsBaseEntity {
*维保负责人2姓名
*/
@TableField
(
"\"ME_MASTER1\""
)
@FieldDisplayDefine
(
value
=
"维保负责人2姓名"
)
private
String
meMaster1
;
...
...
@@ -105,43 +119,45 @@ public class IdxBizJgMaintenanceRecordInfo extends TzsBaseEntity {
*维保负责人2身份证
*/
@TableField
(
"\"ME_MASTER1_ID\""
)
@FieldDisplayDefine
(
value
=
"维保负责人2身份证"
)
private
String
meMaster1Id
;
/**
*维保负责人2电话
*/
@FieldDisplayDefine
(
value
=
"维保负责人2电话"
)
@TableField
(
"\"ME_MASTER1_PHONE\""
)
private
String
meMaster1Phone
;
/**
*
*/
@TableField
(
"\"EMERGENCYCALL\""
)
@TableField
(
"\"EMERGENCYCALL\""
)
private
String
emergencycall
;
/**
*
*/
@TableField
(
"\"ME_CYCLE\""
)
@TableField
(
"\"ME_CYCLE\""
)
private
String
meCycle
;
/**
*
*/
@TableField
(
"\"OVERHAUL_CYCLE\""
)
@TableField
(
"\"OVERHAUL_CYCLE\""
)
private
String
overhaulCycle
;
/**
*
*/
@TableField
(
"\"ME24_TELEPHONE\""
)
@TableField
(
"\"ME24_TELEPHONE\""
)
private
String
me24Telephone
;
/**
*
*/
@TableField
(
"\"SEQUENCE_CODE\""
)
@TableField
(
"\"SEQUENCE_CODE\""
)
private
String
sequenceCode
;
@TableField
(
exist
=
false
)
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/entity/IdxBizJgRegisterInfo.java
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ymt
.
api
.
entity
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine
;
import
com.yeejoin.amos.boot.biz.common.annotation.Group
;
import
com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
...
...
@@ -17,52 +20,54 @@ import lombok.experimental.Accessors;
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"idx_biz_jg_register_info"
)
@Group
(
value
=
"idx_biz_jg_register_info"
)
public
class
IdxBizJgRegisterInfo
extends
TzsBaseEntity
{
/**
*
*/
@TableField
(
"\"RECORD\""
)
@TableField
(
"\"RECORD\""
)
private
String
record
;
/**
*
*/
@TableField
(
"\"INSTANCE_ID\""
)
@TableField
(
"\"INSTANCE_ID\""
)
private
String
instanceId
;
/**
*
*/
@TableField
(
"\"STATUS\""
)
@TableField
(
"\"STATUS\""
)
private
String
status
;
/**
*
*/
@TableField
(
"\"ORGANIZATION_CODE\""
)
@TableField
(
"\"ORGANIZATION_CODE\""
)
private
String
organizationCode
;
/**
*
*/
@TableField
(
"\"ORGANIZATION_NAME\""
)
@TableField
(
"\"ORGANIZATION_NAME\""
)
private
String
organizationName
;
/**
*
*/
@TableField
(
"\"USE_ORG_CODE\""
)
@TableField
(
"\"USE_ORG_CODE\""
)
@FieldDisplayDefine
(
value
=
"使用登记证编号"
)
private
String
useOrgCode
;
/**
*
*/
@TableField
(
"\"REGISTER_STATE\""
)
@TableField
(
"\"REGISTER_STATE\""
)
private
String
registerState
;
...
...
@@ -70,103 +75,111 @@ public class IdxBizJgRegisterInfo extends TzsBaseEntity {
* 设备代码类型手工输入(1)、系统自动生成(2)
*/
@TableField
(
"\"EQU_CODE_TYPE\""
)
private
String
equCodeType
;
@FieldDisplayDefine
(
value
=
"设备代码类型"
)
private
String
equCodeType
;
/**
* 设备代码
*/
@TableField
(
"\"EQU_CODE\""
)
@TableField
(
"\"EQU_CODE\""
)
@FieldDisplayDefine
(
value
=
"设备代码"
)
private
String
equCode
;
/**
*
*/
@TableField
(
"\"EQU_LIST\""
)
@TableField
(
"\"EQU_LIST\""
)
private
String
equList
;
/**
*
*/
@TableField
(
"\"EQU_CATEGORY\""
)
@TableField
(
"\"EQU_CATEGORY\""
)
private
String
equCategory
;
/**
*
*/
@TableField
(
"\"EQU_DEFINE\""
)
@TableField
(
"\"EQU_DEFINE\""
)
@FieldDisplayDefine
(
value
=
"设备品种"
)
private
String
equDefine
;
/**
*
*/
@TableField
(
"\"PRODUCT_NAME\""
)
@TableField
(
"\"PRODUCT_NAME\""
)
@FieldDisplayDefine
(
value
=
"产品名称"
)
private
String
productName
;
/**
*
*/
@TableField
(
"\"BRAND_NAME\""
)
@TableField
(
"\"BRAND_NAME\""
)
private
String
brandName
;
/**
*
*/
@TableField
(
"\"EQU_TYPE\""
)
@TableField
(
"\"EQU_TYPE\""
)
@FieldDisplayDefine
(
value
=
"设备型号"
)
private
String
equType
;
/**
*
*/
@TableField
(
"\"EQU_PRICE\""
)
@TableField
(
"\"EQU_PRICE\""
)
@FieldDisplayDefine
(
value
=
"设备总价值(万元)"
)
private
String
equPrice
;
/**
*
*/
@TableField
(
"\"USE_REGISTRATION_CERTIFICATE\""
)
@TableField
(
"\"USE_REGISTRATION_CERTIFICATE\""
)
private
String
useRegistrationCertificate
;
/**
*
*/
@TableField
(
"\"USE_SIGN\""
)
@TableField
(
"\"USE_SIGN\""
)
private
String
useSign
;
/**
*
*/
@TableField
(
"\"PRODUCT_PHOTO\""
)
@TableField
(
"\"PRODUCT_PHOTO\""
)
@FieldDisplayDefine
(
value
=
"产品照片(可上传产品铭牌)"
,
type
=
JSON
.
class
)
private
String
productPhoto
;
/**
*
*/
@TableField
(
"\"CAR_NUMBER\""
)
@TableField
(
"\"CAR_NUMBER\""
)
private
String
carNumber
;
/**
*
*/
@TableField
(
"\"FRAME_NUMBER\""
)
@TableField
(
"\"FRAME_NUMBER\""
)
private
String
frameNumber
;
/**
*
*/
@TableField
(
"\"ENGINE_NUMBER\""
)
@TableField
(
"\"ENGINE_NUMBER\""
)
private
String
engineNumber
;
/**
*
*/
@TableField
(
"\"MOTOR_NUMBER\""
)
@TableField
(
"\"MOTOR_NUMBER\""
)
private
String
motorNumber
;
/**
*
*/
@TableField
(
"\"OTHER_ACCESSORIES_REG\""
)
@TableField
(
"\"OTHER_ACCESSORIES_REG\""
)
@FieldDisplayDefine
(
value
=
"其他附件"
,
type
=
JSON
.
class
)
private
String
otherAccessoriesReg
;
/**
...
...
@@ -174,7 +187,7 @@ public class IdxBizJgRegisterInfo extends TzsBaseEntity {
* 1:是
* 0:不是
*/
@TableField
(
"\"WHETHER_VEHICLE_CYLINDER\""
)
@TableField
(
"\"WHETHER_VEHICLE_CYLINDER\""
)
private
String
whetherVehicleCylinder
;
/**
...
...
@@ -207,6 +220,7 @@ public class IdxBizJgRegisterInfo extends TzsBaseEntity {
* 2:其他
*/
@TableField
(
"\"CYLINDER_CATEGORY\""
)
@FieldDisplayDefine
(
value
=
"气瓶类别"
)
private
String
cylinderCategory
;
...
...
@@ -220,6 +234,7 @@ public class IdxBizJgRegisterInfo extends TzsBaseEntity {
* 安装资料是否完整齐全:1-齐全;2-不齐全【历史无证设备需要】
*/
@TableField
(
"\"INSTALLATION_IS_COMPLETE\""
)
@FieldDisplayDefine
(
value
=
"安装资料是否完整齐全"
)
private
String
installationIsComplete
;
/**
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/entity/IdxBizJgSupervisionInfo.java
View file @
0d10d721
...
...
@@ -2,7 +2,10 @@ package com.yeejoin.amos.boot.module.ymt.api.entity;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine
;
import
com.yeejoin.amos.boot.biz.common.annotation.Group
;
import
com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity
;
import
com.yeejoin.amos.boot.module.common.api.dto.IBaseChangeData
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
...
...
@@ -17,64 +20,68 @@ import lombok.experimental.Accessors;
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"idx_biz_jg_supervision_info"
)
public
class
IdxBizJgSupervisionInfo
extends
TzsBaseEntity
{
@Group
(
"idx_biz_jg_supervision_info"
)
public
class
IdxBizJgSupervisionInfo
extends
TzsBaseEntity
implements
IBaseChangeData
{
/**
*
*/
@TableField
(
"\"RECORD\""
)
@TableField
(
"\"RECORD\""
)
private
String
record
;
/**
*
*/
@TableField
(
"\"INSTANCE_ID\""
)
@TableField
(
"\"INSTANCE_ID\""
)
private
String
instanceId
;
/**
*
*/
@TableField
(
"\"STATUS\""
)
@TableField
(
"\"STATUS\""
)
private
String
status
;
/**
*
*/
@TableField
(
"\"ORG_BRANCH_CODE\""
)
@FieldDisplayDefine
(
value
=
"管辖分局组织机构代码"
)
@TableField
(
"\"ORG_BRANCH_CODE\""
)
private
String
orgBranchCode
;
/**
* * 公司/组织机构代码
* */
@TableField
(
value
=
"\"COMPANY_ORG_BRANCH_CODE\""
)
@FieldDisplayDefine
(
value
=
"公司/组织机构代码"
)
private
String
companyOrgBranchCode
;
/**
*
*/
@TableField
(
"\"ORG_BRANCH_NAME\""
)
@TableField
(
"\"ORG_BRANCH_NAME\""
)
@FieldDisplayDefine
(
value
=
"管辖分局名称"
)
private
String
orgBranchName
;
/**
*
*/
@TableField
(
"\"KEY_MONITORING_EQU\""
)
@TableField
(
"\"KEY_MONITORING_EQU\""
)
private
String
keyMonitoringEqu
;
/**
*
*/
@TableField
(
"\"DENSELY_POPULATED_AREAS\""
)
@TableField
(
"\"DENSELY_POPULATED_AREAS\""
)
private
String
denselyPopulatedAreas
;
/**
*
*/
@TableField
(
"\"IMPORTANT_PLACES\""
)
@TableField
(
"\"IMPORTANT_PLACES\""
)
private
String
importantPlaces
;
}
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/entity/IdxBizJgUseInfo.java
View file @
0d10d721
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ymt
.
api
.
entity
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.annotation.FieldDisplayDefine
;
import
com.yeejoin.amos.boot.biz.common.annotation.Group
;
import
com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity
;
import
com.yeejoin.amos.boot.module.common.api.dto.IBaseChangeData
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
...
...
@@ -19,207 +23,224 @@ import java.util.Date;
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"idx_biz_jg_use_info"
)
public
class
IdxBizJgUseInfo
extends
TzsBaseEntity
{
@Group
(
value
=
"idx_biz_jg_use_info"
)
public
class
IdxBizJgUseInfo
extends
TzsBaseEntity
implements
IBaseChangeData
{
/**
*
*/
@TableField
(
"\"RECORD\""
)
@TableField
(
"\"RECORD\""
)
private
String
record
;
/**
*
*/
@TableField
(
"\"INSTANCE_ID\""
)
@TableField
(
"\"INSTANCE_ID\""
)
private
String
instanceId
;
/**
*
*/
@TableField
(
"\"STATUS\""
)
@TableField
(
"\"STATUS\""
)
private
String
status
;
/**
*
*/
@TableField
(
"\"USE_UNIT_CREDIT_CODE\""
)
@TableField
(
"\"USE_UNIT_CREDIT_CODE\""
)
@FieldDisplayDefine
(
value
=
"使用单位统一信用代码"
)
private
String
useUnitCreditCode
;
/**
*
*/
@TableField
(
"\"USE_UNIT_NAME\""
)
@TableField
(
"\"USE_UNIT_NAME\""
)
@FieldDisplayDefine
(
value
=
"使用单位名称"
)
private
String
useUnitName
;
/**
*
*/
@TableField
(
"\"ESTATE_UNIT_CREDIT_CODE\""
)
@TableField
(
"\"ESTATE_UNIT_CREDIT_CODE\""
)
@FieldDisplayDefine
(
value
=
"产权单位统一信用代码"
)
private
String
estateUnitCreditCode
;
/**
*
*/
@TableField
(
"\"ESTATE_UNIT_NAME\""
)
@TableField
(
"\"ESTATE_UNIT_NAME\""
)
@FieldDisplayDefine
(
value
=
"产权单位名称"
)
private
String
estateUnitName
;
/**
*
*/
@TableField
(
"\"USE_STATE_CHANGE_DATE\""
)
@TableField
(
"\"USE_STATE_CHANGE_DATE\""
)
private
String
useStateChangeDate
;
/**
*
*/
@TableField
(
"\"CHANGES\""
)
@TableField
(
"\"CHANGES\""
)
private
String
changes
;
/**
*
*/
@TableField
(
"\"USE_INNER_CODE\""
)
@TableField
(
"\"USE_INNER_CODE\""
)
@FieldDisplayDefine
(
value
=
"使用内部编号"
)
private
String
useInnerCode
;
/**
*
*/
@TableField
(
"\"USE_DATE\""
)
@TableField
(
"\"USE_DATE\""
)
@FieldDisplayDefine
(
value
=
"投用日期"
)
private
String
useDate
;
/**
*
*/
@TableField
(
"\"AGENT\""
)
@TableField
(
"\"AGENT\""
)
private
String
agent
;
/**
*
*/
@TableField
(
"\"PROVINCE\""
)
@TableField
(
"\"PROVINCE\""
)
@FieldDisplayDefine
(
value
=
"省份行政区划"
)
private
String
province
;
/**
*
*/
@TableField
(
"\"CITY\""
)
@TableField
(
"\"CITY\""
)
@FieldDisplayDefine
(
value
=
"地市行政区划"
)
private
String
city
;
/**
*
*/
@TableField
(
"\"COUNTY\""
)
@TableField
(
"\"COUNTY\""
)
@FieldDisplayDefine
(
value
=
"区县行政区划"
)
private
String
county
;
/**
*
*/
@TableField
(
"\"FACTORY_USE_SITE_STREET\""
)
@TableField
(
"\"FACTORY_USE_SITE_STREET\""
)
@FieldDisplayDefine
(
value
=
"街道行政区划"
)
private
String
factoryUseSiteStreet
;
/**
*
*/
@TableField
(
"\"ADDRESS\""
)
@TableField
(
"\"ADDRESS\""
)
@FieldDisplayDefine
(
value
=
"详细地址"
)
private
String
address
;
/**
*
*/
@TableField
(
"\"LONGITUDE_LATITUDE\""
)
@TableField
(
"\"LONGITUDE_LATITUDE\""
)
@FieldDisplayDefine
(
value
=
"经纬度"
,
type
=
JSON
.
class
)
private
String
longitudeLatitude
;
/**
*
*/
@TableField
(
"\"USE_PLACE\""
)
@TableField
(
"\"USE_PLACE\""
)
@FieldDisplayDefine
(
value
=
"使用场所"
)
private
String
usePlace
;
/**
*
*/
@TableField
(
"\"EQU_MANAGE_DT\""
)
@TableField
(
"\"EQU_MANAGE_DT\""
)
private
String
equManageDt
;
/**
*
*/
@TableField
(
"\"SAFETY_MANAGE_DT\""
)
@TableField
(
"\"SAFETY_MANAGE_DT\""
)
private
String
safetyManageDt
;
/**
*
*/
@TableField
(
"\"SAFETY_MANAGER\""
)
@FieldDisplayDefine
(
value
=
"安管理员名称"
)
@TableField
(
"\"SAFETY_MANAGER\""
)
private
String
safetyManager
;
/**
*
*/
@TableField
(
"\"PHONE\""
)
@FieldDisplayDefine
(
value
=
"安管理员电话"
)
@TableField
(
"\"PHONE\""
)
private
String
phone
;
/**
*
*/
@TableField
(
"\"EQU_STATE\""
)
@TableField
(
"\"EQU_STATE\""
)
private
String
equState
;
/**
*
*/
@TableField
(
"\"PROVINCE_NAME\""
)
@TableField
(
"\"PROVINCE_NAME\""
)
private
String
provinceName
;
/**
*
*/
@TableField
(
"\"CITY_NAME\""
)
@TableField
(
"\"CITY_NAME\""
)
private
String
cityName
;
/**
*
*/
@TableField
(
"\"COUNTY_NAME\""
)
@TableField
(
"\"COUNTY_NAME\""
)
private
String
countyName
;
/**
*
*/
@TableField
(
"\"IS_NOT_ES\""
)
@TableField
(
"\"IS_NOT_ES\""
)
private
String
isNotEs
;
/**
*
*/
@TableField
(
"\"IS_NOT_ELEV\""
)
@TableField
(
"\"IS_NOT_ELEV\""
)
private
String
isNotElev
;
/**
*
创建时间
* 创建时间
*/
@TableField
(
"\"CREATE_DATE\""
)
private
Date
createDate
;
/**
*
认领时间
* 认领时间
*/
@TableField
(
"\"CLAIM_DATE\""
)
private
Date
claimDate
;
/**
*
数据来源(新增:0、导入:1、复制:复制数据的id 、jg:从监管加入的设备)
* 数据来源(新增:0、导入:1、复制:复制数据的id 、jg:从监管加入的设备)
*/
@TableField
(
"\"DATA_SOURCE\""
)
private
String
dataSource
;
/**
*
是否西咸
* 是否西咸
*/
@TableField
(
"\"IS_NOT_XIXIAN\""
)
@FieldDisplayDefine
(
value
=
"是否西咸"
)
private
String
isNotXiXian
;
...
...
@@ -230,13 +251,15 @@ public class IdxBizJgUseInfo extends TzsBaseEntity {
*
*/
@TableField
(
"\"SAFETY_MANAGER_ID\""
)
@FieldDisplayDefine
(
value
=
"安全管理员id"
)
private
String
safetyManagerId
;
/**
*
是否是否纳管:true - 已纳管 false-未纳管
* 是否是否纳管:true - 已纳管 false-未纳管
*/
@TableField
(
"\"IS_INTO_MANAGEMENT\""
)
@FieldDisplayDefine
(
value
=
"是否已纳管"
)
private
Boolean
isIntoManagement
;
...
...
@@ -244,6 +267,7 @@ public class IdxBizJgUseInfo extends TzsBaseEntity {
* 工程装置名称(工业管道使用)
*/
@TableField
(
"\"PROJECT_CONTRAPTION\""
)
@FieldDisplayDefine
(
value
=
"工程装置名称(工业管道使用)"
)
private
String
projectContraption
;
...
...
@@ -251,6 +275,7 @@ public class IdxBizJgUseInfo extends TzsBaseEntity {
* 历史设备-原使用登记证附件
*/
@TableField
(
"\"OLD_USE_REGISTRATION_CERTIFICATE\""
)
@FieldDisplayDefine
(
value
=
"原使用登记证附件"
)
private
String
oldUseRegistrationCertificate
;
...
...
@@ -258,6 +283,7 @@ public class IdxBizJgUseInfo extends TzsBaseEntity {
* 历史设备-原使用登记表附件
*/
@TableField
(
"\"OLD_USE_REGISTRATION_TABLE\""
)
@FieldDisplayDefine
(
value
=
"原使用登记表附件"
)
private
String
oldUseRegistrationTable
;
...
...
@@ -265,6 +291,7 @@ public class IdxBizJgUseInfo extends TzsBaseEntity {
* 历史设备-原登记机关
*/
@TableField
(
"\"O_REG_UNIT\""
)
@FieldDisplayDefine
(
value
=
"原登记机关"
)
private
String
oRegUnit
;
...
...
@@ -272,6 +299,7 @@ public class IdxBizJgUseInfo extends TzsBaseEntity {
* 历史设备-原登记日期
*/
@TableField
(
"\"O_REG_DATE\""
)
@FieldDisplayDefine
(
value
=
"原登记日期"
)
private
String
oRegDate
;
...
...
@@ -279,11 +307,13 @@ public class IdxBizJgUseInfo extends TzsBaseEntity {
* 工程装置ID
*/
@TableField
(
"\"PROJECT_CONTRAPTION_ID\""
)
@FieldDisplayDefine
(
value
=
"工程装置ID"
)
private
String
projectContraptionId
;
/**
* 备注
*/
@TableField
(
"\"REMARK\""
)
@FieldDisplayDefine
(
value
=
"备注"
)
private
String
remark
;
}
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