Przeglądaj źródła

更新统计

master
牧羊人 4 lat temu
rodzic
commit
6e2b1535b2
7 zmienionych plików z 199 dodań i 9 usunięć
  1. +5
    -0
      src/main/java/com/taauav/admin/vo/inspectdriver/TauvInspectDriverInfoVo.java
  2. +132
    -9
      src/main/java/com/taauav/front/controller/UserDataStatisticsController.java
  3. +8
    -0
      src/main/java/com/taauav/front/mapper/UserWaterAlarmMapper.java
  4. +9
    -0
      src/main/java/com/taauav/front/mapper/UserWaterAlarmMapper.xml
  5. +31
    -0
      src/main/java/com/taauav/front/query/UserMultiDriverWaterAlarmQuery.java
  6. +9
    -0
      src/main/java/com/taauav/front/service/impl/UserInspectQuestionServiceImpl.java
  7. +5
    -0
      src/main/java/com/taauav/front/vo/inspectquestion/UserInspectQuestionInfoVo.java

+ 5
- 0
src/main/java/com/taauav/admin/vo/inspectdriver/TauvInspectDriverInfoVo.java Wyświetl plik

@@ -107,6 +107,11 @@ public class TauvInspectDriverInfoVo {
*/
private String inspectHandName;

/**
* 状态
*/
private Integer status;

/**
* 无人机设备
*/

+ 132
- 9
src/main/java/com/taauav/front/controller/UserDataStatisticsController.java Wyświetl plik

@@ -2,13 +2,16 @@ package com.taauav.front.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.taauav.admin.entity.TauvDriver;
import com.taauav.admin.entity.TauvInspectQuestion;
import com.taauav.admin.mapper.TauvDriverMapper;
import com.taauav.common.bean.Response;
import com.taauav.common.util.StringUtils;
import com.taauav.front.mapper.UserInspectQuestionMapper;
import com.taauav.front.mapper.UserWaterAlarmInfoMapper;
import com.taauav.front.mapper.UserWaterAlarmMapper;
import com.taauav.front.query.UserDriverWaterAlarmQuery;
import com.taauav.front.query.UserMultiDriverWaterAlarmQuery;
import com.taauav.front.vo.inspectquestion.InspectQuestionCategoryVo;
import io.netty.util.internal.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
@@ -30,6 +33,8 @@ public class UserDataStatisticsController {
@Autowired
private UserWaterAlarmMapper userWaterAlarmMapper;
@Autowired
private TauvDriverMapper driverMapper;
@Autowired
private Response response;

@GetMapping("/index")
@@ -289,15 +294,15 @@ public class UserDataStatisticsController {
public Response getDriverWaterAlarmInfoList(@RequestBody UserDriverWaterAlarmQuery query) {
// 时间处理
if (StringUtils.isEmpty(query.getTime())) {
return response.failure("");
return response.failure("请选择时间段");
}
String[] time = query.getTime().split(" ~ ");
String[] item = time[1].split("-");

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar date = Calendar.getInstance();
Integer year = Integer.valueOf(date.get(Calendar.YEAR));
Integer month = Integer.valueOf(date.get(Calendar.MONTH)) + 1;
Integer year = Integer.valueOf(item[0]);
Integer month = Integer.valueOf(item[1]);
Date beginTime = getBeginTime(year, month);
Date endTime = getEndTime(year, month);

@@ -310,7 +315,7 @@ public class UserDataStatisticsController {
stringList.add("TP");

List<Map<String, Object>> mapList = new ArrayList<>();
for (int i = 0; i < 5; i++) {
for (int i = month - 1; i >= month - 5; i--) {
String startTimeStr = addMonthDate(sdf.format(beginTime), -i, "yyyy-MM-dd HH:mm:ss");
String endTimeStr = addMonthDate(sdf.format(endTime), -i, "yyyy-MM-dd HH:mm:ss");
System.out.println(startTimeStr);
@@ -319,13 +324,17 @@ public class UserDataStatisticsController {
for (String s : stringList) {
Map<String, Object> map = new HashMap<>();
map.put("driverId", query.getDriverId());
map.put("startTime", sdf.format(beginTime));
map.put("endTime", sdf.format(endTime));
map.put("startTime", startTimeStr);
map.put("endTime", endTimeStr);
map.put("name", s);
Map<String, Object> alarmInfo = userWaterAlarmMapper.getDriverWaterAlarmInfo(map);

// 获取日期
String[] timeArr = startTimeStr.split(" ");
String[] dateArr = timeArr[0].split("-");

Map<String, Object> map1 = new HashMap<>();
map1.put("month", String.format("%s.%s", i, query.getMonth()));
map1.put("month", Integer.valueOf(dateArr[1]));
map1.put("name", s);
if (alarmInfo != null) {
map1.put("value", alarmInfo.get("value"));
@@ -335,7 +344,121 @@ public class UserDataStatisticsController {
mapList.add(map1);
}
}
return response.success(mapList);
}

return null;
/**
* 获取单河流水质分析信息
*
* @return
*/
@PostMapping("/getMultiDriverWaterAlarmInfo")
public Response getMultiDriverWaterAlarmInfo(@RequestBody UserMultiDriverWaterAlarmQuery query) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar date = Calendar.getInstance();
// 获取当前年份
Integer year = Integer.valueOf(date.get(Calendar.YEAR));
// 河流ID
String[] strings = query.getDriverId().split(",");
List<Map<String, Object>> mapList = new ArrayList<>();
for (int i = year - 4; i <= year; i++) {
// 开始时间
Date beginTime = getBeginTime(i, query.getMonth());
// 结束时间
Date endTime = getEndTime(i, query.getMonth());
System.out.println("开始时间:" + sdf.format(beginTime));
System.out.println("结束时间:" + sdf.format(endTime));

for (String string : strings) {
// 河湖ID
Integer driverId = Integer.valueOf(string);
// 获取河湖信息
TauvDriver driver = driverMapper.selectById(driverId);
if (driver == null) {
continue;
}
Map<String, Object> map = new HashMap<>();
map.put("driverId", driverId);
map.put("startTime", sdf.format(beginTime));
map.put("endTime", sdf.format(endTime));
map.put("name", query.getName());
Map<String, Object> alarmInfo = userWaterAlarmMapper.getMultiDriverWaterAlarmInfo(map);
Map<String, Object> map1 = new HashMap<>();
map1.put("month", String.format("%s.%s", i, query.getMonth()));
map1.put("name", driver.getName());
if (alarmInfo != null) {
map1.put("value", alarmInfo.get("value"));
} else {
map1.put("value", 0);
}
mapList.add(map1);
}
}
return response.success(mapList);
}

/**
* 单河流环比分析
*
* @param query 参数
* @return
*/
@PostMapping("/getMultiDriverWaterAlarmInfoList")
public Response getMultiDriverWaterAlarmInfoList(@RequestBody UserMultiDriverWaterAlarmQuery query) {
// 时间处理
if (StringUtils.isEmpty(query.getTime())) {
return response.failure("请选择时间段");
}
String[] time = query.getTime().split(" ~ ");
String[] item = time[1].split("-");

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar date = Calendar.getInstance();
Integer year = Integer.valueOf(item[0]);
Integer month = Integer.valueOf(item[1]);
Date beginTime = getBeginTime(year, month);
Date endTime = getEndTime(year, month);

// 河流ID
String[] strings = query.getDriverId().split(",");

List<Map<String, Object>> mapList = new ArrayList<>();
for (int i = month - 1; i >= month - 5; i--) {
String startTimeStr = addMonthDate(sdf.format(beginTime), -i, "yyyy-MM-dd HH:mm:ss");
String endTimeStr = addMonthDate(sdf.format(endTime), -i, "yyyy-MM-dd HH:mm:ss");
System.out.println(startTimeStr);
System.out.println(endTimeStr);

for (String string : strings) {
// 河湖ID
Integer driverId = Integer.valueOf(string);
// 获取河湖信息
TauvDriver driver = driverMapper.selectById(driverId);
if (driver == null) {
continue;
}
Map<String, Object> map = new HashMap<>();
map.put("driverId", driverId);
map.put("startTime", startTimeStr);
map.put("endTime", endTimeStr);
map.put("name", query.getName());
Map<String, Object> alarmInfo = userWaterAlarmMapper.getMultiDriverWaterAlarmInfo(map);

// 获取日期
String[] timeArr = startTimeStr.split(" ");
String[] dateArr = timeArr[0].split("-");

Map<String, Object> map1 = new HashMap<>();
map1.put("month", Integer.valueOf(dateArr[1]));
map1.put("name", driver.getName());
if (alarmInfo != null) {
map1.put("value", alarmInfo.get("value"));
} else {
map1.put("value", 0);
}
mapList.add(map1);
}
}
return response.success(mapList);
}
}

+ 8
- 0
src/main/java/com/taauav/front/mapper/UserWaterAlarmMapper.java Wyświetl plik

@@ -34,4 +34,12 @@ public interface UserWaterAlarmMapper extends BaseMapper<TauvWaterAlarm> {
*/
Map<String, Object> getDriverWaterAlarmInfo(@Param("param") Map<String, Object> param);

/**
* 多条河流水质分析
*
* @param param 参数
* @return
*/
Map<String, Object> getMultiDriverWaterAlarmInfo(@Param("param") Map<String, Object> param);

}

+ 9
- 0
src/main/java/com/taauav/front/mapper/UserWaterAlarmMapper.xml Wyświetl plik

@@ -31,4 +31,13 @@
GROUP BY i.`name`
</select>

<!-- 多河流水质数据统计 -->
<select id="getMultiDriverWaterAlarmInfo" parameterType="java.util.Map" resultType="java.util.Map">
SELECT d.`name`, count(i.`name`) AS `value` FROM tauv_water_alarm_info AS i
INNER JOIN tauv_water_alarm AS a ON a.id=i.water_alarm_id
INNER JOIN tauv_driver AS d ON d.id=a.driver_id
WHERE i.mark=1 AND a.mark=1 AND i.`name`=concat('',#{param.name},'') AND a.driver_id=#{param.driverId} AND a.create_time BETWEEN #{param.startTime} and #{param.endTime}
GROUP BY i.`name`
</select>

</mapper>

+ 31
- 0
src/main/java/com/taauav/front/query/UserMultiDriverWaterAlarmQuery.java Wyświetl plik

@@ -0,0 +1,31 @@
package com.taauav.front.query;

import lombok.Data;

/**
* 单河流水质查询条件
*/
@Data
public class UserMultiDriverWaterAlarmQuery {

/**
* 河湖ID
*/
private String driverId;

/**
* 警告分类
*/
private String name;

/**
* 月份
*/
private Integer month;

/**
* 时间
*/
private String time;

}

+ 9
- 0
src/main/java/com/taauav/front/service/impl/UserInspectQuestionServiceImpl.java Wyświetl plik

@@ -215,6 +215,14 @@ public class UserInspectQuestionServiceImpl extends BaseServiceImpl<UserInspectQ
if (!StringUtils.isEmpty(inspectQuestionInfoVo.getFileSrc())) {
inspectQuestionInfoVo.setFileSrc(uploadUrl + inspectQuestionInfoVo.getFileSrc());
}
// 原图
if (!StringUtils.isEmpty(inspectQuestionInfoVo.getOriginalImg())) {
inspectQuestionInfoVo.setOriginalImg(uploadUrl + inspectQuestionInfoVo.getOriginalImg());
}
// 处理之后的图片
if (!StringUtils.isEmpty(entity.getHandlerImage())) {
inspectQuestionInfoVo.setHandlerImage(uploadUrl + entity.getHandlerImage());
}
return response.success(inspectQuestionInfoVo);
}

@@ -268,6 +276,7 @@ public class UserInspectQuestionServiceImpl extends BaseServiceImpl<UserInspectQ

/**
* 获取指挥大屏问题详情
*
* @param id
* @return
*/

+ 5
- 0
src/main/java/com/taauav/front/vo/inspectquestion/UserInspectQuestionInfoVo.java Wyświetl plik

@@ -43,6 +43,11 @@ public class UserInspectQuestionInfoVo {
*/
private String fileSrc;

/**
* 问题原图
*/
private String originalImg;

/**
* 问题描述内容
*/

Ładowanie…
Anuluj
Zapisz