Commit eff4ee07 authored by lisong's avatar lisong

修改bug

parent 53bed829
......@@ -21,6 +21,7 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
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;
import java.text.ParseException;
......@@ -259,7 +260,7 @@ public class ConfigureController extends AbstractBaseController {
item.put("unNormalNum", (Integer) item.get("startAndStopNum") <= 1 ? 0 : 1);
Map<String, String> stateMap = fireFightingSystemMapper.queryPressureNowStateBySpecificId((Long) item.get("id"));
if (!ObjectUtils.isEmpty(stateMap) && stateMap.containsKey("update_date") && stateMap.containsKey("equipment_index_name")) {
item.put("update_time", stateMap.get("update_date"));
item.put("update_time", String.valueOf(stateMap.get("update_date")).replaceAll("T", " "));
item.put("equipment_index_name", stateMap.get("equipment_index_name"));
}
return item;
......@@ -449,4 +450,149 @@ public class ConfigureController extends AbstractBaseController {
return CommonResponseUtil.success(iFireFightingSystemService.equipmentState(result, hashMap));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "物联监控大屏3大-获取某站下装备数量、摄像头数量")
@GetMapping("/statisticsByStation")
public ResponseModel getEquipmentState(@RequestParam(required = false) String bizOrgCode) {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
return CommonResponseUtil.success(iFireFightingSystemService.statisticsByStation(bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "物联监控大屏3大-获取某站下今日告警设备")
@GetMapping("/todayAlarmEquipment")
public ResponseModel todayAlarmEquipment(@RequestParam(required = false) String bizOrgCode) {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
return CommonResponseUtil.success(iFireFightingSystemService.todayAlarmEquipment(bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "物联监控大屏3大-获取某站下今日告警信息")
@GetMapping("/todayAlarmMessage")
public ResponseModel todayAlarmMessage(@RequestParam(required = false) String bizOrgCode) {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
return CommonResponseUtil.success(iFireFightingSystemService.todayAlarmMessage(bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "物联监控大屏3大-获取某站下未消除的告警设备")
@GetMapping("/todayAlarmUnEliminateEquipment")
public ResponseModel todayAlarmUnEliminateEquipment(@RequestParam(required = false) String bizOrgCode) {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
return CommonResponseUtil.success(iFireFightingSystemService.todayAlarmUnEliminateEquipment(bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "物联监控大屏3大-获取某站下未消除的告警信息")
@GetMapping("/todayAlarmUnEliminateMessage")
public ResponseModel todayAlarmUnEliminateMessage(@RequestParam(required = false) String bizOrgCode) {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
return CommonResponseUtil.success(iFireFightingSystemService.todayAlarmUnEliminateMessage(bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "物联监控大屏3大-获取某站下近一月的告警信息")
@GetMapping("/monthAlarm")
public ResponseModel monthAlarm(@RequestParam(required = false) String bizOrgCode) {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
return CommonResponseUtil.success(iFireFightingSystemService.monthAlarm(bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "物联监控大屏3大-获取某站下近一年告警统计")
@GetMapping("/yearsAlarm")
public ResponseModel yearsAlarm(@RequestParam(required = false) String bizOrgCode) {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
return CommonResponseUtil.success(iFireFightingSystemService.yearsAlarm(bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "物联监控大屏3大-检测告警记录")
@GetMapping("/alarmList")
public ResponseModel alarmList(@RequestParam(required = false) String bizOrgCode, CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(iFireFightingSystemService.alarmList(page, bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/equipList")
@ApiOperation(httpMethod = "GET", value = "装备列表-用于站端查看信息卡", notes = "装备列表-用于站端查看信息卡")
public ResponseModel equipList(CommonPageable commonPageable, @RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(iFireFightingSystemService.equipList(page, bizOrgCode));
}
}
......@@ -47,4 +47,17 @@ public class VideoImportantEquipmentController {
}
return videoImportantEquipmentService.getVideoImportantEquipmentList(map);
}
@RequestMapping(value = "/getVideoList", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "获取视屏监控关联重点设备集合(需求优化)", notes = "获取视屏监控关联重点设备集合(需求优化)")
public List<Map<String, List<VideoImportantEquipmentVo>>> getVideoList(@RequestParam(required = false) Long importantEquipmentId) {
Map<String, Object> map = null;
if (importantEquipmentId != null) {
map = new HashMap<>();
map.put("importantEquipmentId", importantEquipmentId);
}
return videoImportantEquipmentService.getVideoList(map);
}
}
\ No newline at end of file
......@@ -371,4 +371,66 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
* @return
*/
List<EquipmentExportVO> exportEquipmentList(@Param("dto") EquipTypeAmountPageDTO dto);
/**
* 统计某站下装备总数、摄像头总数
* @param bizOrgCode
* @return
*/
Map<String, Object> statisticsByStation(@Param("bizOrgCode") String bizOrgCode);
/**
* 查询某站今日告警设备信息
* @param bizOrgCode
* @return
*/
Map<String, Object> todayAlarmEquipment(@Param("bizOrgCode") String bizOrgCode);
/**
* 查询某站今日告警信息
* @param bizOrgCode
* @return
*/
Map<String, Object> todayAlarmMessage(@Param("bizOrgCode") String bizOrgCode);
/**
* 查询某站今日未消除设备
* @param bizOrgCode
* @return
*/
Map<String, Object> todayAlarmUnEliminateEquipment(@Param("bizOrgCode") String bizOrgCode);
/**
* 查询某站今日未消除告警
* @param bizOrgCode
* @return
*/
Map<String, Object> todayAlarmUnEliminateMessage(@Param("bizOrgCode") String bizOrgCode);
/**
* 查询某站近一月告警趋势
* @param bizOrgCode
* @return
*/
List<Map<String, Object>> monthAlarm(@Param("bizOrgCode") String bizOrgCode);
/**
* 查询某站近一年告警统计
* @param bizOrgCode
* @return
*/
List<Map<String, Object>> yearsAlarm(@Param("bizOrgCode") String bizOrgCode);
/**
* 分页查询站下检测告警记录
* @param bizOrgCode
* @return
*/
Page<Map<String, Object>> alarmList(Page page, @Param("bizOrgCode") String bizOrgCode);
/**
* 站端装备列表
* @param page
* @param bizOrgCode
* @return
*/
Page<Map<String, Object>> equipList (Page page, @Param("bizOrgCode") String bizOrgCode);
}
......@@ -16,4 +16,9 @@ import java.util.Map;
@Mapper
public interface VideoImportantEquipmentMapper extends BaseMapper<VideoImportantEquipment> {
List<VideoImportantEquipmentVo> getVideoImportantEquipmentList(Map<String, Object> map);
List<VideoImportantEquipmentVo> getVideoList(Map<String, Object> map);
List<String> getVideoAddressGroupList(Map<String, Object> map);
}
......@@ -254,4 +254,21 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
Page<Map<String, Object>> equipmentState(Page result, HashMap<String, Object> hashMap);
Map<String, Object> statisticsByStation(String bizOrgCode);
Map<String, Object> todayAlarmEquipment(String bizOrgCode);
Map<String, Object> todayAlarmMessage(String bizOrgCode);
Map<String, Object> todayAlarmUnEliminateEquipment(String bizOrgCode);
Map<String, Object> todayAlarmUnEliminateMessage(String bizOrgCode);
List<Map<String, Object>> monthAlarm(String bizOrgCode);
List<Map<String, Object>> yearsAlarm(String bizOrgCode);
Page<Map<String, Object>> alarmList(Page page, String bizOrgCode);
Page<Map<String, Object>> equipList(Page page, String bizOrgCode);
}
......@@ -14,4 +14,6 @@ import java.util.Map;
*/
public interface IVideoImportantEquipmentService extends IService<VideoImportantEquipment> {
List<VideoImportantEquipmentVo> getVideoImportantEquipmentList(Map<String, Object> map);
List<Map<String, List<VideoImportantEquipmentVo>>> getVideoList(Map<String, Object> map);
}
......@@ -11,8 +11,11 @@ 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.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -62,6 +65,20 @@ public class EquipmentInfoOnPlanServiceImpl implements IEquipmentInfoOnPlanServi
@Override
public List<Map<String, Object>> getOtherEquipInfo() {
List<Map<String, Object>> list = equipmentSpecificIndexMapper.getEquipSpecificIndexByUpdateDateDesc();
list.stream().filter(item -> item.containsKey("createDate") && !ObjectUtils.isEmpty(item.get("createDate"))).forEach(item -> {
// try {
// Date carStateDate = DateUtils.dateParse(item.get("createDate").toString(), "yyyy-MM-dd'T'HH:mm:ss");
// String s = DateUtils.dateFormat(carStateDate, DateUtils.DATE_TIME_PATTERN).replaceAll("T", " ");
// item.put("createDate", s);
// } catch (ParseException e) {
// e.printStackTrace();
// }
String s = item.get("createDate").toString().replaceAll("T", " ");
item.put("createDate", s);
});
return Optional.ofNullable(list).orElse(Lists.newArrayList());
}
......
......@@ -45,6 +45,7 @@ import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.math.BigDecimal;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
......@@ -1322,4 +1323,67 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return fireFightingSystemMapper.getWaterInfo(page, bizOrgCode, systemCode);
}
@Override
public Map<String, Object> statisticsByStation(String bizOrgCode) {
return fireFightingSystemMapper.statisticsByStation(bizOrgCode);
}
@Override
public Map<String, Object> todayAlarmEquipment(String bizOrgCode) {
Map<String, Object> map = fireFightingSystemMapper.todayAlarmEquipment(bizOrgCode);
BigDecimal dayAbs = new BigDecimal(map.get("dayAbs").toString()).setScale(2, BigDecimal.ROUND_HALF_DOWN);
map.put("dayAbs", dayAbs.toString());
BigDecimal monthAbs = new BigDecimal(map.get("monthAbs").toString()).setScale(2, BigDecimal.ROUND_HALF_DOWN);
map.put("monthAbs", monthAbs.toString());
return map;
}
@Override
public Map<String, Object> todayAlarmMessage(String bizOrgCode) {
Map<String, Object> map = fireFightingSystemMapper.todayAlarmMessage(bizOrgCode);
BigDecimal dayAbs = new BigDecimal(map.get("dayAbs").toString()).setScale(2, BigDecimal.ROUND_HALF_DOWN);
map.put("dayAbs", dayAbs.toString());
BigDecimal monthAbs = new BigDecimal(map.get("monthAbs").toString()).setScale(2, BigDecimal.ROUND_HALF_DOWN);
map.put("monthAbs", monthAbs.toString());
return map;
}
@Override
public Map<String, Object> todayAlarmUnEliminateEquipment(String bizOrgCode) {
Map<String, Object> map = fireFightingSystemMapper.todayAlarmUnEliminateEquipment(bizOrgCode);
BigDecimal dayAbs = new BigDecimal(map.get("dayAbs").toString()).setScale(2, BigDecimal.ROUND_HALF_DOWN);
map.put("dayAbs", dayAbs.toString());
BigDecimal monthAbs = new BigDecimal(map.get("monthAbs").toString()).setScale(2, BigDecimal.ROUND_HALF_DOWN);
map.put("monthAbs", monthAbs.toString());
return map;
}
@Override
public Map<String, Object> todayAlarmUnEliminateMessage(String bizOrgCode) {
Map<String, Object> map = fireFightingSystemMapper.todayAlarmUnEliminateMessage(bizOrgCode);
BigDecimal dayAbs = new BigDecimal(map.get("dayAbs").toString()).setScale(2, BigDecimal.ROUND_HALF_DOWN);
map.put("dayAbs", dayAbs.toString());
BigDecimal monthAbs = new BigDecimal(map.get("monthAbs").toString()).setScale(2, BigDecimal.ROUND_HALF_DOWN);
map.put("monthAbs", monthAbs.toString());
return map;
}
@Override
public List<Map<String, Object>> monthAlarm(String bizOrgCode) {
return fireFightingSystemMapper.monthAlarm(bizOrgCode);
}
@Override
public List<Map<String, Object>> yearsAlarm(String bizOrgCode) {
return fireFightingSystemMapper.yearsAlarm(bizOrgCode);
}
@Override
public Page<Map<String, Object>> alarmList(Page page, String bizOrgCode) {
return fireFightingSystemMapper.alarmList(page, bizOrgCode);
}
@Override
public Page<Map<String, Object>> equipList(Page page, String bizOrgCode) {
return fireFightingSystemMapper.equipList(page, bizOrgCode);
}
}
......@@ -7,9 +7,14 @@ import com.yeejoin.equipmanage.mapper.VideoImportantEquipmentMapper;
import com.yeejoin.equipmanage.service.IVideoImportantEquipmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author ZeHua Li
......@@ -26,4 +31,22 @@ public class VideoImportantEquipmentServiceImpl extends ServiceImpl<VideoImporta
public List<VideoImportantEquipmentVo> getVideoImportantEquipmentList(Map<String, Object> map) {
return videoImportantEquipmentMapper.getVideoImportantEquipmentList(map);
}
@Override
public List<Map<String, List<VideoImportantEquipmentVo>>> getVideoList(Map<String, Object> map) {
ArrayList<Map<String, List<VideoImportantEquipmentVo>>> maps = new ArrayList<>();
List<VideoImportantEquipmentVo> videoList = videoImportantEquipmentMapper.getVideoList(map);
List<String> videoAddressGroupList = videoImportantEquipmentMapper.getVideoAddressGroupList(map);
for (String address : videoAddressGroupList) {
if (!ObjectUtils.isEmpty(address)) {
List<VideoImportantEquipmentVo> collect = videoList.stream().filter(item -> item.getAddress().equals(address)).collect(Collectors.toList());
if (collect.size() > 0) {
HashMap<String, List<VideoImportantEquipmentVo>> listMap = new HashMap<>();
listMap.put(address, collect);
maps.add(listMap);
}
}
}
return maps;
}
}
......@@ -1231,47 +1231,59 @@
</select>
<select id="fireFacilitiesList" resultType="java.util.Map">
SELECT temp.id,temp.name,IFNULL(temp1.notReturned,0) AS notReturned ,IFNULL(temp2.returned,0) AS returned ,
CASE
WHEN (temp1.notReturned > 0 ) THEN
"异常"
ELSE "正常"
END
AS `status`
FROM
(SELECT ffs.id,ffs.name FROM f_fire_fighting_system ffs
WHERE ffs.biz_org_code = #{bizOrgCode}) temp
LEFT JOIN
(SELECT esa.system_ids,COUNT(1) AS notReturned
FROM wl_equipment_specific_alarm esa
WHERE esa.type = "BREAKDOWN"
and esa.equipment_specific_index_value = "true"
and esa.create_date BETWEEN #{startTime} and #{endTime}
GROUP BY esa.system_ids)temp1
on
FIND_IN_SET(temp.id,temp1.system_ids)
SELECT temp.id,temp.name,IFNULL(temp1.notReturned,0) AS notReturned ,(IFNULL(temp2.total,0) - IFNULL(temp1.notReturned,0)) AS returned,
CASE
WHEN (temp1.notReturned > 0 ) THEN
"异常"
ELSE "正常"
END
AS `status`
FROM
(SELECT ffs.id,ffs.name FROM f_fire_fighting_system ffs
WHERE ffs.biz_org_code = #{bizOrgCode}
) temp
LEFT JOIN
(SELECT esa.system_ids,COUNT(1) AS returned
FROM wl_equipment_specific_alarm esa WHERE esa.type = "BREAKDOWN"
AND esa.equipment_specific_index_value = "false"
and esa.create_date BETWEEN #{startTime} and #{endTime}
(SELECT esa.system_ids,COUNT(DISTINCT(esa.iot_code)) AS notReturned
FROM wl_equipment_specific_alarm esa
WHERE esa.type = "BREAKDOWN"
and esa.equipment_specific_index_value = "true" and esa.create_date BETWEEN #{startTime} and #{endTime}
GROUP BY esa.system_ids)temp1
on
FIND_IN_SET(temp.id,temp1.system_ids)
LEFT JOIN
(SELECT esa.system_ids,COUNT(DISTINCT(esa.iot_code)) AS total
FROM wl_equipment_specific_alarm esa
WHERE esa.type = "BREAKDOWN" and esa.create_date BETWEEN #{startTime} and #{endTime}
GROUP BY esa.system_ids)temp2
on
FIND_IN_SET(temp.id,temp2.system_ids)
FIND_IN_SET(temp.id,temp2.system_ids)
</select>
<select id="dailyMaintenance" resultType="java.util.Map">
select
(SELECT count(1) AS total FROM wl_equipment_specific wes
WHERE wes.biz_org_code = #{bizOrgCode})AS total,
(
SELECT COUNT(1) FROM wl_equipment_specific_alarm esa WHERE esa.org_code = #{orgCode} and create_date between #{startTime} and #{endTime}
)AS alarmEquipNum,
(
SELECT COUNT(1) FROM wl_equipment_specific_alarm esa WHERE esa.org_code = #{orgCode} and create_date between #{startTime} and #{endTime} AND esa.equipment_specific_index_value = "true"
)as returned,
(
SELECT COUNT(1) FROM wl_equipment_specific_alarm esa WHERE esa.org_code = #{orgCode} and create_date between #{startTime} and #{endTime} AND esa.equipment_specific_index_value = "false"
)as motReturned
SELECT temp.total,temp.notReturned, temp.alarmEquipNum,(temp.alarmEquipNum - temp.notReturned) AS returned
FROM(
select
(SELECT
count(1 ) AS total
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
LEFT JOIN wl_equipment e ON e.id = ed.equipment_id
WHERE
e.is_iot = 1 and es.biz_org_code = #{bizOrgCode}
)AS total,
(
SELECT COUNT(DISTINCT(esa.iot_code)) FROM wl_equipment_specific_alarm esa
WHERE esa.org_code = #{orgCode}
and create_date between #{startTime} and #{endTime}
)AS alarmEquipNum,
(
SELECT COUNT(DISTINCT(esa.iot_code)) FROM wl_equipment_specific_alarm esa
WHERE esa.org_code = #{orgCode} AND esa.equipment_specific_index_value = "true"
and create_date between #{startTime} and #{endTime}
)as notReturned)temp
</select>
<select id="inspectionMessage" resultType="java.util.Map">
SELECT
......
......@@ -2654,4 +2654,615 @@
</select>
<select id="statisticsByStation" resultType="java.util.Map">
SELECT
(
SELECT COUNT(1) FROM wl_video v
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
v.biz_org_code = #{bizOrgCode}
</if>
</where>
) AS videoNum,
(
SELECT COUNT(1) FROM wl_equipment_specific ws
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
ws.biz_org_code = #{bizOrgCode}
</if>
</where>
)AS equipNum
</select>
<select id="todayAlarmEquipment" resultType="java.util.Map">
SELECT
`a`.`currentDateNum` AS `currentDateNum`,
(
abs(
(
( `a`.`currentDateNum` - `a`.`yesterdayNum` ) /
IF
( ( `a`.`yesterdayNum` = 0 ), 1, `a`.`yesterdayNum` )
)
) * 100
) AS `dayAbs`,
(
CASE
WHEN ( ( `a`.`currentDateNum` - `a`.`yesterdayNum` ) &lt; 0 ) THEN
'0'
WHEN ( ( `a`.`currentDateNum` - `a`.`yesterdayNum` ) > 0 ) THEN
'1'
ELSE
'2'
END
) AS `dayStatus`,
(
abs(
(
( `a`.`currentMonthNum` - `a`.`lastMonthNum` ) /
IF
( ( `a`.`lastMonthNum` = 0 ), 1, `a`.`lastMonthNum` )
)
) * 100
) AS `monthAbs`,
(
CASE
WHEN ( ( `a`.`currentMonthNum` - `a`.`lastMonthNum` ) &lt; 0 ) THEN
'0'
WHEN ( ( `a`.`currentMonthNum` - `a`.`lastMonthNum` ) > 0 ) THEN
'1'
ELSE
'2'
END
) AS `monthStatus`
FROM
(
SELECT
( SELECT count( DISTINCT `wl_equipment_specific_alarm_log`.`equipment_specific_id` ) FROM `wl_equipment_specific_alarm_log`
WHERE create_date LIKE concat( curdate( ), '%' )
<if test="bizOrgCode != null and bizOrgCode != ''">
and equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode})
</if>
) AS `currentDateNum`,
(
SELECT
count( DISTINCT `wl_equipment_specific_alarm_log`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log`
WHERE
create_date LIKE concat( cast( ( curdate( ) + INTERVAL - ( 1 ) DAY ) AS date ), '%' )
<if test="bizOrgCode != null and bizOrgCode != ''">
and equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode})
</if>
) AS `yesterdayNum`,
(
SELECT
count( DISTINCT `wl_equipment_specific_alarm_log`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log`
WHERE
create_date LIKE concat( date_format( curdate( ), '%Y-%m' ), '%' )
<if test="bizOrgCode != null and bizOrgCode != ''">
and equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode})
</if>
) AS `currentMonthNum`,
(
SELECT
count( DISTINCT `wl_equipment_specific_alarm_log`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log`
WHERE
`create_date` LIKE concat( date_format( cast( ( curdate( ) + INTERVAL - ( 1 ) MONTH ) AS date ), '%Y-%m' ), '%' )
<if test="bizOrgCode != null and bizOrgCode != ''">
and equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode})
</if>
) AS `lastMonthNum`
) `a`
</select>
<select id="todayAlarmMessage" resultType="java.util.Map">
SELECT
`a`.`currentDateNum` AS `currentDateNum`,
(
abs(
(
( `a`.`currentDateNum` - `a`.`yesterdayNum` ) /
IF
( ( `a`.`yesterdayNum` = 0 ), 1, `a`.`yesterdayNum` )
)
) * 100
) AS `dayAbs`,
(
CASE
WHEN ( ( `a`.`currentDateNum` - `a`.`yesterdayNum` ) &lt; 0 ) THEN
'0'
WHEN ( ( `a`.`currentDateNum` - `a`.`yesterdayNum` ) > 0 ) THEN
'1'
ELSE
'2'
END
) AS `dayStatus`,
(
abs(
(
( `a`.`currentMonthNum` - `a`.`lastMonthNum` ) /
IF
( ( `a`.`lastMonthNum` = 0 ), 1, `a`.`lastMonthNum` )
)
) * 100
) AS `monthAbs`,
(
CASE
WHEN ( ( `a`.`currentMonthNum` - `a`.`lastMonthNum` ) &lt; 0 ) THEN
'0'
WHEN ( ( `a`.`currentMonthNum` - `a`.`lastMonthNum` ) > 0 ) THEN
'1'
ELSE
'2'
END
) AS `monthStatus`
FROM
(
SELECT
( SELECT count( `wl_equipment_specific_alarm_log`.`equipment_specific_id` ) FROM `wl_equipment_specific_alarm_log` WHERE
create_date LIKE concat( curdate( ), '%' )
<if test="bizOrgCode != null and bizOrgCode != ''">
and equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode})
</if>
) AS `currentDateNum`,
(
SELECT
count( `wl_equipment_specific_alarm_log`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log`
WHERE
create_date LIKE concat( cast( ( curdate( ) + INTERVAL - ( 1 ) DAY ) AS date ), '%' )
<if test="bizOrgCode != null and bizOrgCode != ''">
and equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode})
</if>
) AS `yesterdayNum`,
(
SELECT
count( `wl_equipment_specific_alarm_log`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log`
WHERE
create_date LIKE concat( date_format( curdate( ), '%Y-%m' ), '%' )
<if test="bizOrgCode != null and bizOrgCode != ''">
and equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode})
</if>
) AS `currentMonthNum`,
(
SELECT
count( `wl_equipment_specific_alarm_log`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log`
WHERE
create_date LIKE concat( date_format( cast( ( curdate( ) + INTERVAL - ( 1 ) MONTH ) AS date ), '%Y-%m' ), '%' )
<if test="bizOrgCode != null and bizOrgCode != ''">
and equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode})
</if>
) AS `lastMonthNum`
) `a`
</select>
<select id="todayAlarmUnEliminateEquipment" resultType="java.util.Map">
SELECT
`a`.`currentDateNum` AS `currentDateNum`,
(
abs(
(
( `a`.`currentDateNum` - `a`.`yesterdayNum` ) /
IF
( ( `a`.`yesterdayNum` = 0 ), 1, `a`.`yesterdayNum` )
)
) * 100
) AS `dayAbs`,
(
CASE
WHEN ( ( `a`.`currentDateNum` - `a`.`yesterdayNum` ) &lt; 0 ) THEN
'0'
WHEN ( ( `a`.`currentDateNum` - `a`.`yesterdayNum` ) > 0 ) THEN
'1'
ELSE
'2'
END
) AS `dayStatus`,
(
abs(
(
( `a`.`currentMonthNum` - `a`.`lastMonthNum` ) /
IF
( ( `a`.`lastMonthNum` = 0 ), 1, `a`.`lastMonthNum` )
)
) * 100
) AS `monthAbs`,
(
CASE
WHEN ( ( `a`.`currentMonthNum` - `a`.`lastMonthNum` ) &lt; 0 ) THEN
'0'
WHEN ( ( `a`.`currentMonthNum` - `a`.`lastMonthNum` ) > 0 ) THEN
'1'
ELSE
'2'
END
) AS `monthStatus`
FROM
(
SELECT
(
SELECT
count( DISTINCT `wl_equipment_specific_alarm_log`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log`
WHERE
create_date LIKE concat( curdate( ), '%' ) AND status = 1
<if test="bizOrgCode != null and bizOrgCode != ''">
and equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode})
</if>
) AS `currentDateNum`,
(
SELECT
count( DISTINCT `wl_equipment_specific_alarm_log`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log`
WHERE
create_date LIKE concat( cast( ( curdate( ) + INTERVAL - ( 1 ) DAY ) AS date ), '%' )
AND status = 1
<if test="bizOrgCode != null and bizOrgCode != ''">
and equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode})
</if>
) AS `yesterdayNum`,
(
SELECT
count( DISTINCT `wl_equipment_specific_alarm_log`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log`
WHERE
create_date LIKE concat( date_format( curdate( ), '%Y-%m' ), '%' )
AND status = 1
<if test="bizOrgCode != null and bizOrgCode != ''">
and equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode})
</if>
) AS `currentMonthNum`,
(
SELECT
count( DISTINCT `wl_equipment_specific_alarm_log`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log`
WHERE
create_date LIKE concat( date_format( cast( ( curdate( ) + INTERVAL - ( 1 ) MONTH ) AS date ), '%Y-%m' ), '%' )
AND status = 1
<if test="bizOrgCode != null and bizOrgCode != ''">
and equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode})
</if>
) AS `lastMonthNum`
) `a`
</select>
<select id="todayAlarmUnEliminateMessage" resultType="java.util.Map">
SELECT
`a`.`currentDateNum` AS `currentDateNum`,
(
abs(
(
( `a`.`currentDateNum` - `a`.`yesterdayNum` ) /
IF
( ( `a`.`yesterdayNum` = 0 ), 1, `a`.`yesterdayNum` )
)
) * 100
) AS `dayAbs`,
(
CASE
WHEN ( ( `a`.`currentDateNum` - `a`.`yesterdayNum` ) &lt; 0 ) THEN
'0'
WHEN ( ( `a`.`currentDateNum` - `a`.`yesterdayNum` ) > 0 ) THEN
'1'
ELSE
'2'
END
) AS `dayStatus`,
(
abs(
(
( `a`.`currentMonthNum` - `a`.`lastMonthNum` ) /
IF
( ( `a`.`lastMonthNum` = 0 ), 1, `a`.`lastMonthNum` )
)
) * 100
) AS `monthAbs`,
(
CASE
WHEN ( ( `a`.`currentMonthNum` - `a`.`lastMonthNum` ) &lt; 0 ) THEN
'0'
WHEN ( ( `a`.`currentMonthNum` - `a`.`lastMonthNum` ) > 0 ) THEN
'1'
ELSE
'2'
END
) AS `monthStatus`
FROM
(
SELECT
(
SELECT
count( `wl_equipment_specific_alarm_log`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log`
WHERE
create_date LIKE concat( curdate( ), '%' ) AND confirm_date IS NULL
<if test="bizOrgCode != null and bizOrgCode != ''">
and equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode})
</if>
) AS `currentDateNum`,
(
SELECT
count( `wl_equipment_specific_alarm_log`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log`
WHERE
create_date LIKE concat( cast( ( curdate( ) + INTERVAL - ( 1 ) DAY ) AS date ), '%' )
AND confirm_date IS NULL
<if test="bizOrgCode != null and bizOrgCode != ''">
and equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode})
</if>
) AS `yesterdayNum`,
(
SELECT
count( `wl_equipment_specific_alarm_log`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log`
WHERE
create_date LIKE concat( date_format( curdate( ), '%Y-%m' ), '%' )
AND confirm_date IS NULL
<if test="bizOrgCode != null and bizOrgCode != ''">
and equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode})
</if>
) AS `currentMonthNum`,
(
SELECT
count( `wl_equipment_specific_alarm_log`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log`
WHERE
create_date LIKE concat( date_format( cast( ( curdate( ) + INTERVAL - ( 1 ) MONTH ) AS date ), '%Y-%m' ), '%' )
AND confirm_date IS NULL
<if test="bizOrgCode != null and bizOrgCode != ''">
and equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode})
</if>
) AS `lastMonthNum`
) `a`
</select>
<select id="monthAlarm" resultType="java.util.Map">
SELECT
`result`.`click_date` AS `click_date`,
`a`.`fireAlarmNum` AS `fireAlarmNum`,
`b`.`breakdownNum` AS `breakdownNum`,
`c`.`shieldNum` AS `shieldNum`,
`d`.`otherNum` AS `otherNum`
FROM
(
(
(
(
`v_monitor_event_utils_month` `result`
LEFT JOIN (
SELECT
`monthUtil`.`click_date` AS `click_date`,
ifnull( count( `fireAlarm`.`id` ), 0 ) AS `fireAlarmNum`
FROM
(
`v_monitor_event_utils_month` `monthUtil`
LEFT JOIN `wl_equipment_specific_alarm_log` `fireAlarm` ON date_format( `fireAlarm`.`create_date`, '%Y-%m-%d' )
= `monthUtil`.`click_date`
AND `fireAlarm`.`equipment_specific_index_name` = '火警'
<if test="bizOrgCode != null and bizOrgCode != ''">
and fireAlarm.equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code =
#{bizOrgCode} )
</if>
)
GROUP BY
`monthUtil`.`click_date`
ORDER BY
`monthUtil`.`click_date`
) `a` ON ( ( `a`.`click_date` = `result`.`click_date` ) )
)
LEFT JOIN (
SELECT
`monthUtil`.`click_date` AS `click_date`,
ifnull( count( `breakdown`.`id` ), 0 ) AS `breakdownNum`
FROM
(
`v_monitor_event_utils_month` `monthUtil`
LEFT JOIN `wl_equipment_specific_alarm_log` `breakdown` ON `monthUtil`.`click_date` = date_format(
`breakdown`.`create_date`, '%Y-%m-%d' ) AND `breakdown`.`equipment_specific_index_name` = '故障'
<if test="bizOrgCode != null and bizOrgCode != ''">
and breakdown.equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code =
#{bizOrgCode} )
</if>
)
GROUP BY
`monthUtil`.`click_date`
ORDER BY
`monthUtil`.`click_date`
) `b` ON ( ( `b`.`click_date` = `result`.`click_date` ) )
)
LEFT JOIN (
SELECT
`monthUtil`.`click_date` AS `click_date`,
ifnull( count( `shield`.`id` ), 0 ) AS `shieldNum`
FROM
(
`v_monitor_event_utils_month` `monthUtil`
LEFT JOIN `wl_equipment_specific_alarm_log` `shield` ON date_format( `shield`.`create_date`, '%Y-%m-%d' ) =
`monthUtil`.`click_date` AND `shield`.`equipment_specific_index_name` = '屏蔽'
<if test="bizOrgCode != null and bizOrgCode != ''">
and shield.equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode}
)
</if>
)
GROUP BY
`monthUtil`.`click_date`
ORDER BY
`monthUtil`.`click_date`
) `c` ON ( ( `c`.`click_date` = `result`.`click_date` ) )
)
LEFT JOIN (
SELECT
`monthUtil`.`click_date` AS `click_date`,
ifnull( count( `other`.`id` ), 0 ) AS `otherNum`
FROM
(
`v_monitor_event_utils_month` `monthUtil`
LEFT JOIN `wl_equipment_specific_alarm_log` `other` ON
date_format( `other`.`create_date`, '%Y-%m-%d' ) = `monthUtil`.`click_date`
AND `other`.`equipment_specific_index_name` NOT IN ( '火警', '故障', '屏蔽' )
<if test="bizOrgCode != null and bizOrgCode != ''">
and other.equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode} )
</if>
)
GROUP BY
`monthUtil`.`click_date`
ORDER BY
`monthUtil`.`click_date`
) `d` ON ( ( `d`.`click_date` = `result`.`click_date` ) )
)
ORDER BY
`result`.`click_date`
</select>
<select id="yearsAlarm" resultType="java.util.Map">
SELECT
`result`.`date` AS `date`,
`a`.`alarmEquipNum` AS `alarmEquipNum`,
`b`.`alarmInfoNum` AS `alarmInfoNum`
FROM
(
(
`one_years_month_util_view` `result`
LEFT JOIN (
SELECT
`monthUtil`.`date` AS `date`,
ifnull( count( DISTINCT `wes1`.`equipment_specific_id` ), 0 ) AS `alarmEquipNum`
FROM
( `one_years_month_util_view` `monthUtil` LEFT JOIN `wl_equipment_specific_alarm_log` `wes1` ON date_format( `wes1`.`create_date`, '%Y-%m' ) = `monthUtil`.`date`
<if test="bizOrgCode != null and bizOrgCode != ''">
and wes1.equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode} )
</if>
)
GROUP BY
`monthUtil`.`date`
ORDER BY
`monthUtil`.`date`
) `a` ON `a`.`date` = `result`.`date`
)
LEFT JOIN (
SELECT
`monthUtil`.`date` AS `date`,
ifnull( count( `wes1`.`id` ), 0 ) AS `alarmInfoNum`
FROM
( `one_years_month_util_view` `monthUtil` LEFT JOIN `wl_equipment_specific_alarm_log` `wes1` ON date_format( `wes1`.`create_date`, '%Y-%m' ) = `monthUtil`.`date`
<if test="bizOrgCode != null and bizOrgCode != ''">
and wes1.equipment_specific_id in(SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode} )
</if>
)
GROUP BY
`monthUtil`.`date`
ORDER BY
`monthUtil`.`date`
) `b` ON `b`.`date` = `result`.`date`
)
ORDER BY
`result`.`date`
</select>
<select id="alarmList" resultType="java.util.Map">
SELECT * FROM alarm_all_list_view
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
specificId in (SELECT id FROM wl_equipment_specific WHERE biz_org_code = #{bizOrgCode})
</if>
</where>
ORDER BY createDate DESC
</select>
<select id="equipList" resultType="java.util.Map">
SELECT wesp.name,
wesp.`code` AS num,
ifNull(ed.standard,"") AS type,
ifNull(mi.`name`,"") as manufacturer,
ifNull( wws.full_name,"") as address,
ifNull(eq.`name`,"") AS equType,
wesp.biz_org_name AS bizOrgName,
case wsd.status
when '1' then '在位'
when '2' then '执勤'
when '3' then '维修'
when '6' then '退役'
when '7' then '报废'
when '10' then '车载'
when '11' then '损耗'
when '12' then '配装'
else '未入库' END as status
,
ifNull( ed.delivery_date, "") AS putDate
FROM wl_equipment_specific wesp
LEFT JOIN wl_equipment_detail ed ON ed.id = wesp.equipment_detail_id
LEFT JOIN wl_equipment eq ON eq.id = ed.equipment_id
LEFT JOIN wl_manufacturer_info mi ON mi.id = ed.manufacturer_id
LEFT JOIN wl_stock_detail wsd ON wsd.equipment_specific_id = wesp.id
LEFT JOIN wl_warehouse_structure wws ON wsd.warehouse_structure_id = wws.id
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
wesp.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
</select>
</mapper>
......@@ -22,4 +22,36 @@
</if>
</where>
</select>
<select id="getVideoList" resultType="com.yeejoin.equipmanage.common.vo.VideoImportantEquipmentVo">
SELECT
v.id AS videoId,
v.`name`,
v.`code`,
v.type_code,
v.type,
v.url,
v.img,
v.address
FROM
wl_video v
<where>
<if test="importantEquipmentId != null">
v.id in (select video_id from wl_video_important_equipment
where important_equipment_id = #{importantEquipmentId})
</if>
</where>
</select>
<select id="getVideoAddressGroupList" resultType="java.lang.String">
SELECT
v.address
FROM
wl_video v
<where>
<if test="importantEquipmentId != null">
v.id in (select video_id from wl_video_important_equipment
where important_equipment_id = #{importantEquipmentId})
</if>
</where>
GROUP BY v.address
</select>
</mapper>
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