Commit ceb4483b authored by KeYong's avatar KeYong

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

parents 67ca4b65 affedbf4
...@@ -883,11 +883,17 @@ public class DateUtils { ...@@ -883,11 +883,17 @@ public class DateUtils {
endDay = i; endDay = i;
} }
if(startDay != 0 && endDay != 0){ if(startDay != 0 && endDay != 0){
String s = year + "第" + getWeekOfYear(date2) + "周" + "(" + date.substring(5) + "月" + startDay + String s = "";
"日至" + date.substring(5) + "月" + endDay + "日" +")";
String weekStart = year + "-"+ date.substring(5) +"-" +startDay +" 00:00:00"; String weekStart = year + "-"+ date.substring(5) +"-" +startDay +" 00:00:00";
String weekEnd = year + "-"+ date.substring(5) +"-" +endDay +" 23:59:59"; String weekEnd = year + "-"+ date.substring(5) +"-" +endDay +" 23:59:59";
if("12".equals(date.substring(5)) && weekOfYear(date2) == 1 ){
long week = Long.valueOf(dates.get(dates.size()-1).get("name").substring(5,7)) + 1;
s = year + "第" + week + "周" + "(" + date.substring(5) + "月" + startDay +
"日至" + date.substring(5) + "月" + endDay + "日" +")";
} else {
s = year + "第" + getWeekOfYear(date2) + "周" + "(" + date.substring(5) + "月" + startDay +
"日至" + date.substring(5) + "月" + endDay + "日" +")";
}
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
map.put("name",s); map.put("name",s);
map.put("weekStart",weekStart); map.put("weekStart",weekStart);
...@@ -912,6 +918,14 @@ public class DateUtils { ...@@ -912,6 +918,14 @@ public class DateUtils {
return week_of_year; return week_of_year;
} }
public static int weekOfYear(Date date) {
Calendar c = Calendar.getInstance();
c.setTime(date);
c.setFirstDayOfWeek(Calendar.MONDAY);
int week_of_year = c.get(Calendar.WEEK_OF_YEAR);
return week_of_year;
}
/** /**
* 获得本月的开始时间,即2012-01-01 00:00:00 * 获得本月的开始时间,即2012-01-01 00:00:00
* *
......
...@@ -11,6 +11,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -11,6 +11,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -23,6 +24,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -23,6 +24,8 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*; import java.util.*;
import static org.typroject.tyboot.core.foundation.utils.DateTimeUtil.ISO8601_DATE_HOUR_MIN_SEC; import static org.typroject.tyboot.core.foundation.utils.DateTimeUtil.ISO8601_DATE_HOUR_MIN_SEC;
...@@ -153,29 +156,133 @@ public class EmergencyController extends AbstractBaseController { ...@@ -153,29 +156,133 @@ public class EmergencyController extends AbstractBaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("火灾自动报警系统告警分析") @ApiOperation("火灾自动报警系统告警分析-折线图")
@GetMapping(value = "/selectAlarmAnalysis") @GetMapping(value = "/selectAlarmAnalysis")
public List<Map<String, Object>> selectPressureFlow(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode, public List<Map<String, Object>> selectPressureFlow(@RequestParam(value = "startDate") String startDate,
@RequestParam(value = "startDate") String startDate, @RequestParam(value = "endDate") String endDate,
@RequestParam(value = "endDate") String endDate) { @RequestParam(value = "type") String type,
if (ObjectUtils.isEmpty(bizOrgCode)){ @RequestParam(value = "systemType") String systemType)throws Exception {
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode(); ArrayList<Map<String, Object>> result = new ArrayList<>();
List<Map<String, Object>> maps = iEmergencyService.selectAlarmAnalysis(startDate, endDate, "0", "", systemType);
if ("week".equals(type)) {
String beginMonth = startDate.substring(5,7);
String endMonth = endDate.substring(5,7);
List<Map<String, String>> weeksMapInterval = DateUtils.getWeeksMapInterval(DateUtils.dateToStringMonth(startDate));
for (Map<String, String> week : weeksMapInterval) {
Date weekStart = null;
Date weekEnd = null;
try {
weekStart = DateUtils.dateParse(week.get("weekStart"), DateUtils.DATE_PATTERN);
weekEnd = DateUtils.dateParse(week.get("weekEnd"), DateUtils.DATE_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
long startTime = weekStart.getTime();
long endTime = weekEnd.getTime();
HashMap<String, Object> mapData = new HashMap<>();
for (Map<String, Object> map : maps) {
Date check = null;
try {
check = DateUtils.dateParse(String.valueOf(map.get("date")), DateUtils.DATE_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
if (!ObjectUtils.isEmpty(check) && check.getTime() >= startTime && check.getTime() <= endTime) {
if (!ObjectUtils.isEmpty(mapData)) {
BigDecimal old = new BigDecimal(String.valueOf(mapData.get("faultNum")));
BigDecimal add = new BigDecimal(String.valueOf(map.get("faultNum")));
BigDecimal now = old.add(add);
mapData.put("faultNum", String.valueOf(now));
BigDecimal firePumpsOld = new BigDecimal(String.valueOf(mapData.get("alarmNum")));
BigDecimal firePumpsAdd = new BigDecimal(String.valueOf(map.get("alarmNum")));
BigDecimal firePumpsNow = firePumpsOld.add(firePumpsAdd);
mapData.put("alarmNum", String.valueOf(firePumpsNow));
BigDecimal stabilizedOld = new BigDecimal(String.valueOf(mapData.get("shieldNum")));
BigDecimal stabilizedAdd = new BigDecimal(String.valueOf(map.get("shieldNum")));
BigDecimal stabilizedNow = stabilizedOld.add(stabilizedAdd);
mapData.put("shieldNum", String.valueOf(stabilizedNow));
} else {
mapData.put("name", week.get("name"));
mapData.put("faultNum", map.get("faultNum"));
mapData.put("alarmNum", map.get("alarmNum"));
mapData.put("shieldNum", map.get("shieldNum"));
}
}
}
result.add(mapData);
}
if(!StringUtils.isEmpty(beginMonth) && !beginMonth.equals(endMonth)){
weeksMapInterval = DateUtils.getWeeksMapInterval(DateUtils.dateToStringMonth(endDate));
for (Map<String, String> weeks : weeksMapInterval) {
Date weekStart1 = null;
Date weekEnd1 = null;
try {
weekStart1 = DateUtils.dateParse(weeks.get("weekStart"), DateUtils.DATE_PATTERN);
weekEnd1 = DateUtils.dateParse(weeks.get("weekEnd"), DateUtils.DATE_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
long startTime1 = weekStart1.getTime();
long endTime1 = weekEnd1.getTime();
HashMap<String, Object> mapData1 = new HashMap<>();
for (Map<String, Object> map : maps) {
Date check = null;
try {
check = DateUtils.dateParse(String.valueOf(map.get("date")), DateUtils.DATE_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
if (!ObjectUtils.isEmpty(check) && check.getTime() >= startTime1 && check.getTime() <= endTime1) {
if (!ObjectUtils.isEmpty(mapData1)) {
BigDecimal old = new BigDecimal(String.valueOf(mapData1.get("faultNum")));
BigDecimal add = new BigDecimal(String.valueOf(map.get("faultNum")));
BigDecimal now = old.add(add);
mapData1.put("faultNum", String.valueOf(now));
BigDecimal firePumpsOld = new BigDecimal(String.valueOf(mapData1.get("alarmNum")));
BigDecimal firePumpsAdd = new BigDecimal(String.valueOf(map.get("alarmNum")));
BigDecimal firePumpsNow = firePumpsOld.add(firePumpsAdd);
mapData1.put("alarmNum", String.valueOf(firePumpsNow));
BigDecimal stabilizedOld = new BigDecimal(String.valueOf(mapData1.get("shieldNum")));
BigDecimal stabilizedAdd = new BigDecimal(String.valueOf(map.get("shieldNum")));
BigDecimal stabilizedNow = stabilizedOld.add(stabilizedAdd);
mapData1.put("shieldNum", String.valueOf(stabilizedNow));
} else {
mapData1.put("name", weeks.get("name"));
mapData1.put("faultNum", map.get("faultNum"));
mapData1.put("alarmNum", map.get("alarmNum"));
mapData1.put("shieldNum", map.get("shieldNum"));
}
}
}
result.add(mapData1);
}
}
} else if ("day".equals(type)) {
return maps;
} else if ("month".equals(type)) {
String date = startDate.substring(0, 4) + "-01" + "-01";
return iEmergencyService.selectAlarmAnalysis(startDate, endDate, "1", date, systemType);
} }
return iEmergencyService.selectAlarmAnalysis(bizOrgCode, startDate, endDate);
return result;
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("火灾自动报警系统告警分析-饼图") @ApiOperation("火灾自动报警系统告警分析-饼图")
@GetMapping(value = "/selectAlarmAnalysisCount") @GetMapping(value = "/selectAlarmAnalysisCount")
public List<Map<String, Object>> selectAlarmAnalysisCount(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode, public List<Map<String, Object>> selectAlarmAnalysisCount(@RequestParam(value = "startDate") String startDate,
@RequestParam(value = "startDate") String startDate, @RequestParam(value = "endDate") String endDate,
@RequestParam(value = "endDate") String endDate) { @RequestParam(value = "systemType") String systemType) {
if (ObjectUtils.isEmpty(bizOrgCode)) { return iEmergencyService.selectAlarmAnalysisCount(systemType, startDate, endDate);
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
return iEmergencyService.selectAlarmAnalysisCount(bizOrgCode, startDate, endDate);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
...@@ -208,6 +315,8 @@ public class EmergencyController extends AbstractBaseController { ...@@ -208,6 +315,8 @@ public class EmergencyController extends AbstractBaseController {
ArrayList<Map<String, Object>> result = new ArrayList<>(); ArrayList<Map<String, Object>> result = new ArrayList<>();
List<Map<String, Object>> maps = iEmergencyService.waterSystemAlarmAnalysis(startDate, endDate, "0", "", systemType); List<Map<String, Object>> maps = iEmergencyService.waterSystemAlarmAnalysis(startDate, endDate, "0", "", systemType);
if ("week".equals(type)) { if ("week".equals(type)) {
String beginMonth = startDate.substring(5,7);
String endMonth = endDate.substring(5,7);
List<Map<String, String>> weeksMapInterval = DateUtils.getWeeksMapInterval(DateUtils.dateToStringMonth(startDate)); List<Map<String, String>> weeksMapInterval = DateUtils.getWeeksMapInterval(DateUtils.dateToStringMonth(startDate));
for (Map<String, String> week : weeksMapInterval) { for (Map<String, String> week : weeksMapInterval) {
Date weekStart = null; Date weekStart = null;
...@@ -256,6 +365,55 @@ public class EmergencyController extends AbstractBaseController { ...@@ -256,6 +365,55 @@ public class EmergencyController extends AbstractBaseController {
} }
result.add(mapData); result.add(mapData);
} }
if(!StringUtils.isEmpty(beginMonth) && !beginMonth.equals(endMonth)){
weeksMapInterval = DateUtils.getWeeksMapInterval(DateUtils.dateToStringMonth(endDate));
for (Map<String, String> weeks : weeksMapInterval) {
Date weekStart1 = null;
Date weekEnd1 = null;
try {
weekStart1 = DateUtils.dateParse(weeks.get("weekStart"), DateUtils.DATE_PATTERN);
weekEnd1 = DateUtils.dateParse(weeks.get("weekEnd"), DateUtils.DATE_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
long startTime1 = weekStart1.getTime();
long endTime1 = weekEnd1.getTime();
HashMap<String, Object> mapData1 = new HashMap<>();
for (Map<String, Object> map : maps) {
Date check = null;
try {
check = DateUtils.dateParse(String.valueOf(map.get("date")), DateUtils.DATE_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
if (!ObjectUtils.isEmpty(check) && check.getTime() >= startTime1 && check.getTime() <= endTime1) {
if (!ObjectUtils.isEmpty(mapData1)) {
BigDecimal old = new BigDecimal(String.valueOf(mapData1.get("controlCabinetAlarmNum")));
BigDecimal add = new BigDecimal(String.valueOf(map.get("controlCabinetAlarmNum")));
BigDecimal now = old.add(add);
mapData1.put("controlCabinetAlarmNum", String.valueOf(now));
BigDecimal firePumpsOld = new BigDecimal(String.valueOf(mapData1.get("firePumpsAlarmNum")));
BigDecimal firePumpsAdd = new BigDecimal(String.valueOf(map.get("firePumpsAlarmNum")));
BigDecimal firePumpsNow = firePumpsOld.add(firePumpsAdd);
mapData1.put("firePumpsAlarmNum", String.valueOf(firePumpsNow));
BigDecimal stabilizedOld = new BigDecimal(String.valueOf(mapData1.get("stabilizedPumpAlarmNum")));
BigDecimal stabilizedAdd = new BigDecimal(String.valueOf(map.get("stabilizedPumpAlarmNum")));
BigDecimal stabilizedNow = stabilizedOld.add(stabilizedAdd);
mapData1.put("stabilizedPumpAlarmNum", String.valueOf(stabilizedNow));
} else {
mapData1.put("name", weeks.get("name"));
mapData1.put("controlCabinetAlarmNum", map.get("controlCabinetAlarmNum"));
mapData1.put("firePumpsAlarmNum", map.get("firePumpsAlarmNum"));
mapData1.put("stabilizedPumpAlarmNum", map.get("stabilizedPumpAlarmNum"));
}
}
}
result.add(mapData1);
}
}
} else if ("day".equals(type)) { } else if ("day".equals(type)) {
return maps; return maps;
...@@ -279,6 +437,8 @@ public class EmergencyController extends AbstractBaseController { ...@@ -279,6 +437,8 @@ public class EmergencyController extends AbstractBaseController {
ArrayList<Map<String, Object>> result = new ArrayList<>(); ArrayList<Map<String, Object>> result = new ArrayList<>();
List<Map<String, Object>> maps = iEmergencyService.fireCannonSystemAlarmAnalysis(startDate, endDate, "0", "", systemType); List<Map<String, Object>> maps = iEmergencyService.fireCannonSystemAlarmAnalysis(startDate, endDate, "0", "", systemType);
if ("week".equals(type)) { if ("week".equals(type)) {
String beginMonth = startDate.substring(5,7);
String endMonth = endDate.substring(5,7);
List<Map<String, String>> weeksMapInterval = DateUtils.getWeeksMapInterval(DateUtils.dateToStringMonth(startDate)); List<Map<String, String>> weeksMapInterval = DateUtils.getWeeksMapInterval(DateUtils.dateToStringMonth(startDate));
for (Map<String, String> week : weeksMapInterval) { for (Map<String, String> week : weeksMapInterval) {
Date weekStart = null; Date weekStart = null;
...@@ -333,6 +493,62 @@ public class EmergencyController extends AbstractBaseController { ...@@ -333,6 +493,62 @@ public class EmergencyController extends AbstractBaseController {
} }
result.add(mapData); result.add(mapData);
} }
if(!StringUtils.isEmpty(beginMonth) && !beginMonth.equals(endMonth)){
weeksMapInterval = DateUtils.getWeeksMapInterval(DateUtils.dateToStringMonth(endDate));
for (Map<String, String> weeks : weeksMapInterval) {
Date weekStart1 = null;
Date weekEnd1 = null;
try {
weekStart1 = DateUtils.dateParse(weeks.get("weekStart"), DateUtils.DATE_PATTERN);
weekEnd1 = DateUtils.dateParse(weeks.get("weekEnd"), DateUtils.DATE_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
long startTime1 = weekStart1.getTime();
long endTime1 = weekEnd1.getTime();
HashMap<String, Object> mapData1 = new HashMap<>();
for (Map<String, Object> map : maps) {
Date check = null;
try {
check = DateUtils.dateParse(String.valueOf(map.get("date")), DateUtils.DATE_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
if (!ObjectUtils.isEmpty(check) && check.getTime() >= startTime1 && check.getTime() <= endTime1) {
if (!ObjectUtils.isEmpty(mapData1)) {
BigDecimal old = new BigDecimal(String.valueOf(mapData1.get("powerLossNum")));
BigDecimal add = new BigDecimal(String.valueOf(map.get("powerLossNum")));
BigDecimal now = old.add(add);
mapData1.put("powerLossNum", String.valueOf(now));
BigDecimal firePumpsOld = new BigDecimal(String.valueOf(mapData1.get("faultNum")));
BigDecimal firePumpsAdd = new BigDecimal(String.valueOf(map.get("faultNum")));
BigDecimal firePumpsNow = firePumpsOld.add(firePumpsAdd);
mapData1.put("faultNum", String.valueOf(firePumpsNow));
BigDecimal stabilizedOld = new BigDecimal(String.valueOf(mapData1.get("fireAlarmNum")));
BigDecimal stabilizedAdd = new BigDecimal(String.valueOf(map.get("fireAlarmNum")));
BigDecimal stabilizedNow = stabilizedOld.add(stabilizedAdd);
mapData1.put("fireAlarmNum", String.valueOf(stabilizedNow));
BigDecimal shieldOld = new BigDecimal(String.valueOf(mapData1.get("shieldNum")));
BigDecimal shieldAdd = new BigDecimal(String.valueOf(map.get("shieldNum")));
BigDecimal shieldNow = shieldOld.add(shieldAdd);
mapData1.put("shieldNum", String.valueOf(shieldNow));
} else {
mapData1.put("name", weeks.get("name"));
mapData1.put("powerLossNum", map.get("powerLossNum"));
mapData1.put("faultNum", map.get("faultNum"));
mapData1.put("fireAlarmNum", map.get("fireAlarmNum"));
mapData1.put("shieldNum", map.get("shieldNum"));
}
}
}
result.add(mapData1);
}
}
} else if ("day".equals(type)) { } else if ("day".equals(type)) {
return maps; return maps;
......
...@@ -61,9 +61,9 @@ public interface EmergencyMapper extends BaseMapper{ ...@@ -61,9 +61,9 @@ public interface EmergencyMapper extends BaseMapper{
List<Map<String, Object>> getCAFSWaterTankInfo(@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> getCAFSWaterTankInfo(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> selectAlarmAnalysis(@Param("bizOrgCode") String bizOrgCode, @Param("startDate")String startDate, @Param("endDate")String endDate); List<Map<String, Object>> selectAlarmAnalysis(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("dataType")String dataType, @Param("date")String date, @Param("list") List<String> codes);
List<Map<String, Object>> selectAlarmAnalysisCount(@Param("bizOrgCode") String bizOrgCode, @Param("startDate")String startDate, @Param("endDate")String endDate); List<Map<String, Object>> selectAlarmAnalysisCount( @Param("startDate")String startDate, @Param("endDate")String endDate,@Param("list") List<String> codes);
Map<String, Object> getSystemAndCarCount(); Map<String, Object> getSystemAndCarCount();
......
...@@ -34,9 +34,9 @@ public interface IEmergencyService { ...@@ -34,9 +34,9 @@ public interface IEmergencyService {
Page<Map<String, Object>> selectPressureFlow(Page<Map<String, Object>> page, String bizOrgCode); Page<Map<String, Object>> selectPressureFlow(Page<Map<String, Object>> page, String bizOrgCode);
List<Map<String, Object>> selectAlarmAnalysis(String bizOrgCode, String startDate, String endDate); List<Map<String, Object>> selectAlarmAnalysis(String startDate, String endDate, String dataType, String date, String systemType);
List<Map<String, Object>> selectAlarmAnalysisCount(String bizOrgCode, String startDate, String endDate); List<Map<String, Object>> selectAlarmAnalysisCount(String systemType, String startDate, String endDate);
Map<String, Object> systemAndCar(); Map<String, Object> systemAndCar();
......
package com.yeejoin.equipmanage.service.impl; package com.yeejoin.equipmanage.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.utils.DateUtils;
import com.yeejoin.equipmanage.mapper.EmergencyMapper; import com.yeejoin.equipmanage.mapper.EmergencyMapper;
import com.yeejoin.equipmanage.service.IEmergencyService; import com.yeejoin.equipmanage.service.IEmergencyService;
import org.apache.commons.compress.utils.Lists; import org.apache.commons.compress.utils.Lists;
...@@ -8,8 +9,13 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -8,8 +9,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import static com.yeejoin.equipmanage.common.utils.DateUtils.getFirstDayOfMonth;
/** /**
* *
* 四横八纵应急模块接口服务类 * 四横八纵应急模块接口服务类
...@@ -90,13 +96,23 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -90,13 +96,23 @@ public class EmergencyServiceImpl implements IEmergencyService {
} }
@Override @Override
public List<Map<String, Object>> selectAlarmAnalysis(String bizOrgCode, String startDate, String endDate) { public List<Map<String, Object>> selectAlarmAnalysis(String startDate, String endDate, String dataType, String date, String systemType) {
return emergencyMapper.selectAlarmAnalysis(bizOrgCode, startDate, endDate); List<String> strings = emergencyMapper.selectSystemCodes(systemType);
if (!CollectionUtils.isEmpty(strings)) {
return emergencyMapper.selectAlarmAnalysis(startDate, endDate, dataType, date, strings);
}
return null;
} }
@Override @Override
public List<Map<String, Object>> selectAlarmAnalysisCount(String bizOrgCode, String startDate, String endDate) { public List<Map<String, Object>> selectAlarmAnalysisCount(String systemType, String startDate, String endDate) {
return emergencyMapper.selectAlarmAnalysisCount(bizOrgCode, startDate, endDate); List<String> strings = emergencyMapper.selectSystemCodes(systemType);
if (!CollectionUtils.isEmpty(strings)) {
return emergencyMapper.selectAlarmAnalysisCount( startDate, endDate,strings);
}
return null;
} }
@Override @Override
......
...@@ -412,7 +412,9 @@ ...@@ -412,7 +412,9 @@
wespa.equipment_specific_index_key LIKE concat('%', 'Fault') wespa.equipment_specific_index_key LIKE concat('%', 'Fault')
AND wespa.create_date LIKE concat(temp.date, '%') AND wespa.create_date LIKE concat(temp.date, '%')
AND wespa.equipment_specific_index_value = 'true' AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code like concat(#{bizOrgCode}, '%') <foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
) AS faultNum, ) AS faultNum,
( (
SELECT SELECT
...@@ -427,7 +429,9 @@ ...@@ -427,7 +429,9 @@
wespa.equipment_specific_index_key LIKE concat('%', 'FireAlarm') wespa.equipment_specific_index_key LIKE concat('%', 'FireAlarm')
AND wespa.create_date LIKE concat(temp.date, '%') AND wespa.create_date LIKE concat(temp.date, '%')
AND wespa.equipment_specific_index_value = 'true' AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code like concat(#{bizOrgCode}, '%') <foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
) AS alarmNum, ) AS alarmNum,
( (
SELECT SELECT
...@@ -442,22 +446,95 @@ ...@@ -442,22 +446,95 @@
wespa.equipment_specific_index_key LIKE concat('%', 'Shield') wespa.equipment_specific_index_key LIKE concat('%', 'Shield')
AND wespa.create_date LIKE concat(temp.date, '%') AND wespa.create_date LIKE concat(temp.date, '%')
AND wespa.equipment_specific_index_value = 'true' AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code like concat(#{bizOrgCode}, '%') <foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
) AS shieldNum ) AS shieldNum
FROM FROM
<if test="dataType == 1">
(
SELECT
date_format(
(#{date} - INTERVAL 0 MONTH),
'%Y-%m'
) AS `date`
UNION
(SELECT
date_format(
(#{date} - INTERVAL -1 MONTH),
'%Y-%m'
) AS `date`)
UNION
(SELECT
date_format(
(#{date} - INTERVAL -2 MONTH),
'%Y-%m'
) AS `date`)
UNION
(SELECT
date_format(
(#{date} - INTERVAL -3 MONTH),
'%Y-%m'
) AS `date`)
UNION
(SELECT
date_format(
(#{date} - INTERVAL -4 MONTH),
'%Y-%m'
) AS `date`)
UNION
(SELECT
date_format(
(#{date} - INTERVAL -5 MONTH),
'%Y-%m'
) AS `date`)UNION
(SELECT
date_format(
(#{date} - INTERVAL -6 MONTH),
'%Y-%m'
) AS `date`)UNION
(SELECT
date_format(
(#{date} - INTERVAL -7 MONTH),
'%Y-%m'
) AS `date`)UNION
(SELECT
date_format(
(#{date} - INTERVAL -8 MONTH),
'%Y-%m'
) AS `date`)UNION
(SELECT
date_format(
(#{date} - INTERVAL -9 MONTH),
'%Y-%m'
) AS `date`)UNION
(SELECT
date_format(
(#{date} - INTERVAL -10 MONTH),
'%Y-%m'
) AS `date`)UNION
(SELECT
date_format(
(#{date} - INTERVAL -11 MONTH),
'%Y-%m'
) AS `date`))temp
</if>
<if test="dataType != 1">
( (
SELECT temp.selected_date as date FROM SELECT temp.selected_date as date FROM
(SELECT ADDDATE('1970-01-01',t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) selected_date FROM (SELECT ADDDATE('1970-01-01',t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) selected_date FROM
(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t0, (SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t0,
(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t1, (SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t1,
(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t2, (SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t2,
(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t3, (SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t3,
(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t4) (SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t4)
temp temp
WHERE selected_date BETWEEN #{startDate} AND #{endDate} WHERE selected_date BETWEEN #{startDate} AND #{endDate}
) temp ) temp
ORDER BY ORDER BY
temp.date temp.date
</if>
</select> </select>
<select id="selectAlarmAnalysisCount" resultType="java.util.Map"> <select id="selectAlarmAnalysisCount" resultType="java.util.Map">
SELECT SELECT
...@@ -473,9 +550,11 @@ ...@@ -473,9 +550,11 @@
WHERE WHERE
wespa.equipment_specific_index_key LIKE concat('%', 'Fault') wespa.equipment_specific_index_key LIKE concat('%', 'Fault')
AND wespa.equipment_specific_index_value = 'true' AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND wespa.create_date BETWEEN #{startDate} AND wespa.create_date BETWEEN #{startDate}
AND #{endDate} AND #{endDate}
<foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
) AS faultNum, ) AS faultNum,
( (
SELECT SELECT
...@@ -489,9 +568,11 @@ ...@@ -489,9 +568,11 @@
WHERE WHERE
wespa.equipment_specific_index_key LIKE concat('%', 'FireAlarm') wespa.equipment_specific_index_key LIKE concat('%', 'FireAlarm')
AND wespa.equipment_specific_index_value = 'true' AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND wespa.create_date BETWEEN #{startDate} AND wespa.create_date BETWEEN #{startDate}
AND #{endDate} AND #{endDate}
<foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
) AS fireAlarmNum, ) AS fireAlarmNum,
( (
SELECT SELECT
...@@ -505,9 +586,11 @@ ...@@ -505,9 +586,11 @@
WHERE WHERE
wespa.equipment_specific_index_key LIKE concat('%', 'Shield') wespa.equipment_specific_index_key LIKE concat('%', 'Shield')
AND wespa.equipment_specific_index_value = 'true' AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code LIKE concat(#{bizOrgCode}, '%')
AND wespa.create_date BETWEEN #{startDate} AND wespa.create_date BETWEEN #{startDate}
AND #{endDate} AND #{endDate}
<foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
) AS shieldNum ) AS shieldNum
</select> </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