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
ee5b9cf6
Commit
ee5b9cf6
authored
May 29, 2024
by
tianbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
安全追溯调整
parent
2b5a270c
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
669 additions
and
118 deletions
+669
-118
SafetyProblemSourceTypeEnum.java
...boot/module/jg/api/enums/SafetyProblemSourceTypeEnum.java
+3
-7
SafetyProblemStatusEnum.java
...mos/boot/module/jg/api/enums/SafetyProblemStatusEnum.java
+7
-5
SafetyProblemTypeEnum.java
.../amos/boot/module/jg/api/enums/SafetyProblemTypeEnum.java
+16
-11
SafetyProblemEvent.java
...oin/amos/boot/module/jg/api/event/SafetyProblemEvent.java
+14
-0
SafetyProblemEventHandler.java
...odule/jg/api/event/handler/SafetyProblemEventHandler.java
+18
-0
CommonMapper.java
.../yeejoin/amos/boot/module/jg/api/mapper/CommonMapper.java
+1
-0
CommonMapper.xml
...-module-jg-api/src/main/resources/mapper/CommonMapper.xml
+41
-1
SafetyProblemTracingMapper.xml
.../src/main/resources/mapper/SafetyProblemTracingMapper.xml
+18
-29
AppConfig.java
...com/yeejoin/amos/boot/module/jg/biz/config/AppConfig.java
+15
-0
SafetyProblemTracingController.java
...ule/jg/biz/controller/SafetyProblemTracingController.java
+31
-5
JYBJEventHandler.java
...oin/amos/boot/module/jg/biz/handler/JYBJEventHandler.java
+73
-0
JYCQEventHandler.java
...oin/amos/boot/module/jg/biz/handler/JYCQEventHandler.java
+43
-0
SafetyProblemEventHandlerFactory.java
...dule/jg/biz/handler/SafetyProblemEventHandlerFactory.java
+39
-0
WBBAEventHandler.java
...oin/amos/boot/module/jg/biz/handler/WBBAEventHandler.java
+31
-0
WBCQEventHandler.java
...oin/amos/boot/module/jg/biz/handler/WBCQEventHandler.java
+43
-0
ZZCQEventHandler.java
...oin/amos/boot/module/jg/biz/handler/ZZCQEventHandler.java
+30
-0
SafetyProblemTopicMessage.java
...oot/module/jg/biz/listener/SafetyProblemTopicMessage.java
+99
-43
JgMaintenanceContractServiceImpl.java
...jg/biz/service/impl/JgMaintenanceContractServiceImpl.java
+8
-0
SafetyProblemTracingGenServiceImpl.java
.../biz/service/impl/SafetyProblemTracingGenServiceImpl.java
+60
-11
SafetyProblemTracingServiceImpl.java
.../jg/biz/service/impl/SafetyProblemTracingServiceImpl.java
+73
-6
TzBaseEnterpriseInfo.java
...amos/boot/module/tcm/api/entity/TzBaseEnterpriseInfo.java
+3
-0
ESEquipmentCategoryDto.java
.../amos/boot/module/ymt/api/dto/ESEquipmentCategoryDto.java
+3
-0
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/enums/SafetyProblemSourceTypeEnum.java
View file @
ee5b9cf6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
enums
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
enums
;
import
lombok.Getter
;
/**
/**
* 业务类型枚举
* 业务类型枚举
*
*
* @author Administrator
* @author Administrator
*/
*/
@Getter
public
enum
SafetyProblemSourceTypeEnum
{
public
enum
SafetyProblemSourceTypeEnum
{
/**
/**
...
@@ -36,11 +39,4 @@ public enum SafetyProblemSourceTypeEnum {
...
@@ -36,11 +39,4 @@ public enum SafetyProblemSourceTypeEnum {
return
name
;
return
name
;
}
}
public
String
getCode
()
{
return
code
;
}
public
String
getName
()
{
return
name
;
}
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/enums/SafetyProblemStatusEnum.java
View file @
ee5b9cf6
...
@@ -7,24 +7,26 @@ import lombok.Getter;
...
@@ -7,24 +7,26 @@ import lombok.Getter;
*
*
* @author Administrator
* @author Administrator
*/
*/
@Getter
public
enum
SafetyProblemStatusEnum
{
public
enum
SafetyProblemStatusEnum
{
/**
/**
* 问题主体类型
* 问题主体类型
*/
*/
UNHANDLED
(
"0"
,
"未处理"
),
UNHANDLED
(
"0"
,
"未处理"
,
"red"
),
HANDLED
(
"1"
,
"已处理"
);
HANDLED
(
"1"
,
"已处理"
,
"green"
);
@Getter
private
final
String
code
;
private
final
String
code
;
@Getter
private
final
String
name
;
private
final
String
name
;
SafetyProblemStatusEnum
(
String
code
,
String
name
)
{
private
final
String
color
;
SafetyProblemStatusEnum
(
String
code
,
String
name
,
String
color
)
{
this
.
code
=
code
;
this
.
code
=
code
;
this
.
name
=
name
;
this
.
name
=
name
;
this
.
color
=
color
;
}
}
public
static
String
getNameByType
(
String
code
)
{
public
static
String
getNameByType
(
String
code
)
{
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/enums/SafetyProblemTypeEnum.java
View file @
ee5b9cf6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
enums
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
enums
;
import
com.yeejoin.amos.boot.module.jg.api.event.handler.SafetyProblemEventHandler
;
import
lombok.Getter
;
import
lombok.Getter
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.config.AutowireCapableBeanFactory
;
/**
/**
* 业务类型枚举
* 业务类型枚举
*
*
* @author Administrator
* @author Administrator
*/
*/
@Getter
public
enum
SafetyProblemTypeEnum
{
public
enum
SafetyProblemTypeEnum
{
/**
/**
* 问题主体类型
* 问题主体类型
*/
*/
JYCQ
(
"2"
,
"检验超期"
,
"设备检验超期"
,
"jy/cq"
),
JYCQ
(
"2"
,
"检验超期"
,
"设备检验超期"
,
"safetyProblemTracing/jy/cq"
,
"outOfInspectionRecords"
),
JYBJ
(
"21"
,
"检验报检"
,
"设备报检"
,
"safetyProblemTracing/jy/bj"
,
null
),
WBCQ
(
"1"
,
"维保超期"
,
"设备维保超期"
,
"safetyProblemTracing/wb/cq"
,
"outOfMaintenanceRecords"
),
WBBA
(
"11"
,
"维保备案"
,
"设备维保备案"
,
"safetyProblemTracing/wb/ba"
,
null
),
ZZCQ
(
"3"
,
"资质超期"
,
"企业资质超期"
,
"safetyProblemTracing/zz/cq"
,
null
);
WBCQ
(
"1"
,
"维保超期"
,
"设备维保超期"
,
"wb/cq"
),
ZZCQ
(
"3"
,
"资质超期"
,
"企业资质超期"
,
"zz/cq"
);
@Getter
private
final
String
code
;
private
final
String
code
;
@Getter
private
final
String
name
;
private
final
String
name
;
@Getter
private
final
String
desc
;
private
final
String
desc
;
@Getter
private
final
String
topic
;
private
final
String
topic
;
SafetyProblemTypeEnum
(
String
code
,
String
name
,
String
desc
,
String
topic
)
{
/**
* 消息对象属性
* */
private
final
String
msgKey
;
SafetyProblemTypeEnum
(
String
code
,
String
name
,
String
desc
,
String
topic
,
String
msgKey
)
{
this
.
code
=
code
;
this
.
code
=
code
;
this
.
name
=
name
;
this
.
name
=
name
;
this
.
desc
=
desc
;
this
.
desc
=
desc
;
this
.
topic
=
topic
;
this
.
topic
=
topic
;
this
.
msgKey
=
msgKey
;
}
}
public
static
String
getNameByType
(
String
code
)
{
public
static
String
getNameByType
(
String
code
)
{
...
@@ -47,5 +53,4 @@ public enum SafetyProblemTypeEnum {
...
@@ -47,5 +53,4 @@ public enum SafetyProblemTypeEnum {
}
}
return
name
;
return
name
;
}
}
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/event/SafetyProblemEvent.java
0 → 100644
View file @
ee5b9cf6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
event
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
org.eclipse.paho.client.mqttv3.MqttMessage
;
@Data
@AllArgsConstructor
public
class
SafetyProblemEvent
{
private
String
topic
;
private
MqttMessage
message
;
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/event/handler/SafetyProblemEventHandler.java
0 → 100644
View file @
ee5b9cf6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
event
.
handler
;
import
com.yeejoin.amos.boot.module.jg.api.event.SafetyProblemEvent
;
/**
* 安全问题事件处理器接口。该接口定义了一个处理安全问题事件的方法。
*/
public
interface
SafetyProblemEventHandler
{
/**
* 处理安全问题事件。
*
* @param event 安全问题事件对象,包含事件的详细信息。
* 该参数不能为空,调用方应确保传入的事件对象有效。
*/
void
handle
(
SafetyProblemEvent
event
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/mapper/CommonMapper.java
View file @
ee5b9cf6
...
@@ -112,5 +112,6 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
...
@@ -112,5 +112,6 @@ public interface CommonMapper extends BaseMapper<EquipmentCategory> {
* */
* */
List
<
Map
<
String
,
Object
>>
queryOutOfMaintenanceRecord
();
List
<
Map
<
String
,
Object
>>
queryOutOfMaintenanceRecord
();
List
<
Map
<
String
,
Object
>>
queryOutOfInspectionRecord
();
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/CommonMapper.xml
View file @
ee5b9cf6
...
@@ -892,7 +892,7 @@
...
@@ -892,7 +892,7 @@
ROW_NUMBER () OVER (
ROW_NUMBER () OVER (
PARTITION BY "RECORD"
PARTITION BY "RECORD"
ORDER BY
ORDER BY
"
INFORM_END
"
"
REC_DATE
"
) AS rowNum1,"RECORD", "INFORM_END"
) AS rowNum1,"RECORD", "INFORM_END"
FROM
FROM
idx_biz_jg_maintenance_record_info
idx_biz_jg_maintenance_record_info
...
@@ -906,4 +906,44 @@
...
@@ -906,4 +906,44 @@
LEFT JOIN idx_biz_jg_supervision_info si on si."RECORD" = tt."RECORD"
LEFT JOIN idx_biz_jg_supervision_info si on si."RECORD" = tt."RECORD"
WHERE ui."DATA_SOURCE" like 'jg%'
WHERE ui."DATA_SOURCE" like 'jg%'
</select>
</select>
<select
id=
"queryOutOfInspectionRecord"
resultType=
"java.util.Map"
>
SELECT
tt."RECORD",
tt."NEXT_INSPECT_DATE",
ui."USE_UNIT_NAME",
ui."USE_UNIT_CREDIT_CODE",
(select unit_type from tz_base_enterprise_info where use_unit_code = ui."USE_UNIT_CREDIT_CODE") unitType,
ri."EQU_LIST",
(SELECT name FROM tz_equipment_category WHERE code = ri."EQU_LIST") equList,
(SELECT name FROM tz_equipment_category WHERE code = ri."EQU_CATEGORY") equCategory,
ri."EQU_CATEGORY",
oi."CODE96333",
oi."SUPERVISORY_CODE",
si."ORG_BRANCH_NAME",
si."ORG_BRANCH_CODE",
si."COMPANY_ORG_BRANCH_CODE"
FROM
(SELECT
"RECORD","NEXT_INSPECT_DATE"
FROM
(
SELECT
ROW_NUMBER () OVER (
PARTITION BY "RECORD"
ORDER BY
"REC_DATE"
) AS rowNum1,"RECORD", "NEXT_INSPECT_DATE"
FROM
idx_biz_jg_inspection_detection_info
WHERE "NEXT_INSPECT_DATE"
<![CDATA[<]]>
to_char(now(), 'YYYY-MM-DD')
) d
WHERE
rowNum1 = 1) tt
LEFT JOIN idx_biz_jg_use_info ui ON ui."RECORD" = tt."RECORD"
LEFT JOIN idx_biz_jg_register_info ri ON ri."RECORD" = tt."RECORD"
LEFT JOIN idx_biz_jg_other_info oi ON oi."RECORD" = tt."RECORD"
LEFT JOIN idx_biz_jg_supervision_info si on si."RECORD" = tt."RECORD"
WHERE ui."DATA_SOURCE" like 'jg%'
</select>
</mapper>
</mapper>
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/SafetyProblemTracingMapper.xml
View file @
ee5b9cf6
...
@@ -62,7 +62,12 @@
...
@@ -62,7 +62,12 @@
(select name from tz_equipment_category where code = ri."EQU_LIST") equList,
(select name from tz_equipment_category where code = ri."EQU_LIST") equList,
(select name from tz_equipment_category where code = ri."EQU_CATEGORY") equCategory,
(select name from tz_equipment_category where code = ri."EQU_CATEGORY") equCategory,
oi."CODE96333" code96333,
oi."CODE96333" code96333,
oi."SUPERVISORY_CODE" supervisoryCode
oi."SUPERVISORY_CODE" supervisoryCode,
oi."STATUS" problemStatus,
case when oi."STATUS" = '0' then 'red'
else 'green' end problemStatusColor,
case when oi."STATUS" = '0' then '异常'
else '正常' end problemStatusName
FROM
FROM
tzs_safety_problem_tracing spt
tzs_safety_problem_tracing spt
LEFT JOIN idx_biz_jg_use_info ui on ui."RECORD" = spt.source_id
LEFT JOIN idx_biz_jg_use_info ui on ui."RECORD" = spt.source_id
...
@@ -83,7 +88,12 @@
...
@@ -83,7 +88,12 @@
ei.unit_type unitType,
ei.unit_type unitType,
ei.governing_body governingBody,
ei.governing_body governingBody,
ei.use_contact useContact,
ei.use_contact useContact,
ei.contact_phone contactPhone
ei.contact_phone contactPhone,
ei.status,
case when ei.status = '0' then '异常'
else '正常' end problemStatusName,
case when ei.status = '0' then 'red'
else 'green' end problemStatusColor
FROM
FROM
tzs_safety_problem_tracing spt
tzs_safety_problem_tracing spt
LEFT JOIN tz_base_enterprise_info ei on ei.sequence_nbr = spt.source_id
LEFT JOIN tz_base_enterprise_info ei on ei.sequence_nbr = spt.source_id
...
@@ -99,7 +109,12 @@
...
@@ -99,7 +109,12 @@
ei.unit_type unitType,
ei.unit_type unitType,
ei.governing_body governingBody,
ei.governing_body governingBody,
ei.use_contact useContact,
ei.use_contact useContact,
ei.contact_phone contactPhone
ei.contact_phone contactPhone,
ei.status,
case when ei.status = '0' then '异常'
else '正常' end problemStatusName,
case when ei.status = '0' then 'red'
else 'green' end problemStatusColor
FROM
FROM
tzs_safety_problem_tracing spt
tzs_safety_problem_tracing spt
LEFT JOIN tz_base_enterprise_info ei on ei.use_unit_code = spt.principal_unit_code
LEFT JOIN tz_base_enterprise_info ei on ei.use_unit_code = spt.principal_unit_code
...
@@ -107,30 +122,4 @@
...
@@ -107,30 +122,4 @@
spt.sequence_nbr = #{problemId}
spt.sequence_nbr = #{problemId}
) t WHERE t.sourceTypeCode = #{sourceTypeCode}
) t WHERE t.sourceTypeCode = #{sourceTypeCode}
</select>
</select>
<select
id=
"queryOutOfMaintenanceRecord"
resultType=
"java.util.Map"
>
SELECT
mri."RECORD",
mri."INFORM_END" informEnd,
ui."USE_UNIT_NAME" useUnitName,
ui."USE_UNIT_CREDIT_CODE" useUnitCreditCode,
(select unit_type from tz_base_enterprise_info where use_unit_code = ui."USE_UNIT_CREDIT_CODE") unitType,
ri."EQU_LIST" equListCode,
(SELECT name FROM tz_equipment_category WHERE code = ri."EQU_LIST") equList,
(SELECT name FROM tz_equipment_category WHERE code = ri."EQU_CATEGORY") equCategory,
ri."EQU_CATEGORY" equCategoryCode,
oi."CODE96333" code96333,
oi."SUPERVISORY_CODE" supervisoryCode,
si."ORG_BRANCH_NAME" orgBranchName,
si."ORG_BRANCH_CODE" orgBranchCode,
si."COMPANY_ORG_BRANCH_CODE" companyOrgBranchCode
FROM
idx_biz_jg_maintenance_record_info mri
LEFT JOIN idx_biz_jg_use_info ui ON ui."RECORD" = mri."RECORD"
LEFT JOIN idx_biz_jg_register_info ri ON ri."RECORD" = mri."RECORD"
LEFT JOIN idx_biz_jg_other_info oi ON oi."RECORD" = mri."RECORD"
LEFT JOIN idx_biz_jg_supervision_info si on si."RECORD" = mri."RECORD"
WHERE mri."INFORM_END"
<![CDATA[<]]>
to_char(now(), 'YYYY-MM-DD')
AND ui."DATA_SOURCE" like 'jg%'
</select>
</mapper>
</mapper>
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/config/AppConfig.java
0 → 100644
View file @
ee5b9cf6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
config
;
import
com.yeejoin.amos.boot.module.jg.biz.handler.SafetyProblemEventHandlerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
public
class
AppConfig
{
@Autowired
public
void
configureFactory
(
ApplicationContext
context
)
{
SafetyProblemEventHandlerFactory
.
setApplicationContext
(
context
);
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/SafetyProblemTracingController.java
View file @
ee5b9cf6
...
@@ -179,15 +179,41 @@ public class SafetyProblemTracingController extends BaseController {
...
@@ -179,15 +179,41 @@ public class SafetyProblemTracingController extends BaseController {
}
}
/**
/**
* test
* test
1
*
*
* @return
* @return
*/
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"test"
,
notes
=
"test"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"生成维保、检验检测超期数据"
,
notes
=
"生成维保、检验检测超期数据"
)
@GetMapping
(
value
=
"/test"
)
@GetMapping
(
value
=
"/gen/test1"
)
public
ResponseModel
<
String
>
test
()
{
public
ResponseModel
<
String
>
test1
()
{
safetyProblemTracingGenService
.
queryEquipListByProblemId
();
safetyProblemTracingGenService
.
executeSafetyProblemCheck
();
return
ResponseHelper
.
buildResponse
(
"success"
);
}
/**
* test2
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"生成检验检测超期数据"
,
notes
=
"生成检验检测超期数据"
)
@GetMapping
(
value
=
"/gen/test2"
)
public
ResponseModel
<
String
>
test2
()
{
safetyProblemTracingGenService
.
executeInspectionCheck
();
return
ResponseHelper
.
buildResponse
(
"success"
);
}
/**
* test3
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"生成维保超期数据"
,
notes
=
"生成维保超期数据"
)
@GetMapping
(
value
=
"/gen/test3"
)
public
ResponseModel
<
String
>
test3
()
{
safetyProblemTracingGenService
.
executeMaintenanceCheck
();
return
ResponseHelper
.
buildResponse
(
"success"
);
return
ResponseHelper
.
buildResponse
(
"success"
);
}
}
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/handler/JYBJEventHandler.java
0 → 100644
View file @
ee5b9cf6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
handler
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.api.entity.SafetyProblemTracing
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemStatusEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.event.SafetyProblemEvent
;
import
com.yeejoin.amos.boot.module.jg.api.event.handler.SafetyProblemEventHandler
;
import
com.yeejoin.amos.boot.module.jg.biz.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgOtherInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.SafetyProblemTracingServiceImpl
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.ESEquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.util.Optional
;
/**
* WBCQEventHandler 类实现了 SafetyProblemEventHandler 接口,
* 用于处理检验报检安全问题事件。
*/
@Component
public
class
JYBJEventHandler
implements
SafetyProblemEventHandler
{
SafetyProblemTracingServiceImpl
safetyProblemTracingService
;
IdxBizJgOtherInfoServiceImpl
idxBizJgOtherInfoService
;
ESEquipmentCategory
esEquipmentCategory
;
@Autowired
public
JYBJEventHandler
(
SafetyProblemTracingServiceImpl
safetyProblemTracingService
,
IdxBizJgOtherInfoServiceImpl
idxBizJgOtherInfoService
,
ESEquipmentCategory
esEquipmentCategory
)
{
this
.
safetyProblemTracingService
=
safetyProblemTracingService
;
this
.
idxBizJgOtherInfoService
=
idxBizJgOtherInfoService
;
this
.
esEquipmentCategory
=
esEquipmentCategory
;
}
/**
* 处理安全问题事件。
*
* @param event 安全问题事件对象,包含事件的详细信息。
* 该参数用于描述发生的安全问题事件。
*/
@Override
public
void
handle
(
SafetyProblemEvent
event
)
{
// 此处为处理安全问题事件的逻辑代码
handleInspectionRecord
(
JSON
.
parseObject
(
event
.
getMessage
().
toString
()));
}
private
void
handleInspectionRecord
(
JSONObject
jsonObject
)
{
String
equipRecord
=
jsonObject
.
getString
(
"record"
);
if
(!
ValidationUtil
.
isEmpty
(
equipRecord
))
{
safetyProblemTracingService
.
lambdaUpdate
()
.
set
(
SafetyProblemTracing:
:
getProblemStatusCode
,
SafetyProblemStatusEnum
.
HANDLED
.
getCode
())
.
set
(
SafetyProblemTracing:
:
getProblemStatus
,
SafetyProblemStatusEnum
.
HANDLED
.
getName
())
.
eq
(
SafetyProblemTracing:
:
getSourceId
,
equipRecord
)
.
eq
(
SafetyProblemTracing:
:
getProblemTypeCode
,
SafetyProblemTypeEnum
.
JYCQ
.
getCode
()).
update
();
idxBizJgOtherInfoService
.
lambdaUpdate
().
set
(
IdxBizJgOtherInfo:
:
getStatus
,
SafetyProblemStatusEnum
.
HANDLED
.
getCode
())
.
eq
(
IdxBizJgOtherInfo:
:
getRecord
,
equipRecord
).
update
();
Optional
<
ESEquipmentCategoryDto
>
equipEsDto
=
esEquipmentCategory
.
findById
(
equipRecord
);
if
(
equipEsDto
.
isPresent
())
{
ESEquipmentCategoryDto
equipDto
=
equipEsDto
.
get
();
equipDto
.
setProblemStatus
(
SafetyProblemStatusEnum
.
HANDLED
.
getCode
());
esEquipmentCategory
.
save
(
equipDto
);
}
}
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/handler/JYCQEventHandler.java
0 → 100644
View file @
ee5b9cf6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
handler
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.event.SafetyProblemEvent
;
import
com.yeejoin.amos.boot.module.jg.api.event.handler.SafetyProblemEventHandler
;
import
com.yeejoin.amos.boot.module.jg.biz.listener.SafetyProblemTopicMessage
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.SafetyProblemTracingServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
/**
* WBCQEventHandler 类实现了 SafetyProblemEventHandler 接口,
* 用于处理检验超期安全问题事件。
*/
@Component
public
class
JYCQEventHandler
implements
SafetyProblemEventHandler
{
private
SafetyProblemTracingServiceImpl
safetyProblemTracingService
;
@Autowired
public
JYCQEventHandler
(
SafetyProblemTracingServiceImpl
safetyProblemTracingService
)
{
this
.
safetyProblemTracingService
=
safetyProblemTracingService
;
}
/**
* 处理安全问题事件。
*
* @param event 安全问题事件对象,包含事件的详细信息。
* 该参数用于描述发生的安全问题事件。
*/
@Override
public
void
handle
(
SafetyProblemEvent
event
)
{
// 此处为处理安全问题事件的逻辑代码
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
event
.
getMessage
().
toString
());
generateProblem
(
jsonObject
);
}
private
void
generateProblem
(
JSONObject
jsonObject
)
{
SafetyProblemTopicMessage
.
generateProblem
(
jsonObject
,
SafetyProblemTypeEnum
.
JYCQ
,
safetyProblemTracingService
);
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/handler/SafetyProblemEventHandlerFactory.java
0 → 100644
View file @
ee5b9cf6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
handler
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.event.handler.SafetyProblemEventHandler
;
import
com.yeejoin.amos.boot.module.jg.biz.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgOtherInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.SafetyProblemTracingServiceImpl
;
import
org.springframework.stereotype.Component
;
import
org.springframework.context.ApplicationContext
;
@Component
public
class
SafetyProblemEventHandlerFactory
{
private
static
ApplicationContext
context
;
public
static
void
setApplicationContext
(
ApplicationContext
applicationContext
)
{
context
=
applicationContext
;
}
public
static
SafetyProblemEventHandler
createProblemHandler
(
String
topic
)
{
SafetyProblemTracingServiceImpl
safetyProblemTracingService
=
context
.
getBean
(
SafetyProblemTracingServiceImpl
.
class
);
IdxBizJgOtherInfoServiceImpl
idxBizJgOtherInfoService
=
context
.
getBean
(
IdxBizJgOtherInfoServiceImpl
.
class
);
ESEquipmentCategory
esEquipmentCategory
=
context
.
getBean
(
ESEquipmentCategory
.
class
);
if
(
topic
.
startsWith
(
SafetyProblemTypeEnum
.
WBCQ
.
getTopic
()))
{
return
new
WBCQEventHandler
(
safetyProblemTracingService
);
}
else
if
(
topic
.
startsWith
(
SafetyProblemTypeEnum
.
WBBA
.
getTopic
()))
{
return
new
WBBAEventHandler
();
}
else
if
(
topic
.
startsWith
(
SafetyProblemTypeEnum
.
JYCQ
.
getTopic
()))
{
return
new
JYCQEventHandler
(
safetyProblemTracingService
);
}
else
if
(
topic
.
startsWith
(
SafetyProblemTypeEnum
.
JYBJ
.
getTopic
()))
{
return
new
JYBJEventHandler
(
safetyProblemTracingService
,
idxBizJgOtherInfoService
,
esEquipmentCategory
);
}
else
if
(
topic
.
startsWith
(
SafetyProblemTypeEnum
.
ZZCQ
.
getTopic
()))
{
return
new
ZZCQEventHandler
();
}
else
{
// 其他策略类的创建
throw
new
IllegalArgumentException
(
"Unsupported topic: "
+
topic
);
}
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/handler/WBBAEventHandler.java
0 → 100644
View file @
ee5b9cf6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
handler
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.api.event.SafetyProblemEvent
;
import
com.yeejoin.amos.boot.module.jg.api.event.handler.SafetyProblemEventHandler
;
import
org.springframework.stereotype.Component
;
/**
* WBBAEventHandler 类实现了 SafetyProblemEventHandler 接口,
* 用于处理维保备案安全问题事件。
*/
@Component
public
class
WBBAEventHandler
implements
SafetyProblemEventHandler
{
/**
* 处理安全问题事件。
*
* @param event 安全问题事件对象,包含事件的详细信息。
* 该参数用于描述发生的安全问题事件。
*/
@Override
public
void
handle
(
SafetyProblemEvent
event
)
{
// 此处为处理安全问题事件的逻辑代码
handleMaintenanceRecord
(
JSONObject
.
parseObject
(
event
.
getMessage
().
toString
()));
}
private
void
handleMaintenanceRecord
(
JSONObject
jsonObject
)
{
// JSONArray maintenanceRecords = JSONArray.parseArray(String.valueOf(jsonObject));
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/handler/WBCQEventHandler.java
0 → 100644
View file @
ee5b9cf6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
handler
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.event.SafetyProblemEvent
;
import
com.yeejoin.amos.boot.module.jg.api.event.handler.SafetyProblemEventHandler
;
import
com.yeejoin.amos.boot.module.jg.biz.listener.SafetyProblemTopicMessage
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.SafetyProblemTracingServiceImpl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
/**
* WBCQEventHandler 类实现了 SafetyProblemEventHandler 接口,
* 用于处理维保超期安全问题事件。
*/
@Component
public
class
WBCQEventHandler
implements
SafetyProblemEventHandler
{
SafetyProblemTracingServiceImpl
safetyProblemTracingService
;
@Autowired
public
WBCQEventHandler
(
SafetyProblemTracingServiceImpl
safetyProblemTracingService
)
{
this
.
safetyProblemTracingService
=
safetyProblemTracingService
;
}
/**
* 处理安全问题事件。
*
* @param event 安全问题事件对象,包含事件的详细信息。
* 该参数用于描述发生的安全问题事件。
*/
@Override
public
void
handle
(
SafetyProblemEvent
event
)
{
// 此处为处理安全问题事件的逻辑代码
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
event
.
getMessage
().
toString
());
generateProblem
(
jsonObject
);
}
private
void
generateProblem
(
JSONObject
jsonObject
)
{
SafetyProblemTopicMessage
.
generateProblem
(
jsonObject
,
SafetyProblemTypeEnum
.
JYCQ
,
safetyProblemTracingService
);
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/handler/ZZCQEventHandler.java
0 → 100644
View file @
ee5b9cf6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
handler
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.api.event.SafetyProblemEvent
;
import
com.yeejoin.amos.boot.module.jg.api.event.handler.SafetyProblemEventHandler
;
import
org.springframework.stereotype.Component
;
/**
* ZZCQEventHandler 类实现了 SafetyProblemEventHandler 接口,
* 用于处理企业资质超期安全问题事件。
*/
@Component
public
class
ZZCQEventHandler
implements
SafetyProblemEventHandler
{
/**
* 处理安全问题事件。
*
* @param event 安全问题事件对象,包含事件的详细信息。
* 该参数用于描述发生的安全问题事件。
*/
@Override
public
void
handle
(
SafetyProblemEvent
event
)
{
// 此处为处理安全问题事件的逻辑代码
generateProblem
(
JSONObject
.
parseObject
(
event
.
getMessage
().
toString
()));
}
private
void
generateProblem
(
JSONObject
jsonObject
)
{
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/listener/SafetyProblemTopicMessage.java
View file @
ee5b9cf6
...
@@ -3,12 +3,18 @@ package com.yeejoin.amos.boot.module.jg.biz.listener;
...
@@ -3,12 +3,18 @@ package com.yeejoin.amos.boot.module.jg.biz.listener;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.
google.common.collect.Lists
;
import
com.
baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.api.entity.SafetyProblemTracing
;
import
com.yeejoin.amos.boot.module.jg.api.entity.SafetyProblemTracing
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemSourceTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemSourceTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemStatusEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemStatusEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.event.handler.SafetyProblemEventHandler
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.SafetyProblemTracingMapper
;
import
com.yeejoin.amos.boot.module.jg.biz.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.jg.api.event.SafetyProblemEvent
;
import
com.yeejoin.amos.boot.module.jg.biz.handler.SafetyProblemEventHandlerFactory
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgOtherInfoServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.SafetyProblemTracingServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.SafetyProblemTracingServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.StartPlatformTokenService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -18,27 +24,35 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -18,27 +24,35 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
org.typroject.tyboot.component.emq.EmqxListener
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.concurrent.BlockingQueue
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.stream.Collectors
;
@Component
@Component
@Slf4j
@Slf4j
public
class
SafetyProblemTopicMessage
extends
EmqxListener
{
public
class
SafetyProblemTopicMessage
extends
EmqxListener
{
@Value
(
"${safety.problem.message.handle.thread.number:3}"
)
private
int
threadNumber
;
@Value
(
"${spring.application.name}"
)
private
String
applicationName
;
@Resource
@Resource
protected
EmqKeeper
emqKeeper
;
protected
EmqKeeper
emqKeeper
;
@Value
(
"${safety.problem.tracing.topic:safetyProblemTracing/
wb/cq
}"
)
@Value
(
"${safety.problem.tracing.topic:safetyProblemTracing/
#
}"
)
private
String
problemEventTopic
;
private
String
problemEventTopic
;
@PostConstruct
void
init
()
throws
Exception
{
emqKeeper
.
subscript
(
problemEventTopic
,
2
,
this
);
}
@Autowired
@Autowired
RedisUtils
redisUtil
;
RedisUtils
redisUtil
;
...
@@ -46,54 +60,96 @@ public class SafetyProblemTopicMessage extends EmqxListener {
...
@@ -46,54 +60,96 @@ public class SafetyProblemTopicMessage extends EmqxListener {
StartPlatformTokenService
platformTokenService
;
StartPlatformTokenService
platformTokenService
;
@Autowired
@Autowired
SafetyProblemTracingServiceImpl
safetyProblemTracingService
;
SafetyProblemTracingMapper
safetyProblemTracingMapper
;
@Autowired
IdxBizJgOtherInfoServiceImpl
idxBizJgOtherInfoService
;
@Autowired
ESEquipmentCategory
esEquipmentCategory
;
private
final
BlockingQueue
<
SafetyProblemEvent
>
blockingQueue
=
new
LinkedBlockingQueue
<>();
@PostConstruct
void
init
()
throws
Exception
{
emqKeeper
.
subscript
(
buildTopic
(
problemEventTopic
),
2
,
this
);
ExecutorService
executorService
=
Executors
.
newFixedThreadPool
(
threadNumber
);
for
(
int
i
=
0
;
i
<
threadNumber
;
i
++)
{
executorService
.
execute
(()
->
{
try
{
while
(
true
)
{
SafetyProblemEvent
safetyProblemMessageEvent
=
blockingQueue
.
take
();
JSONObject
jsonObject
=
JSON
.
parseObject
(
safetyProblemMessageEvent
.
getMessage
().
toString
());
log
.
info
(
"接收到问题生产消息:{}"
,
jsonObject
);
SafetyProblemEventHandler
eventHandler
=
SafetyProblemEventHandlerFactory
.
createProblemHandler
(
safetyProblemMessageEvent
.
getTopic
());
eventHandler
.
handle
(
safetyProblemMessageEvent
);
log
.
info
(
"处理问题生产消息完成"
);
}
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
log
.
error
(
"处理问题生产消息异常"
,
e
);
throw
new
RuntimeException
(
e
);
}
});
}
}
@Override
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
{
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
{
// TODO 提出单独模块处理生成问题
log
.
info
(
"接收问题生产消息开始"
);
log
.
info
(
"接收问题生产消息开始"
);
platformTokenService
.
getToken
();
blockingQueue
.
add
(
new
SafetyProblemEvent
(
topic
,
message
));
JSONObject
jsonObject
=
JSON
.
parseObject
(
message
.
toString
());
if
(
topic
.
endsWith
(
SafetyProblemTypeEnum
.
WBCQ
.
getTopic
()))
{
handleMaintenanceProblem
(
jsonObject
);
}
log
.
info
(
"接收问题生产消息完成"
);
log
.
info
(
"接收问题生产消息完成"
);
}
}
private
void
handleMaintenanceProblem
(
JSONObject
jsonObject
)
{
public
static
void
generateProblem
(
JSONObject
jsonObject
,
SafetyProblemTypeEnum
problemTypeEnum
,
SafetyProblemTracingServiceImpl
safetyProblemTracingService
)
{
JSONArray
maintenanceRecords
=
jsonObject
.
getJSONArray
(
"outOfMaintenanceRecords"
);
if
(
jsonObject
==
null
||
problemTypeEnum
==
null
)
{
List
<
SafetyProblemTracing
>
safetyProblemTracingList
=
Lists
.
newArrayList
();
throw
new
IllegalArgumentException
(
"jsonObject and problemTypeEnum must not be null."
);
maintenanceRecords
.
forEach
(
item
->
{
}
JSONObject
json
=
(
JSONObject
)
item
;
JSONArray
records
=
jsonObject
.
getJSONArray
(
problemTypeEnum
.
getMsgKey
());
SafetyProblemTracing
safetyProblemTracing
=
new
SafetyProblemTracing
();
if
(!
ValidationUtil
.
isEmpty
(
records
))
{
List
<
SafetyProblemTracing
>
safetyProblemTracingList
=
records
.
stream
().
map
(
item
->
{
if
(!(
item
instanceof
JSONObject
))
{
throw
new
IllegalArgumentException
(
"item is not a JSONObject."
);
}
JSONObject
json
=
(
JSONObject
)
item
;
SafetyProblemTracing
safetyProblemTracing
=
new
SafetyProblemTracing
();
// safetyProblemTracing.setProblemNum(json.getString("problemNum"));
// safetyProblemTracing.setProblemNum(json.getString("problemNum"));
safetyProblemTracing
.
setProblemType
(
SafetyProblemTypeEnum
.
WBCQ
.
getName
());
safetyProblemTracing
.
setProblemType
(
problemTypeEnum
.
getName
());
safetyProblemTracing
.
setProblemTypeCode
(
SafetyProblemTypeEnum
.
WBCQ
.
getCode
());
safetyProblemTracing
.
setProblemTypeCode
(
problemTypeEnum
.
getCode
());
safetyProblemTracing
.
setProblemDesc
(
SafetyProblemTypeEnum
.
WBCQ
.
getDesc
());
safetyProblemTracing
.
setProblemDesc
(
problemTypeEnum
.
getDesc
());
// safetyProblemTracing.setProblemLevel(json.getString("problemLevel"));
// safetyProblemTracing.setProblemLevel(json.getString("problemLevel"));
// safetyProblemTracing.setProblemLevelCode(json.getString("problemLevelCode"));
// safetyProblemTracing.setProblemLevelCode(json.getString("problemLevelCode"));
safetyProblemTracing
.
setSourceType
(
SafetyProblemSourceTypeEnum
.
EQUIP
.
getName
());
safetyProblemTracing
.
setSourceType
(
SafetyProblemSourceTypeEnum
.
EQUIP
.
getName
());
safetyProblemTracing
.
setSourceTypeCode
(
SafetyProblemSourceTypeEnum
.
EQUIP
.
getCode
());
safetyProblemTracing
.
setSourceTypeCode
(
SafetyProblemSourceTypeEnum
.
EQUIP
.
getCode
());
safetyProblemTracing
.
setSourceId
(
json
.
getString
(
"RECORD"
));
safetyProblemTracing
.
setSourceId
(
json
.
getOrDefault
(
"RECORD"
,
""
).
toString
(
));
safetyProblemTracing
.
setProblemTime
(
new
Date
());
safetyProblemTracing
.
setProblemTime
(
new
Date
());
safetyProblemTracing
.
setEquipSuperviseCode
(
json
.
getString
(
"supervisoryCode"
));
safetyProblemTracing
.
setEquipSuperviseCode
(
json
.
getOrDefault
(
"SUPERVISORY_CODE"
,
""
).
toString
(
));
safetyProblemTracing
.
setEquipList
(
json
.
getString
(
"equList"
));
safetyProblemTracing
.
setEquipList
(
json
.
getOrDefault
(
"equList"
,
""
).
toString
(
));
safetyProblemTracing
.
setEquipListCode
(
json
.
getString
(
"equListCode"
));
safetyProblemTracing
.
setEquipListCode
(
json
.
getOrDefault
(
"EQU_LIST"
,
""
).
toString
(
));
safetyProblemTracing
.
setPrincipalUnit
(
json
.
getString
(
"useUnitName"
));
safetyProblemTracing
.
setPrincipalUnit
(
json
.
getOrDefault
(
"USE_UNIT_NAME"
,
""
).
toString
(
));
safetyProblemTracing
.
setPrincipalUnitCode
(
json
.
getString
(
"useUnitCreditCode"
));
safetyProblemTracing
.
setPrincipalUnitCode
(
json
.
getOrDefault
(
"USE_UNIT_CREDIT_CODE"
,
""
).
toString
(
));
safetyProblemTracing
.
setPrincipalUnitType
(
json
.
getString
(
"unitType"
));
safetyProblemTracing
.
setPrincipalUnitType
(
json
.
getOrDefault
(
"unitType"
,
""
).
toString
(
));
safetyProblemTracing
.
setGoverningBody
(
json
.
getString
(
"orgBranchName"
));
safetyProblemTracing
.
setGoverningBody
(
json
.
getOrDefault
(
"ORG_BRANCH_NAME"
,
""
).
toString
(
));
safetyProblemTracing
.
setGoverningBodyCode
(
json
.
getString
(
"companyOrgBranchCode"
));
safetyProblemTracing
.
setGoverningBodyCode
(
json
.
getOrDefault
(
"COMPANY_ORG_BRANCH_CODE"
,
""
).
toString
(
));
safetyProblemTracing
.
setGoverningBodyOrgCode
(
json
.
getString
(
"orgBranchCode"
));
safetyProblemTracing
.
setGoverningBodyOrgCode
(
json
.
getOrDefault
(
"ORG_BRANCH_CODE"
,
""
).
toString
(
));
// safetyProblemTracing.setRegionName(json.getString("regionName"));
// safetyProblemTracing.setRegionName(json.getString("regionName"));
safetyProblemTracing
.
setRegionCode
(
json
.
getString
(
"regionCode"
));
safetyProblemTracing
.
setRegionCode
(
json
.
getString
(
"regionCode"
));
safetyProblemTracing
.
setCreateDate
(
new
Date
());
safetyProblemTracing
.
setCreateDate
(
new
Date
());
// safetyProblemTracing.setCreateUser(json.getString("createUser"));
// safetyProblemTracing.setCreateUser(json.getString("createUser"));
// safetyProblemTracing.setCreateUserId(json.getString("createUserId"));
// safetyProblemTracing.setCreateUserId(json.getString("createUserId"));
safetyProblemTracing
.
setProblemStatus
(
SafetyProblemStatusEnum
.
UNHANDLED
.
getName
());
safetyProblemTracing
.
setProblemStatus
(
SafetyProblemStatusEnum
.
UNHANDLED
.
getName
());
safetyProblemTracing
.
setProblemStatusCode
(
SafetyProblemStatusEnum
.
UNHANDLED
.
getCode
());
safetyProblemTracing
.
setProblemStatusCode
(
SafetyProblemStatusEnum
.
UNHANDLED
.
getCode
());
safetyProblemTracingList
.
add
(
safetyProblemTracing
);
return
safetyProblemTracing
;
});
}).
collect
(
Collectors
.
toList
());
safetyProblemTracingService
.
saveBatch
(
safetyProblemTracingList
);
safetyProblemTracingService
.
saveOrUpdateBatchByColumns
(
safetyProblemTracingList
,
safetyProblemTracing
->
new
QueryWrapper
<>()
.
eq
(
"problem_type_code"
,
safetyProblemTracing
.
getProblemTypeCode
())
.
eq
(
"source_id"
,
safetyProblemTracing
.
getSourceId
())
.
eq
(
"problem_status_code"
,
SafetyProblemStatusEnum
.
UNHANDLED
.
getCode
()));}
}
public
String
buildTopic
(
String
topic
)
{
String
topicPrefix
=
"$share/"
+
applicationName
;
return
String
.
format
(
"%s/%s"
,
topicPrefix
,
topic
);
}
}
}
}
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/JgMaintenanceContractServiceImpl.java
View file @
ee5b9cf6
...
@@ -15,6 +15,7 @@ import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintenanceContract;
...
@@ -15,6 +15,7 @@ import com.yeejoin.amos.boot.module.jg.api.entity.JgMaintenanceContract;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgMaintenanceContractEq
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgMaintenanceContractEq
;
import
com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgMaintenanceContractEqMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgMaintenanceContractEqMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgMaintenanceContractMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgMaintenanceContractMapper
;
...
@@ -33,6 +34,7 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
...
@@ -33,6 +34,7 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import
com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO
;
import
com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO
;
import
com.yeejoin.amos.feign.workflow.model.TaskResultDTO
;
import
com.yeejoin.amos.feign.workflow.model.TaskResultDTO
;
import
io.seata.spring.annotation.GlobalTransactional
;
import
io.seata.spring.annotation.GlobalTransactional
;
import
lombok.SneakyThrows
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.redisson.api.RedissonClient
;
...
@@ -44,6 +46,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -44,6 +46,7 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
...
@@ -90,6 +93,9 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
...
@@ -90,6 +93,9 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
@Autowired
@Autowired
private
RedissonClient
redissonClient
;
private
RedissonClient
redissonClient
;
@Autowired
EmqKeeper
emqKeeper
;
/**
/**
* 分页查询
* 分页查询
*/
*/
...
@@ -606,6 +612,7 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
...
@@ -606,6 +612,7 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
*
*
* @param id
* @param id
*/
*/
@SneakyThrows
private
void
updateEquipMessage
(
Long
id
)
{
private
void
updateEquipMessage
(
Long
id
)
{
JgMaintenanceContract
jgMaintenanceContract
=
this
.
getBaseMapper
().
selectById
(
id
);
JgMaintenanceContract
jgMaintenanceContract
=
this
.
getBaseMapper
().
selectById
(
id
);
LambdaQueryWrapper
<
JgMaintenanceContractEq
>
lambda
=
new
QueryWrapper
<
JgMaintenanceContractEq
>().
lambda
();
LambdaQueryWrapper
<
JgMaintenanceContractEq
>
lambda
=
new
QueryWrapper
<
JgMaintenanceContractEq
>().
lambda
();
...
@@ -631,6 +638,7 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
...
@@ -631,6 +638,7 @@ public class JgMaintenanceContractServiceImpl extends BaseService<JgMaintenanceC
}
}
});
});
idxBizJgMaintenanceRecordInfoService
.
updateBatchById
(
data
);
idxBizJgMaintenanceRecordInfoService
.
updateBatchById
(
data
);
emqKeeper
.
getMqttClient
().
publish
(
SafetyProblemTypeEnum
.
WBBA
.
getTopic
(),
JSON
.
toJSONBytes
(
data
),
2
,
false
);
}
}
...
...
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/SafetyProblemTracingGenServiceImpl.java
View file @
ee5b9cf6
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.SafetyProblemTracingMapper
;
import
com.google.common.collect.Lists
;
import
lombok.SneakyThrows
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemStatusEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.CommonMapper
;
import
com.yeejoin.amos.boot.module.jg.biz.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.ESEquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo
;
import
net.javacrumbs.shedlock.spring.annotation.SchedulerLock
;
import
net.javacrumbs.shedlock.spring.annotation.SchedulerLock
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -12,7 +18,9 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
...
@@ -12,7 +18,9 @@ import org.typroject.tyboot.component.emq.EmqKeeper;
import
java.nio.charset.StandardCharsets
;
import
java.nio.charset.StandardCharsets
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
/**
/**
* 安全追溯问题生成服务实现类
* 安全追溯问题生成服务实现类
*
*
...
@@ -21,24 +29,64 @@ import java.util.Map;
...
@@ -21,24 +29,64 @@ import java.util.Map;
*/
*/
@Service
@Service
public
class
SafetyProblemTracingGenServiceImpl
{
public
class
SafetyProblemTracingGenServiceImpl
{
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
SafetyProblemTracingGenServiceImpl
.
class
);
@Autowired
CommonMapper
commonMapper
;
@Autowired
IdxBizJgOtherInfoServiceImpl
idxBizJgOtherInfoService
;
@Autowired
@Autowired
SafetyProblemTracingMapper
safetyProblemTracingMapper
;
ESEquipmentCategory
esEquipmentCategory
;
@Autowired
@Autowired
EmqKeeper
emqKeeper
;
EmqKeeper
emqKeeper
;
@Scheduled
(
cron
=
"0 0 1 * * ?"
)
@Scheduled
(
cron
=
"0 0 1 * * ?"
)
@SchedulerLock
(
name
=
"executeSafetyProblemCheck
1"
,
lockAtMostFor
=
"PT5H"
,
lockAtLeastFor
=
"PT60S
"
)
@SchedulerLock
(
name
=
"executeSafetyProblemCheck
"
,
lockAtMostFor
=
"PT5H"
,
lockAtLeastFor
=
"PT10M
"
)
public
void
queryEquipListByProblemId
()
{
public
void
executeSafetyProblemCheck
()
{
executeMaintenanceCheck
();
executeMaintenanceCheck
();
executeInspectionCheck
();
}
}
@SneakyThrows
public
void
executeInspectionCheck
()
{
private
void
executeMaintenanceCheck
()
{
logger
.
info
(
"开始检验检测超期检查"
);
List
<
Map
<
String
,
Object
>>
outOfMaintenanceRecords
=
safetyProblemTracingMapper
.
queryOutOfMaintenanceRecord
();
// 查询当天检验超期的设备
List
<
Map
<
String
,
Object
>>
outOfInspectionRecords
=
commonMapper
.
queryOutOfInspectionRecord
();
updateEquipAndSendMessage
(
outOfInspectionRecords
,
SafetyProblemTypeEnum
.
JYCQ
);
logger
.
info
(
"检验检测超期检查结束"
);
}
public
void
executeMaintenanceCheck
()
{
logger
.
info
(
"开始维保超期检查"
);
// 查询当天维保超期的设备
List
<
Map
<
String
,
Object
>>
outOfMaintenanceRecords
=
commonMapper
.
queryOutOfMaintenanceRecord
();
updateEquipAndSendMessage
(
outOfMaintenanceRecords
,
SafetyProblemTypeEnum
.
WBCQ
);
logger
.
info
(
"维保超期检查结束"
);
}
private
void
updateEquipAndSendMessage
(
List
<
Map
<
String
,
Object
>>
mapList
,
SafetyProblemTypeEnum
safetyProblemTypeEnum
)
{
List
<
String
>
records
=
mapList
.
stream
().
map
(
m
->
m
.
get
(
"RECORD"
).
toString
()).
collect
(
Collectors
.
toList
());
// 更新设备状态为未处理(异常)
idxBizJgOtherInfoService
.
lambdaUpdate
()
.
in
(
IdxBizJgOtherInfo:
:
getRecord
,
records
)
.
set
(
IdxBizJgOtherInfo:
:
getStatus
,
SafetyProblemStatusEnum
.
UNHANDLED
.
getCode
())
.
update
();
List
<
ESEquipmentCategoryDto
>
esEquipmentCategoryDto
=
Lists
.
newArrayList
();
for
(
ESEquipmentCategoryDto
equipmentCategoryDto
:
esEquipmentCategory
.
findAllById
(
records
))
{
equipmentCategoryDto
.
setProblemStatus
(
SafetyProblemStatusEnum
.
UNHANDLED
.
getCode
());
esEquipmentCategoryDto
.
add
(
equipmentCategoryDto
);
}
esEquipmentCategory
.
saveAll
(
esEquipmentCategoryDto
);
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"outOfMaintenanceRecords"
,
outOfMaintenanceRecords
);
jsonObject
.
put
(
safetyProblemTypeEnum
.
getMsgKey
(),
mapList
);
emqKeeper
.
getMqttClient
().
publish
(
"wb/cq"
,
jsonObject
.
toString
().
getBytes
(
StandardCharsets
.
UTF_8
),
2
,
false
);
try
{
emqKeeper
.
getMqttClient
().
publish
(
safetyProblemTypeEnum
.
getTopic
(),
jsonObject
.
toString
().
getBytes
(
StandardCharsets
.
UTF_8
),
2
,
false
);
}
catch
(
MqttException
e
)
{
logger
.
error
(
"发送安全追溯问题设备信息消息失败---->{}"
,
e
.
getMessage
());
throw
new
RuntimeException
(
e
);
}
}
}
}
}
\ 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/SafetyProblemTracingServiceImpl.java
View file @
ee5b9cf6
...
@@ -3,22 +3,36 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
...
@@ -3,22 +3,36 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.enums.SqlMethod
;
import
com.baomidou.mybatisplus.core.metadata.TableInfo
;
import
com.baomidou.mybatisplus.core.metadata.TableInfoHelper
;
import
com.baomidou.mybatisplus.core.toolkit.Assert
;
import
com.baomidou.mybatisplus.core.toolkit.Constants
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.yeejoin.amos.boot.module.jg.api.entity.SafetyProblemTracing
;
import
com.yeejoin.amos.boot.module.jg.api.entity.SafetyProblemTracing
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemSourceTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemSourceTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemStatusEnum
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.SafetyProblemTracingMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.SafetyProblemTracingMapper
;
import
com.yeejoin.amos.boot.module.jg.api.model.SafetyProblemTracingModel
;
import
com.yeejoin.amos.boot.module.jg.api.model.SafetyProblemTracingModel
;
import
com.yeejoin.amos.boot.module.jg.api.service.ISafetyProblemTracingService
;
import
com.yeejoin.amos.boot.module.jg.api.service.ISafetyProblemTracingService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService
;
import
com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgRegisterInfoService
;
import
org.apache.ibatis.session.SqlSession
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.function.Function
;
import
static
org
.
springframework
.
jdbc
.
object
.
BatchSqlUpdate
.
DEFAULT_BATCH_SIZE
;
/**
/**
* 安全追溯问题服务实现类
* 安全追溯问题服务实现类
...
@@ -27,7 +41,7 @@ import java.util.Map;
...
@@ -27,7 +41,7 @@ import java.util.Map;
* @date 2024-05-21
* @date 2024-05-21
*/
*/
@Service
@Service
public
class
SafetyProblemTracingServiceImpl
extends
BaseService
<
SafetyProblemTracingModel
,
SafetyProblemTracing
,
SafetyProblemTracingMapper
>
implements
ISafetyProblemTracingService
{
public
class
SafetyProblemTracingServiceImpl
extends
BaseService
<
SafetyProblemTracingModel
,
SafetyProblemTracing
,
SafetyProblemTracingMapper
>
implements
ISafetyProblemTracingService
{
@Autowired
@Autowired
IIdxBizJgRegisterInfoService
idxBizJgRegisterInfoService
;
IIdxBizJgRegisterInfoService
idxBizJgRegisterInfoService
;
...
@@ -35,11 +49,11 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
...
@@ -35,11 +49,11 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
/**
/**
* 分页查询
* 分页查询
*/
*/
public
Page
<
SafetyProblemTracingModel
>
queryForSafetyProblemTracingPage
(
Page
<
SafetyProblemTracingModel
>
page
,
SafetyProblemTracingModel
problemModel
)
{
public
Page
<
SafetyProblemTracingModel
>
queryForSafetyProblemTracingPage
(
Page
<
SafetyProblemTracingModel
>
page
,
SafetyProblemTracingModel
problemModel
)
{
return
this
.
baseMapper
.
queryForSafetyProblemTracingPage
(
page
,
problemModel
);
return
this
.
baseMapper
.
queryForSafetyProblemTracingPage
(
page
,
problemModel
);
}
}
public
Page
<
SafetyProblemTracingModel
>
queryProblemPageByEquipId
(
Page
<
SafetyProblemTracingModel
>
page
,
String
equipId
)
{
public
Page
<
SafetyProblemTracingModel
>
queryProblemPageByEquipId
(
Page
<
SafetyProblemTracingModel
>
page
,
String
equipId
)
{
SafetyProblemTracingModel
problemModel
=
new
SafetyProblemTracingModel
();
SafetyProblemTracingModel
problemModel
=
new
SafetyProblemTracingModel
();
problemModel
.
setSourceId
(
equipId
);
problemModel
.
setSourceId
(
equipId
);
return
this
.
baseMapper
.
queryForSafetyProblemTracingPage
(
page
,
problemModel
);
return
this
.
baseMapper
.
queryForSafetyProblemTracingPage
(
page
,
problemModel
);
...
@@ -48,7 +62,7 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
...
@@ -48,7 +62,7 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
/**
/**
* 根据ID查询
* 根据ID查询
*/
*/
public
SafetyProblemTracingModel
selectOne
(
Long
sequenceNbr
)
{
public
SafetyProblemTracingModel
selectOne
(
Long
sequenceNbr
)
{
SafetyProblemTracingModel
entity
=
new
SafetyProblemTracingModel
();
SafetyProblemTracingModel
entity
=
new
SafetyProblemTracingModel
();
LambdaQueryWrapper
<
SafetyProblemTracing
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
SafetyProblemTracing
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
SafetyProblemTracing:
:
getSequenceNbr
,
sequenceNbr
);
queryWrapper
.
eq
(
SafetyProblemTracing:
:
getSequenceNbr
,
sequenceNbr
);
...
@@ -63,8 +77,8 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
...
@@ -63,8 +77,8 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
/**
/**
* 列表查询 示例
* 列表查询 示例
*/
*/
public
List
<
SafetyProblemTracingModel
>
queryForSafetyProblemTracingList
()
{
public
List
<
SafetyProblemTracingModel
>
queryForSafetyProblemTracingList
()
{
return
this
.
queryForList
(
""
,
false
);
return
this
.
queryForList
(
""
,
false
);
}
}
public
Page
<
Map
<
String
,
Object
>>
queryEquipListByProblemId
(
Page
<
Map
<
String
,
Object
>>
page
,
String
problemId
)
{
public
Page
<
Map
<
String
,
Object
>>
queryEquipListByProblemId
(
Page
<
Map
<
String
,
Object
>>
page
,
String
problemId
)
{
...
@@ -83,11 +97,20 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
...
@@ -83,11 +97,20 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
List
<
Map
<
String
,
Object
>>
finalList
=
Lists
.
newArrayList
();
List
<
Map
<
String
,
Object
>>
finalList
=
Lists
.
newArrayList
();
result
.
getRecords
().
forEach
(
item
->
{
result
.
getRecords
().
forEach
(
item
->
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"record"
,
item
.
get
(
"SEQUENCE_NBR"
));
map
.
put
(
"equList"
,
item
.
get
(
"EQU_LIST"
));
map
.
put
(
"equList"
,
item
.
get
(
"EQU_LIST"
));
map
.
put
(
"equCategory"
,
item
.
get
(
"EQU_CATEGORY"
));
map
.
put
(
"equCategory"
,
item
.
get
(
"EQU_CATEGORY"
));
map
.
put
(
"useUnitName"
,
item
.
get
(
"USE_UNIT_NAME"
));
map
.
put
(
"useUnitName"
,
item
.
get
(
"USE_UNIT_NAME"
));
map
.
put
(
"code96333"
,
item
.
get
(
"CODE96333"
));
map
.
put
(
"code96333"
,
item
.
get
(
"CODE96333"
));
map
.
put
(
"supervisoryCode"
,
item
.
get
(
"SUPERVISORY_CODE"
));
map
.
put
(
"supervisoryCode"
,
item
.
get
(
"SUPERVISORY_CODE"
));
map
.
put
(
"problemStatus"
,
item
.
get
(
"problemStatus"
));
if
(
SafetyProblemStatusEnum
.
UNHANDLED
.
getCode
().
equals
(
item
.
get
(
"problemStatus"
)))
{
map
.
put
(
"problemStatusColor"
,
SafetyProblemStatusEnum
.
UNHANDLED
.
getColor
());
map
.
put
(
"problemStatusName"
,
"异常"
);
}
else
{
map
.
put
(
"problemStatusColor"
,
SafetyProblemStatusEnum
.
HANDLED
.
getColor
());
map
.
put
(
"problemStatusName"
,
"正常"
);
}
finalList
.
add
(
map
);
finalList
.
add
(
map
);
});
});
BeanUtils
.
copyProperties
(
result
,
list
);
BeanUtils
.
copyProperties
(
result
,
list
);
...
@@ -102,4 +125,47 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
...
@@ -102,4 +125,47 @@ public class SafetyProblemTracingServiceImpl extends BaseService<SafetyProblemTr
SafetyProblemTracing
problem
=
this
.
baseMapper
.
selectOne
(
queryWrapper
);
SafetyProblemTracing
problem
=
this
.
baseMapper
.
selectOne
(
queryWrapper
);
return
this
.
baseMapper
.
queryPrincipalUnitByProblemId
(
page
,
problemId
,
problem
.
getSourceTypeCode
());
return
this
.
baseMapper
.
queryPrincipalUnitByProblemId
(
page
,
problemId
,
problem
.
getSourceTypeCode
());
}
}
/**
* 条件批量添加更新
*
* @param entityList 数据
* @param queryWrapperFunction 条件
* @return boolean
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
saveOrUpdateBatchByColumns
(
List
<
SafetyProblemTracing
>
entityList
,
Function
<
SafetyProblemTracing
,
QueryWrapper
>
queryWrapperFunction
)
{
Assert
.
notEmpty
(
entityList
,
"error: entityList must not be empty"
);
Class
<?>
cls
=
currentModelClass
();
TableInfo
tableInfo
=
TableInfoHelper
.
getTableInfo
(
cls
);
Assert
.
notNull
(
tableInfo
,
"error: can not execute. because can not find cache of TableInfo for entity!"
);
String
keyProperty
=
tableInfo
.
getKeyProperty
();
Assert
.
notEmpty
(
keyProperty
,
"error: can not execute. because can not find column for id from entity!"
);
try
(
SqlSession
batchSqlSession
=
sqlSessionBatch
())
{
int
i
=
0
;
for
(
SafetyProblemTracing
entity
:
entityList
)
{
// Object idVal = ReflectionKit.getMethodValue(cls, entity, keyProperty);
SafetyProblemTracing
target
=
getBaseMapper
().
selectOne
(
new
QueryWrapper
<
SafetyProblemTracing
>()
.
eq
(
"problem_type_code"
,
entity
.
getProblemTypeCode
())
.
eq
(
"source_id"
,
entity
.
getSourceId
())
.
eq
(
"problem_status_code"
,
entity
.
getProblemStatusCode
()));
if
(
Objects
.
isNull
(
target
))
{
batchSqlSession
.
insert
(
sqlStatement
(
SqlMethod
.
INSERT_ONE
),
entity
);
}
else
{
Map
<
String
,
Object
>
param
=
Maps
.
newHashMap
();
param
.
put
(
Constants
.
ENTITY
,
entity
);
param
.
put
(
Constants
.
WRAPPER
,
queryWrapperFunction
.
apply
(
entity
));
batchSqlSession
.
update
(
sqlStatement
(
SqlMethod
.
UPDATE
),
param
);
}
// 不知道以后会不会有人说更新失败了还要执行插入 😂😂😂
if
(
i
>=
1
&&
i
%
DEFAULT_BATCH_SIZE
==
0
)
{
batchSqlSession
.
flushStatements
();
}
i
++;
}
batchSqlSession
.
flushStatements
();
}
return
true
;
}
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/entity/TzBaseEnterpriseInfo.java
View file @
ee5b9cf6
...
@@ -193,4 +193,7 @@ public class TzBaseEnterpriseInfo extends BaseEntity {
...
@@ -193,4 +193,7 @@ public class TzBaseEnterpriseInfo extends BaseEntity {
@ApiModelProperty
(
value
=
"其他附件"
)
@ApiModelProperty
(
value
=
"其他附件"
)
private
String
otherAccessories
;
private
String
otherAccessories
;
@ApiModelProperty
(
value
=
"企业问题状态"
)
private
String
status
;
}
}
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/api/dto/ESEquipmentCategoryDto.java
View file @
ee5b9cf6
...
@@ -135,4 +135,7 @@ public class ESEquipmentCategoryDto {
...
@@ -135,4 +135,7 @@ public class ESEquipmentCategoryDto {
@Field
(
type
=
FieldType
.
Text
)
@Field
(
type
=
FieldType
.
Text
)
private
String
WHETHER_SKID_MOUNTED_PRESSURE_VESSEL
;
private
String
WHETHER_SKID_MOUNTED_PRESSURE_VESSEL
;
@Field
(
type
=
FieldType
.
Text
)
private
String
problemStatus
;
// 问题状态
}
}
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