Quellcode durchsuchen

预警列表查询接口分页

tags/v1.2.0^2
chengwang vor 1 Jahr
Ursprung
Commit
8793bc84e6
4 geänderte Dateien mit 62 neuen und 33 gelöschten Zeilen
  1. +7
    -6
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/query/WarningQuery.java
  2. +34
    -11
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/query/QueryWarningPageListService.java
  3. +19
    -16
      tuoheng-admin/src/main/resources/application-local.yml
  4. +2
    -0
      tuoheng-common/src/main/java/com/tuoheng/common/utils/DateUtils.java

+ 7
- 6
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/query/WarningQuery.java Datei anzeigen

@@ -31,22 +31,23 @@ public class WarningQuery extends BaseQuery {
private Integer status;

/**
* 创建时间-->预警时间
* 起始日期
*/
private String startTime;

/**
* 结束日期
*/
private String waringTime;
private String endTime;

/**
* 起始日期
*/
@DateTimeFormat(pattern = "yyyy.MM.dd hh:mm:ss")
@JsonFormat(pattern = "yyyy.MM.dd hh:mm:ss", timezone = "GMT+8")
private Date waringStartTime;

/**
* 结束日期
*/
@DateTimeFormat(pattern = "yyyy.MM.dd hh:mm:ss")
@JsonFormat(pattern = "yyyy.MM.dd hh:mm:ss", timezone = "GMT+8")
private Date waringEndTime;



+ 34
- 11
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/query/QueryWarningPageListService.java Datei anzeigen

@@ -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);

+ 19
- 16
tuoheng-admin/src/main/resources/application-local.yml Datei anzeigen

@@ -38,9 +38,12 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
# 填写你数据库的url、登录名、密码和数据库名
url: jdbc:mysql://localhost:3306/tuoheng_lc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false
url: jdbc:mysql://192.168.11.13:3306/tuoheng_lc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false
username: root
password: qweasd
password: idontcare
# url: jdbc:mysql://localhost:3306/tuoheng_lc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false
# username: root
# password: qweasd
druid:
# 连接池的配置信息
# 初始连接数
@@ -195,17 +198,17 @@ generate:
autoRemovePre: true
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
tablePrefix: sys_
xxl:
enable: true
job:
admin:
addresses: http://192.168.11.11:8110/xxl-job-admin
accessToken: tuoheng
executor:
appname: xxl-job-executor-lc
address:
ip:
# 多个后台,端口号不能相同
port: 9998
logpath: /data/java/logs/xxl-job/jobhandler
logretentiondays: 15
#xxl:
# enable: true
# job:
# admin:
# addresses: http://192.168.11.11:8110/xxl-job-admin
# accessToken: tuoheng
# executor:
# appname: xxl-job-executor-lc
# address:
# ip:
# # 多个后台,端口号不能相同
# port: 9998
# logpath: /data/java/logs/xxl-job/jobhandler
# logretentiondays: 15

+ 2
- 0
tuoheng-common/src/main/java/com/tuoheng/common/utils/DateUtils.java Datei anzeigen

@@ -27,6 +27,8 @@ public final class DateUtils extends org.apache.commons.lang3.time.DateUtils {

public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";

public static String YYYY_MM_DD_HH_MM_SSS = "yyyy.MM.dd HH:mm:ss";

private static String[] parsePatterns = {
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",

Laden…
Abbrechen
Speichern