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
b4afff5c
Commit
b4afff5c
authored
Jan 15, 2021
by
吴俊凯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
预案启动暂时提交
parent
e1d5bb1b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
106 additions
and
0 deletions
+106
-0
ContingencyPlanController.java
...os/fas/business/controller/ContingencyPlanController.java
+16
-0
IPlanDetailDao.java
...join/amos/fas/business/dao/repository/IPlanDetailDao.java
+4
-0
ContingencyPlanServiceImpl.java
...fas/business/service/impl/ContingencyPlanServiceImpl.java
+56
-0
ContingencyPlanService.java
...os/fas/business/service/intfc/ContingencyPlanService.java
+3
-0
ContingencyPlanParamVo.java
.../yeejoin/amos/fas/business/vo/ContingencyPlanParamVo.java
+27
-0
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/ContingencyPlanController.java
View file @
b4afff5c
package
com
.
yeejoin
.
amos
.
fas
.
business
.
controller
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
controller
;
import
com.yeejoin.amos.fas.business.service.intfc.ContingencyPlanService
;
import
com.yeejoin.amos.fas.business.vo.ContingencyPlanParamVo
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil2
;
import
com.yeejoin.amos.fas.core.util.ResponseModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RestController
...
@@ -9,4 +17,12 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -9,4 +17,12 @@ import org.springframework.web.bind.annotation.RestController;
@Api
(
"预案api"
)
@Api
(
"预案api"
)
public
class
ContingencyPlanController
extends
BaseController
{
public
class
ContingencyPlanController
extends
BaseController
{
@Autowired
private
ContingencyPlanService
contingencyPlanService
;
@ApiOperation
(
value
=
"启动"
)
@RequestMapping
(
value
=
"/start"
,
method
=
RequestMethod
.
POST
)
public
ResponseModel
create
(
@RequestBody
ContingencyPlanParamVo
vo
)
{
contingencyPlanService
.
planStart
(
vo
);
return
CommonResponseUtil2
.
success
();
}
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/IPlanDetailDao.java
View file @
b4afff5c
package
com
.
yeejoin
.
amos
.
fas
.
business
.
dao
.
repository
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
dao
.
repository
;
import
com.yeejoin.amos.fas.dao.entity.PlanDetail
;
import
com.yeejoin.amos.fas.dao.entity.PlanDetail
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
/**
/**
...
@@ -12,4 +13,7 @@ import org.springframework.stereotype.Repository;
...
@@ -12,4 +13,7 @@ import org.springframework.stereotype.Repository;
@Repository
@Repository
public
interface
IPlanDetailDao
extends
BaseDao
<
PlanDetail
,
Long
>
{
public
interface
IPlanDetailDao
extends
BaseDao
<
PlanDetail
,
Long
>
{
@Query
(
value
=
"SELECT count(*) from c_plan_detail where status in (?1) AND is_delete = 0 "
,
nativeQuery
=
true
)
int
findByStatus
(
Integer
[]
status
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyPlanServiceImpl.java
View file @
b4afff5c
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
impl
;
import
com.yeejoin.amos.fas.business.dao.repository.IPlanDetailDao
;
import
com.yeejoin.amos.fas.business.service.intfc.ContingencyPlanService
;
import
com.yeejoin.amos.fas.business.service.intfc.ContingencyPlanService
;
import
com.yeejoin.amos.fas.business.service.intfc.IEquipmentService
;
import
com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService
;
import
com.yeejoin.amos.fas.business.vo.ContingencyPlanParamVo
;
import
com.yeejoin.amos.fas.common.enums.ContingencyPlanStatusEnum
;
import
com.yeejoin.amos.fas.core.enums.NumberEnum
;
import
com.yeejoin.amos.fas.core.enums.ReserveEnum
;
import
com.yeejoin.amos.fas.dao.entity.Equipment
;
import
com.yeejoin.amos.fas.dao.entity.PlanDetail
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.Arrays
;
import
java.util.Optional
;
/**
/**
*@program: YeeAmosFireAutoSysRoot
*@program: YeeAmosFireAutoSysRoot
*@description: 预案实现类
*@description: 预案实现类
...
@@ -11,5 +24,47 @@ import org.springframework.stereotype.Service;
...
@@ -11,5 +24,47 @@ import org.springframework.stereotype.Service;
*/
*/
@Service
(
"ContingencyPlanService"
)
@Service
(
"ContingencyPlanService"
)
public
class
ContingencyPlanServiceImpl
implements
ContingencyPlanService
{
public
class
ContingencyPlanServiceImpl
implements
ContingencyPlanService
{
@Autowired
private
IPlanDetailDao
planDetailDao
;
@Autowired
private
IEquipmentService
equipmentService
;
@Autowired
private
IRiskSourceService
riskSourceService
;
@Override
public
String
planStart
(
ContingencyPlanParamVo
vo
){
ReserveEnum
reserveEnum
=
null
;
//模拟启动
if
(
ContingencyPlanStatusEnum
.
SIMULATION_START
.
getCode
().
equals
(
vo
.
getStatus
())){
Integer
[]
statusArray
=
(
Integer
[])
Arrays
.
asList
(
ContingencyPlanStatusEnum
.
SIMULATION_START
.
getCode
(),
ContingencyPlanStatusEnum
.
ONGOING
.
getCode
()).
toArray
();
int
count
=
planDetailDao
.
findByStatus
(
statusArray
);
if
(
count
>
NumberEnum
.
ZERO
.
getValue
())
{
return
ReserveEnum
.
RUNNING
.
getText
();
}
}
else
if
(
ContingencyPlanStatusEnum
.
ONGOING
.
getCode
().
equals
(
vo
.
getStatus
())){
//自动启动
Integer
[]
statusArray
=
(
Integer
[])
Arrays
.
asList
(
ContingencyPlanStatusEnum
.
ONGOING
.
getCode
()).
toArray
();
int
count
=
planDetailDao
.
findByStatus
(
statusArray
);
if
(
count
>
NumberEnum
.
ZERO
.
getValue
())
{
return
ReserveEnum
.
RUNNING
.
getText
();
}
}
else
{
return
"预控启动状态不正确"
;
}
//预案启动
Optional
<
PlanDetail
>
PlanDetailOp
=
planDetailDao
.
findById
(
Long
.
valueOf
(
vo
.
getPlanId
()));
if
(
PlanDetailOp
.
get
()!=
null
){
Equipment
equipment
=
equipmentService
.
queryOne
(
PlanDetailOp
.
get
().
getId
());
//预案启动
reserveEnum
=
riskSourceService
.
startEquipReserve
(
equipment
.
getId
(),
equipment
.
getCode
());
if
(
ReserveEnum
.
RUN
.
getStatus
()
==
reserveEnum
.
getStatus
()){
PlanDetail
planDetail
=
PlanDetailOp
.
get
();
planDetail
.
setStatus
(
Integer
.
parseInt
(
ContingencyPlanStatusEnum
.
SIMULATION_START
.
getCode
()));
planDetailDao
.
save
(
planDetail
);
}
}
return
reserveEnum
.
getText
();
}
}
}
\ No newline at end of file
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/ContingencyPlanService.java
View file @
b4afff5c
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
intfc
;
package
com
.
yeejoin
.
amos
.
fas
.
business
.
service
.
intfc
;
import
com.yeejoin.amos.fas.business.vo.ContingencyPlanParamVo
;
/**
/**
* @author wjk
* @author wjk
* @date 2021-01-14
* @date 2021-01-14
...
@@ -7,4 +9,5 @@ package com.yeejoin.amos.fas.business.service.intfc;
...
@@ -7,4 +9,5 @@ package com.yeejoin.amos.fas.business.service.intfc;
*/
*/
public
interface
ContingencyPlanService
{
public
interface
ContingencyPlanService
{
String
planStart
(
ContingencyPlanParamVo
vo
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/vo/ContingencyPlanParamVo.java
0 → 100644
View file @
b4afff5c
package
com
.
yeejoin
.
amos
.
fas
.
business
.
vo
;
//请求参数
public
class
ContingencyPlanParamVo
{
public
String
planId
;
public
String
status
;
public
String
getPlanId
()
{
return
planId
;
}
public
void
setPlanId
(
String
planId
)
{
this
.
planId
=
planId
;
}
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
}
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