소스 검색

Merge branch 'master' of git.taauav.net:gitadmin/taauav_nanjing

master
daixiantong 4 년 전
부모
커밋
6c3dd0d00f
8개의 변경된 파일262개의 추가작업 그리고 0개의 파일을 삭제
  1. +2
    -0
      src/main/java/com/taauav/admin/entity/TauvWaterWarn.java
  2. +200
    -0
      src/main/java/com/taauav/front/controller/UserIndexController.java
  3. +2
    -0
      src/main/java/com/taauav/front/entity/UserInspectQuestion.java
  4. +8
    -0
      src/main/java/com/taauav/front/mapper/UserInspectQuestionMapper.java
  5. +9
    -0
      src/main/java/com/taauav/front/mapper/UserInspectQuestionMapper.xml
  6. +10
    -0
      src/main/java/com/taauav/front/mapper/UserWaterAlarmInfoMapper.java
  7. +5
    -0
      src/main/java/com/taauav/front/mapper/UserWaterAlarmInfoMapper.xml
  8. +26
    -0
      src/main/java/com/taauav/front/vo/inspectquestion/InspectQuestionCategoryVo.java

+ 2
- 0
src/main/java/com/taauav/admin/entity/TauvWaterWarn.java 파일 보기

@@ -53,6 +53,8 @@ public class TauvWaterWarn extends Entity {
/**
* 巡检日期
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date inspectTime;
/**
* 预警类型:1水质富营养化 2水生藻类植物

+ 200
- 0
src/main/java/com/taauav/front/controller/UserIndexController.java 파일 보기

@@ -0,0 +1,200 @@
package com.taauav.front.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.taauav.admin.entity.TauvInspectDriver;
import com.taauav.admin.entity.TauvWaterAlarm;
import com.taauav.admin.entity.TauvWaterWarn;
import com.taauav.admin.mapper.TauvInspectDriverMapper;
import com.taauav.admin.mapper.TauvWaterAlarmMapper;
import com.taauav.admin.mapper.TauvWaterWarnMapper;
import com.taauav.common.bean.Response;
import com.taauav.front.entity.UserInspectQuestion;
import com.taauav.front.entity.UserNotice;
import com.taauav.front.mapper.UserInspectQuestionMapper;
import com.taauav.front.mapper.UserNoticeMapper;
import com.taauav.front.mapper.UserWaterAlarmInfoMapper;
import com.taauav.front.vo.inspectquestion.InspectQuestionCategoryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* 客户端首页
*/
@RestController
@RequestMapping("/front/index")
public class UserIndexController {

@Autowired
private Response response;
@Autowired
private TauvInspectDriverMapper inspectDriverMapper;
@Autowired
private UserInspectQuestionMapper inspectQuestionMapper;
@Autowired
private TauvWaterAlarmMapper waterAlarmMapper;
@Autowired
private TauvWaterWarnMapper waterWarnMapper;
@Autowired
private UserWaterAlarmInfoMapper userWaterAlarmInfoMapper;
@Autowired
private UserNoticeMapper userNoticeMapper;


/**
* 获取首页统计
*
* @return
*/
@GetMapping("/index")
public Response index() {
// 任务统计
Map<String, Object> taskInfo = getInspectTaskInfo();
// 问题统计
Map<String, Object> questionInfo = getInspectQuestionInfo();
// 获取最新4条报警信息
List<TauvWaterAlarm> waterAlarmList = getWaterAlarmList();
// 获取最新4条预警数据
List<TauvWaterWarn> waterWarnList = getWaterWarnList();
// 获取问题类型统计列表
List<InspectQuestionCategoryVo> inspectQuestionCategoryVoList = inspectQuestionMapper.getInspectQuestionCategoryList();
// 获取水质警告分类统计列表
List<Map<String, Object>> waterAlarmCategoryList = userWaterAlarmInfoMapper.getWaterAlarmCategoryList();

// 返回结果
Map<String, Object> result = new HashMap<>();
result.put("taskInfo", taskInfo);
result.put("questionInfo", questionInfo);
result.put("waterAlarmList", waterAlarmList);
result.put("waterWarnList", waterWarnList);
result.put("inspectQuestionCategoryList", inspectQuestionCategoryVoList);
result.put("waterAlarmCategoryList", waterAlarmCategoryList);
return response.success(result);
}

/**
* 获取任务统计信息
*
* @return
*/
private Map<String, Object> getInspectTaskInfo() {
Map<String, Object> map = new HashMap<>();
// 获取任务总数
Integer totalNum = inspectDriverMapper.selectCount(new LambdaQueryWrapper<TauvInspectDriver>()
.eq(TauvInspectDriver::getMark, 1));
map.put("totalNum", totalNum);
// 获取已完成总数
Integer funishedNum = inspectDriverMapper.selectCount(new LambdaQueryWrapper<TauvInspectDriver>()
.eq(TauvInspectDriver::getStatus, 4)
.eq(TauvInspectDriver::getMark, 1));
map.put("funishedNum", funishedNum);
// 获取执行中总数
Integer[] status = {3, 5, 6};
Integer executionNum = inspectDriverMapper.selectCount(new LambdaQueryWrapper<TauvInspectDriver>()
.in(TauvInspectDriver::getStatus, status)
.eq(TauvInspectDriver::getMark, 1));
map.put("executionNum", executionNum);
// 获取待执行总数
Integer executionWaitNum = inspectDriverMapper.selectCount(new LambdaQueryWrapper<TauvInspectDriver>()
.eq(TauvInspectDriver::getStatus, 2)
.eq(TauvInspectDriver::getMark, 1));
map.put("executionWaitNum", executionWaitNum);
return map;
}

/**
* 获取巡检问题信息
*
* @return
*/
private Map<String, Object> getInspectQuestionInfo() {
Map<String, Object> map = new HashMap<>();
// 获取问题总数
Integer totalNum = inspectQuestionMapper.selectCount(new LambdaQueryWrapper<UserInspectQuestion>()
.eq(UserInspectQuestion::getMark, 1));
map.put("totalNum", totalNum);
// 获取已完成总数
Integer funishedNum = inspectQuestionMapper.selectCount(new LambdaQueryWrapper<UserInspectQuestion>()
.eq(UserInspectQuestion::getStatus, 3)
.eq(UserInspectQuestion::getMark, 1));
map.put("funishedNum", funishedNum);
// 获取处理中总数
Integer processNum = inspectQuestionMapper.selectCount(new LambdaQueryWrapper<UserInspectQuestion>()
.eq(UserInspectQuestion::getStatus, 2)
.eq(UserInspectQuestion::getMark, 1));
map.put("processNum", processNum);
// 获取待处理总数
Integer waitNum = inspectQuestionMapper.selectCount(new LambdaQueryWrapper<UserInspectQuestion>()
.eq(UserInspectQuestion::getStatus, 1)
.eq(UserInspectQuestion::getMark, 1));
map.put("waitNum", waitNum);
return map;
}

/**
* 获取一定条数的报警数据
*
* @return
*/
private List<TauvWaterAlarm> getWaterAlarmList() {
QueryWrapper<TauvWaterAlarm> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("mark", 1);
queryWrapper.gt("status", 1);
queryWrapper.orderByDesc("id");
IPage<TauvWaterAlarm> page = new Page<>(1, 4);
IPage<TauvWaterAlarm> data = waterAlarmMapper.selectPage(page, queryWrapper);
List<TauvWaterAlarm> waterAlarmList = data.getRecords();
waterAlarmList.forEach(item -> {
item.setStatusText(item.statusList().get(item.getStatus().toString()));
});
return waterAlarmList;
}

/**
* 获取一定条数的预警数据
*
* @return
*/
private List<TauvWaterWarn> getWaterWarnList() {
QueryWrapper<TauvWaterWarn> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("mark", 1);
queryWrapper.gt("status", 1);
queryWrapper.orderByDesc("id");
IPage<TauvWaterWarn> page = new Page<>(1, 4);
IPage<TauvWaterWarn> data = waterWarnMapper.selectPage(page, queryWrapper);
List<TauvWaterWarn> waterWarnList = data.getRecords();
if (!waterWarnList.isEmpty()) {
waterWarnList.forEach(item -> {
item.setStatusText(item.statusList().get(item.getStatus().toString()));
});
}
return waterWarnList;
}

/**
* 根据类型获取通知公告信息
*
* @param type 公告类型:1水务新闻 2政策法规
* @return
*/
@GetMapping("/getNoticeList")
private Response getNoticeList(Integer type) {
QueryWrapper<UserNotice> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("mark", 1);
queryWrapper.gt("status", 1);
queryWrapper.orderByDesc("id");
IPage<UserNotice> page = new Page<>(1, 4);
IPage<UserNotice> data = userNoticeMapper.selectPage(page, queryWrapper);
return response.success(data.getRecords());
}

}

+ 2
- 0
src/main/java/com/taauav/front/entity/UserInspectQuestion.java 파일 보기

@@ -3,6 +3,7 @@ package com.taauav.front.entity;
import java.time.LocalDateTime;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.taauav.common.domain.Entity;
import lombok.Data;
@@ -21,6 +22,7 @@ import org.springframework.format.annotation.DateTimeFormat;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("tauv_inspect_question")
public class UserInspectQuestion extends Entity {

private static final long serialVersionUID = 1L;

+ 8
- 0
src/main/java/com/taauav/front/mapper/UserInspectQuestionMapper.java 파일 보기

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.taauav.front.entity.UserInspectQuestion;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.taauav.front.query.UserInspectQuestionQuery;
import com.taauav.front.vo.inspectquestion.InspectQuestionCategoryVo;
import com.taauav.front.vo.inspectquestion.UserInspectQuestionInfoVo;
import com.taauav.front.vo.inspectquestion.UserInspectQuestionListVo;
import org.springframework.web.bind.annotation.RequestParam;
@@ -36,4 +37,11 @@ public interface UserInspectQuestionMapper extends BaseMapper<UserInspectQuestio
*/
UserInspectQuestionInfoVo getInspectQuestionInfoById(Integer id);

/**
* 获取巡检问题分类统计列表
*
* @return
*/
List<InspectQuestionCategoryVo> getInspectQuestionCategoryList();

}

+ 9
- 0
src/main/java/com/taauav/front/mapper/UserInspectQuestionMapper.xml 파일 보기

@@ -45,4 +45,13 @@
ORDER BY q.id DESC
</select>

<!-- 获取首页巡检问题类型统计列表 -->
<select id="getInspectQuestionCategoryList" resultType="com.taauav.front.vo.inspectquestion.InspectQuestionCategoryVo">
SELECT f.question_id,q.content AS question_content,count(f.id) AS question_num FROM tauv_inspect_question AS i
INNER JOIN tauv_inspect_file AS f ON i.inspect_file_id=f.id
LEFT JOIN tauv_question_options AS q ON f.question_id=q.id
WHERE f.mark = 1 AND f.question_id > 0 GROUP BY f.question_id ORDER BY question_num DESC
LIMIT 0, 5;
</select>

</mapper>

+ 10
- 0
src/main/java/com/taauav/front/mapper/UserWaterAlarmInfoMapper.java 파일 보기

@@ -3,6 +3,9 @@ package com.taauav.front.mapper;
import com.taauav.admin.entity.TauvWaterAlarmInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

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

/**
* <p>
* 水质报警附表 Mapper 接口
@@ -13,4 +16,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface UserWaterAlarmInfoMapper extends BaseMapper<TauvWaterAlarmInfo> {

/**
* 获取水质警告分类统计列表
*
* @return
*/
List<Map<String, Object>> getWaterAlarmCategoryList();

}

+ 5
- 0
src/main/java/com/taauav/front/mapper/UserWaterAlarmInfoMapper.xml 파일 보기

@@ -2,4 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.taauav.front.mapper.UserWaterAlarmInfoMapper">

<!-- 获取水质警告分类统计 -->
<select id="getWaterAlarmCategoryList" resultType="java.util.Map">
SELECT `name`,count(id) AS totalNum FROM tauv_water_alarm_info WHERE mark=1 GROUP BY `name` ORDER BY totalNum DESC;
</select>

</mapper>

+ 26
- 0
src/main/java/com/taauav/front/vo/inspectquestion/InspectQuestionCategoryVo.java 파일 보기

@@ -0,0 +1,26 @@
package com.taauav.front.vo.inspectquestion;

import lombok.Data;

/**
* 巡检问题统计
*/
@Data
public class InspectQuestionCategoryVo {

/**
* 巡检问题类型ID
*/
private Integer questionId;

/**
* 问题类型描述
*/
private String questionContent;

/**
* 问题类型对应的问题数量
*/
private Integer questionNum;

}

Loading…
취소
저장