Commit c51897dc authored by zhangsen's avatar zhangsen

根据换流站统计消防系统状态

parent 8de6ebf7
...@@ -32,4 +32,11 @@ public interface FireEquipmentSignalLogMapper extends BaseMapper<FireEquipmentSi ...@@ -32,4 +32,11 @@ public interface FireEquipmentSignalLogMapper extends BaseMapper<FireEquipmentSi
* @return List<FireEquipmentDto> * @return List<FireEquipmentDto>
*/ */
List<FireEquipmentDto> distinctByEquipmentId(@Param("stationCode") String stationCode, @Param("alarmDate") String alarmDate); List<FireEquipmentDto> distinctByEquipmentId(@Param("stationCode") String stationCode, @Param("alarmDate") String alarmDate);
/**
* 根据系统
* @param mrid
* @return
*/
Integer getAlarmCountByMrid(@Param("mrid") String mrid);
} }
...@@ -3,6 +3,8 @@ package com.yeejoin.amos.boot.module.ccs.api.mapper; ...@@ -3,6 +3,8 @@ package com.yeejoin.amos.boot.module.ccs.api.mapper;
import com.yeejoin.amos.boot.module.ccs.api.entity.FireFightingSystem; import com.yeejoin.amos.boot.module.ccs.api.entity.FireFightingSystem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/** /**
* 消防系统信息 Mapper 接口 * 消防系统信息 Mapper 接口
* *
...@@ -11,4 +13,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -11,4 +13,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystem> { public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystem> {
List<FireFightingSystem> getMridByCode(String stationCode);
} }
...@@ -74,4 +74,13 @@ ...@@ -74,4 +74,13 @@
and ai.station_code =#{stationCode} and ai.station_code =#{stationCode}
</if> </if>
</select> </select>
<select id="getAlarmCountByMrid" resultType="java.lang.Integer">
SELECT
IFNULL( sum( is_alarm ), 0 )
FROM
asf_fire_equipment_signal_log
WHERE
FIND_IN_SET(#{mrid,jdbcType=VARCHAR}, system_mrids)
</select>
</mapper> </mapper>
...@@ -2,4 +2,12 @@ ...@@ -2,4 +2,12 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.ccs.api.mapper.FireFightingSystemMapper"> <mapper namespace="com.yeejoin.amos.boot.module.ccs.api.mapper.FireFightingSystemMapper">
<select id="getMridByCode" resultType="com.yeejoin.amos.boot.module.ccs.api.entity.FireFightingSystem">
SELECT *
FROM
ast_fire_fighting_system
where station_code = #{stationCode,jdbcType=VARCHAR}
GROUP BY
mrid
</select>
</mapper> </mapper>
...@@ -112,10 +112,20 @@ public class FireStationInfoController extends BaseController { ...@@ -112,10 +112,20 @@ public class FireStationInfoController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据换流站code统计消防车", notes = "根据换流站code统计消防车") @ApiOperation(httpMethod = "GET", value = "根据换流站code统计消防车", notes = "根据换流站code统计消防车")
@GetMapping(value = "/getCarInfoByStationCode") @GetMapping(value = "/getCarInfoByStationCode")
public ResponseModel<List<CarInfoVO>> getCarInfoByStationCode(@ApiParam(value = "换流站编号") @RequestParam(required = true) String stationCode) { public ResponseModel<List<CarInfoVO>> getCarInfoByStationCode(@ApiParam(value = "换流站编号", required = true) @RequestParam(required = true) String stationCode) {
if (StrUtil.isEmpty(stationCode)) { if (StrUtil.isEmpty(stationCode)) {
throw new BadRequest("换流站编号不能为空"); throw new BadRequest("换流站编号不能为空");
} }
return ResponseHelper.buildResponse(fireStationInfoServiceImpl.getCarInfoByStationCode(stationCode)); return ResponseHelper.buildResponse(fireStationInfoServiceImpl.getCarInfoByStationCode(stationCode));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据换流站code统计消防系统状态", notes = "根据换流站code统计消防系统状态")
@GetMapping(value = "/getFireSystemByStationCode")
public ResponseModel<Map<String, Integer>> getFireSystemByStationCode(@ApiParam(value = "换流站编号", required = true) @RequestParam(required = true) String stationCode) {
if (StrUtil.isEmpty(stationCode)) {
throw new BadRequest("换流站编号不能为空");
}
return ResponseHelper.buildResponse(fireStationInfoServiceImpl.getFireSystemByStationCode(stationCode));
}
} }
...@@ -6,8 +6,11 @@ import cn.hutool.core.date.DateTime; ...@@ -6,8 +6,11 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.yeejoin.amos.boot.module.ccs.api.dto.FireStationInfoDto; import com.yeejoin.amos.boot.module.ccs.api.dto.FireStationInfoDto;
import com.yeejoin.amos.boot.module.ccs.api.entity.FireFightingSystem;
import com.yeejoin.amos.boot.module.ccs.api.entity.FireStationInfo; import com.yeejoin.amos.boot.module.ccs.api.entity.FireStationInfo;
import com.yeejoin.amos.boot.module.ccs.api.enums.StationOrderByTypeEnum; import com.yeejoin.amos.boot.module.ccs.api.enums.StationOrderByTypeEnum;
import com.yeejoin.amos.boot.module.ccs.api.mapper.FireEquipmentSignalLogMapper;
import com.yeejoin.amos.boot.module.ccs.api.mapper.FireFightingSystemMapper;
import com.yeejoin.amos.boot.module.ccs.api.mapper.FireStationInfoMapper; import com.yeejoin.amos.boot.module.ccs.api.mapper.FireStationInfoMapper;
import com.yeejoin.amos.boot.module.ccs.api.mapper.FireVehicleMapper; import com.yeejoin.amos.boot.module.ccs.api.mapper.FireVehicleMapper;
import com.yeejoin.amos.boot.module.ccs.api.service.IFireStationInfoService; import com.yeejoin.amos.boot.module.ccs.api.service.IFireStationInfoService;
...@@ -34,6 +37,13 @@ public class FireStationInfoServiceImpl extends BaseService<FireStationInfoDto, ...@@ -34,6 +37,13 @@ public class FireStationInfoServiceImpl extends BaseService<FireStationInfoDto,
@Autowired @Autowired
private FireVehicleMapper fireVehicleMapper; private FireVehicleMapper fireVehicleMapper;
@Autowired
private FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
private FireEquipmentSignalLogMapper fireEquipmentSignalLogMapper;
/** /**
* 列表查询 示例 * 列表查询 示例
* *
...@@ -153,4 +163,13 @@ public class FireStationInfoServiceImpl extends BaseService<FireStationInfoDto, ...@@ -153,4 +163,13 @@ public class FireStationInfoServiceImpl extends BaseService<FireStationInfoDto,
}); });
return carInfoByStationCode; return carInfoByStationCode;
} }
public Map<String, Integer> getFireSystemByStationCode(String stationCode) {
HashMap<String, Integer> resultMap = new HashMap<>();
List<FireFightingSystem> mridList = fireFightingSystemMapper.getMridByCode(stationCode);
mridList.forEach(item -> {
resultMap.put(item.getName(), fireEquipmentSignalLogMapper.getAlarmCountByMrid(item.getMrid()));
});
return resultMap;
}
} }
\ 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