|
@@ -8,12 +8,14 @@ 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.BaseUserCompany;
|
|
|
import com.usky.fire.mapper.AlarmFireMapper;
|
|
|
import com.usky.fire.service.AlarmFireService;
|
|
|
+import com.usky.fire.service.BaseUserCompanyService;
|
|
|
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.time.LocalDateTime;
|
|
@@ -34,6 +36,9 @@ import java.util.Map;
|
|
|
@Service
|
|
|
public class AlarmFireServiceImpl extends AbstractCrudService<AlarmFireMapper, AlarmFire> implements AlarmFireService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private BaseUserCompanyService baseUserCompanyService;
|
|
|
+
|
|
|
@Override
|
|
|
public CommonPage<AlarmFireVo> alarmFireLowerList(String companyName, Integer handlingStatus, String startDate, String endDate,
|
|
|
Integer pageNum, Integer pageSize, String alarmType) {
|
|
@@ -45,44 +50,48 @@ public class AlarmFireServiceImpl extends AbstractCrudService<AlarmFireMapper, A
|
|
|
alarmTypeList.add(alarmTypeArray[i]);
|
|
|
}
|
|
|
}
|
|
|
- String userType = null;
|
|
|
- LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
- if (loginUser != null && !"".equals(loginUser)) {
|
|
|
- userType = loginUser.getUserType();
|
|
|
- }
|
|
|
- //缺少单位ID部分代码
|
|
|
- List<Integer> companyIdList = new ArrayList<>();
|
|
|
- CommonPage<AlarmFire> alarmFireList = this.alarmFireList(companyIdList, companyName, handlingStatus, startDate, endDate, pageNum, pageSize, alarmTypeList);
|
|
|
+ LambdaQueryWrapper<BaseUserCompany> QueryWrapper = Wrappers.lambdaQuery();
|
|
|
+ QueryWrapper.select(BaseUserCompany::getCompanyId)
|
|
|
+ .eq(BaseUserCompany::getUserId, SecurityUtils.getUserId());
|
|
|
+ List<BaseUserCompany> comoanyList = baseUserCompanyService.list(QueryWrapper);
|
|
|
List<AlarmFireVo> list = new ArrayList<>();
|
|
|
- for (int i = 0; i < alarmFireList.getRecords().size(); i++) {
|
|
|
- AlarmFireVo alarmFireVo = new AlarmFireVo();
|
|
|
- alarmFireVo.setId(alarmFireList.getRecords().get(i).getId());
|
|
|
- alarmFireVo.setDeviceCode(alarmFireList.getRecords().get(i).getDeviceCode());
|
|
|
- alarmFireVo.setCompanyName(alarmFireList.getRecords().get(i).getCompanyName());
|
|
|
- alarmFireVo.setCompanyId(alarmFireList.getRecords().get(i).getCompanyId());
|
|
|
- alarmFireVo.setAlarmTime(df.format(alarmFireList.getRecords().get(i).getAlarmTime()));
|
|
|
- alarmFireVo.setAlarmType(alarmFireList.getRecords().get(i).getAlarmType());
|
|
|
- alarmFireVo.setConten(alarmFireList.getRecords().get(i).getDeviceName() + "," + alarmFireList.getRecords().get(i).getAttributeValue4());
|
|
|
- alarmFireVo.setHandlingStatus(alarmFireList.getRecords().get(i).getHandlingStatus());
|
|
|
- alarmFireVo.setHandler(alarmFireList.getRecords().get(i).getHandler());
|
|
|
- if (alarmFireList.getRecords().get(i).getHandlingTime() != null) {
|
|
|
- alarmFireVo.setHandlingTime(df.format(alarmFireList.getRecords().get(i).getHandlingTime()));
|
|
|
- } else {
|
|
|
- alarmFireVo.setHandlingTime(null);
|
|
|
+ CommonPage<AlarmFire> alarmFireList = new CommonPage<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(comoanyList)) {
|
|
|
+ List<Integer> companyIdList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < comoanyList.size(); i++) {
|
|
|
+ companyIdList.add(comoanyList.get(i).getCompanyId());
|
|
|
}
|
|
|
- alarmFireVo.setFalseAlarm(alarmFireList.getRecords().get(i).getFalseAlarm());
|
|
|
- alarmFireVo.setHandlingContent(alarmFireList.getRecords().get(i).getHandlingContent());
|
|
|
- alarmFireVo.setSitePhoto(alarmFireList.getRecords().get(i).getSitePhoto());
|
|
|
- alarmFireVo.setPortNum(alarmFireList.getRecords().get(i).getPortNum());
|
|
|
- alarmFireVo.setHostNum(alarmFireList.getRecords().get(i).getHostNum());
|
|
|
- alarmFireVo.setLoopNum(alarmFireList.getRecords().get(i).getLoopNum());
|
|
|
- alarmFireVo.setPtNum(alarmFireList.getRecords().get(i).getPtNum());
|
|
|
+ alarmFireList = this.alarmFireList(companyIdList, companyName, handlingStatus, startDate, endDate, pageNum, pageSize, alarmTypeList);
|
|
|
+ for (int i = 0; i < alarmFireList.getRecords().size(); i++) {
|
|
|
+ AlarmFireVo alarmFireVo = new AlarmFireVo();
|
|
|
+ alarmFireVo.setId(alarmFireList.getRecords().get(i).getId());
|
|
|
+ alarmFireVo.setDeviceCode(alarmFireList.getRecords().get(i).getDeviceCode());
|
|
|
+ alarmFireVo.setCompanyName(alarmFireList.getRecords().get(i).getCompanyName());
|
|
|
+ alarmFireVo.setCompanyId(alarmFireList.getRecords().get(i).getCompanyId());
|
|
|
+ alarmFireVo.setAlarmTime(df.format(alarmFireList.getRecords().get(i).getAlarmTime()));
|
|
|
+ alarmFireVo.setAlarmType(alarmFireList.getRecords().get(i).getAlarmType());
|
|
|
+ alarmFireVo.setConten(alarmFireList.getRecords().get(i).getDeviceName() + "," + alarmFireList.getRecords().get(i).getAttributeValue4());
|
|
|
+ alarmFireVo.setHandlingStatus(alarmFireList.getRecords().get(i).getHandlingStatus());
|
|
|
+ alarmFireVo.setHandler(alarmFireList.getRecords().get(i).getHandler());
|
|
|
+ if (alarmFireList.getRecords().get(i).getHandlingTime() != null) {
|
|
|
+ alarmFireVo.setHandlingTime(df.format(alarmFireList.getRecords().get(i).getHandlingTime()));
|
|
|
+ } else {
|
|
|
+ alarmFireVo.setHandlingTime(null);
|
|
|
+ }
|
|
|
+ alarmFireVo.setFalseAlarm(alarmFireList.getRecords().get(i).getFalseAlarm());
|
|
|
+ alarmFireVo.setHandlingContent(alarmFireList.getRecords().get(i).getHandlingContent());
|
|
|
+ alarmFireVo.setSitePhoto(alarmFireList.getRecords().get(i).getSitePhoto());
|
|
|
+ alarmFireVo.setPortNum(alarmFireList.getRecords().get(i).getPortNum());
|
|
|
+ alarmFireVo.setHostNum(alarmFireList.getRecords().get(i).getHostNum());
|
|
|
+ alarmFireVo.setLoopNum(alarmFireList.getRecords().get(i).getLoopNum());
|
|
|
+ alarmFireVo.setPtNum(alarmFireList.getRecords().get(i).getPtNum());
|
|
|
// alarmFireVo.setSystemType(alarmFireList.getRecords().get(i).getSystemType());
|
|
|
// alarmFireVo.setAddress(alarmFireList.getRecords().get(i).getAddress());
|
|
|
// alarmFireVo.setAlarmStatus(alarmFireList.getRecords().get(i).getAlarmStatus());
|
|
|
// alarmFireVo.setPointType(alarmFireList.getRecords().get(i).getPointType());
|
|
|
// alarmFireVo.setHandlerPhone(alarmFireList.getRecords().get(i).getHandlerPhone());
|
|
|
- list.add(alarmFireVo);
|
|
|
+ list.add(alarmFireVo);
|
|
|
+ }
|
|
|
}
|
|
|
return new CommonPage<>(list, alarmFireList.getTotal(), pageSize, pageNum);
|
|
|
}
|
|
@@ -97,32 +106,29 @@ public class AlarmFireServiceImpl extends AbstractCrudService<AlarmFireMapper, A
|
|
|
alarmTypeList.add(alarmTypeArray[i]);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- String userType = null;
|
|
|
- LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
- if (loginUser != null && !"".equals(loginUser)) {
|
|
|
- userType = loginUser.getUserType();
|
|
|
+ LambdaQueryWrapper<BaseUserCompany> QueryWrapper = Wrappers.lambdaQuery();
|
|
|
+ QueryWrapper.select(BaseUserCompany::getCompanyId)
|
|
|
+ .eq(BaseUserCompany::getUserId, SecurityUtils.getUserId());
|
|
|
+ List<BaseUserCompany> comoanyList = baseUserCompanyService.list(QueryWrapper);
|
|
|
+ int untreated = 0;
|
|
|
+ int processed = 0;
|
|
|
+ Integer count = 0;
|
|
|
+ String disposalRate = "0.00%";
|
|
|
+ if (CollectionUtils.isNotEmpty(comoanyList)) {
|
|
|
+ List<Integer> companyIdList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < comoanyList.size(); i++) {
|
|
|
+ companyIdList.add(comoanyList.get(i).getCompanyId());
|
|
|
+ }
|
|
|
+ untreated = this.fireCount(companyIdList, 0, alarmTypeList);
|
|
|
+ processed = this.fireCount(companyIdList, 1, alarmTypeList);
|
|
|
+ count = untreated + processed;
|
|
|
+ disposalRate = OnlineMethod.myPercent(processed, count);
|
|
|
}
|
|
|
- //缺少维保单位部分代码
|
|
|
- List<Integer> companyIdList = new ArrayList<>();
|
|
|
-
|
|
|
- int untreated = this.fireCount(companyIdList, 0, alarmTypeList);
|
|
|
- int processed = this.fireCount(companyIdList, 1, alarmTypeList);
|
|
|
-// String disposalRate = processed / (untreated + processed) + "%";
|
|
|
- Integer count = untreated + processed;
|
|
|
- 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("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;
|
|
|
}
|
|
|
|
|
@@ -136,32 +142,35 @@ public class AlarmFireServiceImpl extends AbstractCrudService<AlarmFireMapper, A
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- String userType = null;
|
|
|
- LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
- if (loginUser != null && !"".equals(loginUser)) {
|
|
|
- userType = loginUser.getUserType();
|
|
|
- }
|
|
|
- //缺少维保单位部分代码
|
|
|
- List<Integer> companyIdList = new ArrayList<>();
|
|
|
- List<String> alarmTypeListOne = new ArrayList<>();
|
|
|
- Integer selectStatus = 0;
|
|
|
- if (alarmTypeList.contains("100")) {
|
|
|
- selectStatus = 1;
|
|
|
- alarmTypeListOne.add("2");
|
|
|
- alarmTypeListOne.add("4");
|
|
|
- } else {
|
|
|
- alarmTypeListOne = alarmTypeList;
|
|
|
- }
|
|
|
- List<AlarmFireStatisticalVo> list = baseMapper.selectAlarmFireStatistical(companyIdList, alarmTypeListOne, startDate, endDate, selectStatus);
|
|
|
+ LambdaQueryWrapper<BaseUserCompany> QueryWrapper = Wrappers.lambdaQuery();
|
|
|
+ QueryWrapper.select(BaseUserCompany::getCompanyId)
|
|
|
+ .eq(BaseUserCompany::getUserId, SecurityUtils.getUserId());
|
|
|
+ List<BaseUserCompany> comoanyList = baseUserCompanyService.list(QueryWrapper);
|
|
|
List<Integer> alarmCountList = new ArrayList<>();
|
|
|
List<Integer> handleCountList = new ArrayList<>();
|
|
|
List<String> alarmTimeList = new ArrayList<>();
|
|
|
List<String> handleRateList = new ArrayList<>();
|
|
|
- for (int i = 0; i < list.size(); i++) {
|
|
|
- alarmCountList.add(list.get(i).getCount());
|
|
|
- handleCountList.add(list.get(i).getSum());
|
|
|
- alarmTimeList.add(list.get(i).getAlarmTime());
|
|
|
- handleRateList.add(OnlineMethod.myPercent(list.get(i).getSum(), list.get(i).getCount()));
|
|
|
+ if (CollectionUtils.isNotEmpty(comoanyList)) {
|
|
|
+ List<Integer> companyIdList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < comoanyList.size(); i++) {
|
|
|
+ companyIdList.add(comoanyList.get(i).getCompanyId());
|
|
|
+ }
|
|
|
+ List<String> alarmTypeListOne = new ArrayList<>();
|
|
|
+ Integer selectStatus = 0;
|
|
|
+ if (alarmTypeList.contains("100")) {
|
|
|
+ selectStatus = 1;
|
|
|
+ alarmTypeListOne.add("2");
|
|
|
+ alarmTypeListOne.add("4");
|
|
|
+ } else {
|
|
|
+ alarmTypeListOne = alarmTypeList;
|
|
|
+ }
|
|
|
+ List<AlarmFireStatisticalVo> list = baseMapper.selectAlarmFireStatistical(companyIdList, alarmTypeListOne, startDate, endDate, selectStatus);
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ alarmCountList.add(list.get(i).getCount());
|
|
|
+ handleCountList.add(list.get(i).getSum());
|
|
|
+ alarmTimeList.add(list.get(i).getAlarmTime());
|
|
|
+ handleRateList.add(OnlineMethod.myPercent(list.get(i).getSum(), list.get(i).getCount()));
|
|
|
+ }
|
|
|
}
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("alarmCountList", alarmCountList);
|
|
@@ -214,44 +223,37 @@ public class AlarmFireServiceImpl extends AbstractCrudService<AlarmFireMapper, A
|
|
|
alarmTypeList.add(alarmTypeArray[i]);
|
|
|
}
|
|
|
}
|
|
|
- String userType = null;
|
|
|
- LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
- if (loginUser != null && !"".equals(loginUser)) {
|
|
|
- userType = loginUser.getUserType();
|
|
|
- }
|
|
|
- //缺少单位ID部分代码
|
|
|
- List<Integer> companyIdList = new ArrayList<>();
|
|
|
- CommonPage<AlarmFire> alarmFireList = this.alarmFireList(companyIdList, companyName, handlingStatus, startDate, endDate, 0, 0, alarmTypeList);
|
|
|
+ LambdaQueryWrapper<BaseUserCompany> QueryWrapper = Wrappers.lambdaQuery();
|
|
|
+ QueryWrapper.select(BaseUserCompany::getCompanyId)
|
|
|
+ .eq(BaseUserCompany::getUserId, SecurityUtils.getUserId());
|
|
|
+ List<BaseUserCompany> comoanyList = baseUserCompanyService.list(QueryWrapper);
|
|
|
List<AlarmFireVo> list = new ArrayList<>();
|
|
|
- for (int i = 0; i < alarmFireList.getRecords().size(); i++) {
|
|
|
- AlarmFireVo alarmFireVo = new AlarmFireVo();
|
|
|
- alarmFireVo.setId(alarmFireList.getRecords().get(i).getId());
|
|
|
- alarmFireVo.setDeviceCode(alarmFireList.getRecords().get(i).getDeviceCode());
|
|
|
- alarmFireVo.setCompanyName(alarmFireList.getRecords().get(i).getCompanyName());
|
|
|
- alarmFireVo.setCompanyId(alarmFireList.getRecords().get(i).getCompanyId());
|
|
|
- alarmFireVo.setAlarmTime(df.format(alarmFireList.getRecords().get(i).getAlarmTime()));
|
|
|
- alarmFireVo.setAlarmType(alarmFireList.getRecords().get(i).getAlarmType());
|
|
|
- alarmFireVo.setConten(alarmFireList.getRecords().get(i).getDeviceName() + "," + alarmFireList.getRecords().get(i).getAttributeValue4());
|
|
|
- alarmFireVo.setHandlingStatus(alarmFireList.getRecords().get(i).getHandlingStatus());
|
|
|
- alarmFireVo.setHandler(alarmFireList.getRecords().get(i).getHandler());
|
|
|
- if (alarmFireList.getRecords().get(i).getHandlingTime() != null) {
|
|
|
- alarmFireVo.setHandlingTime(df.format(alarmFireList.getRecords().get(i).getHandlingTime()));
|
|
|
- } else {
|
|
|
- alarmFireVo.setHandlingTime(null);
|
|
|
+ if (CollectionUtils.isNotEmpty(comoanyList)) {
|
|
|
+ List<Integer> companyIdList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < comoanyList.size(); i++) {
|
|
|
+ companyIdList.add(comoanyList.get(i).getCompanyId());
|
|
|
+ }
|
|
|
+ CommonPage<AlarmFire> alarmFireList = this.alarmFireList(companyIdList, companyName, handlingStatus, startDate, endDate, 0, 0, alarmTypeList);
|
|
|
+ for (int i = 0; i < alarmFireList.getRecords().size(); i++) {
|
|
|
+ AlarmFireVo alarmFireVo = new AlarmFireVo();
|
|
|
+ alarmFireVo.setId(alarmFireList.getRecords().get(i).getId());
|
|
|
+ alarmFireVo.setDeviceCode(alarmFireList.getRecords().get(i).getDeviceCode());
|
|
|
+ alarmFireVo.setCompanyName(alarmFireList.getRecords().get(i).getCompanyName());
|
|
|
+ alarmFireVo.setCompanyId(alarmFireList.getRecords().get(i).getCompanyId());
|
|
|
+ alarmFireVo.setAlarmTime(df.format(alarmFireList.getRecords().get(i).getAlarmTime()));
|
|
|
+ alarmFireVo.setAlarmType(alarmFireList.getRecords().get(i).getAlarmType());
|
|
|
+ alarmFireVo.setConten(alarmFireList.getRecords().get(i).getDeviceName() + "," + alarmFireList.getRecords().get(i).getAttributeValue4());
|
|
|
+ alarmFireVo.setHandlingStatus(alarmFireList.getRecords().get(i).getHandlingStatus());
|
|
|
+ alarmFireVo.setHandler(alarmFireList.getRecords().get(i).getHandler());
|
|
|
+ if (alarmFireList.getRecords().get(i).getHandlingTime() != null) {
|
|
|
+ alarmFireVo.setHandlingTime(df.format(alarmFireList.getRecords().get(i).getHandlingTime()));
|
|
|
+ } else {
|
|
|
+ alarmFireVo.setHandlingTime(null);
|
|
|
+ }
|
|
|
+ alarmFireVo.setFalseAlarm(alarmFireList.getRecords().get(i).getFalseAlarm());
|
|
|
+ alarmFireVo.setHandlingContent(alarmFireList.getRecords().get(i).getHandlingContent());
|
|
|
+ list.add(alarmFireVo);
|
|
|
}
|
|
|
- alarmFireVo.setFalseAlarm(alarmFireList.getRecords().get(i).getFalseAlarm());
|
|
|
- alarmFireVo.setHandlingContent(alarmFireList.getRecords().get(i).getHandlingContent());
|
|
|
-// alarmFireVo.setSystemType(alarmFireList.getRecords().get(i).getSystemType());
|
|
|
-// alarmFireVo.setAddress(alarmFireList.getRecords().get(i).getAddress());
|
|
|
-// alarmFireVo.setAlarmStatus(alarmFireList.getRecords().get(i).getAlarmStatus());
|
|
|
-// alarmFireVo.setPointType(alarmFireList.getRecords().get(i).getPointType());
|
|
|
-// alarmFireVo.setPortNum(alarmFireList.getRecords().get(i).getPortNum());
|
|
|
-// alarmFireVo.setHostNum(alarmFireList.getRecords().get(i).getHostNum());
|
|
|
-// alarmFireVo.setLoopNum(alarmFireList.getRecords().get(i).getLoopNum());
|
|
|
-// alarmFireVo.setPtNum(alarmFireList.getRecords().get(i).getPtNum());
|
|
|
-// alarmFireVo.setHandlerPhone(alarmFireList.getRecords().get(i).getHandlerPhone());
|
|
|
-// alarmFireVo.setSitePhoto(alarmFireList.getRecords().get(i).getSitePhoto());
|
|
|
- list.add(alarmFireVo);
|
|
|
}
|
|
|
return list;
|
|
|
}
|