Commit 35d85995 authored by 吴江's avatar 吴江

Merge branch 'dev_upgrade' of http://172.16.10.76/station/YeeAmosFireAutoSysRoot into dev_upgrade

# Conflicts: # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
parents 071c4c65 b99e2551
......@@ -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 java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -69,8 +70,9 @@ public class FireCarController extends BaseController {
//@Authorization(ingore = true)
@ApiOperation(httpMethod = "POST", value = "上传消防车图片", notes = "上传消防车图片")
@RequestMapping(value = "/uploadCarImg", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse uploadCarImg(@ApiParam(value = "消防车图片", required = false) @RequestParam(value = "file" ,required = false) MultipartFile[] file,FireCar fireCar) {
public CommonResponse uploadCarImg(@ApiParam(value = "消防车图片", required = false) @RequestParam(value = "file" ,required = false) MultipartFile[] file,FireCar fireCar, BindingResult bindingResult) {
System.out.print(fireCar);
ReginParams reginParams =getSelectedOrgInfo();
String compCode=getOrgCode(reginParams);
fireCar.setOrgCode(compCode);
......@@ -78,5 +80,4 @@ public class FireCarController extends BaseController {
fireCarService.saveFireCarAndPhoto(fireCar,file);
return CommonResponseUtil.success();
}
}
......@@ -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);
}
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.fas.business.controller;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.business.service.intfc.IFireCarService;
import com.yeejoin.amos.fas.business.service.intfc.IFireEquipService;
import com.yeejoin.amos.fas.business.service.intfc.IWaterResourceService;
import com.yeejoin.amos.fas.business.util.CommonPageParamUtil;
import com.yeejoin.amos.fas.business.vo.FireCarDetailVo;
import com.yeejoin.amos.fas.business.vo.ReginParams;
......@@ -28,154 +29,155 @@ import java.util.List;
@RequestMapping(value = "/api/fireSource")
@Api(tags = "消防资源api")
public class FireSourceController extends BaseController {
@Autowired
private IFireCarService fireCarService;
@Autowired
private IFireEquipService iFireEquipService;
@ApiOperation(httpMethod = "POST", value = "添加消防装备", notes = "添加消防装备")
@RequestMapping(value = "", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse create(@RequestBody FireEquipment fireEquipment) throws Exception {
ReginParams reginParams =getSelectedOrgInfo();
String compCode=getOrgCode(reginParams);
fireEquipment.setCreateBy(getUserId());
fireEquipment.setCreateDate(new Date());
fireEquipment.setOrgCode(compCode);
return CommonResponseUtil.success(iFireEquipService.save(fireEquipment));
}
@ApiOperation(httpMethod = "PUT", value = "编辑消防装备", notes = "编辑消防装备")
@RequestMapping(value = "/{id}", produces = "application/json;charset=UTF-8", method = RequestMethod.PUT)
public CommonResponse udpate(@PathVariable Long id, @RequestBody FireEquipment fireEquipment) {
fireEquipment.setId(id);
return CommonResponseUtil.success(iFireEquipService.save(fireEquipment));
}
@ApiOperation(httpMethod = "GET", value = "查询单个消防装备", notes = "查询单个消防装备")
@RequestMapping(value = "/{id}", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse query(@PathVariable Long id) {
return CommonResponseUtil.success(iFireEquipService.queryOne(id));
}
@ApiOperation(httpMethod = "DELETE", value = "删除消防装备", notes = "查询单个消防装备")
@RequestMapping(value = "/{ids}", produces = "application/json;charset=UTF-8", method = RequestMethod.DELETE)
public CommonResponse delete(@PathVariable String ids) throws Exception {
String[] idArray = ids.split(",");
return CommonResponseUtil.success(iFireEquipService.delete(idArray));
}
/**
* 消防车查询
*
* @param id
* @return
*/
@ApiOperation(httpMethod = "POST", value = "查询消防车", notes = "查询消防车")
@RequestMapping(value = "/fire-car/list", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse queryFireCar(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<HashMap<String, Object>> carList = fireCarService.queryFireCar(getToken(),getProduct(),getAppKey(), param);
return CommonResponseUtil.success(carList);
}
/**
* 消防车详情查询
*
* @param id
* @return
*/
@ApiOperation(httpMethod = "GET", value = "查询消防车", notes = "查询消防车")
@RequestMapping(value = "/fire-car/det/{id}", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryFireCar(@ApiParam(value = "查询条件", required = true) @PathVariable Long id) {
FireCarDetailVo car = fireCarService.findFireCarById(getToken(),getProduct(),getAppKey(),id);
return CommonResponseUtil.success(car);
}
/**
* 消防装备查询-查询消防装备及视频监控
*
* @param id
* @return
*/
@ApiOperation(httpMethod = "POST", value = "消防装备查询", notes = "消防装备查询")
@RequestMapping(value = "/fire-equip/list", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse queryFireEquipment(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<HashMap<String, Object>> carList = iFireEquipService.queryFireEquip(param);
return CommonResponseUtil.success(carList);
}
/**
* 配套设备查询
*
* @param id
* @return
*/
@ApiOperation(httpMethod = "POST", value = "配套设备查询", notes = "配套设备查询")
@RequestMapping(value = "/matching-equip/list", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse queryFireEquipmentByProId(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = true) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<HashMap<String, Object>> carList = iFireEquipService.queryFireEquipByProId(param);
return CommonResponseUtil.success(carList);
}
/**
* 生产区域查询查询
*
* @param id
* @return
*/
@ApiOperation(httpMethod = "GET", value = "生产区域查询", notes = "生产区域查询")
@RequestMapping(value = "/fire-equip/area", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryProArea() {
List<String> car = iFireEquipService.findFireEquipArea();
return CommonResponseUtil.success(car);
}
// @Authorization(ingore = true)
@ApiOperation(httpMethod = "GET", value = "查询消防设备历史数据", notes = "查询消防设备历史数据")
@RequestMapping(value = "/data/history", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryForFireEquipmentHistory(
@ApiParam(value = "设备名称", required = false) @RequestParam(required = false) String fireEquipmentName,
@ApiParam(value = "按保护对象名称", required = false) @RequestParam(required = false) String equipmentName,
@ApiParam(value = "开始日期", required = false) @RequestParam(required = false) String startTime,
@ApiParam(value = "结束日期", required = false) @RequestParam(required = false) String endTime, int pageNumber,
int pageSize) {
CommonPageable commonPageable = new CommonPageable(pageNumber, pageSize);
return CommonResponseUtil.success(iFireEquipService.queryForFireEquipmentHistory(
StringUtils.trimToNull(fireEquipmentName), StringUtils.trimToNull(equipmentName),
StringUtils.trimToNull(startTime), StringUtils.trimToNull(endTime), commonPageable));
}
@ApiOperation(httpMethod = "GET", value = "查询消防设备列表", notes = "查询消防设备列表")
@RequestMapping(value = "/info/page", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryForEquipmentList(
@ApiParam(value = "设备名称", required = false) @RequestParam(required = false) String name,
@ApiParam(value = "设备编号", required = false) @RequestParam(required = false) String code,
@ApiParam(value = "设备类型", required = false) @RequestParam(required = false) String equipClassify,
int pageNumber, int pageSize) {
CommonPageable commonPageable = new CommonPageable(pageNumber, pageSize);
return CommonResponseUtil.success(iFireEquipService.queryForEquipmentList(StringUtils.trimToNull(name),
StringUtils.trimToNull(code), StringUtils.trimToNull(equipClassify), commonPageable));
}
@ApiOperation(httpMethod = "GET", value = "消防状态明细信息", notes = "消防状态明细信息")
@RequestMapping(value = "/info/detail", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryForEquipmentList(@ApiParam(value = "设备名称", required = true) @RequestParam Long id,
@ApiParam(value = "设备编号", required = true) @RequestParam String type) throws Exception {
return CommonResponseUtil.success(iFireEquipService.queryForDetail(type, id));
}
@Autowired
private IFireCarService fireCarService;
@Autowired
private IFireEquipService iFireEquipService;
@Autowired
private IWaterResourceService iWaterResourceService;
@ApiOperation(httpMethod = "POST", value = "添加消防装备", notes = "添加消防装备")
@RequestMapping(value = "", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse create(@RequestBody FireEquipment fireEquipment) throws Exception {
ReginParams reginParams = getSelectedOrgInfo();
String compCode = getOrgCode(reginParams);
fireEquipment.setCreateBy(getUserId());
fireEquipment.setCreateDate(new Date());
fireEquipment.setOrgCode(compCode);
return CommonResponseUtil.success(iFireEquipService.save(fireEquipment));
}
@ApiOperation(httpMethod = "PUT", value = "编辑消防装备", notes = "编辑消防装备")
@RequestMapping(value = "/{id}", produces = "application/json;charset=UTF-8", method = RequestMethod.PUT)
public CommonResponse udpate(@PathVariable Long id, @RequestBody FireEquipment fireEquipment) {
fireEquipment.setId(id);
return CommonResponseUtil.success(iFireEquipService.save(fireEquipment));
}
@ApiOperation(httpMethod = "GET", value = "查询单个消防装备", notes = "查询单个消防装备")
@RequestMapping(value = "/{id}", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse query(@PathVariable Long id) {
return CommonResponseUtil.success(iFireEquipService.queryOne(id));
}
@ApiOperation(httpMethod = "DELETE", value = "删除消防装备", notes = "查询单个消防装备")
@RequestMapping(value = "/{ids}", produces = "application/json;charset=UTF-8", method = RequestMethod.DELETE)
public CommonResponse delete(@PathVariable String ids) throws Exception {
String[] idArray = ids.split(",");
if (iWaterResourceService.countAssociatedEquipWaterByIds(idArray) > 0) {
return CommonResponseUtil.failure("该设备已被灭火栓或消防水池绑定,请先删除绑定关系");
}
if (iFireEquipService.countAssociatedEquipStationByIds(idArray) > 0) {
return CommonResponseUtil.failure("该设备已被消防泡沫间或消防小室绑定,请先删除绑定关系");
}
return CommonResponseUtil.success(iFireEquipService.delete(idArray));
}
/**
* 消防车查询
*
* @return
*/
@ApiOperation(httpMethod = "POST", value = "查询消防车", notes = "查询消防车")
@RequestMapping(value = "/fire-car/list", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse queryFireCar(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<HashMap<String, Object>> carList = fireCarService.queryFireCar(getToken(), getProduct(), getAppKey(), param);
return CommonResponseUtil.success(carList);
}
/**
* 消防车详情查询
*
* @param id
* @return
*/
@ApiOperation(httpMethod = "GET", value = "查询消防车", notes = "查询消防车")
@RequestMapping(value = "/fire-car/det/{id}", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryFireCar(@ApiParam(value = "查询条件", required = true) @PathVariable Long id) {
FireCarDetailVo car = fireCarService.findFireCarById(getToken(), getProduct(), getAppKey(), id);
return CommonResponseUtil.success(car);
}
/**
* 消防装备查询-查询消防装备及视频监控
*
* @return
*/
@ApiOperation(httpMethod = "POST", value = "消防装备查询", notes = "消防装备查询")
@RequestMapping(value = "/fire-equip/list", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse queryFireEquipment(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<HashMap<String, Object>> carList = iFireEquipService.queryFireEquip(param);
return CommonResponseUtil.success(carList);
}
/**
* 配套设备查询
*
* @return
*/
@ApiOperation(httpMethod = "POST", value = "配套设备查询", notes = "配套设备查询")
@RequestMapping(value = "/matching-equip/list", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse queryFireEquipmentByProId(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = true) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<HashMap<String, Object>> carList = iFireEquipService.queryFireEquipByProId(param);
return CommonResponseUtil.success(carList);
}
/**
* 生产区域查询查询
*
* @return
*/
@ApiOperation(httpMethod = "GET", value = "生产区域查询", notes = "生产区域查询")
@RequestMapping(value = "/fire-equip/area", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryProArea() {
List<String> car = iFireEquipService.findFireEquipArea();
return CommonResponseUtil.success(car);
}
// @Authorization(ingore = true)
@ApiOperation(httpMethod = "GET", value = "查询消防设备历史数据", notes = "查询消防设备历史数据")
@RequestMapping(value = "/data/history", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryForFireEquipmentHistory(
@ApiParam(value = "设备名称", required = false) @RequestParam(required = false) String fireEquipmentName,
@ApiParam(value = "按保护对象名称", required = false) @RequestParam(required = false) String equipmentName,
@ApiParam(value = "开始日期", required = false) @RequestParam(required = false) String startTime,
@ApiParam(value = "结束日期", required = false) @RequestParam(required = false) String endTime, int pageNumber,
int pageSize) {
CommonPageable commonPageable = new CommonPageable(pageNumber, pageSize);
return CommonResponseUtil.success(iFireEquipService.queryForFireEquipmentHistory(
StringUtils.trimToNull(fireEquipmentName), StringUtils.trimToNull(equipmentName),
StringUtils.trimToNull(startTime), StringUtils.trimToNull(endTime), commonPageable));
}
@ApiOperation(httpMethod = "GET", value = "查询消防设备列表", notes = "查询消防设备列表")
@RequestMapping(value = "/info/page", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryForEquipmentList(
@ApiParam(value = "设备名称", required = false) @RequestParam(required = false) String name,
@ApiParam(value = "设备编号", required = false) @RequestParam(required = false) String code,
@ApiParam(value = "设备类型", required = false) @RequestParam(required = false) String equipClassify,
int pageNumber, int pageSize) {
CommonPageable commonPageable = new CommonPageable(pageNumber, pageSize);
return CommonResponseUtil.success(iFireEquipService.queryForEquipmentList(StringUtils.trimToNull(name),
StringUtils.trimToNull(code), StringUtils.trimToNull(equipClassify), commonPageable));
}
@ApiOperation(httpMethod = "GET", value = "消防状态明细信息", notes = "消防状态明细信息")
@RequestMapping(value = "/info/detail", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryForEquipmentList(@ApiParam(value = "设备名称", required = true) @RequestParam Long id,
@ApiParam(value = "设备编号", required = true) @RequestParam String type) throws Exception {
return CommonResponseUtil.success(iFireEquipService.queryForDetail(type, id));
}
}
......@@ -55,7 +55,12 @@ public class FireStationController extends BaseController {
fireStationFireEquipment.setCreateBy("0");
fireStationFireEquipment.setCreateDate(new Date());
}
return CommonResponseUtil.success(iFireStationService.saveStationFireEquipment(fireStationFireEquipments));
try {
List<FireStationFireEquipment> fireStationFireEquipments1 = iFireStationService.saveStationFireEquipment(fireStationFireEquipments);
return CommonResponseUtil.success(fireStationFireEquipments1);
} catch (Exception e){
return CommonResponseUtil.failure(e.getMessage());
}
}
@ApiOperation(httpMethod = "DELETE", value = "解除绑定消防设备", notes = "解除绑定消防设备")
......
......@@ -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);
......
......@@ -16,4 +16,6 @@ public interface IFireEquipmentDao extends BaseDao<FireEquipment, Long> {
Optional<FireEquipment> findById(Long id);
@Query(value = "SELECT count(1) FROM `f_fire_station_equipment` WHERE fire_equipment_id in ?1", nativeQuery = true)
int countAssociatedEquipStationByIds(String[] ids);
}
......@@ -10,5 +10,4 @@ import com.yeejoin.amos.fas.dao.entity.FireStation;
public interface IFireStationDao extends BaseDao<FireStation, Long> {
Optional<FireStation> findById(Long id);
}
......@@ -4,6 +4,7 @@ import com.yeejoin.amos.fas.dao.entity.WaterResource;
import java.util.Optional;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
@Repository("iWaterResourceDao")
......@@ -11,4 +12,6 @@ public interface IWaterResourceDao extends BaseDao<WaterResource, Long> {
Optional<WaterResource> findById(Long id);
@Query(value = "SELECT count(1) FROM `f_water_resource_equipment` WHERE fire_equipment_id in ?1", nativeQuery = true)
int countAssociatedEquipWaterByIds(String[] ids);
}
......@@ -105,7 +105,7 @@ public class FireCarServiceImpl implements IFireCarService {
List<DepartmentModel> depts =remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIds));
Map<Long, String> deptMap = depts.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr,DepartmentModel::getDepartmentName));
content.forEach(e -> {
e.put("departmentName",deptMap.get(e.get("dept_id")));
e.put("departmentName",deptMap.get(Long.valueOf(e.get("dept_id").toString())));
});
}
}
......
......@@ -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));
}
......
......@@ -189,7 +189,8 @@ public class FireEquipServiceImpl implements IFireEquipService {
return returnEntity;
}
@Override
public int countAssociatedEquipStationByIds(String[] ids) {
return iFireEquipmentDao.countAssociatedEquipStationByIds(ids);
}
}
......@@ -299,8 +299,7 @@ public class View3dServiceImpl implements IView3dService {
}
Optional<RiskSource> optional = iRiskSourceDao.findByOrgCodeAndParentId(orgCode,0L);
TodaySafetyIndexVo vo = new TodaySafetyIndexVo();
if(optional.isPresent()){
//1.按照等级进行转换rpn为分数-机构
if(optional.isPresent()){ //1.按照等级进行转换rpn为分数-机构
RiskSource riskSource = optional.get();
double safetyIndex = this.changeRpnToSafetyIndex(riskSource.getRpn());
vo.setSafetyIndex(safetyIndex);
......@@ -424,7 +423,8 @@ public class View3dServiceImpl implements IView3dService {
List<RiskSource> regionList = iRiskSourceDao.findByParentIdAndIsRegion(optional.get().getId(),RiskSourceRegionEum.TRUE.getCode());
exceptionList = regionList.stream().filter(riskSource -> {
BigDecimal rpn = riskSource.getRpn() == null ? new BigDecimal("0") : riskSource.getRpn();
return rpn.subtract(riskSource.getRpni()).doubleValue() > 0;
BigDecimal rpni = riskSource.getRpni() == null ? new BigDecimal("0") : riskSource.getRpni();
return rpn.subtract(rpni).doubleValue() > 0;
}).map(riskSource -> {
ExceptionRegionVo regionVo = new ExceptionRegionVo();
regionVo.setId(riskSource.getId());
......
......@@ -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;
}
......@@ -98,7 +98,7 @@ public class WaterResourceServiceImpl implements IWaterResourceService {
for(WaterResourceEquipment waterResourceEquipment:waterResourceEquipments){
WaterResourceEquipment saveWaterResourceEquipment = iWaterResourceEquipmentDao.findByWaterResourceIdAndFireEquipmentId(waterResourceEquipment.getWaterResourceId(),waterResourceEquipment.getFireEquipmentId());
if(StringUtil.isNotEmpty(saveWaterResourceEquipment)){
deleteList.add(waterResourceEquipment);
deleteList.add(saveWaterResourceEquipment);
}
}
iWaterResourceEquipmentDao.deleteAll(deleteList);
......@@ -120,8 +120,8 @@ public class WaterResourceServiceImpl implements IWaterResourceService {
}
@Override
public int countAssociatedEquipWaterByIds(String[] ids) {
return iWaterResourceDao.countAssociatedEquipWaterByIds(ids);
}
}
......@@ -18,15 +18,10 @@ public interface IFireEquipService {
List<String> findFireEquipArea();
FireEquipment save(FireEquipment fireEquipment);
FireEquipment queryOne(Long id);
/**
* 删除单个风险点
* @return
......@@ -34,8 +29,6 @@ public interface IFireEquipService {
*/
String [] delete(String []idArray) throws Exception;
Page queryForFireEquipmentHistory(String fireEquipmentName,
String equipmentName,
String startTime,
......@@ -44,9 +37,13 @@ public interface IFireEquipService {
Page queryForEquipmentList(String name, String code,String equipClassify,CommonPageable commonPageable);
//查询设备明细
Object queryForDetail(String type, Long id) throws Exception;
/**
* 查询关联数量
* @param ids
* @return
*/
int countAssociatedEquipStationByIds(String[] ids);
}
......@@ -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);
......@@ -54,4 +54,6 @@ public interface IWaterResourceService {
Object queryForList();
int countAssociatedEquipWaterByIds(String[] ids);
}
......@@ -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
......@@ -45,6 +45,7 @@
left join f_risk_source frs on frs.id = f.risk_source_id
WHERE
fs.fire_station_id = ${fireStationId}
and f.id is not null
LIMIT ${start}, ${length};
</select>
......
......@@ -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>
......
......@@ -68,7 +68,9 @@
fe.room,
fe.risk_source_id,
fe.is_indoor,
fe.model,fe.manufacturer
fe.model,
fe.manufacturer,
fe.floor3d
FROM
f_fire_equipment fe
LEFT JOIN f_risk_source rs ON rs.id = fe.risk_source_id
......
......@@ -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>
......@@ -100,6 +99,7 @@
left join f_risk_source frs on frs.id = f.risk_source_id
WHERE
fs.water_resource_id = ${waterResourceId}
and f.id is not null
LIMIT ${start}, ${length};
</select>
......
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