Browse Source

新增多光谱数据模块

master
牧羊人 4 years ago
parent
commit
605e2a0d5e
14 changed files with 704 additions and 0 deletions
  1. +41
    -0
      src/main/java/com/taauav/front/controller/UserWaterDataController.java
  2. +41
    -0
      src/main/java/com/taauav/front/controller/UserWaterSpectrumController.java
  3. +31
    -0
      src/main/java/com/taauav/front/mapper/UserWaterDataMapper.java
  4. +33
    -0
      src/main/java/com/taauav/front/mapper/UserWaterDataMapper.xml
  5. +31
    -0
      src/main/java/com/taauav/front/mapper/UserWaterSpectrumMapper.java
  6. +29
    -0
      src/main/java/com/taauav/front/mapper/UserWaterSpectrumMapper.xml
  7. +53
    -0
      src/main/java/com/taauav/front/query/UserWaterDataQuery.java
  8. +49
    -0
      src/main/java/com/taauav/front/query/UserWaterSpectrumQuery.java
  9. +26
    -0
      src/main/java/com/taauav/front/service/IUserWaterDataService.java
  10. +26
    -0
      src/main/java/com/taauav/front/service/IUserWaterSpectrumService.java
  11. +71
    -0
      src/main/java/com/taauav/front/service/impl/UserWaterDataServiceImpl.java
  12. +103
    -0
      src/main/java/com/taauav/front/service/impl/UserWaterSpectrumServiceImpl.java
  13. +76
    -0
      src/main/java/com/taauav/front/vo/userwaterspectrum/UserWaterSpectrumListVo.java
  14. +94
    -0
      src/main/java/com/taauav/front/vo/waterdata/UserWaterDataListVo.java

+ 41
- 0
src/main/java/com/taauav/front/controller/UserWaterDataController.java View File

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


import com.taauav.common.bean.Response;
import com.taauav.front.query.UserWaterDataQuery;
import com.taauav.front.service.IUserWaterDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.taauav.front.controller.FrontBaseController;

/**
* <p>
* 水质数据表 前端控制器
* </p>
*
* @author 鲲鹏
* @since 2020-05-15
*/
@RestController
@RequestMapping("/front/waterdata")
public class UserWaterDataController extends FrontBaseController {

@Autowired
private IUserWaterDataService userWaterDataService;

/**
* 获取水质数据列表
*
* @param query 查询条件
* @return
*/
@PostMapping("/index")
public Response index(@RequestBody UserWaterDataQuery query) {
return userWaterDataService.getList(query);
}

}

+ 41
- 0
src/main/java/com/taauav/front/controller/UserWaterSpectrumController.java View File

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


import com.taauav.common.bean.Response;
import com.taauav.front.query.UserWaterSpectrumQuery;
import com.taauav.front.service.IUserWaterSpectrumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.taauav.front.controller.FrontBaseController;

/**
* <p>
* 多光谱图表 前端控制器
* </p>
*
* @author 鲲鹏
* @since 2020-05-15
*/
@RestController
@RequestMapping("/front/waterspectrum")
public class UserWaterSpectrumController extends FrontBaseController {

@Autowired
private IUserWaterSpectrumService userWaterSpectrumService;

/**
* 获取多光谱数据列表
*
* @param query 查询条件
* @return
*/
@PostMapping("/index")
public Response index(@RequestBody UserWaterSpectrumQuery query) {
return userWaterSpectrumService.getList(query);
}

}

+ 31
- 0
src/main/java/com/taauav/front/mapper/UserWaterDataMapper.java View File

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

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.taauav.admin.entity.TauvWaterData;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.taauav.front.query.UserWaterDataQuery;
import com.taauav.front.vo.waterdata.UserWaterDataListVo;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
* <p>
* 水质数据表 Mapper 接口
* </p>
*
* @author 鲲鹏
* @since 2020-05-15
*/
public interface UserWaterDataMapper extends BaseMapper<TauvWaterData> {

/**
* 获取水质数据列表
*
* @param page 分页
* @param query 查询条件
* @return
*/
List<UserWaterDataListVo> getWaterDataList(IPage<UserWaterDataListVo> page, @RequestParam("query") UserWaterDataQuery query);

}

