Browse Source

预警列表查询接口分页

tags/v1.2.0^2
chengwang 1 year ago
parent
commit
4ca63ebc52
19 changed files with 523 additions and 72 deletions
  1. +14
    -0
      tuoheng-admin/pom.xml
  2. +20
    -4
      tuoheng-admin/src/main/java/com/tuoheng/admin/controller/WarningController.java
  3. +18
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/conver/WarningConverMapper.java
  4. +1
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/Camera.java
  5. +1
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/Goods.java
  6. +6
    -2
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/Warning.java
  7. +2
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/warning/QueryWarningListRequest.java
  8. +23
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/warning/WarningConfirmRequest.java
  9. +78
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/warning/WarningListVo.java
  10. +28
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/enums/WarningStatusEnum.java
  11. +2
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/CameraMapper.java
  12. +2
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/GoodsMapper.java
  13. +17
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/WarningMapper.java
  14. +4
    -3
      tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/WarningRecordMapper.java
  15. +92
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/confirm/WarningConfirmService.java
  16. +92
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/ignore/WarningIgnoreService.java
  17. +0
    -55
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/query/QueryWarningListService.java
  18. +94
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/query/QueryWarningPageListService.java
  19. +29
    -3
      tuoheng-admin/src/main/resources/mapper/WarningMapper.xml

+ 14
- 0
tuoheng-admin/pom.xml View File

@@ -178,6 +178,20 @@
<systemPath>${project.basedir}/src/main/resources/lib/aliyun-java-vod-upload-1.4.14.jar</systemPath>
</dependency>

<!--mapStruct依赖 高性能对象映射-->
<!--mapstruct核心-->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>1.5.3.Final</version>
</dependency>

<!--mapstruct编译-->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.5.3.Final</version>
</dependency>

</dependencies>


+ 20
- 4
tuoheng-admin/src/main/java/com/tuoheng/admin/controller/WarningController.java View File

@@ -2,13 +2,13 @@ package com.tuoheng.admin.controller;

import com.tuoheng.admin.entity.query.WarningQuery;
import com.tuoheng.admin.entity.request.warning.QueryWarningListRequest;
import com.tuoheng.admin.entity.request.warning.WarningConfirmRequest;
import com.tuoheng.admin.service.warning.IWarningService;
import com.tuoheng.common.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
* @desc: 预警 前端控制器
@@ -49,5 +49,21 @@ public class WarningController {
return warningService.getOneById(id);
}

/**
* 预警确认
*/
@PostMapping("/confirm")
public JsonResult confirm(@RequestBody WarningConfirmRequest request){
return warningService.confirm(request);
}

/**
* 预警忽略
*
* @return
*/
@PostMapping("/ignore/{id}")
public JsonResult ignore(@PathVariable("id") Integer id){
return warningService.ignore(id);
}
}

+ 18
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/conver/WarningConverMapper.java View File

@@ -0,0 +1,18 @@
package com.tuoheng.admin.conver;

import com.tuoheng.admin.entity.domain.Warning;
import com.tuoheng.admin.entity.vo.warning.WarningListVo;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface WarningConverMapper {

WarningConverMapper INSTANCE = Mappers.getMapper(WarningConverMapper.class);

List<WarningListVo> fromWarningListToWarningListVoList(List<Warning> warningList);


}

+ 1
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/Camera.java View File

