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
c396881e
Commit
c396881e
authored
Dec 15, 2020
by
zhengjiawei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
b2e1de00
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
343 additions
and
328 deletions
+343
-328
RiskModelController.java
...oin/amos/fas/business/controller/RiskModelController.java
+220
-220
RiskSourceMapper.java
...eejoin/amos/fas/business/dao/mapper/RiskSourceMapper.java
+109
-107
RiskSourceServiceImpl.java
...amos/fas/business/service/impl/RiskSourceServiceImpl.java
+5
-1
dbTemplate_risk_source.xml
...t/src/main/resources/db/mapper/dbTemplate_risk_source.xml
+9
-0
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/RiskModelController.java
View file @
c396881e
package
com
.
yeejoin
.
amos
.
fas
.
business
.
controller
;
import
java.util.HashMap
;
import
java.util.List
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yeejoin.amos.fas.business.param.CommonPageInfoParam
;
import
com.yeejoin.amos.fas.business.param.RiskFmeaParam
;
import
com.yeejoin.amos.fas.business.service.intfc.IFmeaService
;
import
com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService
;
import
com.yeejoin.amos.fas.business.util.CommonPageParamUtil
;
import
com.yeejoin.amos.fas.business.vo.ReginParams
;
import
com.yeejoin.amos.fas.client.invoke.RsDataQueue
;
import
com.yeejoin.amos.fas.config.Permission
;
import
com.yeejoin.amos.fas.core.common.request.CommonPageable
;
import
com.yeejoin.amos.fas.core.common.request.CommonRequest
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil
;
import
com.yeejoin.amos.fas.dao.entity.Fmea
;
import
com.yeejoin.amos.fas.dao.entity.RiskSource
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
@RestController
@RequestMapping
(
"/api/riskModel"
)
@Api
(
tags
=
"风险模型api"
)
public
class
RiskModelController
extends
BaseController
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
RiskModelController
.
class
);
@Autowired
private
IRiskSourceService
riskSourceService
;
@Autowired
private
IFmeaService
fmeaService
;
@Permission
@ApiOperation
(
value
=
"根据父类编号获取子类风险点类型"
,
notes
=
"根据父类编号获取子类风险点类型"
)
@GetMapping
(
value
=
"/riskSource/getChildTypeByPid"
)
public
CommonResponse
getChildTypeByPid
(
@ApiParam
(
value
=
"风险模型对象"
,
required
=
true
)
@RequestParam
Long
riskSourceId
)
{
try
{
Integer
type
=
riskSourceService
.
getChildTypeByPid
(
riskSourceId
);
return
CommonResponseUtil
.
success
(
type
);
}
catch
(
Exception
e
)
{
log
.
error
(
"根据父类编号获取子类风险点类型异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
}
/**
* 风险模型新增及维护
*/
@Permission
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"风险模型新增及维护"
,
notes
=
"风险模型新增及维护"
)
@RequestMapping
(
value
=
"/riskSource/editRiskSource"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
CommonResponse
editRiskSource
(
@ApiParam
(
value
=
"风险模型对象"
,
required
=
true
)
@RequestBody
RiskSource
param
)
{
try
{
Integer
type
=
riskSourceService
.
getChildTypeByPid
(
param
.
getParentId
());
String
isRegion
=
param
.
getIsRegion
();
if
(
type
.
equals
(
1
)
&&
isRegion
.
equals
(
"FALSE"
))
{
return
CommonResponseUtil
.
failure
(
"该区域下只能添加区域"
);
}
if
(
type
.
equals
(
2
)
&&
isRegion
.
equals
(
"TRUE"
))
{
return
CommonResponseUtil
.
failure
(
"该区域下只能添加风险点"
);
}
Long
id
=
param
.
getId
();
if
(
id
==
0
)
{
//新增
}
else
{
// 更新的话,就放到前面,更新失败直接阻止本地
// 如果对于新增修改有什么约束,请添加到远程同步之前
String
synMsg
=
riskSourceService
.
saveToEquipManage
(
getAppKey
(),
getProduct
(),
getToken
(),
SUCCESS
,
param
.
getId
(),
param
.
getCode
(),
param
.
getName
(),
param
.
getParentId
());
if
(
synMsg
!=
null
)
{
return
CommonResponseUtil
.
failure
(
synMsg
);
}
}
AgencyUserModel
user
=
getUserInfo
();
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
compCode
=
getOrgCode
(
reginParams
);
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"org_code"
,
compCode
);
map
.
put
(
"user_id"
,
user
.
getUserId
());
map
.
put
(
"param"
,
param
);
CommonResponse
cr
=
CommonResponseUtil
.
success
(
riskSourceService
.
editRiskSource
(
map
));
if
(
id
==
0
)
{
//新增 新增的话,只能放到本地之后,因为必须拿到新增之后的ID才行
// 如果对于新增修改有什么约束,请添加到远程同步之前
String
synMsg
=
riskSourceService
.
saveToEquipManage
(
getAppKey
(),
getProduct
(),
getToken
(),
SUCCESS
,
param
.
getId
(),
param
.
getCode
(),
param
.
getName
(),
param
.
getParentId
());
if
(
synMsg
!=
null
)
{
//远程新增失败,就把本地删了,有点绕,但是没办法
//由于是刚刚新建的,就直接删除,不做任何不能删校验。
riskSourceService
.
deleteById
(
param
.
getId
());
return
CommonResponseUtil
.
failure
(
synMsg
);
}
}
return
cr
;
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
CommonResponseUtil
.
failure
(
"风险模型新增及维护失败:"
+
e
.
getMessage
());
}
}
/**
* 风险模型删除
*/
@Permission
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"风险模型删除"
,
notes
=
"风险模型删除"
)
@RequestMapping
(
value
=
"/riskSource/deleteRiskSource"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
CommonResponse
deleteRiskSource
(
@ApiParam
(
value
=
"风险模型id"
,
required
=
true
)
@RequestBody
Long
[]
riskSourceId
)
{
try
{
riskSourceService
.
deleteRiskSource
(
getAppKey
(),
getProduct
(),
getToken
(),
SUCCESS
,
riskSourceId
);
return
CommonResponseUtil
.
success
();
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
CommonResponseUtil
.
failure
(
"风险模型删除失败:"
+
e
.
getMessage
());
}
}
/**
* 风险点列表分页查询
*/
@Permission
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"风险点列表分页查询"
,
notes
=
"风险点列表分页查询"
)
@RequestMapping
(
value
=
"/riskSource/list"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
CommonResponse
queryRiskSourceByPage
(
@ApiParam
(
value
=
"查询条件"
)
@RequestBody
(
required
=
false
)
List
<
CommonRequest
>
queryRequests
,
@ApiParam
(
value
=
"分页参数"
,
required
=
true
)
CommonPageable
commonPageable
)
{
CommonPageInfoParam
param
=
CommonPageParamUtil
.
fillCommonPageInfoParam
(
queryRequests
,
commonPageable
);
Page
<
HashMap
<
String
,
Object
>>
riskSourceList
=
riskSourceService
.
queryRiskSourceByPage
(
param
);
return
CommonResponseUtil
.
success
(
riskSourceList
);
}
/**
* Fmea模型新增及维护
*/
@Permission
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"Fmea模型新增及维护"
,
notes
=
"Fmea模型新增及维护"
)
@RequestMapping
(
value
=
"/fmea/editFmea"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
CommonResponse
editFmea
(
@ApiParam
(
value
=
"Fmea模型对象"
,
required
=
true
)
@RequestBody
List
<
Fmea
>
params
)
{
try
{
AgencyUserModel
user
=
getUserInfo
();
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"user_id"
,
user
.
getUserId
());
map
.
put
(
"fmeas"
,
params
);
fmeaService
.
editFmea
(
map
);
RsDataQueue
rs
=
RsDataQueue
.
getInstance
();
params
.
forEach
(
param
->
{
if
(!
ObjectUtils
.
isEmpty
(
param
.
getId
()))
{
rs
.
addUpdateMessage
(
param
.
getId
(),
user
.
getRealName
());
}
});
return
CommonResponseUtil
.
success
();
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
CommonResponseUtil
.
failure
(
"Fmea模型新增及维护失败:"
+
e
.
getMessage
());
}
}
/**
* Fmea模型删除
*/
@Permission
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"Fmea模型删除"
,
notes
=
"Fmea模型删除"
)
@RequestMapping
(
value
=
"/fmea/deleteFmea"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
CommonResponse
deleteFmea
(
@ApiParam
(
value
=
"Fmea模型id"
,
required
=
true
)
@RequestBody
RiskFmeaParam
param
)
{
try
{
Long
[]
fmeaIds
=
param
.
getFmeaIds
();
fmeaService
.
deleteFmea
(
fmeaIds
);
if
(
fmeaIds
.
length
>
0
&&
param
.
getRiskSourceId
()
!=
null
)
{
RsDataQueue
rsDataQueue
=
RsDataQueue
.
getInstance
();
rsDataQueue
.
addDeleteMessage
(
param
.
getRiskSourceId
());
}
return
CommonResponseUtil
.
success
();
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
CommonResponseUtil
.
failure
(
"Fmea模型删除失败:"
+
e
.
getMessage
());
}
}
/**
* Fmea列表分页查询
*/
@Permission
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"Fmea列表分页查询"
,
notes
=
"Fmea列表分页查询"
)
@RequestMapping
(
value
=
"/fmea/list"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
CommonResponse
queryFmeaByPage
(
@ApiParam
(
value
=
"查询条件"
)
@RequestBody
(
required
=
false
)
List
<
CommonRequest
>
queryRequests
,
@ApiParam
(
value
=
"分页参数"
,
required
=
true
)
CommonPageable
commonPageable
)
{
CommonPageInfoParam
param
=
CommonPageParamUtil
.
fillCommonPageInfoParam
(
queryRequests
,
commonPageable
);
Page
<
HashMap
<
String
,
Object
>>
fmeaList
=
fmeaService
.
queryFmeaList
(
param
,
getToken
(),
getProduct
(),
getAppKey
());
return
CommonResponseUtil
.
success
(
fmeaList
);
}
@Permission
@ApiOperation
(
value
=
"Fmea是否关联对象查询"
,
notes
=
"Fmea是否关联对象查询"
)
@GetMapping
(
value
=
"/fmea/{ids}/controlObjCount"
)
public
CommonResponse
queryFmeaControlObj
(
@ApiParam
(
value
=
"fmea ids"
)
@PathVariable
(
value
=
"ids"
,
required
=
true
)
String
[]
ids
)
{
return
CommonResponseUtil
.
success
(
fmeaService
.
queryControlObjCount
(
ids
));
}
}
package
com
.
yeejoin
.
amos
.
fas
.
business
.
controller
;
import
java.util.HashMap
;
import
java.util.List
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.yeejoin.amos.fas.business.param.CommonPageInfoParam
;
import
com.yeejoin.amos.fas.business.param.RiskFmeaParam
;
import
com.yeejoin.amos.fas.business.service.intfc.IFmeaService
;
import
com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService
;
import
com.yeejoin.amos.fas.business.util.CommonPageParamUtil
;
import
com.yeejoin.amos.fas.business.vo.ReginParams
;
import
com.yeejoin.amos.fas.client.invoke.RsDataQueue
;
import
com.yeejoin.amos.fas.config.Permission
;
import
com.yeejoin.amos.fas.core.common.request.CommonPageable
;
import
com.yeejoin.amos.fas.core.common.request.CommonRequest
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil
;
import
com.yeejoin.amos.fas.dao.entity.Fmea
;
import
com.yeejoin.amos.fas.dao.entity.RiskSource
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiParam
;
@RestController
@RequestMapping
(
"/api/riskModel"
)
@Api
(
tags
=
"风险模型api"
)
public
class
RiskModelController
extends
BaseController
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
RiskModelController
.
class
);
@Autowired
private
IRiskSourceService
riskSourceService
;
@Autowired
private
IFmeaService
fmeaService
;
@Permission
@ApiOperation
(
value
=
"根据父类编号获取子类风险点类型"
,
notes
=
"根据父类编号获取子类风险点类型"
)
@GetMapping
(
value
=
"/riskSource/getChildTypeByPid"
)
public
CommonResponse
getChildTypeByPid
(
@ApiParam
(
value
=
"风险模型对象"
,
required
=
true
)
@RequestParam
Long
riskSourceId
)
{
try
{
Integer
type
=
riskSourceService
.
getChildTypeByPid
(
riskSourceId
);
return
CommonResponseUtil
.
success
(
type
);
}
catch
(
Exception
e
)
{
log
.
error
(
"根据父类编号获取子类风险点类型异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
}
/**
* 风险模型新增及维护
*/
@Permission
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"风险模型新增及维护"
,
notes
=
"风险模型新增及维护"
)
@RequestMapping
(
value
=
"/riskSource/editRiskSource"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
CommonResponse
editRiskSource
(
@ApiParam
(
value
=
"风险模型对象"
,
required
=
true
)
@RequestBody
RiskSource
param
)
{
try
{
Integer
type
=
riskSourceService
.
getChildTypeByPid
(
param
.
getParentId
());
String
isRegion
=
param
.
getIsRegion
();
if
(
type
.
equals
(
1
)
&&
isRegion
.
equals
(
"FALSE"
))
{
return
CommonResponseUtil
.
failure
(
"该区域下只能添加区域"
);
}
if
(
type
.
equals
(
2
)
&&
isRegion
.
equals
(
"TRUE"
))
{
return
CommonResponseUtil
.
failure
(
"该区域下只能添加风险点"
);
}
Long
id
=
param
.
getId
();
if
(
id
==
0
)
{
//新增
}
else
{
// 更新的话,就放到前面,更新失败直接阻止本地
// 如果对于新增修改有什么约束,请添加到远程同步之前
String
synMsg
=
riskSourceService
.
saveToEquipManage
(
getAppKey
(),
getProduct
(),
getToken
(),
SUCCESS
,
param
.
getId
(),
param
.
getCode
(),
param
.
getName
(),
param
.
getParentId
());
if
(
synMsg
!=
null
)
{
return
CommonResponseUtil
.
failure
(
synMsg
);
}
}
AgencyUserModel
user
=
getUserInfo
();
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
compCode
=
getOrgCode
(
reginParams
);
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"org_code"
,
compCode
);
map
.
put
(
"user_id"
,
user
.
getUserId
());
map
.
put
(
"param"
,
param
);
CommonResponse
cr
=
CommonResponseUtil
.
success
(
riskSourceService
.
editRiskSource
(
map
));
if
(
id
==
0
)
{
//新增 新增的话,只能放到本地之后,因为必须拿到新增之后的ID才行
// 如果对于新增修改有什么约束,请添加到远程同步之前
String
synMsg
=
riskSourceService
.
saveToEquipManage
(
getAppKey
(),
getProduct
(),
getToken
(),
SUCCESS
,
param
.
getId
(),
param
.
getCode
(),
param
.
getName
(),
param
.
getParentId
());
if
(
synMsg
!=
null
)
{
//远程新增失败,就把本地删了,有点绕,但是没办法
//由于是刚刚新建的,就直接删除,不做任何不能删校验。
riskSourceService
.
deleteById
(
param
.
getId
());
return
CommonResponseUtil
.
failure
(
synMsg
);
}
}
return
cr
;
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
CommonResponseUtil
.
failure
(
"风险模型新增及维护失败:"
+
e
.
getMessage
());
}
}
/**
* 风险模型删除
*/
@Permission
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"风险模型删除"
,
notes
=
"风险模型删除"
)
@RequestMapping
(
value
=
"/riskSource/deleteRiskSource"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
CommonResponse
deleteRiskSource
(
@ApiParam
(
value
=
"风险模型id"
,
required
=
true
)
@RequestBody
Long
[]
riskSourceId
)
{
try
{
riskSourceService
.
deleteRiskSource
(
getAppKey
(),
getProduct
(),
getToken
(),
SUCCESS
,
riskSourceId
);
return
CommonResponseUtil
.
success
();
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
CommonResponseUtil
.
failure
(
"风险模型删除失败:"
+
e
.
getMessage
());
}
}
/**
* 风险点列表分页查询
*/
@Permission
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"风险点列表分页查询"
,
notes
=
"风险点列表分页查询"
)
@RequestMapping
(
value
=
"/riskSource/list"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
CommonResponse
queryRiskSourceByPage
(
@ApiParam
(
value
=
"查询条件"
)
@RequestBody
(
required
=
false
)
List
<
CommonRequest
>
queryRequests
,
@ApiParam
(
value
=
"分页参数"
,
required
=
true
)
CommonPageable
commonPageable
)
{
CommonPageInfoParam
param
=
CommonPageParamUtil
.
fillCommonPageInfoParam
(
queryRequests
,
commonPageable
);
Page
<
HashMap
<
String
,
Object
>>
riskSourceList
=
riskSourceService
.
queryRiskSourceByPage
(
param
);
return
CommonResponseUtil
.
success
(
riskSourceList
);
}
/**
* Fmea模型新增及维护
*/
@Permission
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"Fmea模型新增及维护"
,
notes
=
"Fmea模型新增及维护"
)
@RequestMapping
(
value
=
"/fmea/editFmea"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
CommonResponse
editFmea
(
@ApiParam
(
value
=
"Fmea模型对象"
,
required
=
true
)
@RequestBody
List
<
Fmea
>
params
)
{
try
{
AgencyUserModel
user
=
getUserInfo
();
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"user_id"
,
user
.
getUserId
());
map
.
put
(
"fmeas"
,
params
);
fmeaService
.
editFmea
(
map
);
RsDataQueue
rs
=
RsDataQueue
.
getInstance
();
params
.
forEach
(
param
->
{
if
(!
ObjectUtils
.
isEmpty
(
param
.
getId
()))
{
rs
.
addUpdateMessage
(
param
.
getId
(),
user
.
getRealName
());
}
});
return
CommonResponseUtil
.
success
();
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
CommonResponseUtil
.
failure
(
"Fmea模型新增及维护失败:"
+
e
.
getMessage
());
}
}
/**
* Fmea模型删除
*/
@Permission
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"Fmea模型删除"
,
notes
=
"Fmea模型删除"
)
@RequestMapping
(
value
=
"/fmea/deleteFmea"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
CommonResponse
deleteFmea
(
@ApiParam
(
value
=
"Fmea模型id"
,
required
=
true
)
@RequestBody
RiskFmeaParam
param
)
{
try
{
Long
[]
fmeaIds
=
param
.
getFmeaIds
();
fmeaService
.
deleteFmea
(
fmeaIds
);
if
(
fmeaIds
.
length
>
0
&&
param
.
getRiskSourceId
()
!=
null
)
{
RsDataQueue
rsDataQueue
=
RsDataQueue
.
getInstance
();
rsDataQueue
.
addDeleteMessage
(
param
.
getRiskSourceId
());
}
return
CommonResponseUtil
.
success
();
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
CommonResponseUtil
.
failure
(
"Fmea模型删除失败:"
+
e
.
getMessage
());
}
}
/**
* Fmea列表分页查询
*/
@Permission
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"Fmea列表分页查询"
,
notes
=
"Fmea列表分页查询"
)
@RequestMapping
(
value
=
"/fmea/list"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
CommonResponse
queryFmeaByPage
(
@ApiParam
(
value
=
"查询条件"
)
@RequestBody
(
required
=
false
)
List
<
CommonRequest
>
queryRequests
,
@ApiParam
(
value
=
"分页参数"
,
required
=
true
)
CommonPageable
commonPageable
)
{
CommonPageInfoParam
param
=
CommonPageParamUtil
.
fillCommonPageInfoParam
(
queryRequests
,
commonPageable
);
Page
<
HashMap
<
String
,
Object
>>
fmeaList
=
fmeaService
.
queryFmeaList
(
param
,
getToken
(),
getProduct
(),
getAppKey
());
return
CommonResponseUtil
.
success
(
fmeaList
);
}
@Permission
@ApiOperation
(
value
=
"Fmea是否关联对象查询"
,
notes
=
"Fmea是否关联对象查询"
)
@GetMapping
(
value
=
"/fmea/{ids}/controlObjCount"
)
public
CommonResponse
queryFmeaControlObj
(
@ApiParam
(
value
=
"fmea ids"
)
@PathVariable
(
value
=
"ids"
,
required
=
true
)
String
[]
ids
)
{
return
CommonResponseUtil
.
success
(
fmeaService
.
queryControlObjCount
(
ids
));
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/mapper/RiskSourceMapper.java
View file @
c396881e
package
com
.
yeejoin
.
amos
.
fas
.
business
.
dao
.
mapper
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.ibatis.annotations.Param
;
import
com.yeejoin.amos.fas.business.bo.BindRegionBo
;
import
com.yeejoin.amos.fas.business.param.CommonPageInfoParam
;
import
com.yeejoin.amos.fas.core.common.response.RegionTreeResponse
;
import
com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse
;
import
com.yeejoin.amos.fas.dao.entity.RiskSource
;
public
interface
RiskSourceMapper
extends
BaseMapper
{
/**
* 风险点查询,分页查询统计用
*
* @param param
* @return
*/
long
countPageData
(
CommonPageInfoParam
param
);
/**
* 风险点分页查询queryForRiskSourceLevel
*
* @param param
* @return
*/
List
<
HashMap
<
String
,
Object
>>
queryRiskSourceByPage
(
CommonPageInfoParam
param
);
List
<
Map
>
queryForRegion
();
List
<
Map
>
queryRPNReport
();
Map
queryForRiseUp
(
@Param
(
"startTime"
)
String
startTime
,
@Param
(
"endTime"
)
String
endTime
);
Long
countByParentIdAndIsRegion
(
@Param
(
"riskSourceId"
)
Long
riskSourceId
,
@Param
(
"isRegion"
)
String
isRegion
);
List
<
Map
>
queryForMatrix
();
List
<
RiskSourceTreeResponse
>
getRiskSources
(
String
compCode
);
List
<
RiskSourceTreeResponse
>
getRiskSourcesEquipment
();
List
<
RiskSource
>
queryByFireEqument
(
@Param
(
"fireEquipmentId"
)
Long
fireEquipmentId
);
List
<
RiskSource
>
queryByPoint
(
@Param
(
"pointId"
)
Long
pointId
);
//厂区rpn,重点设备个数,风险点个数,巡检点个数
Map
<
String
,
List
>
statistics3dCount
();
//消防设备按分类统计个数
List
<
Map
>
statisticsEquipClassify
();
//风险点按级别统计个数
List
<
Map
>
statisticsRiskLevel
();
//巡检点按状态统计个数
List
<
Map
>
statisticsPointStatus
();
RiskSourceTreeResponse
findRiskSourceDetatil
(
@Param
(
"id"
)
Long
id
);
//风险点详情和级别
Map
queryForRiskSourceLevel
(
@Param
(
"riskSourceId"
)
Long
riskSourceId
);
List
<
Map
>
queryForUnqualified
(
@Param
(
"riskSourceId"
)
Long
riskSourceId
);
List
<
Map
>
queryForFmeaEquipAlarm
(
@Param
(
"riskSourceId"
)
Long
riskSourceId
);
/**
* 子节点的rpni
*
* @param parentId
* @return
*/
List
<
Map
<
String
,
BigDecimal
>>
queryForRiskSourceRpni
(
@Param
(
"parentId"
)
Long
parentId
);
List
<
HashMap
<
String
,
Object
>>
queryRiskAreaRpn
();
List
<
RiskSource
>
queryByFactor
(
@Param
(
"factorId"
)
Long
factorId
);
List
<
HashMap
<
String
,
Object
>>
queryRiskSourceSecondLevel
(
String
compCode
);
List
<
RiskSourceTreeResponse
>
getRiskSourcesFireEquipmentByType
(
@Param
(
"type"
)
String
[]
type
);
List
<
RiskSourceTreeResponse
>
getCheckPointRiskSource
();
List
<
Map
>
queryContingencyWater
();
List
<
Map
>
queryFmeaByPointId
(
@Param
(
"pointId"
)
Long
pointId
);
void
updateRpn
(
RiskSource
riskSource
);
List
<
RegionTreeResponse
>
getRegionList
(
String
channelType
,
String
orgCode
);
HashMap
<
String
,
Object
>
findRegionById
(
@Param
(
"id"
)
Long
id
,
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"channelType"
)
String
channelType
);
void
batchSaveRegionUe4
(
List
<
BindRegionBo
>
regionBoList
);
}
package
com
.
yeejoin
.
amos
.
fas
.
business
.
dao
.
mapper
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.ibatis.annotations.Param
;
import
com.yeejoin.amos.fas.business.bo.BindRegionBo
;
import
com.yeejoin.amos.fas.business.param.CommonPageInfoParam
;
import
com.yeejoin.amos.fas.core.common.response.RegionTreeResponse
;
import
com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse
;
import
com.yeejoin.amos.fas.dao.entity.RiskSource
;
public
interface
RiskSourceMapper
extends
BaseMapper
{
/**
* 风险点查询,分页查询统计用
*
* @param param
* @return
*/
long
countPageData
(
CommonPageInfoParam
param
);
/**
* 风险点分页查询queryForRiskSourceLevel
*
* @param param
* @return
*/
List
<
HashMap
<
String
,
Object
>>
queryRiskSourceByPage
(
CommonPageInfoParam
param
);
List
<
Map
>
queryForRegion
();
List
<
Map
>
queryRPNReport
();
Map
queryForRiseUp
(
@Param
(
"startTime"
)
String
startTime
,
@Param
(
"endTime"
)
String
endTime
);
Long
countByParentIdAndIsRegion
(
@Param
(
"riskSourceId"
)
Long
riskSourceId
,
@Param
(
"isRegion"
)
String
isRegion
);
List
<
Map
>
queryForMatrix
();
List
<
RiskSourceTreeResponse
>
getRiskSources
(
String
compCode
);
List
<
RiskSourceTreeResponse
>
getRiskSourcesEquipment
();
List
<
RiskSource
>
queryByFireEqument
(
@Param
(
"fireEquipmentId"
)
Long
fireEquipmentId
);
List
<
RiskSource
>
queryByPoint
(
@Param
(
"pointId"
)
Long
pointId
);
//厂区rpn,重点设备个数,风险点个数,巡检点个数
Map
<
String
,
List
>
statistics3dCount
();
//消防设备按分类统计个数
List
<
Map
>
statisticsEquipClassify
();
//风险点按级别统计个数
List
<
Map
>
statisticsRiskLevel
();
//巡检点按状态统计个数
List
<
Map
>
statisticsPointStatus
();
RiskSourceTreeResponse
findRiskSourceDetatil
(
@Param
(
"id"
)
Long
id
);
//风险点详情和级别
Map
queryForRiskSourceLevel
(
@Param
(
"riskSourceId"
)
Long
riskSourceId
);
List
<
Map
>
queryForUnqualified
(
@Param
(
"riskSourceId"
)
Long
riskSourceId
);
List
<
Map
>
queryForFmeaEquipAlarm
(
@Param
(
"riskSourceId"
)
Long
riskSourceId
);
/**
* 子节点的rpni
*
* @param parentId
* @return
*/
List
<
Map
<
String
,
BigDecimal
>>
queryForRiskSourceRpni
(
@Param
(
"parentId"
)
Long
parentId
);
List
<
HashMap
<
String
,
Object
>>
queryRiskAreaRpn
();
List
<
RiskSource
>
queryByFactor
(
@Param
(
"factorId"
)
Long
factorId
);
List
<
HashMap
<
String
,
Object
>>
queryRiskSourceSecondLevel
(
String
compCode
);
List
<
RiskSourceTreeResponse
>
getRiskSourcesFireEquipmentByType
(
@Param
(
"type"
)
String
[]
type
);
List
<
RiskSourceTreeResponse
>
getCheckPointRiskSource
();
List
<
Map
>
queryContingencyWater
();
List
<
Map
>
queryFmeaByPointId
(
@Param
(
"pointId"
)
Long
pointId
);
void
updateRpn
(
RiskSource
riskSource
);
void
updateRpnForNull
(
RiskSource
riskSource
);
List
<
RegionTreeResponse
>
getRegionList
(
String
channelType
,
String
orgCode
);
HashMap
<
String
,
Object
>
findRegionById
(
@Param
(
"id"
)
Long
id
,
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"channelType"
)
String
channelType
);
void
batchSaveRegionUe4
(
List
<
BindRegionBo
>
regionBoList
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
View file @
c396881e
...
...
@@ -1652,7 +1652,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
riskSource
.
setRiskLevelId
(
null
);
riskSource
.
setFlickerFrequency
(
0
);
//1.更新fmea对应风险点rpn、rpni、level
riskSourceMapper
.
updateRpn
(
riskSource
);
riskSourceMapper
.
updateRpn
ForNull
(
riskSource
);
//2.记录风险点rpn变化流水
this
.
saveRpnLog
(
riskSource
.
getId
(),
fmeaId
,
resetValue
,
resetValue
,
notifyType
);
...
...
@@ -1818,6 +1818,10 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
List
<
Fmea
>
fmeas
=
fmeaMapper
.
listByRiskSourceIds
(
ids
);
RpnCalculationBo
rpnValueBo
=
RpnUtils
.
calRpnAndRpni
(
fmeas
);
if
(
rpnValueBo
.
isEmpty
())
{
riskSource
.
setRpn
(
null
);
riskSource
.
setRpni
(
null
);
riskSource
.
setRiskLevelId
(
null
);
iRiskSourceDao
.
save
(
riskSource
);
return
;
}
BigDecimal
rpn
=
rpnValueBo
.
getRpn
();
...
...
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/dbTemplate_risk_source.xml
View file @
c396881e
...
...
@@ -701,6 +701,15 @@
parent_id = #{riskSourceId}
</select>
<update
id=
"updateRpnForNull"
>
update f_risk_source
set
rpn = null,
rpni = null,
risk_level_id = null,
flicker_frequency = null
where id = #{id}
</update>
<update
id=
"updateRpn"
>
update f_risk_source
<set>
...
...
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