Ver código fonte

1、新增预警确认接口;2、新增预警忽略接口;3、修改获取预警列表接口;

tags/v1.2.0^2
wanjing 1 ano atrás
pai
commit
7c23e1c778
20 arquivos alterados com 532 adições e 19 exclusões
  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. +19
    -1
      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. +21
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/IWarningService.java
  16. +19
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/WarningServiceImpl.java
  17. +92
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/confirm/WarningConfirmService.java
  18. +92
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/ignore/WarningIgnoreService.java
  19. +61
    -1
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/query/QueryWarningListService.java
  20. +29
    -3
      tuoheng-admin/src/main/resources/mapper/WarningMapper.xml

+ 14
- 0
tuoheng-admin/pom.xml Ver arquivo

@@ -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 Ver arquivo

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

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: 预警
@@ -38,5 +38,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 Ver arquivo

@@ -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 Ver arquivo

@@ -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 Ver arquivo

@@ -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 Ver arquivo

@@ -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 Ver arquivo

@@ -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 Ver arquivo

@@ -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 Ver arquivo

@@ -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 Ver arquivo

@@ -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 Ver arquivo

@@ -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 Ver arquivo

@@ -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> {

/**
* 查询物资列表

+ 19
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/WarningMapper.java Ver arquivo

@@ -1,9 +1,11 @@
package com.tuoheng.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tuoheng.admin.entity.domain.Warning;
import com.tuoheng.admin.entity.request.warning.QueryWarningListRequest;

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

/**
* 预警Mapper接口
@@ -12,7 +14,7 @@ import java.util.List;
* @author wanjing
* @date 2023-02-06
*/
public interface WarningMapper {
public interface WarningMapper extends BaseMapper<Warning> {

/**
* 查询预警列表
@@ -29,4 +31,20 @@ public interface WarningMapper {
* @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 Ver arquivo

@@ -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 预警记录
*/

+ 21
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/IWarningService.java Ver arquivo

@@ -1,8 +1,11 @@
package com.tuoheng.admin.service.warning;
import com.tuoheng.admin.entity.request.warning.QueryWarningListRequest;
import com.tuoheng.admin.entity.request.warning.WarningConfirmRequest;
import com.tuoheng.common.utils.JsonResult;
import java.util.List;
/**
* 预警Service接口
*
@@ -28,4 +31,22 @@ public interface IWarningService {
*/
JsonResult getOneById(Integer id);
/**
*
* 确认
*
* @param request
* @return
*/
JsonResult confirm(WarningConfirmRequest request);
/**
*
* 忽略
*
* @param id
* @return
*/
JsonResult ignore(Integer id);
}

+ 19
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/WarningServiceImpl.java Ver arquivo

@@ -1,6 +1,9 @@
package com.tuoheng.admin.service.warning;
import com.tuoheng.admin.entity.request.warning.QueryWarningListRequest;
import com.tuoheng.admin.entity.request.warning.WarningConfirmRequest;
import com.tuoheng.admin.service.warning.confirm.WarningConfirmService;
import com.tuoheng.admin.service.warning.ignore.WarningIgnoreService;
import com.tuoheng.admin.service.warning.query.QueryWarningListService;
import com.tuoheng.common.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
@@ -19,6 +22,12 @@ public class WarningServiceImpl implements IWarningService {
@Autowired
private QueryWarningListService queryWarningListService;
@Autowired
private WarningConfirmService warningConfirmService;
@Autowired
private WarningIgnoreService warningIgnoreService;
/**
* 查询预警列表
*
@@ -41,4 +50,14 @@ public class WarningServiceImpl implements IWarningService {
return null;
}
@Override
public JsonResult confirm(WarningConfirmRequest request) {
return warningConfirmService.confirm(request);
}
@Override
public JsonResult ignore(Integer id) {
return warningIgnoreService.ignore(id);
}
}

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

@@ -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 Ver arquivo

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

}

+ 61
- 1
tuoheng-admin/src/main/java/com/tuoheng/admin/service/warning/query/QueryWarningListService.java Ver arquivo

@@ -1,11 +1,20 @@
package com.tuoheng.admin.service.warning.query;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.conver.WarningConverMapper;
import com.tuoheng.admin.entity.domain.Goods;
import com.tuoheng.admin.entity.domain.Question;
import com.tuoheng.admin.entity.domain.Warning;
import com.tuoheng.admin.entity.request.goods.QueryGoodsListRequest;
import com.tuoheng.admin.entity.request.warning.QueryWarningListRequest;
import com.tuoheng.admin.entity.vo.warning.WarningListVo;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.mapper.GoodsMapper;
import com.tuoheng.admin.mapper.QuestionMapper;
import com.tuoheng.admin.mapper.WarningMapper;
import com.tuoheng.common.utils.JsonResult;
import com.tuoheng.system.entity.User;
@@ -14,7 +23,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* 查询预警业务层处理
@@ -30,6 +42,9 @@ public class QueryWarningListService {
@Autowired
private WarningMapper warningMapper;

@Autowired
private QuestionMapper questionMapper;

public JsonResult getList(QueryWarningListRequest request) {
// log.info("进入查询预警列表业务");
User user = ShiroUtils.getUserInfo();
@@ -45,7 +60,11 @@ public class QueryWarningListService {
if (CollectionUtil.isEmpty(warningList)) {
log.info("预警列表数据为空");
}
return JsonResult.success(warningList);

// 构造返回结果对象
List<WarningListVo> warningListVoList = this.buildWarningListVo(warningList);

return JsonResult.success(warningListVoList);
}

/**
@@ -60,4 +79,45 @@ public class QueryWarningListService {
return JsonResult.success();
}

/**
* 1)、完善经纬度坐标字段
*
* @param warningList
* @return
*/
private List<WarningListVo> buildWarningListVo(List<Warning> warningList) {
List<WarningListVo> warningListVoList = WarningConverMapper.INSTANCE.fromWarningListToWarningListVoList(warningList);
Map<Integer, Question> questionMap = this.getQuestionMap( warningList);
Question question;
for (WarningListVo warningListVo : warningListVoList) {
question = questionMap.get(warningListVo.getQuestionId());
if (ObjectUtil.isNotNull(question)) {
warningListVo.setLng(question.getLng());
warningListVo.setLat(question.getLat());
}
}
return warningListVoList;
}

/**
* 查询到的任务列表中的部门Id,作为部门id列表,查询所有的部门,该结果数据量不会太大,放到map中
*
* @param warningList
* @return
*/
private Map<Integer, Question> getQuestionMap(List<Warning> warningList) {
Map<Integer, Question> map = new HashMap<>();
List<Integer> questionIdList = warningList.stream().map(o -> o.getQuestionId()).collect(Collectors.toList());
if (CollectionUtil.isEmpty(questionIdList)) {
log.info("questionIdList为空");
return null;
}
List<Question> questionList = questionMapper.selectList(new LambdaQueryWrapper<Question>()
.in(Question::getId, questionIdList)
.eq(Question::getMark, MarkEnum.VALID.getCode()));
for (Question question : questionList) {
map.put(question.getId(), question);
}
return map;
}
}

+ 29
- 3
tuoheng-admin/src/main/resources/mapper/WarningMapper.xml Ver arquivo

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

Carregando…
Cancelar
Salvar