@@ -36,7 +36,7 @@ public class Camera extends BaseEntity implements Serializable {
/**
* 设备类型 1枪机 2球机
*/
private String cameraType;
private Integer cameraType;
/**
* 经度

+ 1
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/Goods.java View File

@@ -41,7 +41,7 @@ public class Goods extends BaseEntity implements Serializable {
/**
* 物资类型 1个人防护装备 2搜救装备 3医疗及防疫设备及常用应急药品 4应急照明设备 5灭火处置设备
*/
private String goodsType;
private Integer goodsType;
/**
* 物资库存

+ 6
- 2
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/Warning.java View File

@@ -34,7 +34,7 @@ public class Warning extends BaseEntity implements Serializable {
/**
* 发现方式 1监控摄像 2无人机巡检 3人工巡检
*/
private String discoveryWay;
private Integer discoveryWay;
/**
* 火灾位置名称
@@ -44,7 +44,7 @@ public class Warning extends BaseEntity implements Serializable {
/**
* 预警状态 1待确认 2确认 3忽略
*/
private String status;
private Integer status;
/**
* 问题ID
@@ -63,4 +63,8 @@ public class Warning extends BaseEntity implements Serializable {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date checkTime;
/**
* 处理结果
*/
private String checkResult;
}

+ 2
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/warning/QueryWarningListRequest.java View File

@@ -1,6 +1,5 @@
package com.tuoheng.admin.entity.request.warning;

import com.tuoheng.common.common.BaseQuery;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@@ -18,4 +17,6 @@ public class QueryWarningListRequest implements Serializable {
@ApiModelProperty(value = "租户Id",hidden = true)
private Integer tenantId;

@ApiModelProperty(value = "预警状态: 0:全部;1:待确认;2:确认;3:忽略;")
private Integer status;
}

+ 23
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/request/warning/WarningConfirmRequest.java View File

@@ -0,0 +1,23 @@
package com.tuoheng.admin.entity.request.warning;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
* 预警确认请求实体
* @author: qiujinyang
*/
@Data
public class WarningConfirmRequest implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty(value = "预警ID")
private Integer id;

@ApiModelProperty(value = "处理内容")
private String checkResult;

}

+ 78
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/vo/warning/WarningListVo.java View File

@@ -0,0 +1,78 @@
package com.tuoheng.admin.entity.vo.warning;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.common.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 返回预警列表视图Vo
*
* @author wanjing
* @team tuoheng
* @date 2023-02-07
*/
@Data
public class WarningListVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 租户ID
*/
private Integer tenantId;
/**
* 发现方式 1监控摄像 2无人机巡检 3人工巡检
*/
private String discoveryWay;
/**
* 火灾位置名称
*/
private String location;
/**
* 预警状态 1待确认 2确认 3忽略
*/
private String status;
/**
* 问题ID
*/
private Integer questionId;
/**
* 处理人
*/
private Integer checkUser;
/**
* 处理时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date checkTime;
/**
* 处理结果
*/
private String checkResult;
/**
* 经度
*/
private String lng;
/**
* 纬度
*/
private String lat;
}

+ 28
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/enums/WarningStatusEnum.java View File

@@ -0,0 +1,28 @@
package com.tuoheng.admin.enums;

import lombok.Getter;

/**
* 预警状态类型
*
* @author wanjing
* @team tuoheng
* @date 2023-02-06
*/
public enum WarningStatusEnum {

WAIT_CONFIRM (1,"待确认"),
CONFIRM(2,"确认"),
IGNORE(3,"确认");

WarningStatusEnum(int code, String description){
this.code = code;
this.description = description;
}

@Getter
private int code;

@Getter
private String description;
}

+ 2
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/CameraMapper.java View File

@@ -1,5 +1,6 @@
package com.tuoheng.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.admin.entity.domain.Camera;
import com.tuoheng.admin.entity.request.camera.QueryCameraListRequest;

