Commit cdb3ef58 authored by maoying's avatar maoying

修改消防水池,点位添加,风险模型相关模块bug

parent bc956768
......@@ -42,6 +42,8 @@ public class FireEquipmentPoint extends BasicEntity {
@Column(name="alarm_type")
private Long alarmType;
@Column(name="org_code")
private String orgCode;
public String getCode() {
return code;
}
......@@ -113,4 +115,12 @@ public class FireEquipmentPoint extends BasicEntity {
public void setAlarmType(Long alarmType) {
this.alarmType = alarmType;
}
public String getOrgCode() {
return orgCode;
}
public void setOrgCode(String orgCode) {
this.orgCode = orgCode;
}
}
\ No newline at end of file
......@@ -82,6 +82,15 @@ public class WaterResource extends BasicEntity{
*/
@Column(name="create_by")
private String createBy;
@Column(name="area")
private String area;
@Column(name="max_level")
private String maxLevel;
@Column(name="alarm_level")
private String alarmLevel;
/**
* ue4位置
......@@ -209,4 +218,28 @@ public class WaterResource extends BasicEntity{
public void setUe4Rotation(String ue4Rotation) {
this.ue4Rotation = ue4Rotation;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public String getMaxLevel() {
return maxLevel;
}
public void setMaxLevel(String maxLevel) {
this.maxLevel = maxLevel;
}
public String getAlarmLevel() {
return alarmLevel;
}
public void setAlarmLevel(String alarmLevel) {
this.alarmLevel = alarmLevel;
}
}
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.fas.business.controller;
import com.google.common.collect.Maps;
import com.yeejoin.amos.fas.business.entity.mybatis.FireEquipmentPointEntity;
import com.yeejoin.amos.fas.business.service.intfc.IFireEquipPontService;
import com.yeejoin.amos.fas.business.vo.ReginParams;
import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
......@@ -45,11 +46,13 @@ public class FireEquimtPointController extends BaseController {
if (fireEquipmentPoint == null
|| StringUtils.isEmpty(fireEquipmentPoint.getName())
|| StringUtils.isEmpty(fireEquipmentPoint.getFireEquipmentId())
|| StringUtils.isEmpty(fireEquipmentPoint.getType())
|| StringUtils.isEmpty(fireEquipmentPoint.getCode()))
throw new Exception("数据校验失败.");
|| StringUtils.isEmpty(fireEquipmentPoint.getCode())){
return CommonResponseUtil.failure("请检查必填字段");
};
ReginParams reginParams =getSelectedOrgInfo();
String compCode=getOrgCode(reginParams);
fireEquipmentPoint.setOrgCode(compCode);
fireEquipmentPoint.setCreateBy(getUserId());
fireEquipmentPoint.setCreateDate(new Date());
return CommonResponseUtil.success(fireEquipPontService.savePoint(fireEquipmentPoint));
......@@ -100,13 +103,16 @@ public class FireEquimtPointController extends BaseController {
@ApiParam(value = "监测点编号或者监测点名称模糊匹配") @RequestParam(required = false) String searchValue,
@ApiParam(value = "类型(模拟量:ANALOGUE;开关量:SWITCH)") @RequestParam(required = false) String type) {
Map<String, Object> queryMap = Maps.newHashMap();
queryMap.put("offset", pageNumber*pageSize);
ReginParams reginParams =getSelectedOrgInfo();
String compCode=getOrgCode(reginParams);
queryMap.put("pageNumber", pageNumber);
queryMap.put("pageSize", pageSize);
if (isBindDevice != null && isBindDevice == 0) {
queryMap.put("fireEquipmentId", 0);
}
queryMap.put("searchValue", searchValue);
queryMap.put("type", type);
queryMap.put("compCode", compCode);
return fireEquipPontService.queryByMap(queryMap);
}
......
......@@ -27,6 +27,7 @@ import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService;
import com.yeejoin.amos.fas.business.service.model.ContingencyDeviceStatus;
import com.yeejoin.amos.fas.business.service.model.FireEquimentDataRo;
import com.yeejoin.amos.fas.business.service.model.ProtalDataRo;
import com.yeejoin.amos.fas.business.vo.ReginParams;
import com.yeejoin.amos.fas.core.common.request.CommonPageable;
import com.yeejoin.amos.fas.core.common.response.RiskSourceTreeResponse;
import com.yeejoin.amos.fas.core.util.CommonResponse;
......@@ -107,7 +108,9 @@ public class RiskSourceController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "获取风险点树型结构", notes = "获取风险点树型结构")
@RequestMapping(value = "/riskSourceTress", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse getRiskSourceTress() {
List<RiskSourceTreeResponse> riskSources = riskSourceService.findRiskSourceTrees();
ReginParams reginParams =getSelectedOrgInfo();
String compCode=getOrgCode(reginParams);
List<RiskSourceTreeResponse> riskSources = riskSourceService.findRiskSourceTrees(compCode);
return CommonResponseUtil.success(getRiskSourcesTree(riskSources));
}
......@@ -138,7 +141,9 @@ public class RiskSourceController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "统计级别为1的风险点下面", notes = "获取风险点树型结构")
@RequestMapping(value = "/riskSourceStatistics", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse riskSourceStatistics() throws Exception {
List<RiskSourceTreeResponse> riskSources = riskSourceService.findRiskSourceTrees();
ReginParams reginParams =getSelectedOrgInfo();
String compCode=getOrgCode(reginParams);
List<RiskSourceTreeResponse> riskSources = riskSourceService.findRiskSourceTrees(compCode);
List<RiskSourceTreeResponse> treeRiskSources = getRiskSourcesTree(riskSources);
return CommonResponseUtil.success(riskSourceStatistics(treeRiskSources));
}
......@@ -632,7 +637,9 @@ public class RiskSourceController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "获取危险因素树二级节点", notes = "获取危险因素树二级节点")
@RequestMapping(value = "/riskSourceSecondLevel", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryRiskSourceSecondLevel() {
return CommonResponseUtil.success(riskSourceService.queryRiskSourceSecondLevel());
ReginParams reginParams =getSelectedOrgInfo();
String compCode=getOrgCode(reginParams);
return CommonResponseUtil.success(riskSourceService.queryRiskSourceSecondLevel(compCode));
}
/**
......
......@@ -91,8 +91,9 @@ public class WaterResourceController extends BaseController{
@RequestParam int pageSize
) {
CommonPageable commonPageable = new CommonPageable(pageNumber,pageSize);
return CommonResponseUtil.success(iWaterResourceService.queryForPage(StringUtils.trimToNull(name),StringUtils.trimToNull(code),StringUtils.trimToNull(type),commonPageable));
ReginParams reginParams =getSelectedOrgInfo();
String compCode = getOrgCode(reginParams);
return CommonResponseUtil.success(iWaterResourceService.queryForPage(compCode,StringUtils.trimToNull(name),StringUtils.trimToNull(code),StringUtils.trimToNull(type),commonPageable));
}
//@Authorization(ingore = true)
......
......@@ -42,7 +42,7 @@ public interface RiskSourceMapper extends BaseMapper {
List<Map> queryForMatrix();
List<RiskSourceTreeResponse> getRiskSources();
List<RiskSourceTreeResponse> getRiskSources(String compCode);
List<RiskSourceTreeResponse> getRiskSourcesEquipment();
......@@ -87,7 +87,7 @@ public interface RiskSourceMapper extends BaseMapper {
List<RiskSource> queryByFactor(@Param("factorId") Long factorId);
List<HashMap<String, Object>> queryRiskSourceSecondLevel();
List<HashMap<String, Object>> queryRiskSourceSecondLevel(String compCode);
List<RiskSourceTreeResponse> getRiskSourcesFireEquipmentByType(@Param("type") String[] type);
......
......@@ -14,12 +14,14 @@ public interface WaterResourceMapper extends BaseMapper {
List<Map> queryForPage(
@Param("orgCode") String compCode,
@Param("name") String name,
@Param("code") String code,
@Param("type") String type,
@Param("start") long start,
@Param("length") Integer length);
Long queryCountForPage(
@Param("orgCode") String compCode,
@Param("name") String name,
@Param("code") String code,
@Param("type")String type);
......
......@@ -92,13 +92,14 @@ public class FireEquipPointServiceImpl implements IFireEquipPontService {
@Override
public CommonResponse queryByMap(Map<String, Object> map) {
int pageNumber = map.get("pageNumber") != null ? Integer.parseInt(map.get("pageNumber").toString()) : 0;
int pageSize = map.get("pageSize") != null ? Integer.parseInt(map.get("pageSize").toString()) : 0;
CommonPageable commonPageable = new CommonPageable(pageNumber, pageSize);
Long total = fireEquipPointMapper.countByMap(map);
if (total.equals(0L)) {
return CommonResponseUtil.success(new PageImpl<>(Lists.newArrayList(), null, total));
return CommonResponseUtil.success(new PageImpl<>(Lists.newArrayList(), commonPageable, total));
}
int pageNumber = map.get("pageNumber") != null ? Integer.parseInt(map.get("pageNumber").toString()) : 0;
int pageSize = map.get("pageSize") != null ? Integer.parseInt(map.get("pageSize").toString()) : 0;
CommonPageable commonPageable = new CommonPageable(pageNumber, pageSize);
map.put("offset", pageNumber*pageSize);
List<FireEquipmentPointEntity> list = fireEquipPointMapper.listByMap(map);
return CommonResponseUtil.success(new PageImpl<>(list, commonPageable, total));
}
......
......@@ -262,6 +262,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
int count = iRiskSourceDao.countByParentId(rId);
Optional<RiskSource> rs = iRiskSourceDao.findById(rId);
rs.ifPresent(riskSource -> parentIds.add(riskSource.getParentId()));
if(parentIds.contains(0l)){
throw new YeeException("公司节点不能删除");
}
if (count > 0) {
throw new YeeException("该数据有关联子项,请先删除子项数据");
}
......@@ -387,8 +390,8 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
@Override
public List<RiskSourceTreeResponse> findRiskSourceTrees() {
return riskSourceMapper.getRiskSources();
public List<RiskSourceTreeResponse> findRiskSourceTrees(String compCode) {
return riskSourceMapper.getRiskSources(compCode);
}
@Override
......@@ -1002,9 +1005,9 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
@Override
public List<HashMap<String, Object>> queryRiskSourceSecondLevel() {
public List<HashMap<String, Object>> queryRiskSourceSecondLevel(String compCode) {
// TODO Auto-generated method stub
return riskSourceMapper.queryRiskSourceSecondLevel();
return riskSourceMapper.queryRiskSourceSecondLevel(compCode);
}
@Override
......
......@@ -68,10 +68,10 @@ public class WaterResourceServiceImpl implements IWaterResourceService {
}
public Page queryForPage(String username,String code,String type, CommonPageable pageable)
public Page queryForPage(String compCode, String username,String code,String type, CommonPageable pageable)
{
Long total = waterResourceMapper.queryCountForPage(username,code,type);
List<Map> content = waterResourceMapper.queryForPage(username,code,type,pageable.getOffset(),pageable.getPageSize());
Long total = waterResourceMapper.queryCountForPage(compCode,username,code,type);
List<Map> content = waterResourceMapper.queryForPage(compCode,username,code,type,pageable.getOffset(),pageable.getPageSize());
Page result = new PageImpl(content,pageable,total);
return result;
}
......
......@@ -52,7 +52,7 @@ public interface IRiskSourceService {
/**
* 获取所有风险点
*/
List<RiskSourceTreeResponse> findRiskSourceTrees();
List<RiskSourceTreeResponse> findRiskSourceTrees(String compCode);
List<FmeaEquipmentPoint> bindFireEquiment(FmeaBindParam fmeaBindParam);
......@@ -93,7 +93,7 @@ public interface IRiskSourceService {
void saveData(List<AlarmParam> deviceDatas, String type);
List<HashMap<String, Object>> queryRiskSourceSecondLevel();
List<HashMap<String, Object>> queryRiskSourceSecondLevel(String compCode);
List<RiskSourceTreeResponse> findRiskSourceEquipStatistics();
......
......@@ -39,7 +39,7 @@ public interface IWaterResourceService {
* 查询指定设备的风险点列表
* @return
*/
Page queryForPage(String username, String code, String type,CommonPageable pageable);
Page queryForPage(String compCode,String username, String code, String type,CommonPageable pageable);
void saveBindFireEquipment(List<WaterResourceEquipment> waterResourceEquipments);
......
......@@ -279,4 +279,16 @@
update f_risk_level set manage_level = 4 where level = '4';
</sql>
</changeSet>
<changeSet author="maoying" id="11590390304001-1">
<preConditions onFail="MARK_RAN">
<columnExists tableName="f_fire_equipment_point " columnName="fire_equipment_id"/>
</preConditions>
<comment>修改fire_equipment_id可为空</comment>
<sql>
ALTER TABLE `f_fire_equipment_point`
MODIFY COLUMN `fire_equipment_id` bigint(20) NULL COMMENT '消防装备id' AFTER `code`;
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -141,6 +141,7 @@
f_fire_equipment as b on a.fire_equipment_id = b.id
left join f_dict fd on fd.id = a.alarm_type
<where>
a.org_code = #{compCode}
<if test="searchValue!=null and searchValue.trim() != ''">
and (a.name like concat('%',#{searchValue},'%') or a.code like concat('%',#{searchValue},'%'))
</if>
......@@ -163,6 +164,7 @@
from
f_fire_equipment_point as a
<where>
a.org_code = #{compCode}
<if test="searchValue!=null and searchValue.trim() != ''">
and (a.name like concat('%',#{searchValue},'%') or a.code like concat('%',#{searchValue},'%'))
</if>
......
......@@ -210,6 +210,7 @@
FROM
`f_risk_source` rs
LEFT JOIN f_risk_level rl ON rl.id = rs.risk_level_id
where rs.org_code = #{compCode}
ORDER BY rs.sort_num,rs.id ASC
</select>
......@@ -597,7 +598,7 @@
FROM
f_risk_source
WHERE
parent_id = 0
parent_id = 0 and org_code = #{compCode}
)
ORDER BY sort_num ASC,id DESC
</select>
......
......@@ -32,7 +32,7 @@
FROM
f_water_resource fs
WHERE
1=1
fs.org_code = #{orgCode}
<if test="name!=null">
AND (fs.name LIKE '%${name}%' or fs.`code` LIKE '%${name}%')
</if>
......@@ -63,8 +63,7 @@
f_water_resource fs
left join f_risk_source frs on frs.id = fs.risk_source_id
WHERE
1=1
fs.org_code = #{orgCode}
<if test="name!=null">
AND (fs.name LIKE '%${name}%' or fs.`code` LIKE '%${name}%')
</if>
......
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