Commit 8c451a6e authored by 高建强's avatar 高建强

Merge remote-tracking branch 'origin/develop_dl_plan6' into develop_dl_plan6

parents 166a728e ac110d27
......@@ -32,4 +32,11 @@ public interface FireEquipmentSignalLogMapper extends BaseMapper<FireEquipmentSi
* @return List<FireEquipmentDto>
*/
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;
import com.yeejoin.amos.boot.module.ccs.api.entity.FireFightingSystem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* 消防系统信息 Mapper 接口
*
......@@ -11,4 +13,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystem> {
List<FireFightingSystem> getMridByCode(String stationCode);
}
......@@ -2,6 +2,10 @@ package com.yeejoin.amos.boot.module.ccs.api.mapper;
import com.yeejoin.amos.boot.module.ccs.api.entity.FireVehicle;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.ccs.api.vo.CarInfoVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 消防车辆信息 Mapper 接口
......@@ -11,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface FireVehicleMapper extends BaseMapper<FireVehicle> {
List<CarInfoVO> getCarInfoByStationCode(@Param("stationCode") String stationCode);
}
package com.yeejoin.amos.boot.module.ccs.api.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class CarInfoVO implements Serializable {
private Integer total;
private String carType;
private String strCarNumber;
private List<CarNumberVO> carList;
}
package com.yeejoin.amos.boot.module.ccs.api.vo;
import lombok.Data;
@Data
public class CarNumberVO {
private String carNum;
}
......@@ -74,4 +74,13 @@
and ai.station_code =#{stationCode}
</if>
</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>
......@@ -2,4 +2,12 @@
<!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">
<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>
......@@ -147,14 +147,14 @@
and s.confirm_date like concat(date ,'%')
</where>
) as alarmNums,
date
concat(date ,'时') as date
from
(SELECT
DATE_FORMAT( DATE_ADD( #{beginDateTime}, INTERVAL @s HOUR ),'%Y-%m-%d %H') AS date,
@s := @s + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 0 ) temp
( SELECT @s := 1 ) temp
WHERE
@s <![CDATA[<=]]>
hour(TIMEDIFF(#{endDateTime},#{beginDateTime}))) t
......
......@@ -2,4 +2,16 @@
<!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.FireVehicleMapper">
<select id="getCarInfoByStationCode" resultType="com.yeejoin.amos.boot.module.ccs.api.vo.CarInfoVO">
SELECT
count(*) as total,
`type` as carType,
group_concat( `number` ) AS strCarNumber
FROM
ast_fire_vehicle
WHERE
station_code = #{stationCode,jdbcType=VARCHAR}
GROUP BY
`type`
</select>
</mapper>
package com.yeejoin.amos.boot.module.ccs.biz.controller;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.util.StrUtil;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.ccs.api.dto.FireStationInfoDto;
import com.yeejoin.amos.boot.module.ccs.api.enums.StationOrderByTypeEnum;
import com.yeejoin.amos.boot.module.ccs.api.vo.CarInfoVO;
import com.yeejoin.amos.boot.module.ccs.biz.service.impl.FireStationInfoServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -12,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -63,7 +66,7 @@ public class FireStationInfoController extends BaseController {
@GetMapping(value = "/getStationSafetyListByCode")
public ResponseModel<List<FireStationInfoDto>> stationSafetyList(
@ApiParam(value = "换流站编码") @RequestParam(required = false) String stationCode,
@ApiParam(value = "数量") @RequestParam(required = true) Integer top) {
@ApiParam(value = "数量") @RequestParam(required = false) Integer top) {
return ResponseHelper.buildResponse(fireStationInfoServiceImpl.queryStationAlarmListByCode(stationCode, top));
}
......@@ -105,4 +108,24 @@ public class FireStationInfoController extends BaseController {
@ApiParam(value = "换流站编号") @RequestParam(required = false) String stationCode) {
return ResponseHelper.buildResponse(fireStationInfoServiceImpl.getAlarmTrendByDatePeriod(stationCode, beginDate, endDate));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据换流站code统计消防车", notes = "根据换流站code统计消防车")
@GetMapping(value = "/getCarInfoByStationCode")
public ResponseModel<List<CarInfoVO>> getCarInfoByStationCode(@ApiParam(value = "换流站编号", required = true) @RequestParam(required = true) String stationCode) {
if (StrUtil.isEmpty(stationCode)) {
throw new BadRequest("换流站编号不能为空");
}
return ResponseHelper.buildResponse(fireStationInfoServiceImpl.getCarInfoByStationCode(stationCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据换流站code统计消防系统状态", notes = "根据换流站code统计消防系统状态")
@GetMapping(value = "/getFireSystemByStationCode")
public ResponseModel<List<Map<String, String>>> getFireSystemByStationCode(@ApiParam(value = "换流站编号", required = true) @RequestParam(required = true) String stationCode) {
if (StrUtil.isEmpty(stationCode)) {
throw new BadRequest("换流站编号不能为空");
}
return ResponseHelper.buildResponse(fireStationInfoServiceImpl.getFireSystemByStationCode(stationCode));
}
}
......@@ -5,14 +5,22 @@ import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
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.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.FireVehicleMapper;
import com.yeejoin.amos.boot.module.ccs.api.service.IFireStationInfoService;
import com.yeejoin.amos.boot.module.ccs.api.vo.AlarmCountVO;
import com.yeejoin.amos.boot.module.ccs.api.vo.CarInfoVO;
import com.yeejoin.amos.boot.module.ccs.api.vo.CarNumberVO;
import com.yeejoin.amos.boot.module.ccs.api.vo.DateAlarmCountVO;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
......@@ -28,6 +36,16 @@ import java.util.stream.Collectors;
*/
@Service
public class FireStationInfoServiceImpl extends BaseService<FireStationInfoDto, FireStationInfo, FireStationInfoMapper> implements IFireStationInfoService {
@Autowired
private FireVehicleMapper fireVehicleMapper;
@Autowired
private FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
private FireEquipmentSignalLogMapper fireEquipmentSignalLogMapper;
/**
* 列表查询 示例
*
......@@ -63,7 +81,12 @@ public class FireStationInfoServiceImpl extends BaseService<FireStationInfoDto,
item.setConfirmFalseNum(collect.get(item.getCode()).getConfirmFalseNum());
}
});
List<FireStationInfoDto> finalVoList = fireStationInfoList.stream().skip(0).limit(top).sorted(Comparator.comparing(FireStationInfoDto::getAlarmNum).reversed()).collect(Collectors.toList());
List<FireStationInfoDto> finalVoList = new ArrayList<>();
if (null == top) {
finalVoList = fireStationInfoList.stream().skip(0).sorted(Comparator.comparing(FireStationInfoDto::getAlarmNum).reversed()).collect(Collectors.toList());
} else {
finalVoList = fireStationInfoList.stream().skip(0).limit(top).sorted(Comparator.comparing(FireStationInfoDto::getAlarmNum).reversed()).collect(Collectors.toList());
}
return finalVoList;
}
......@@ -131,4 +154,33 @@ public class FireStationInfoServiceImpl extends BaseService<FireStationInfoDto,
resultMap.put("alarmNum", alarmNumList);
return resultMap;
}
public List<CarInfoVO> getCarInfoByStationCode(String stationCode) {
List<CarInfoVO> carInfoByStationCode = fireVehicleMapper.getCarInfoByStationCode(stationCode);
carInfoByStationCode.forEach(item -> {
if (StrUtil.isNotEmpty(item.getStrCarNumber())) {
List<CarNumberVO> carNumberVOS = new ArrayList<>();
List<String> list = Arrays.asList(item.getStrCarNumber().split(","));
list.forEach(carNum -> {
CarNumberVO carNumberVO = new CarNumberVO();
carNumberVO.setCarNum(carNum);
carNumberVOS.add(carNumberVO);
});
item.setCarList(carNumberVOS);
}
});
return carInfoByStationCode;
}
public List<Map<String, String>> getFireSystemByStationCode(String stationCode) {
List<Map<String, String>> resultList= new ArrayList<>();
List<FireFightingSystem> mridList = fireFightingSystemMapper.getMridByCode(stationCode);
mridList.forEach(item -> {
HashMap<String, String> resultMap = new HashMap<>();
resultMap.put("systemName", item.getName());
resultMap.put("alarmNum", String.valueOf(fireEquipmentSignalLogMapper.getAlarmCountByMrid(item.getMrid())));
resultList.add(resultMap);
});
return resultList;
}
}
\ 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