@@ -12,7 +13,7 @@ import java.util.List;
* @team tuoheng
* @date 2023-02-06
*/
public interface CameraMapper {
public interface CameraMapper extends BaseMapper<Camera> {

/**
* 查询摄像头列表

+ 2
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/GoodsMapper.java View File

@@ -2,6 +2,7 @@ package com.tuoheng.admin.mapper;

import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.admin.entity.domain.Goods;
import com.tuoheng.admin.entity.request.goods.QueryGoodsListRequest;

@@ -12,7 +13,7 @@ import com.tuoheng.admin.entity.request.goods.QueryGoodsListRequest;
* @author wanjing
* @date 2023-02-06
*/
public interface GoodsMapper {
public interface GoodsMapper extends BaseMapper<Goods> {

/**
* 查询物资列表

+ 17
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/WarningMapper.java View File

@@ -5,6 +5,7 @@ import com.tuoheng.admin.entity.domain.Warning;
import com.tuoheng.admin.entity.request.warning.QueryWarningListRequest;

import java.util.List;
import java.util.Map;

/**
* 预警Mapper接口
@@ -30,4 +31,20 @@ public interface WarningMapper extends BaseMapper<Warning> {
* @return 预警
*/
Warning getOneById(Integer id);

/**
* 确认
*
* @param map
* @return
*/
int confirm(Map<String, Object> map);

/**
* 忽略
*
* @param map
* @return
*/
int ignore(Map<String, Object> map);
}

+ 4
- 3
tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/WarningRecordMapper.java View File

@@ -1,5 +1,6 @@
package com.tuoheng.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.admin.entity.domain.WarningRecord;
import com.tuoheng.admin.entity.request.warningrecord.QueryWarningRecordListRequest;

@@ -8,11 +9,11 @@ import java.util.List;
/**
* 预警记录Mapper接口
*
* @team tuoheng
* @author wanjing
* @team tuoheng
* @date 2023-02-06
*/
public interface WarningRecordMapper {
public interface WarningRecordMapper extends BaseMapper<WarningRecord> {

/**
* 查询预警记录列表
@@ -24,7 +25,7 @@ public interface WarningRecordMapper {

/**
* 查询预警记录
*
*
* @param id 预警记录主键
* @return 预警记录
*/

+ 92
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/confirm/WarningConfirmService.java View File

@@ -0,0 +1,92 @@
package com.tuoheng.admin.service.warning.confirm;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.domain.Warning;
import com.tuoheng.admin.entity.request.warning.WarningConfirmRequest;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.WarningStatusEnum;
import com.tuoheng.admin.mapper.WarningMapper;
import com.tuoheng.common.exception.ServiceException;
import com.tuoheng.common.utils.DateUtils;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.system.entity.User;
import com.tuoheng.system.utils.ShiroUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
* 预警确认业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2023-02-07
*/
@Slf4j
@Service
public class WarningConfirmService {

@Autowired
private WarningMapper warningMapper;

public JsonResult confirm(WarningConfirmRequest request) {
log.info("进入预警确认业务, request:{}", request);
User user = ShiroUtils.getUserInfo();
JsonResult result = this.check(request);
if (0 != result.getCode()) {
log.info("进入任务问题确认业务:校验失败:{}", result.getMsg());
return result;
}
// 确认预警
result = this.updateStatus(user, request);

return result;
}

/**
* 检查参数
*
* @param request
* @return
*/
private JsonResult check(WarningConfirmRequest request) {
// 判断预警id是否为空
if (ObjectUtil.isNotNull(request.getId())) {
throw new ServiceException(0, "预警为空");
}
Warning warning = warningMapper.selectOne(new LambdaQueryWrapper<Warning>()
.in(Warning::getId, request.getId())
.eq(Warning::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNull(warning)) {
throw new ServiceException(0, "预警信息不存在");
}
return JsonResult.success(warning);
}

/**
* 预警状态,改为确认
*
* @param user
* @param id
*/
private JsonResult updateStatus(User user, WarningConfirmRequest request) {
Map<String, Object> map = new HashMap<>();
map.put("id", request.getId());
map.put("status", WarningStatusEnum.CONFIRM.getCode());
map.put("updateUser", user.getId());
map.put("updateTime", DateUtils.now());
map.put("checkUser", user.getId());
map.put("checkTime", DateUtils.now());
map.put("checkResult", request.getCheckResult());
Integer rowCount = warningMapper.confirm(map);
if (rowCount <= 0) {
log.info("修改预警状态, 确认失败");
throw new ServiceException(0, "修改预警状态, 确认失败");
}
return JsonResult.success();
}
}

+ 92
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/ignore/WarningIgnoreService.java View File

@@ -0,0 +1,92 @@
package com.tuoheng.admin.service.warning.ignore;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.domain.Warning;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.WarningStatusEnum;
import com.tuoheng.admin.mapper.WarningMapper;
import com.tuoheng.common.exception.ServiceException;
import com.tuoheng.common.utils.DateUtils;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.system.entity.User;
import com.tuoheng.system.utils.ShiroUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
* 预警忽略业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2023-02-07
*/
@Slf4j
@Service
public class WarningIgnoreService {

@Autowired
private WarningMapper warningMapper;

public JsonResult ignore(Integer id) {
log.info("进入预警忽略业务, id:{}", id);
User user = ShiroUtils.getUserInfo();
JsonResult result = this.check(id);
if (0 != result.getCode()) {
log.info("进入预警忽略业务:校验失败:{}", result.getMsg());
return result;
}

// 忽略任务问题
result = this.updateStatus(user, id);

return result;
}

/**
* 检查参数
*
* @param id
* @return
*/
private JsonResult check(Integer id) {
// 判断预警id是否为空
if (ObjectUtil.isNotNull(id)) {
throw new ServiceException(0, "预警为空");
}
Warning warning = warningMapper.selectOne(new LambdaQueryWrapper<Warning>()
.in(Warning::getId, id)
.eq(Warning::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNull(warning)) {
throw new ServiceException(0, "预警信息不存在");
}
return JsonResult.success(warning);
}

/**
* 预警状态,改为忽略
*
* @param user
* @param id
*/
private JsonResult updateStatus(User user, Integer id) {
Map<String, Object> map = new HashMap<>();
map.put("id", id);
map.put("status", WarningStatusEnum.CONFIRM.getCode());
map.put("updateUser", user.getId());
map.put("updateTime", DateUtils.now());
map.put("checkUser", user.getId());
map.put("checkTime", DateUtils.now());
Integer rowCount = warningMapper.confirm(map);
if (rowCount <= 0) {
log.info("修改预警状态, 确认失败");
throw new ServiceException(0, "修改预警状态, 确认失败");
}
return JsonResult.success();
}

}

+ 0
- 55
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/query/QueryWarningListService.java View File

@@ -78,59 +78,4 @@ public class QueryWarningListService {
return JsonResult.success();
}

/**
* 告警列表查询 分页
*
* @param query
* @return
*/
public JsonResult index(WarningQuery query) {
//校验
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();
if(null == tenantId) {
return JsonResult.error(WarningEnum.TENANT_ID_IS_NULL.getCode(),WarningEnum.TENANT_ID_IS_NULL.getMsg());
}
query.setTenantId(tenantId);
IPage<Warning> page = new Page<>(query.getPage(),query.getLimit());
IPage<WarningVO> pageData = new Page<>(query.getPage(),query.getLimit());
//时间
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");
}
query.setWaringStartTime(startTime);
query.setWaringEndTime(endTime);
//获取分页数据

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::getMark, MarkTypeEnum.VALID.getCode()));
if(null == warningPageData){
return null;
}
//属性赋值
List<WarningVO> collect = warningPageData.getRecords().stream().map(x -> {
WarningVO vo = new WarningVO();
BeanUtils.copyProperties(x, vo);
//预警来源
//if(x.getDiscoveryWay() == DiscoveryWayEnum.SURVEILLANCE_CAMERA.getCode())

return vo;
}).collect(Collectors.toList());
pageData.setRecords(collect);

return JsonResult.success(pageData);

}
}

+ 94
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/query/QueryWarningPageListService.java View File

@@ -0,0 +1,94 @@
package com.tuoheng.admin.service.warning.query;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.MarkTypeEnum;
import com.tuoheng.admin.enums.WarningEnum;
import com.tuoheng.admin.mapper.WarningMapper;
import com.tuoheng.common.exception.ServiceException;
import com.tuoheng.common.utils.DateUtils;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.common.utils.StringUtils;
import com.tuoheng.system.entity.User;
import com.tuoheng.system.utils.ShiroUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
* @Author ChengWang
* @Date 2023/2/7
*/
@Slf4j
@Service
public class QueryWarningPageListService {

@Autowired
private WarningMapper warningMapper;

/**
* 告警列表查询 分页
*
* @param query
* @return
*/
public JsonResult index(WarningQuery query) {
//校验
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();
if (null == tenantId) {
return JsonResult.error(WarningEnum.TENANT_ID_IS_NULL.getCode(), WarningEnum.TENANT_ID_IS_NULL.getMsg());
}
query.setTenantId(tenantId);
IPage<Warning> page = new Page<>(query.getPage(), query.getLimit());
IPage<WarningVO> pageData = new Page<>(query.getPage(), query.getLimit());
//时间
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");
}
query.setWaringStartTime(startTime);
query.setWaringEndTime(endTime);
//获取分页数据

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::getMark, MarkTypeEnum.VALID.getCode()));
if (null == warningPageData) {
return null;
}
//属性赋值
List<WarningVO> collect = warningPageData.getRecords().stream().map(x -> {
WarningVO vo = new WarningVO();
BeanUtils.copyProperties(x, vo);
//预警来源
//if(x.getDiscoveryWay() == DiscoveryWayEnum.SURVEILLANCE_CAMERA.getCode())

return vo;
}).collect(Collectors.toList());
pageData.setRecords(collect);

return JsonResult.success(pageData);
}
}

