Commit aa2d214c authored by KeYong's avatar KeYong

提交消防力量车辆状态查询接口

parent 98ecb762
......@@ -46,5 +46,20 @@ public class EquipmentInfoOnPlanController {
return CommonResponseUtil.success(list);
}
@ApiOperation(httpMethod = "GET", value = "其他设备信息", notes = "其他设备信息")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value ="/journal")
public ResponseModel getOtherEquipInfo() {
List<Map<String, Object>> list = equipmentInfoOnPlanService.getOtherEquipInfo();
return CommonResponseUtil.success(list);
}
@ApiOperation(httpMethod = "GET", value = "消防力量和车辆启停信息", notes = "消防力量和车辆启停信息")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value ="/power/info")
public ResponseModel getFirePowerAndCarInfo() {
Map<String, Object> list = equipmentInfoOnPlanService.getFirePowerAndCarInfo();
return CommonResponseUtil.success(list);
}
}
......@@ -71,4 +71,8 @@ public interface CarMapper extends BaseMapper<Car> {
int equipmentCarListcount(Long teamId, String name,String code,Long id,Boolean isNo);
List<CarFusionDto> selectCarAndCarProperty();
List<Map<String, Object>> getCarState();
List<Map<String, Object>> getFirePowerInfo();
}
......@@ -8,7 +8,9 @@ import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @author keyong
......@@ -32,4 +34,8 @@ public interface EquipmentSpecificAlarmLogMapper extends BaseMapper<EquipmentSpe
List<FireEquipmentFireAlarm> getFireEquipAlarmLogDetailsById(@Param("list") List<Long> ids);
Map<String, Object> getPlanRecord();
List<Map<String, Object>> getOtherEquipInfo(@Param("date") String date, @Param("equipmentId") Long equipmentId);
}
package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
import java.util.Map;
......@@ -27,4 +25,16 @@ public interface IEquipmentInfoOnPlanService {
* @return
*/
List<Map<String, Object>> getFirePumpInfo();
/**
* 其他设备信息
* @return
*/
List<Map<String, Object>> getOtherEquipInfo();
/**
* 消防力量和车辆启停信息
* @return
*/
Map<String, Object> getFirePowerAndCarInfo();
}
package com.yeejoin.equipmanage.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Maps;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.mapper.CarMapper;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmLogMapper;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper;
import com.yeejoin.equipmanage.service.IEquipmentInfoOnPlanService;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.List;
import java.util.Map;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @author keyong
......@@ -22,7 +27,13 @@ import java.util.Map;
public class EquipmentInfoOnPlanServiceImpl implements IEquipmentInfoOnPlanService {
@Autowired
EquipmentSpecificMapper equipmentSpecificMapper;
private EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired
private EquipmentSpecificAlarmLogMapper equipmentSpecificAlarmLogMapper;
@Autowired
private CarMapper carMapper;
@Value("${equipment.plan.monitor}")
String monitorCodes;
......@@ -33,12 +44,42 @@ public class EquipmentInfoOnPlanServiceImpl implements IEquipmentInfoOnPlanServi
@Override
public List<Map<String, Object>> getFireMonitorInfo(Long fireEquipmentId) {
String[] strings = monitorCodes.split(",");
return equipmentSpecificMapper.getFireMonitorInfo(fireEquipmentId, strings);
List<Map<String, Object>> list = equipmentSpecificMapper.getFireMonitorInfo(fireEquipmentId, strings);
return Optional.ofNullable(list).orElse(Lists.newArrayList());
}
@Override
public List<Map<String, Object>> getFirePumpInfo() {
String[] strings = pumpCodes.split(",");
return equipmentSpecificMapper.getFirePumpInfo(strings);
List<Map<String, Object>> list = equipmentSpecificMapper.getFirePumpInfo(strings);
return Optional.ofNullable(list).orElse(Lists.newArrayList());
}
@Override
public List<Map<String, Object>> getOtherEquipInfo() {
Map<String, Object> map = equipmentSpecificAlarmLogMapper.getPlanRecord();
Date startTime = null;
Long equipmentId = null;
if (!ValidationUtil.isEmpty(map)) {
try {
startTime = DateUtils.dateParse(String.valueOf(map.get("startTime")), DateUtils.DATE_TIME_T_PATTERN);
equipmentId = Long.valueOf(String.valueOf(map.get("equipmentId")));
} catch (Exception e) {
e.printStackTrace();
}
}
String dateParam = startTime == null ? null : new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(startTime);
List<Map<String, Object>> list = equipmentSpecificAlarmLogMapper.getOtherEquipInfo(dateParam, equipmentId);
return Optional.ofNullable(list).orElse(Lists.newArrayList());
}
@Override
public Map<String, Object> getFirePowerAndCarInfo() {
List<Map<String, Object>> firePowerMap = carMapper.getFirePowerInfo();
List<Map<String, Object>> carStateMap = carMapper.getCarState();
Map<String, Object> map = new HashMap<>();
map.put("firePower", Optional.ofNullable(firePowerMap).orElse(Lists.newArrayList()));
map.put("carState", Optional.ofNullable(carStateMap).orElse(Lists.newArrayList()));
return map;
}
}
......@@ -619,4 +619,18 @@
from wl_car wc LEFT JOIN wl_car_property wcp on wc.id = wcp.car_id
where wcp.equipment_index_key in ('FAS_Car_Video', 'FAS_Car_GIS');
</select>
<select id="getCarState" resultType="Map">
SELECT
*
FROM
v_fire_firecar_num
</select>
<select id="getFirePowerInfo" resultType="Map">
SELECT
department_name departmentName,
total,
on_duty onDuty
FROM
v_duty_person
</select>
</mapper>
......@@ -148,4 +148,36 @@
</if>
</where>
</select>
<select id="getPlanRecord" resultType="Map">
SELECT
start_time startTime,
equipment_code equipmentCode,
equipment_name equipmentName,
equipment_id equipmentId,
fire_equipment_id fireEquipmentId
FROM
c_plan_operation_record cpor
WHERE
cpor.status = 0
ORDER BY cpor.create_date DESC
LIMIT 1
</select>
<select id="getOtherEquipInfo" resultType="com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog">
SELECT
*
FROM
wl_equipment_specific_alarm_log weal
<where>
weal.type != 'HearBeat'
<if test="date != null">
AND weal.create_date <![CDATA[>=]]> DATE_FORMAT(#{date}, '%Y-%m-%d %H:%i:%S')
</if>
<if test="equipmentId != null">
AND weal.equipment_specific_id = #{equipmentId}
</if>
</where>
ORDER BY weal.create_date DESC
</select>
</mapper>
\ No newline at end of file
......@@ -1501,6 +1501,7 @@
<select id="getFireMonitorInfo" resultType="Map">
SELECT
wes.id,
wes.name,
wes.position,
wes.equipment_code equipmentCode,
......@@ -1528,6 +1529,7 @@
</select>
<select id="getFirePumpInfo" resultType="Map">
SELECT
wes.id,
wes.name,
wes.position,
wes.equipment_code equipmentCode,
......
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