|
|
@@ -8,8 +8,10 @@ import com.tuoheng.admin.common.ServiceExceptionEnum; |
|
|
|
import com.tuoheng.admin.entity.domain.Warning; |
|
|
|
import com.tuoheng.admin.entity.query.WarningQuery; |
|
|
|
import com.tuoheng.admin.entity.vo.WarningVO; |
|
|
|
import com.tuoheng.admin.enums.DiscoveryWayEnum; |
|
|
|
import com.tuoheng.admin.enums.MarkTypeEnum; |
|
|
|
import com.tuoheng.admin.enums.WarningEnum; |
|
|
|
import com.tuoheng.admin.enums.WarningStatusEnum; |
|
|
|
import com.tuoheng.admin.mapper.WarningMapper; |
|
|
|
import com.tuoheng.common.exception.ServiceException; |
|
|
|
import com.tuoheng.common.utils.DateUtils; |
|
|
@@ -48,11 +50,11 @@ public class QueryWarningPageListService { |
|
|
|
if (query.getLimit() == null && query.getPage() == null) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
User user = ShiroUtils.getUserInfo(); |
|
|
|
if (ObjectUtils.isEmpty(user)) { |
|
|
|
return JsonResult.error(WarningEnum.USER_IS_NOT_EXIST.getCode(), WarningEnum.USER_IS_NOT_EXIST.getMsg()); |
|
|
|
} |
|
|
|
Integer tenantId = user.getTenantId(); |
|
|
|
// User user = ShiroUtils.getUserInfo(); |
|
|
|
// Integer tenantId = user.getTenantId(); |
|
|
|
Integer tenantId = 1; |
|
|
|
|
|
|
|
|
|
|
|
if (null == tenantId) { |
|
|
|
return JsonResult.error(WarningEnum.TENANT_ID_IS_NULL.getCode(), WarningEnum.TENANT_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
@@ -62,9 +64,9 @@ public class QueryWarningPageListService { |
|
|
|
//时间 |
|
|
|
Date startTime = null; |
|
|
|
Date endTime = null; |
|
|
|
if (StringUtils.isNotEmpty(query.getWaringTime())) { |
|
|
|
startTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, query.getWaringTime() + " 00:00:00"); |
|
|
|
endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, query.getWaringTime() + " 23:59:59"); |
|
|
|
if (StringUtils.isNotEmpty(query.getStartTime()) && StringUtils.isNotEmpty(query.getEndTime())) { |
|
|
|
startTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SSS,query.getStartTime()+" 00:00:00"); |
|
|
|
endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SSS,query.getEndTime()+" 23:59:59"); |
|
|
|
} |
|
|
|
query.setWaringStartTime(startTime); |
|
|
|
query.setWaringEndTime(endTime); |
|
|
@@ -73,7 +75,9 @@ public class QueryWarningPageListService { |
|
|
|
IPage<Warning> warningPageData = warningMapper.selectPage(page, Wrappers.<Warning>lambdaQuery() |
|
|
|
.eq(null != query.getDiscoveryWay(), Warning::getDiscoveryWay, query.getDiscoveryWay()) |
|
|
|
.eq(null != query.getStatus(), Warning::getStatus, query.getStatus()) |
|
|
|
.between(null != query.getWaringStartTime() && null != query.getWaringEndTime(), Warning::getCheckTime, query.getWaringStartTime(), query.getWaringEndTime()) |
|
|
|
.eq(Warning::getTenantId,tenantId) |
|
|
|
.eq(Warning::getMark,MarkTypeEnum.VALID.getCode()) |
|
|
|
.between(null != query.getWaringStartTime() && null != query.getWaringEndTime(), Warning::getCreateTime, query.getWaringStartTime(), query.getWaringEndTime()) |
|
|
|
.eq(Warning::getMark, MarkTypeEnum.VALID.getCode())); |
|
|
|
if (null == warningPageData) { |
|
|
|
return null; |
|
|
@@ -82,9 +86,28 @@ public class QueryWarningPageListService { |
|
|
|
List<WarningVO> collect = warningPageData.getRecords().stream().map(x -> { |
|
|
|
WarningVO vo = new WarningVO(); |
|
|
|
BeanUtils.copyProperties(x, vo); |
|
|
|
//时间 |
|
|
|
vo.setWaringTime(x.getCreateTime()); |
|
|
|
//预警来源 |
|
|
|
//if(x.getDiscoveryWay() == DiscoveryWayEnum.SURVEILLANCE_CAMERA.getCode()) |
|
|
|
|
|
|
|
if(x.getDiscoveryWay() == DiscoveryWayEnum.SURVEILLANCE_CAMERA.getCode()){ |
|
|
|
vo.setDiscoverWayName(DiscoveryWayEnum.SURVEILLANCE_CAMERA.getDescription()); |
|
|
|
} |
|
|
|
if(x.getDiscoveryWay() == DiscoveryWayEnum.UAV_PATROL.getCode()){ |
|
|
|
vo.setDiscoverWayName(DiscoveryWayEnum.UAV_PATROL.getDescription()); |
|
|
|
} |
|
|
|
if(x.getDiscoveryWay() == DiscoveryWayEnum.MANUAL_INSPECTION.getCode()){ |
|
|
|
vo.setDiscoverWayName(DiscoveryWayEnum.MANUAL_INSPECTION.getDescription()); |
|
|
|
} |
|
|
|
//状态 |
|
|
|
if(x.getStatus() == WarningStatusEnum.WAIT_CONFIRM.getCode()){ |
|
|
|
vo.setStatusName(WarningStatusEnum.WAIT_CONFIRM.getDescription()); |
|
|
|
} |
|
|
|
if(x.getStatus() == WarningStatusEnum.CONFIRM.getCode()){ |
|
|
|
vo.setStatusName(WarningStatusEnum.CONFIRM.getDescription()); |
|
|
|
} |
|
|
|
if(x.getStatus() == WarningStatusEnum.IGNORE.getCode()){ |
|
|
|
vo.setStatusName(WarningStatusEnum.IGNORE.getDescription()); |
|
|
|
} |
|
|
|
return vo; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
pageData.setRecords(collect); |