+ 29
- 3
tuoheng-admin/src/main/resources/mapper/WarningMapper.xml View File

@@ -17,18 +17,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="checkUser" column="check_user" />
<result property="checkTime" column="check_time" />
<result property="checkResult" column="check_result" />
<result property="mark" column="mark" />
</resultMap>
<sql id="selectWarningVo">
select id, tenant_id, discovery_way, location, status, question_id, create_user, create_time, update_user, update_time, check_user, check_time, mark from th_warning
select id, tenant_id, discovery_way, location, status, question_id, create_user, create_time, update_user, update_time, check_user, check_time, check_result, mark from th_warning
</sql>
<select id="getList" parameterType="com.tuoheng.admin.entity.request.warning.QueryWarningListRequest" resultMap="WarningResult">
<include refid="selectWarningVo"/>
<where>
<if test="1 == 1"> and mark = 1 </if>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
<if test="tenantId != null "> and tenant_id = #{tenantId} </if>
<if test="status != null and status != 0 "> and status = #{status}</if>
</where>
order by create_time desc
</select>
@@ -37,5 +39,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectWarningVo"/>
where mark = 1 and id = #{id}
</select>
<update id="confirm" parameterType="hashmap">
update th_inspection_file
<trim prefix="SET" suffixOverrides=",">
<if test="status != null"> status = #{status}, </if>
<if test="updateUser != null and updateUser != ''"> update_user = #{updateUser}, </if>
<if test="updateTime != null"> update_time = #{updateTime}, </if>
<if test="checkUser != null and checkUser != ''"> check_user = #{checkUser}, </if>
<if test="checkTime != null"> check_time = #{checkTime}, </if>
<if test="checkResult != null and checkResult != ''"> check_result = #{checkResult}, </if>
</trim>
where id = #{id}
</update>
<update id="ignore" parameterType="hashmap">
update th_inspection_file
<trim prefix="SET" suffixOverrides=",">
<if test="status != null"> status = #{status}, </if>
<if test="updateUser != null and updateUser != ''"> update_user = #{updateUser}, </if>
<if test="updateTime != null"> update_time = #{updateTime}, </if>
<if test="checkUser != null and checkUser != ''"> check_user = #{checkUser}, </if>
<if test="checkTime != null"> check_time = #{checkTime}, </if>
</trim>
where id = #{id}
</update>
</mapper>

Loading…
Cancel
Save