+ 33
- 0
src/main/java/com/taauav/front/mapper/UserWaterDataMapper.xml View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.taauav.front.mapper.UserWaterDataMapper">

<!-- 获取水质数据列表 -->
<select id="getWaterDataList" parameterType="com.taauav.front.query.UserWaterDataQuery" resultType="com.taauav.front.vo.waterdata.UserWaterDataListVo">
SELECT w.id,d.inspect_no,d.num,d.driver_id,d.driver_name,i.inspect_time,d.driver_area,c.`name` AS driver_area_name,w.water_tp,w.water_tn,w.water_nh3n,w.water_do,w.water_cod,w.water_tub,w.`status`
FROM tauv_water_data w
INNER JOIN tauv_inspect_driver AS d ON w.inspect_driver_id = d.id
INNER JOIN tauv_inspect AS i ON i.id = d.inspect_id
INNER JOIN sys_city AS c ON c.id=d.driver_area
WHERE w.`status`=1 AND w.mark=1 AND d.mark=1 AND i.mark=1
<if test="query.inspectNo != null">
and d.inspect_no like concat('%', #{query.inspectNo}, '%')
</if>
<if test="query.driverName != null">
and d.driver_name like concat('%', #{query.driverName}, '%')
</if>
<if test="query.inspectTime != null and query.inspectTime !=''">
and i.inspect_time between #{query.inspectStartTime} and #{query.inspectEndTime}
</if>
<if test="query.driverAreaList != null"> and d.driver_area in
<foreach collection="query.driverAreaList" item="area" open="(" close=")" separator=",">
#{area}
</foreach>
</if>
<if test="query.status != null and query.status > 0">
and w.status = #{query.status}
</if>
ORDER BY w.id DESC
</select>

</mapper>

+ 31
- 0
src/main/java/com/taauav/front/mapper/UserWaterSpectrumMapper.java View File

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

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.taauav.admin.entity.TauvWaterSpectrum;
import com.taauav.front.query.UserWaterSpectrumQuery;
import com.taauav.front.vo.userwaterspectrum.UserWaterSpectrumListVo;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
* <p>
* 多光谱图表 Mapper 接口
* </p>
*
* @author 鲲鹏
* @since 2020-05-15
*/
public interface UserWaterSpectrumMapper extends BaseMapper<TauvWaterSpectrum> {

/**
* 获取多光谱数据列表
*
* @param page 分页
* @param query 查询条件
* @return
*/
List<UserWaterSpectrumListVo> getWaterSpectrumList(IPage<UserWaterSpectrumListVo> page, @RequestParam("query") UserWaterSpectrumQuery query);

}

+ 29
- 0
src/main/java/com/taauav/front/mapper/UserWaterSpectrumMapper.xml View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.taauav.front.mapper.UserWaterSpectrumMapper">

<!-- 获取多光谱数据列表 -->
<select id="getWaterSpectrumList" parameterType="com.taauav.front.query.UserWaterSpectrumQuery" resultType="com.taauav.front.vo.userwaterspectrum.UserWaterSpectrumListVo">
SELECT s.id,s.area_name,d.inspect_no,d.num,d.driver_id,d.driver_name,i.inspect_time,s.cod_pic,s.nh3n_pic,s.tp_pic,s.tn_pic,s.do_pic,s.tub_pic
FROM tauv_water_spectrum s
INNER JOIN tauv_inspect_driver AS d ON s.inspect_driver_id = d.id
INNER JOIN tauv_inspect AS i ON i.id = d.inspect_id
WHERE s.`status`=1 AND s.mark=1 AND d.mark=1 AND i.mark=1
<if test="query.inspectNo != null">
and d.inspect_no like concat('%', #{query.inspectNo}, '%')
</if>
<if test="query.driverName != null">
and d.driver_name like concat('%', #{query.driverName}, '%')
</if>
<if test="query.inspectTime != null and query.inspectTime !=''">
and i.inspect_time between #{query.inspectStartTime} and #{query.inspectEndTime}
</if>
<if test="query.driverAreaList != null"> and d.driver_area in
<foreach collection="query.driverAreaList" item="area" open="(" close=")" separator=",">
#{area}
</foreach>
</if>
ORDER BY s.id DESC
</select>

</mapper>

+ 53
- 0
src/main/java/com/taauav/front/query/UserWaterDataQuery.java View File

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

import com.taauav.common.core.mps.BaseQuery;
import lombok.Data;

import java.math.BigInteger;

/**
* 水质数据查询条件
*/
@Data
public class UserWaterDataQuery extends BaseQuery {

/**
* 任务单号
*/
private String inspectNo;

/**
* 河湖名称
*/
private String driverName;

/**
* 巡检时间
*/
private String inspectTime;

/**
* 巡检开始时间
*/
private String inspectStartTime;

/**
* 巡检结束时间
*/
private String inspectEndTime;

/**
* 区划ID
*/
private BigInteger driverArea;

/**
* 区划ID集合
*/
private BigInteger[] driverAreaList;

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

+ 49
- 0
src/main/java/com/taauav/front/query/UserWaterSpectrumQuery.java View File

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

import com.taauav.common.core.mps.BaseQuery;
import lombok.Data;

import java.math.BigInteger;

/**
* 多光谱数据查询条件
*/
@Data
public class UserWaterSpectrumQuery extends BaseQuery {

/**
* 任务单号
*/
private String inspectNo;

/**
* 河湖名称
*/
private String driverName;

/**
* 巡检时间
*/
private String inspectTime;

/**
* 巡检开始时间
*/
private String inspectStartTime;

/**
* 巡检结束时间
*/
private String inspectEndTime;

/**
* 区划ID
*/
private BigInteger driverArea;

/**
* 区划ID集合
*/
private BigInteger[] driverAreaList;

}

+ 26
- 0
src/main/java/com/taauav/front/service/IUserWaterDataService.java View File

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

import com.taauav.admin.entity.TauvWaterData;
import com.taauav.common.bean.Response;
import com.taauav.common.service.IBaseService;
import com.taauav.front.query.UserWaterDataQuery;

/**
* <p>
* 水质数据表 服务类
* </p>
*
* @author 鲲鹏
* @since 2020-05-15
*/
public interface IUserWaterDataService extends IBaseService<TauvWaterData> {

/**
* 获取水质数据列表
*
* @param query 查询条件
* @return
*/
Response getList(UserWaterDataQuery query);

}

+ 26
- 0
src/main/java/com/taauav/front/service/IUserWaterSpectrumService.java View File

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

import com.taauav.admin.entity.TauvWaterSpectrum;
import com.taauav.common.bean.Response;
import com.taauav.common.service.IBaseService;
import com.taauav.front.query.UserWaterSpectrumQuery;

/**
* <p>
* 多光谱图表 服务类
* </p>
*
* @author 鲲鹏
* @since 2020-05-15
*/
public interface IUserWaterSpectrumService extends IBaseService<TauvWaterSpectrum> {

/**
* 获取多光谱数据列表
*
* @param query 查询条件
* @return
*/
Response getList(UserWaterSpectrumQuery query);

}

+ 71
- 0
src/main/java/com/taauav/front/service/impl/UserWaterDataServiceImpl.java View File

@@ -0,0 +1,71 @@
package com.taauav.front.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.taauav.admin.entity.TauvWaterData;
import com.taauav.admin.service.ISysCityService;
import com.taauav.common.bean.Response;
import com.taauav.common.service.impl.BaseServiceImpl;
import com.taauav.common.util.FunctionUtils;
import com.taauav.front.constant.TauvInspectQuestionConstant;
import com.taauav.front.mapper.UserWaterDataMapper;
import com.taauav.front.query.UserWaterDataQuery;
import com.taauav.front.service.IUserWaterDataService;
import com.taauav.front.vo.inspectquestion.UserInspectQuestionListVo;
import com.taauav.front.vo.waterdata.UserWaterDataListVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.math.BigInteger;
import java.util.List;

/**
* <p>
* 水质数据表 服务实现类
* </p>
*
* @author 鲲鹏
* @since 2020-05-15
*/
@Service
public class UserWaterDataServiceImpl extends BaseServiceImpl<UserWaterDataMapper, TauvWaterData> implements IUserWaterDataService {

@Autowired
private ISysCityService sysCityService;

@Autowired
private UserWaterDataMapper userWaterDataMapper;

@Autowired
private Response response;

/**
* 获取水质数据列表
*
* @param query 查询条件
* @return
*/
@Override
public Response getList(UserWaterDataQuery query) {
// 区划ID处理
if (query.getDriverArea() != null) {
List<BigInteger> cityIds = sysCityService.getChildCityIds(query.getDriverArea());
// 加入当前选中的区划
cityIds.add(query.getDriverArea());
BigInteger[] integers = cityIds.toArray(new BigInteger[cityIds.size()]);
query.setDriverAreaList(integers);
}
// 巡检时间处理
if (!StringUtils.isEmpty(query.getInspectTime())) {
String startTime = FunctionUtils.formatTime(Integer.valueOf(query.getInspectTime()), "yyyy-MM-dd") + " 0:00:00";
String endTime = FunctionUtils.formatTime(Integer.valueOf(query.getInspectTime()), "yyyy-MM-dd") + " 23:59:59";
query.setInspectStartTime(startTime);
query.setInspectEndTime(endTime);
}
IPage<UserWaterDataListVo> page = new Page<>(query.getPage(), query.getPage());
List<UserWaterDataListVo> inspectQuestionList = userWaterDataMapper.getWaterDataList(page, query);
page.setRecords(inspectQuestionList);
return response.success(page);
}
}

+ 103
- 0
src/main/java/com/taauav/front/service/impl/UserWaterSpectrumServiceImpl.java View File

@@ -0,0 +1,103 @@
package com.taauav.front.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.taauav.admin.entity.TauvWaterSpectrum;
import com.taauav.admin.service.ISysCityService;
import com.taauav.common.bean.Response;
import com.taauav.common.service.impl.BaseServiceImpl;
import com.taauav.common.util.FunctionUtils;
import com.taauav.front.constant.TauvInspectQuestionConstant;
import com.taauav.front.mapper.UserWaterSpectrumMapper;
import com.taauav.front.query.UserWaterSpectrumQuery;
import com.taauav.front.service.IUserWaterSpectrumService;
import com.taauav.front.vo.userwaterspectrum.UserWaterSpectrumListVo;
import com.taauav.front.vo.waterdata.UserWaterDataListVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.math.BigInteger;
import java.util.List;

/**
* <p>
* 多光谱图表 服务实现类
* </p>
*
* @author 鲲鹏
* @since 2020-05-15
*/
@Service
public class UserWaterSpectrumServiceImpl extends BaseServiceImpl<UserWaterSpectrumMapper, TauvWaterSpectrum> implements IUserWaterSpectrumService {

@Autowired
private UserWaterSpectrumMapper userWaterSpectrumMapper;

@Autowired
private ISysCityService sysCityService;

@Autowired
private Response response;

@Value("${server.UPLOAD_URL}")
private String uploadUrl;

/**
* 获取多光谱数据列表
*
* @param query 查询条件
* @return
*/
@Override
public Response getList(UserWaterSpectrumQuery query) {
// 区划ID处理
if (query.getDriverArea() != null) {
List<BigInteger> cityIds = sysCityService.getChildCityIds(query.getDriverArea());
// 加入当前选中的区划
cityIds.add(query.getDriverArea());
BigInteger[] integers = cityIds.toArray(new BigInteger[cityIds.size()]);
query.setDriverAreaList(integers);
}
// 巡检时间处理
if (!StringUtils.isEmpty(query.getInspectTime())) {
String startTime = FunctionUtils.formatTime(Integer.valueOf(query.getInspectTime()), "yyyy-MM-dd") + " 0:00:00";
String endTime = FunctionUtils.formatTime(Integer.valueOf(query.getInspectTime()), "yyyy-MM-dd") + " 23:59:59";
query.setInspectStartTime(startTime);
query.setInspectEndTime(endTime);
}
IPage<UserWaterSpectrumListVo> page = new Page<>(query.getPage(), query.getPage());
List<UserWaterSpectrumListVo> waterSpectrumListVoList = userWaterSpectrumMapper.getWaterSpectrumList(page, query);
if (!waterSpectrumListVoList.isEmpty()) {
waterSpectrumListVoList.forEach(item -> {
// 化学需氧量多光谱路径
if (!StringUtils.isEmpty(item.getCodPic())) {
item.setCodPic(uploadUrl + item.getCodPic());
}
// 氨氮多光谱路径
if (!StringUtils.isEmpty(item.getNh3nPic())) {
item.setNh3nPic(uploadUrl + item.getNh3nPic());
}
// 总磷多光谱路径
if (!StringUtils.isEmpty(item.getTpPic())) {
item.setTpPic(uploadUrl + item.getTpPic());
}
// 总氮多光谱路径
if (!StringUtils.isEmpty(item.getTnPic())) {
item.setTnPic(uploadUrl + item.getTnPic());
}
// 溶解氧多光谱路径
if (!StringUtils.isEmpty(item.getDoPic())) {
item.setDoPic(uploadUrl + item.getDoPic());
}
// 浊度多光谱路径
if (!StringUtils.isEmpty(item.getTubPic())) {
item.setTubPic(uploadUrl + item.getTubPic());
}
});
}
page.setRecords(waterSpectrumListVoList);
return response.success(page);
}
}

+ 76
- 0
src/main/java/com/taauav/front/vo/userwaterspectrum/UserWaterSpectrumListVo.java View File

@@ -0,0 +1,76 @@
package com.taauav.front.vo.userwaterspectrum;

import java.time.LocalDateTime;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.taauav.common.domain.Entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

/**
* <p>
* 多光谱图表
* </p>
*
* @author 鲲鹏
* @since 2020-05-15
*/
@Data
public class UserWaterSpectrumListVo {

/**
* 多光谱数据ID
*/
private Integer id;

/**
* 区属名称
*/
private String areaName;

/**
* 河湖名称
*/
private String driverName;

/**
* 巡检时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date inspectTime;

/**
* 化学需氧量多光谱路径
*/
private String codPic;

/**
* 氨氮多光谱路径
*/
private String nh3nPic;

/**
* 总磷多光谱路径
*/
private String tpPic;

/**
* 总氮多光谱路径
*/
private String tnPic;

/**
* 溶解氧多光谱路径
*/
private String doPic;

/**
* 浊度多光谱路径
*/
private String tubPic;

}

+ 94
- 0
src/main/java/com/taauav/front/vo/waterdata/UserWaterDataListVo.java View File

@@ -0,0 +1,94 @@
package com.taauav.front.vo.waterdata;

import java.math.BigInteger;
import java.time.LocalDateTime;

import lombok.Data;

/**
* <p>
* 水质数据表列表Vo
* </p>
*
* @author 鲲鹏
* @since 2020-05-15
*/
@Data
public class UserWaterDataListVo {

/**
* 水质数据ID
*/
private Integer id;

/**
* 任务单号
*/
private String inspectNo;

/**
* 任务单号行号
*/
private String num;

/**
* 区划ID
*/
private BigInteger driverArea;

/**
* 区划名称
*/
private String driverAreaName;

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

/**
* 河湖名称
*/
private String driverName;

/**
* 巡检时间
*/
private String inspectTime;

/**
* 化学需氧量
*/
private String waterCod;

/**
* 氨氮
*/
private String waterNh3n;

/**
* 总磷
*/
private String waterTp;

/**
* 总氮
*/
private String waterTn;

/**
* 溶解氧
*/
private String waterDo;

/**
* 浊度
*/
private String waterTub;

/**
* 状态:1有效 2无效
*/
private Integer status;

}

Loading…
Cancel
Save