Commit a361df30 authored by xukaiqiang's avatar xukaiqiang

添加风险点校验接口

parent d75f26fa
...@@ -21,8 +21,8 @@ import org.slf4j.Logger; ...@@ -21,8 +21,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.repository.query.Param;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody; 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.RequestMethod;
...@@ -34,7 +34,7 @@ import java.util.List; ...@@ -34,7 +34,7 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/api/riskModel") @RequestMapping("/api/riskModel")
@Api(tags="风险模型api") @Api(tags = "风险模型api")
public class RiskModelController extends BaseController { public class RiskModelController extends BaseController {
private final Logger log = LoggerFactory.getLogger(RiskLevelController.class); private final Logger log = LoggerFactory.getLogger(RiskLevelController.class);
...@@ -45,35 +45,49 @@ public class RiskModelController extends BaseController { ...@@ -45,35 +45,49 @@ public class RiskModelController extends BaseController {
@Autowired @Autowired
private IFmeaService fmeaService; private IFmeaService fmeaService;
@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("系统繁忙,请稍后再试");
}
}
/** /**
* 风险模型新增及维护 * 风险模型新增及维护
* @param param
* @return
*/ */
@ApiOperation(httpMethod = "POST", value = "风险模型新增及维护", notes = "风险模型新增及维护") @ApiOperation(httpMethod = "POST", value = "风险模型新增及维护", notes = "风险模型新增及维护")
@RequestMapping(value = "/riskSource/editRiskSource", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/riskSource/editRiskSource", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse editRiskSource(@ApiParam(value = "风险模型对象", required = true) @RequestBody RiskSource param) { public CommonResponse editRiskSource(@ApiParam(value = "风险模型对象", required = true) @RequestBody RiskSource param) {
try { 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("该区域下只能添加风险点");
}
User user = getUserInfo(); User user = getUserInfo();
HashMap<String,Object> map = new HashMap<String,Object>(); HashMap<String, Object> map = new HashMap<>();
map.put("org_code", user.getOrgCode()); map.put("org_code", user.getOrgCode());
map.put("user_id", user.getId()); map.put("user_id", user.getId());
map.put("param", param); map.put("param", param);
riskSourceService.editRiskSource(map); riskSourceService.editRiskSource(map);
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
return CommonResponseUtil.failure("风险模型新增及维护失败:"+e.getMessage()); return CommonResponseUtil.failure("风险模型新增及维护失败:" + e.getMessage());
} }
} }
/** /**
* 风险模型删除 * 风险模型删除
* @param param
* @return
*/ */
@ApiOperation(httpMethod = "POST", value = "风险模型删除", notes = "风险模型删除") @ApiOperation(httpMethod = "POST", value = "风险模型删除", notes = "风险模型删除")
@Authorization(ingore = true) @Authorization(ingore = true)
...@@ -83,21 +97,18 @@ public class RiskModelController extends BaseController { ...@@ -83,21 +97,18 @@ public class RiskModelController extends BaseController {
riskSourceService.deleteRiskSource(riskSourceId); riskSourceService.deleteRiskSource(riskSourceId);
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
return CommonResponseUtil.failure("风险模型删除失败:"+e.getMessage()); return CommonResponseUtil.failure("风险模型删除失败:" + e.getMessage());
} }
} }
/** /**
* 风险点列表分页查询 * 风险点列表分页查询
*
* @param id
* @return
*/ */
@ApiOperation(httpMethod = "POST",value = "风险点列表分页查询", notes = "风险点列表分页查询") @ApiOperation(httpMethod = "POST", value = "风险点列表分页查询", notes = "风险点列表分页查询")
@RequestMapping(value = "/riskSource/list", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/riskSource/list", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse queryRiskSourceByPage( public CommonResponse queryRiskSourceByPage(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests, @ApiParam(value = "查询条件") @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) { @ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable); CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<HashMap<String, Object>> riskSourceList = riskSourceService.queryRiskSourceByPage(param); Page<HashMap<String, Object>> riskSourceList = riskSourceService.queryRiskSourceByPage(param);
...@@ -106,15 +117,13 @@ public class RiskModelController extends BaseController { ...@@ -106,15 +117,13 @@ public class RiskModelController extends BaseController {
/** /**
* Fmea模型新增及维护 * Fmea模型新增及维护
* @param param
* @return
*/ */
@ApiOperation(httpMethod = "POST", value = "Fmea模型新增及维护", notes = "Fmea模型新增及维护") @ApiOperation(httpMethod = "POST", value = "Fmea模型新增及维护", notes = "Fmea模型新增及维护")
@RequestMapping(value = "/fmea/editFmea", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/fmea/editFmea", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse editFmea(@ApiParam(value = "Fmea模型对象", required = true) @RequestBody Fmea param) { public CommonResponse editFmea(@ApiParam(value = "Fmea模型对象", required = true) @RequestBody Fmea param) {
try { try {
User user = getUserInfo(); User user = getUserInfo();
HashMap<String,Object> map = new HashMap<String,Object>(); HashMap<String, Object> map = new HashMap<>();
map.put("user_id", user.getId()); map.put("user_id", user.getId());
map.put("fmea", param); map.put("fmea", param);
fmeaService.editFmea(map); fmeaService.editFmea(map);
...@@ -125,15 +134,13 @@ public class RiskModelController extends BaseController { ...@@ -125,15 +134,13 @@ public class RiskModelController extends BaseController {
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
return CommonResponseUtil.failure("Fmea模型新增及维护失败:"+e.getMessage()); return CommonResponseUtil.failure("Fmea模型新增及维护失败:" + e.getMessage());
} }
} }
/** /**
* Fmea模型删除 * Fmea模型删除
* @param param
* @return
*/ */
@ApiOperation(httpMethod = "POST", value = "Fmea模型删除", notes = "Fmea模型删除") @ApiOperation(httpMethod = "POST", value = "Fmea模型删除", notes = "Fmea模型删除")
@RequestMapping(value = "/fmea/deleteFmea", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/fmea/deleteFmea", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
...@@ -150,20 +157,17 @@ public class RiskModelController extends BaseController { ...@@ -150,20 +157,17 @@ public class RiskModelController extends BaseController {
} }
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(), e);
return CommonResponseUtil.failure("Fmea模型删除失败:"+e.getMessage()); return CommonResponseUtil.failure("Fmea模型删除失败:" + e.getMessage());
} }
} }
/** /**
* Fmea列表分页查询 * Fmea列表分页查询
*
* @param id
* @return
*/ */
@ApiOperation(httpMethod = "POST",value = "Fmea列表分页查询", notes = "Fmea列表分页查询") @ApiOperation(httpMethod = "POST", value = "Fmea列表分页查询", notes = "Fmea列表分页查询")
@RequestMapping(value = "/fmea/list", produces = "application/json;charset=UTF-8", method = RequestMethod.POST) @RequestMapping(value = "/fmea/list", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse queryFmeaByPage(@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests, public CommonResponse queryFmeaByPage(@ApiParam(value = "查询条件") @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) { @ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable); CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<HashMap<String, Object>> fmeaList = fmeaService.queryFmeaList(param); Page<HashMap<String, Object>> fmeaList = fmeaService.queryFmeaList(param);
......
package com.yeejoin.amos.fas.business.dao.mapper; 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.param.CommonPageInfoParam; import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.business.param.RiskSourceParam; import com.yeejoin.amos.fas.business.param.RiskSourceParam;
import com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse; import com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse;
import com.yeejoin.amos.fas.dao.entity.RiskSource; import com.yeejoin.amos.fas.dao.entity.RiskSource;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public interface RiskSourceMapper extends BaseMapper { public interface RiskSourceMapper extends BaseMapper {
/** /**
* 风险点查询,分页查询统计用 * 风险点查询,分页查询统计用
*
* @param param * @param param
* @return * @return
*/ */
...@@ -23,6 +23,7 @@ public interface RiskSourceMapper extends BaseMapper { ...@@ -23,6 +23,7 @@ public interface RiskSourceMapper extends BaseMapper {
/** /**
* 风险点分页查询queryForRiskSourceLevel * 风险点分页查询queryForRiskSourceLevel
*
* @param param * @param param
* @return * @return
*/ */
...@@ -33,8 +34,9 @@ public interface RiskSourceMapper extends BaseMapper { ...@@ -33,8 +34,9 @@ public interface RiskSourceMapper extends BaseMapper {
List<Map> queryRPNReport(); List<Map> queryRPNReport();
Map queryForRiseUp(@Param("startTime")String startTime,@Param("endTime")String endTime); Map queryForRiseUp(@Param("startTime") String startTime, @Param("endTime") String endTime);
Long countByParentIdAndIsRegion(@Param("riskSourceId") Long riskSourceId, @Param("isRegion") String isRegion);
List<Map> queryForMatrix(); List<Map> queryForMatrix();
...@@ -56,38 +58,37 @@ public interface RiskSourceMapper extends BaseMapper { ...@@ -56,38 +58,37 @@ public interface RiskSourceMapper extends BaseMapper {
Map statistics3dCount(); Map statistics3dCount();
//消防设备按分类统计个数 //消防设备按分类统计个数
List<Map>statisticsEquipClassify(); List<Map> statisticsEquipClassify();
//风险点按级别统计个数 //风险点按级别统计个数
List<Map>statisticsRiskLevel(); List<Map> statisticsRiskLevel();
//巡检点按状态统计个数 //巡检点按状态统计个数
List<Map>statisticsPointStatus(); List<Map> statisticsPointStatus();
RiskSourceTreeResponse findRiskSourceDetatil(@Param("id") Long id); RiskSourceTreeResponse findRiskSourceDetatil(@Param("id") Long id);
//风险点详情和级别 //风险点详情和级别
Map queryForRiskSourceLevel(@Param("riskSourceId")Long riskSourceId); Map queryForRiskSourceLevel(@Param("riskSourceId") Long riskSourceId);
List<Map> queryForUnqualified(@Param("riskSourceId")Long riskSourceId); List<Map> queryForUnqualified(@Param("riskSourceId") Long riskSourceId);
/** /**
* 子节点的rpni * 子节点的rpni
*
* @param parentId * @param parentId
* @return * @return
*/ */
List<Map<String, BigDecimal>> queryForRiskSourceRpni(@Param("parentId")Long parentId); List<Map<String, BigDecimal>> queryForRiskSourceRpni(@Param("parentId") Long parentId);
List<HashMap<String, Object>> queryRiskAreaRpn(); List<HashMap<String, Object>> queryRiskAreaRpn();
List<RiskSource> queryByFactor(@Param("factorId")Long factorId); List<RiskSource> queryByFactor(@Param("factorId") Long factorId);
List<HashMap<String, Object>> queryRiskSourceSecondLevel(); List<HashMap<String, Object>> queryRiskSourceSecondLevel();
......
...@@ -1142,7 +1142,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1142,7 +1142,6 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} }
private void saveFireEquipmentData(FireEquipmentPoint fireEquipmentPoint, AlarmParam deviceData, String fireEquipmentPointType) { private void saveFireEquipmentData(FireEquipmentPoint fireEquipmentPoint, AlarmParam deviceData, String fireEquipmentPointType) {
FireEquipmentData fireEquipmentData = new FireEquipmentData(); FireEquipmentData fireEquipmentData = new FireEquipmentData();
fireEquipmentData.setEqPointCode(deviceData.getPointCode()); fireEquipmentData.setEqPointCode(deviceData.getPointCode());
...@@ -1344,4 +1343,19 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1344,4 +1343,19 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
public List<Map> queryFmeaByPointId(Long pointId) { public List<Map> queryFmeaByPointId(Long pointId) {
return riskSourceMapper.queryFmeaByPointId(pointId); return riskSourceMapper.queryFmeaByPointId(pointId);
} }
@Override
public Integer getChildTypeByPid(Long riskSourceId) {
Long regionCount = riskSourceMapper.countByParentIdAndIsRegion(riskSourceId, "TRUE");
if (!regionCount.equals(0L)) {
//子节点有风险区域
return 1;
}
Long pointCount = riskSourceMapper.countByParentIdAndIsRegion(riskSourceId, "FALSE");
if (!pointCount.equals(0L)) {
//子节点有风险点
return 2;
}
return 3;
}
} }
...@@ -45,53 +45,55 @@ public interface IRiskSourceService { ...@@ -45,53 +45,55 @@ public interface IRiskSourceService {
Page<HashMap<String, Object>> queryRiskSourceByPage(CommonPageInfoParam param); Page<HashMap<String, Object>> queryRiskSourceByPage(CommonPageInfoParam param);
List<Map> queryForRegion();
List<Map> queryForRegion( );
List<Map> queryRPNReport(); List<Map> queryRPNReport();
/** /**
* 上升率 * 上升率
*
* @return * @return
*/ */
Map queryForRiseUp()throws Exception; Map queryForRiseUp() throws Exception;
List<Map> queryForMatrix(); List<Map> queryForMatrix();
/** /**
* 获取所有风险点 * 获取所有风险点
*
* @return * @return
*/ */
List<RiskSourceTreeResponse> findRiskSourceTrees(); List<RiskSourceTreeResponse> findRiskSourceTrees();
List<RiskSourceEquipment> bindFireEquiment(Long riskSourceId, List<RiskSourceEquipment> riskSourceEquipments); List<RiskSourceEquipment> bindFireEquiment(Long riskSourceId, List<RiskSourceEquipment> riskSourceEquipments);
String [] removeBoundRelation(String [] idArray); String[] removeBoundRelation(String[] idArray);
//解除绑定 //解除绑定
/** /**
* 查询所有已绑定的关系列表 * 查询所有已绑定的关系列表
*
* @param riskSourceId * @param riskSourceId
* @return * @return
*/ */
Page queryForView(CommonPageable commonPageable,String riskSourceId); Page queryForView(CommonPageable commonPageable, String riskSourceId);
/** /**
* 查询指定风险点和设备之间的关系,包含绑定和未绑定 * 查询指定风险点和设备之间的关系,包含绑定和未绑定
*
* @param equipmentId * @param equipmentId
* @return * @return
*/ */
Page queryEquimentRelation(CommonPageable commonPageable, String riskSourceId,String equipmentId,String fname); Page queryEquimentRelation(CommonPageable commonPageable, String riskSourceId, String equipmentId, String fname);
/** /**
* 获取 * 获取
*
* @param param * @param param
* @return * @return
*/ */
...@@ -100,6 +102,7 @@ public interface IRiskSourceService { ...@@ -100,6 +102,7 @@ public interface IRiskSourceService {
/** /**
* 绑定巡检点检查项 * 绑定巡检点检查项
*
* @param riskSourceId * @param riskSourceId
* @param pointInputitems * @param pointInputitems
* @return * @return
...@@ -109,22 +112,20 @@ public interface IRiskSourceService { ...@@ -109,22 +112,20 @@ public interface IRiskSourceService {
/** /**
* 处理巡检数据和设备数据 * 处理巡检数据和设备数据
*
* @param deviceData * @param deviceData
*/ */
String processFireEqumtData(FireEquimentDataRo deviceData) throws Exception; String processFireEqumtData(FireEquimentDataRo deviceData) throws Exception;
boolean processTaskData(ProtalDataRo taskData) throws Exception; boolean processTaskData(ProtalDataRo taskData) throws Exception;
/** /**
* 删除风险点巡检点检查项 * 删除风险点巡检点检查项
*
*/ */
void removeByRSIdAndPId(List<HashMap<String,String>> list); void removeByRSIdAndPId(List<HashMap<String, String>> list);
boolean processProtalData(ProtalDataRo protalData) throws Exception; boolean processProtalData(ProtalDataRo protalData) throws Exception;
...@@ -134,6 +135,7 @@ public interface IRiskSourceService { ...@@ -134,6 +135,7 @@ public interface IRiskSourceService {
/** /**
* 三维图统计 * 三维图统计
*
* @return * @return
*/ */
Map queryFor3DStatistics(); Map queryFor3DStatistics();
...@@ -143,13 +145,13 @@ public interface IRiskSourceService { ...@@ -143,13 +145,13 @@ public interface IRiskSourceService {
BigDecimal updateRiskSourceRpni(Long riskSourceId) throws Exception; BigDecimal updateRiskSourceRpni(Long riskSourceId) throws Exception;
List<HashMap<String,Object>> queryRiskAreaRpn(); List<HashMap<String, Object>> queryRiskAreaRpn();
String processFireEqumtData(AlarmParam deviceData) throws Exception; String processFireEqumtData(AlarmParam deviceData) throws Exception;
void saveData(List<AlarmParam> deviceDatas,String type); void saveData(List<AlarmParam> deviceDatas, String type);
List<HashMap<String,Object>> queryRiskSourceSecondLevel(); List<HashMap<String, Object>> queryRiskSourceSecondLevel();
List<RiskSourceTreeResponse> findRiskSourceEquipStatistics(); List<RiskSourceTreeResponse> findRiskSourceEquipStatistics();
...@@ -162,4 +164,6 @@ public interface IRiskSourceService { ...@@ -162,4 +164,6 @@ public interface IRiskSourceService {
List<Map> queryContingencyWater(); List<Map> queryContingencyWater();
List<Map> queryFmeaByPointId(Long pointId); List<Map> queryFmeaByPointId(Long pointId);
Integer getChildTypeByPid(Long riskSourceId);
} }
spring.application.name = Amos-autosys-tb spring.application.name = Amos-autosys-xkq
#environment #environment
spring.profiles.active = dev spring.profiles.active = dev
......
...@@ -645,4 +645,15 @@ ...@@ -645,4 +645,15 @@
EXISTS ( SELECT 1 FROM f_risk_source_point_inputitem frspi WHERE frspi.risk_source_id = frs.id AND frspi.point_id = ${pointId} ) EXISTS ( SELECT 1 FROM f_risk_source_point_inputitem frspi WHERE frspi.risk_source_id = frs.id AND frspi.point_id = ${pointId} )
</select> </select>
<select id="countByParentIdAndIsRegion" resultType="long">
select
count(1)
from
f_risk_source
where
is_region = #{isRegion}
and
parent_id = #{riskSourceId}
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment