|
@@ -6,15 +6,12 @@ import com.usky.common.core.bean.CommonPage;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
import com.usky.common.security.utils.SecurityUtils;
|
|
|
import com.usky.fire.domain.AlarmFire;
|
|
|
-import com.usky.fire.domain.PlanSite;
|
|
|
import com.usky.fire.mapper.AlarmFireMapper;
|
|
|
-import com.usky.fire.mapper.PlanSiteMapper;
|
|
|
import com.usky.fire.service.AlarmFireService;
|
|
|
import com.usky.fire.service.util.OnlineMethod;
|
|
|
import com.usky.fire.service.vo.AlarmFireStatisticalVo;
|
|
|
import com.usky.fire.service.vo.AlarmFireVo;
|
|
|
import com.usky.system.model.LoginUser;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
@@ -35,7 +32,15 @@ public class AlarmFireServiceImpl extends AbstractCrudService<AlarmFireMapper, A
|
|
|
|
|
|
@Override
|
|
|
public CommonPage<AlarmFireVo> alarmFireLowerList(Integer handlingStatus, String startDate, String endDate,
|
|
|
- Integer pageNum, Integer pageSize, Integer alarmType) {
|
|
|
+ Integer pageNum, Integer pageSize, String alarmType) {
|
|
|
+
|
|
|
+ List<Integer> alarmTypeList = new ArrayList<>();
|
|
|
+ if (alarmType != null && !"".equals(alarmType)) {
|
|
|
+ String[] alarmTypeArray = alarmType.split(",");
|
|
|
+ for (int i = 0; i < alarmTypeArray.length; i++) {
|
|
|
+ alarmTypeList.add(Integer.parseInt(alarmTypeArray[i]));
|
|
|
+ }
|
|
|
+ }
|
|
|
String userType = null;
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
if (loginUser != null && !"".equals(loginUser)) {
|
|
@@ -43,7 +48,7 @@ public class AlarmFireServiceImpl extends AbstractCrudService<AlarmFireMapper, A
|
|
|
}
|
|
|
//缺少维保单位部分代码
|
|
|
List<String> devcieCodeList = new ArrayList<>();
|
|
|
- CommonPage<AlarmFire> alarmFireList = this.alarmFireList(devcieCodeList, handlingStatus, startDate, endDate, pageNum, pageSize,alarmType);
|
|
|
+ CommonPage<AlarmFire> alarmFireList = this.alarmFireList(devcieCodeList, handlingStatus, startDate, endDate, pageNum, pageSize, alarmTypeList);
|
|
|
List<AlarmFireVo> list = new ArrayList<>();
|
|
|
for (int i = 0; i < alarmFireList.getRecords().size(); i++) {
|
|
|
AlarmFireVo alarmFireVo = new AlarmFireVo();
|
|
@@ -76,7 +81,16 @@ public class AlarmFireServiceImpl extends AbstractCrudService<AlarmFireMapper, A
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, Object> fireStatistics(Integer alarmType) {
|
|
|
+ public Map<String, Object> fireStatistics(String alarmType) {
|
|
|
+
|
|
|
+ List<Integer> alarmTypeList = new ArrayList<>();
|
|
|
+ if (alarmType != null && !"".equals(alarmType)) {
|
|
|
+ String[] alarmTypeArray = alarmType.split(",");
|
|
|
+ for (int i = 0; i < alarmTypeArray.length; i++) {
|
|
|
+ alarmTypeList.add(Integer.parseInt(alarmTypeArray[i]));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
String userType = null;
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
if (loginUser != null && !"".equals(loginUser)) {
|
|
@@ -85,30 +99,36 @@ public class AlarmFireServiceImpl extends AbstractCrudService<AlarmFireMapper, A
|
|
|
//缺少维保单位部分代码
|
|
|
List<String> devcieCodeList = new ArrayList<>();
|
|
|
|
|
|
- int untreated = this.fireCount(devcieCodeList, 0,alarmType);
|
|
|
- int processed = this.fireCount(devcieCodeList, 1,alarmType);
|
|
|
+ int untreated = this.fireCount(devcieCodeList, 0, alarmTypeList);
|
|
|
+ int processed = this.fireCount(devcieCodeList, 1, alarmTypeList);
|
|
|
// String disposalRate = processed / (untreated + processed) + "%";
|
|
|
Integer count = untreated + processed;
|
|
|
- String disposalRate = OnlineMethod.myPercent(processed,count);
|
|
|
+ String disposalRate = OnlineMethod.myPercent(processed, count);
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("untreated", untreated);//告警未处理数
|
|
|
map.put("processed", processed);//告警未处理数
|
|
|
map.put("disposalRate", disposalRate);//告警处理率
|
|
|
- map.put("deviceCount", 0);//设备总数
|
|
|
- map.put("deviceOfflineCount", 0);//设备离线数
|
|
|
- map.put("deviceAlarmCount", 0);//设备告警数
|
|
|
- map.put("deviceNormalCount", 0);//设备正常数
|
|
|
- map.put("deviceOfflineRate", 0);//设备离线率
|
|
|
- map.put("deviceAlarmRate", 0);//设备告警率
|
|
|
- map.put("deviceOfflineRate", 0);//设备正常率
|
|
|
+ map.put("alarmCount", count);//告警总数
|
|
|
+// map.put("deviceCount", 0);//设备总数
|
|
|
+// map.put("deviceOfflineCount", 0);//设备离线数
|
|
|
+// map.put("deviceAlarmCount", 0);//设备告警数
|
|
|
+// map.put("deviceNormalCount", 0);//设备正常数
|
|
|
+// map.put("deviceOfflineRate", 0);//设备离线率
|
|
|
+// map.put("deviceAlarmRate", 0);//设备告警率
|
|
|
+// map.put("deviceOfflineRate", 0);//设备正常率
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
@Override
|
|
|
- public Map<String, Object> fireStatisticalChart(Integer alarmType, String startDate, String endDate){
|
|
|
+ public Map<String, Object> fireStatisticalChart(String alarmType, String startDate, String endDate) {
|
|
|
+ List<Integer> alarmTypeList = new ArrayList<>();
|
|
|
+ if (alarmType != null && !"".equals(alarmType)) {
|
|
|
+ String[] alarmTypeArray = alarmType.split(",");
|
|
|
+ for (int i = 0; i < alarmTypeArray.length; i++) {
|
|
|
+ alarmTypeList.add(Integer.parseInt(alarmTypeArray[i]));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
String userType = null;
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
if (loginUser != null && !"".equals(loginUser)) {
|
|
@@ -116,7 +136,7 @@ public class AlarmFireServiceImpl extends AbstractCrudService<AlarmFireMapper, A
|
|
|
}
|
|
|
//缺少维保单位部分代码
|
|
|
List<String> devcieCodeList = new ArrayList<>();
|
|
|
- List<AlarmFireStatisticalVo> list = baseMapper.selectAlarmFireStatistical(alarmType,startDate,endDate);
|
|
|
+ List<AlarmFireStatisticalVo> list = baseMapper.selectAlarmFireStatistical(devcieCodeList, alarmTypeList, startDate, endDate);
|
|
|
List<Integer> alarmCountList = new ArrayList<>();
|
|
|
List<Integer> handleCountList = new ArrayList<>();
|
|
|
List<String> alarmTimeList = new ArrayList<>();
|
|
@@ -126,24 +146,23 @@ public class AlarmFireServiceImpl extends AbstractCrudService<AlarmFireMapper, A
|
|
|
alarmTimeList.add(list.get(i).getAlarmTime());
|
|
|
}
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("alarmCountList",alarmCountList);
|
|
|
+ map.put("alarmCountList", alarmCountList);
|
|
|
map.put("handleCountList", handleCountList);
|
|
|
map.put("alarmTimeList", alarmTimeList);
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 火警告警处置/故障告警处置-数量统计
|
|
|
*
|
|
|
* @param deviceCodeList 单位编号
|
|
|
* @param handlingStatus 处理状态(0、未处理 1、已处理)
|
|
|
- * @param alarmType 告警类型(2 火警、4 故障、16 监管等)
|
|
|
+ * @param alarmTypeList 告警类型(2 火警、4 故障、16 监管等)
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public Integer fireCount(List<String> deviceCodeList, Integer handlingStatus,Integer alarmType) {
|
|
|
+ public Integer fireCount(List<String> deviceCodeList, Integer handlingStatus, List<Integer> alarmTypeList) {
|
|
|
LambdaQueryWrapper<AlarmFire> queryWrapper = Wrappers.lambdaQuery();
|
|
|
if (deviceCodeList.size() > 0) {
|
|
|
queryWrapper.in(AlarmFire::getDeviceCode, deviceCodeList);
|
|
@@ -151,8 +170,8 @@ public class AlarmFireServiceImpl extends AbstractCrudService<AlarmFireMapper, A
|
|
|
if (handlingStatus != null) {
|
|
|
queryWrapper.eq(AlarmFire::getHandlingStatus, handlingStatus);
|
|
|
}
|
|
|
- if (alarmType != null && alarmType != 0) {
|
|
|
- queryWrapper.eq(AlarmFire::getAlarmType, alarmType);
|
|
|
+ if (alarmTypeList.size() > 0) {
|
|
|
+ queryWrapper.in(AlarmFire::getAlarmType, alarmTypeList);
|
|
|
}
|
|
|
int total = this.count(queryWrapper);
|
|
|
return total;
|
|
@@ -167,12 +186,12 @@ public class AlarmFireServiceImpl extends AbstractCrudService<AlarmFireMapper, A
|
|
|
* @param endDate 结束时间 格式:yyyy-MM-dd HH:mm:ss
|
|
|
* @param pageNum 当前页
|
|
|
* @param pageSize 每页条数
|
|
|
- * @param alarmType 告警类型(2 火警、4 故障、16 监管等)
|
|
|
+ * @param alarmTypeList 告警类型(2 火警、4 故障、16 监管等)
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
public CommonPage<AlarmFire> alarmFireList(List<String> deviceCodeList, Integer handlingStatus, String startDate,
|
|
|
- String endDate, Integer pageNum, Integer pageSize,Integer alarmType) {
|
|
|
+ String endDate, Integer pageNum, Integer pageSize, List<Integer> alarmTypeList) {
|
|
|
LambdaQueryWrapper<AlarmFire> queryWrapper = Wrappers.lambdaQuery();
|
|
|
if (deviceCodeList.size() > 0) {
|
|
|
queryWrapper.in(AlarmFire::getDeviceCode, deviceCodeList);
|
|
@@ -181,8 +200,8 @@ public class AlarmFireServiceImpl extends AbstractCrudService<AlarmFireMapper, A
|
|
|
queryWrapper.eq(AlarmFire::getHandlingStatus, handlingStatus);
|
|
|
}
|
|
|
|
|
|
- if (alarmType != null && alarmType != 0) {
|
|
|
- queryWrapper.eq(AlarmFire::getAlarmType, alarmType);
|
|
|
+ if (alarmTypeList.size() > 0) {
|
|
|
+ queryWrapper.in(AlarmFire::getAlarmType, alarmTypeList);
|
|
|
}
|
|
|
|
|
|
if (startDate != null && !"".equals(startDate) && endDate != null && !"".equals(endDate)) {
|