|
@@ -1,6 +1,5 @@
|
|
|
package com.usky.fire.service.impl;
|
|
|
|
|
|
-import com.alibaba.nacos.shaded.io.grpc.netty.shaded.io.netty.channel.DefaultFileRegion;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
@@ -10,9 +9,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.usky.common.core.bean.CommonPage;
|
|
|
import com.usky.common.core.util.Arith;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
-import com.usky.fire.domain.*;
|
|
|
+import com.usky.fire.domain.BaseCompany;
|
|
|
+import com.usky.fire.domain.BaseDevice;
|
|
|
+import com.usky.fire.domain.BaseDeviceStatus;
|
|
|
+import com.usky.fire.domain.DemCase;
|
|
|
import com.usky.fire.mapper.DemCaseMapper;
|
|
|
-import com.usky.fire.service.*;
|
|
|
+import com.usky.fire.service.BaseCompanyService;
|
|
|
+import com.usky.fire.service.BaseDeviceService;
|
|
|
+import com.usky.fire.service.BaseDeviceStatusService;
|
|
|
+import com.usky.fire.service.DemCaseService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -48,7 +53,7 @@ public class DemCaseServiceImpl extends AbstractCrudService<DemCaseMapper, DemCa
|
|
|
queryWrapper.eq(StringUtils.isNotBlank(deviceType), DemCase::getDeviceType, deviceType)
|
|
|
.eq(StringUtils.isNotBlank(streetTown), DemCase::getStreet, streetTown)
|
|
|
.eq(StringUtils.isNotBlank(companyName), DemCase::getDutyGroup, companyName)
|
|
|
- .eq(id!=0&&id!=null,DemCase::getId,id)
|
|
|
+ .eq(id != 0 && id != null, DemCase::getId, id)
|
|
|
.orderByDesc(DemCase::getId);
|
|
|
page = this.page(page, queryWrapper);
|
|
|
return new CommonPage<>(page.getRecords(), page.getTotal(), pageSize, pageNum);
|
|
@@ -61,7 +66,10 @@ public class DemCaseServiceImpl extends AbstractCrudService<DemCaseMapper, DemCa
|
|
|
int caseCount = 0;
|
|
|
// int handleCaseCount = 0;
|
|
|
int closureCaseCount = 0;
|
|
|
- List<String> deviceCodeList = this.deviceList(streetTown, companyId, 2);
|
|
|
+ List<Integer> deviceTypeList = new ArrayList<>();
|
|
|
+ deviceTypeList.add(2);
|
|
|
+ deviceTypeList.add(5);
|
|
|
+ List<String> deviceCodeList = this.deviceList(streetTown, companyId, deviceTypeList);
|
|
|
if (CollectionUtils.isNotEmpty(deviceCodeList)) {
|
|
|
onLineDeviceCount = this.deviceStatusCount(deviceCodeList, 1);
|
|
|
}
|
|
@@ -73,7 +81,7 @@ public class DemCaseServiceImpl extends AbstractCrudService<DemCaseMapper, DemCa
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("deviceCount", deviceCount);
|
|
|
if (onLineDeviceCount != 0 && deviceCount != 0) {
|
|
|
- map.put("onLineDeviceRatio", Arith.div(onLineDeviceCount, deviceCount,2)*100 + "%");
|
|
|
+ map.put("onLineDeviceRatio", Arith.div(onLineDeviceCount, deviceCount, 2) * 100 + "%");
|
|
|
} else {
|
|
|
map.put("onLineDeviceRatio", "0%");
|
|
|
}
|
|
@@ -146,7 +154,7 @@ public class DemCaseServiceImpl extends AbstractCrudService<DemCaseMapper, DemCa
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public List<String> deviceList(String streetTown, String companyId, Integer deviceType) {
|
|
|
+ public List<String> deviceList(String streetTown, String companyId, List<Integer> deviceTypeList) {
|
|
|
List<String> companyIdList = new ArrayList<>();
|
|
|
if (StringUtils.isNotBlank(streetTown)) {
|
|
|
List<BaseCompany> companyList = this.companyList(streetTown, null);
|
|
@@ -162,7 +170,7 @@ public class DemCaseServiceImpl extends AbstractCrudService<DemCaseMapper, DemCa
|
|
|
LambdaQueryWrapper<BaseDevice> queryWrapper = Wrappers.lambdaQuery();
|
|
|
queryWrapper.select(BaseDevice::getDeviceType, BaseDevice::getDeviceCode)
|
|
|
.eq(BaseDevice::getEnable, 1)
|
|
|
- .eq(deviceType != null && deviceType != 0, BaseDevice::getDeviceType, deviceType)
|
|
|
+ .in(CollectionUtils.isNotEmpty(deviceTypeList), BaseDevice::getDeviceType, deviceTypeList)
|
|
|
.in(CollectionUtils.isNotEmpty(companyIdList), BaseDevice::getCompanyId, companyIdList);
|
|
|
List<BaseDevice> deviceList = baseDeviceService.list(queryWrapper);
|
|
|
List<String> deviceCodeList = new ArrayList<>();
|