Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
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
station
YeeAmosFireAutoSysRoot
Commits
3f9096f1
Commit
3f9096f1
authored
Apr 19, 2024
by
张森
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
预案JSON迁移为表数据
parent
c66e9b33
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
80 deletions
+50
-80
ContingencyAction.java
...m/yeejoin/amos/fas/business/action/ContingencyAction.java
+3
-24
EmergencyTaskRoleMapper.java
...amos/fas/business/dao/mapper/EmergencyTaskRoleMapper.java
+2
-1
EquipmentFireEquipmentServiceImpl.java
...iness/service/impl/EquipmentFireEquipmentServiceImpl.java
+6
-21
PlanStepServiceImpl.java
...n/amos/fas/business/service/impl/PlanStepServiceImpl.java
+9
-34
fas-2.0.1.xml
...utoSysStart/src/main/resources/db/changelog/fas-2.0.1.xml
+17
-0
EmergencyTaskRoleMapper.xml
.../src/main/resources/db/mapper/EmergencyTaskRoleMapper.xml
+13
-0
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/action/ContingencyAction.java
View file @
3f9096f1
...
...
@@ -157,14 +157,9 @@ public class ContingencyAction implements CustomerAction {
private
com
.
yeejoin
.
amos
.
component
.
rule
.
RuleTrigger
ruleTrigger
;
@Autowired
private
IEquipmentFireEquipmentService
equipmentFireEquipmentService
;
@Value
(
"classpath:/json/plan-step.json"
)
private
Resource
planStepResource
;
@Value
(
"classpath:/json/plan-step-UHV-zb.json"
)
private
Resource
planStepZBResource
;
@Value
(
"classpath:/json/plan-step-UHV-gk.json"
)
private
Resource
planStepGKResource
;
@Autowired
private
IPlanStepService
iPlanStepService
;
/**
* @param stepCode 当前步骤编号
...
...
@@ -810,23 +805,7 @@ public class ContingencyAction implements CustomerAction {
tempmap1
.
put
(
"content"
,
content
);
result
.
add
(
tempmap1
);
String
instanceId
=
iContingencyInstance
.
getInstanceIdByBatchNOAndCategory
(
"OPERATE"
,
stepName
,
batchNo
);
String
json
=
null
;
try
{
if
(
redisTemplate
.
hasKey
(
"planType"
))
{
String
planType
=
redisTemplate
.
boundValueOps
(
"planType"
).
get
(
0
,
-
1
);
if
(
PlanTypeEnum
.
MAINTRANSFORM
.
getKey
().
equalsIgnoreCase
(
planType
))
{
json
=
IOUtils
.
toString
(
planStepZBResource
.
getInputStream
(),
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
}
else
if
(
PlanTypeEnum
.
HIGHRESISTANCE
.
getKey
().
equalsIgnoreCase
(
planType
))
{
json
=
IOUtils
.
toString
(
planStepGKResource
.
getInputStream
(),
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
}
else
{
json
=
IOUtils
.
toString
(
planStepResource
.
getInputStream
(),
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
}
}
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"获取预案节点信息失败!"
);
}
String
json
=
iPlanStepService
.
getPlanStep
();
List
<
PlanStepJsonVO
>
res
=
JSONObject
.
parseArray
(
json
,
PlanStepJsonVO
.
class
);
PlanStepJsonVO
vo
=
res
.
stream
().
filter
(
x
->
x
.
getStepCode
().
equals
(
stepCode
)).
collect
(
Collectors
.
toList
()).
get
(
0
);
Object
obj
=
equipmentFireEquipmentService
.
automaticExecutePoint
(
vo
.
getIndex
());
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/mapper/EmergencyTaskRoleMapper.java
View file @
3f9096f1
...
...
@@ -3,7 +3,6 @@ package com.yeejoin.amos.fas.business.dao.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.fas.dao.entity.EmergencyTaskRole
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
...
...
@@ -29,4 +28,6 @@ public interface EmergencyTaskRoleMapper extends BaseMapper<EmergencyTaskRole> {
EmergencyTaskRole
selectByCode
(
String
code
);
List
<
EmergencyTaskRole
>
selectList
();
String
getPlanStepInfoByType
(
String
planType
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/EquipmentFireEquipmentServiceImpl.java
View file @
3f9096f1
...
...
@@ -2,36 +2,28 @@ package com.yeejoin.amos.fas.business.service.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificIndexMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.EquipmentSpecificMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.PlanMessageMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper
;
import
com.yeejoin.amos.fas.business.dao.mapper.*
;
import
com.yeejoin.amos.fas.business.dao.repository.IEquipmentDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IEquipmentFireEquipmentDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IPlanMessageDao
;
import
com.yeejoin.amos.fas.business.service.intfc.EquipmentSpecificIndexService
;
import
com.yeejoin.amos.fas.business.service.intfc.IEquipmentFireEquipmentService
;
import
com.yeejoin.amos.fas.business.service.intfc.IPlanStepService
;
import
com.yeejoin.amos.fas.business.vo.ConditionVO
;
import
com.yeejoin.amos.fas.business.vo.PlanStepJsonVO
;
import
com.yeejoin.amos.fas.common.enums.SqlKeyWordEnum
;
import
com.yeejoin.amos.fas.dao.entity.Equipment
;
import
com.yeejoin.amos.fas.dao.entity.EquipmentFireEquipment
;
import
com.yeejoin.amos.fas.dao.entity.PlanMessage
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.Resource
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -86,10 +78,8 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
EquipmentSpecificIndexMapper
equipmentSpecificIndexMapper
;
@Autowired
private
EquipmentSpecificMapper
equipmentSpecificMapper
;
private
IPlanStepService
iPlanStepService
;
@Value
(
"classpath:/json/plan-step.json"
)
private
Resource
planStepResource
;
@Override
public
List
<
EquipmentFireEquipment
>
findByEquipmentId
(
Long
equipmentId
)
{
...
...
@@ -178,13 +168,8 @@ public class EquipmentFireEquipmentServiceImpl implements IEquipmentFireEquipmen
if
(
ObjectUtils
.
isEmpty
(
index
))
{
return
false
;
}
String
json
;
try
{
json
=
IOUtils
.
toString
(
planStepResource
.
getInputStream
(),
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"获取预案节点信息失败!"
);
}
List
<
PlanStepJsonVO
>
result
=
JSONObject
.
parseArray
(
json
,
PlanStepJsonVO
.
class
);
String
planStep
=
iPlanStepService
.
getPlanStep
();
List
<
PlanStepJsonVO
>
result
=
JSONObject
.
parseArray
(
planStep
,
PlanStepJsonVO
.
class
);
if
(!
CollectionUtils
.
isEmpty
(
result
))
{
// 获取电力设备id及batchNo
Map
<
String
,
Object
>
map
=
planOperationRecordMapper
.
getLatestFireEquipId
();
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/PlanStepServiceImpl.java
View file @
3f9096f1
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.fas.business.dao.mapper.EmergencyTaskRoleMapper
;
import
com.yeejoin.amos.fas.business.service.intfc.IPlanStepService
;
import
com.yeejoin.amos.fas.business.vo.PlanStepJsonVO
;
import
com.yeejoin.amos.fas.common.enums.PlanTypeEnum
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.Resource
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
@Service
...
...
@@ -26,14 +19,8 @@ public class PlanStepServiceImpl implements IPlanStepService {
@Autowired
private
RedisTemplate
redisTemplate
;
@Value
(
"classpath:/json/plan-step.json"
)
private
Resource
planStepResource
;
@Value
(
"classpath:/json/plan-step-UHV-zb.json"
)
private
Resource
planStepZBResource
;
@Value
(
"classpath:/json/plan-step-UHV-gk.json"
)
private
Resource
planStepGKResource
;
@Autowired
private
EmergencyTaskRoleMapper
emergencyTaskRoleMapper
;
@Override
public
String
getPlanStepRoleCodeByButtonCode
(
String
buttonCode
)
{
...
...
@@ -61,31 +48,19 @@ public class PlanStepServiceImpl implements IPlanStepService {
@Override
public
List
<
PlanStepJsonVO
>
getPlanStepJsonVOS
()
{
String
json
=
""
;
try
{
json
=
IOUtils
.
toString
(
planStepResource
.
getInputStream
(),
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"获取预案相关角色信息失败!"
);
}
List
<
PlanStepJsonVO
>
result
=
JSONObject
.
parseArray
(
json
,
PlanStepJsonVO
.
class
);
String
planStepString
=
getPlanStep
();
List
<
PlanStepJsonVO
>
result
=
JSONObject
.
parseArray
(
planStepString
,
PlanStepJsonVO
.
class
);
return
result
;
}
@Override
public
String
getPlanStep
()
{
try
{
String
planType
=
""
;
if
(
redisTemplate
.
hasKey
(
"planType"
))
{
String
planType
=
redisTemplate
.
boundValueOps
(
"planType"
).
get
(
0
,
-
1
);
if
(
PlanTypeEnum
.
MAINTRANSFORM
.
getKey
().
equalsIgnoreCase
(
planType
))
{
return
IOUtils
.
toString
(
planStepZBResource
.
getInputStream
(),
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
}
else
if
(
PlanTypeEnum
.
HIGHRESISTANCE
.
getKey
().
equalsIgnoreCase
(
planType
))
{
return
IOUtils
.
toString
(
planStepGKResource
.
getInputStream
(),
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
}
}
return
IOUtils
.
toString
(
planStepResource
.
getInputStream
(),
String
.
valueOf
(
StandardCharsets
.
UTF_8
));
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"获取预案初始化planStep信息失败!"
);
planType
=
redisTemplate
.
boundValueOps
(
"planType"
).
get
(
0
,
-
1
);
}
String
json
=
emergencyTaskRoleMapper
.
getPlanStepInfoByType
(
planType
);
return
json
;
}
@Override
...
...
YeeAmosFireAutoSysStart/src/main/resources/db/changelog/fas-2.0.1.xml
View file @
3f9096f1
...
...
@@ -991,4 +991,20 @@
</sql>
</changeSet>
<changeSet
author=
"zs"
id=
"20240419-01"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<tableExists
tableName=
"c_plan_step_config"
/>
</not>
</preConditions>
<comment>
create table c_plan_step_config
</comment>
<sql>
CREATE TABLE `c_plan_step_config` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
`type` varchar(255) DEFAULT NULL COMMENT '类型',
`data` longtext COMMENT 'json数据',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/EmergencyTaskRoleMapper.xml
View file @
3f9096f1
...
...
@@ -59,4 +59,16 @@
<select
id=
"selectList"
resultType=
"com.yeejoin.amos.fas.dao.entity.EmergencyTaskRole"
>
select * from c_emergency_task_role where is_delete = 0 order by sort desc
</select>
<select
id=
"getPlanStepInfoByType"
resultType=
"java.lang.String"
>
select `data` from c_plan_step_config
<where>
1 = 1
<if
test=
"planType != null and planType != ''"
>
AND type = #{planType}
</if>
</where>
order by id ASC
limit 1
</select>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment