Bläddra i källkod

'水质预警'

master
daixiantong 4 år sedan
förälder
incheckning
1c3b8b60e8
9 ändrade filer med 183 tillägg och 55 borttagningar
  1. +1
    -1
      src/main/java/com/taauav/admin/controller/TauvReportController.java
  2. +1
    -1
      src/main/java/com/taauav/admin/controller/TauvWaterDataController.java
  3. +26
    -25
      src/main/java/com/taauav/admin/controller/TauvWaterWarnController.java
  4. +35
    -10
      src/main/java/com/taauav/admin/entity/TauvWaterSpectrum.java
  5. +40
    -9
      src/main/java/com/taauav/admin/entity/TauvWaterWarn.java
  6. +13
    -0
      src/main/java/com/taauav/admin/service/ITauvWaterWarnService.java
  7. +37
    -6
      src/main/java/com/taauav/admin/service/impl/TauvReportServiceImpl.java
  8. +3
    -3
      src/main/java/com/taauav/admin/service/impl/TauvWaterDataServiceImpl.java
  9. +27
    -0
      src/main/java/com/taauav/admin/service/impl/TauvWaterWarnServiceImpl.java

+ 1
- 1
src/main/java/com/taauav/admin/controller/TauvReportController.java Visa fil

@@ -152,7 +152,7 @@ public class TauvReportController extends BaseController {
* @return
*/
@PostMapping("checkSub")
@RequiresPermissions("report:checkSub")
// @RequiresPermissions("report:checkSub")
public Response chekcSub(@RequestBody Map<String, Object> map) {
return iTauvReportService.editSub(map, "checkSub");
}

+ 1
- 1
src/main/java/com/taauav/admin/controller/TauvWaterDataController.java Visa fil

@@ -59,7 +59,7 @@ public class TauvWaterDataController extends BaseController {
* @return
*/
@PostMapping("/import")
@RequiresPermissions(controllerName + ":" + PermissionConstants.IMPORT_PERMISSION)
// @RequiresPermissions(controllerName + ":" + PermissionConstants.IMPORT_PERMISSION)
public Response importData(@RequestParam("file") MultipartFile file) {
return waterDataService.importData(file);
}

+ 26
- 25
src/main/java/com/taauav/admin/controller/TauvWaterWarnController.java Visa fil

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

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.taauav.admin.controller.BaseController;
import com.taauav.common.bean.Response;
import com.taauav.common.util.DateUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.taauav.common.core.mps.BaseQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.taauav.admin.entity.TauvWaterWarn;
import com.taauav.admin.service.ITauvWaterWarnService;

@@ -25,32 +20,29 @@ import com.taauav.admin.service.ITauvWaterWarnService;
*/
@RestController
@RequestMapping("/admin/warn")
public class TauvWaterWarnController extends BaseController
{
public class TauvWaterWarnController extends BaseController {
@Autowired
private ITauvWaterWarnService tauvWaterWarnService;

@Autowired
private Response response;

/**
* 查询水质预警列表
*/
@RequiresPermissions("admin:warn:list")
@GetMapping("/list")
public Response list(TauvWaterWarn tauvWaterWarn, BaseQuery query)
{
return tauvWaterWarnService.pageData(query,tauvWaterWarn);
public Response list(TauvWaterWarn tauvWaterWarn, BaseQuery query) {
IPage<TauvWaterWarn> list = tauvWaterWarnService.pageData(query, tauvWaterWarn);
return response.success(list);
}



/**
* 获取水质预警详细信息
*/
@RequiresPermissions("admin:warn:query")
@GetMapping(value = "/{id}")
public Response getInfo(@PathVariable("id") Integer id)
{
public Response getInfo(@PathVariable("id") Integer id) {
return response.success(tauvWaterWarnService.getInfo(id));
}

@@ -58,9 +50,8 @@ public class TauvWaterWarnController extends BaseController
* 新增水质预警
*/
@RequiresPermissions("admin:warn:add")
@PostMapping
public Response add(@RequestBody TauvWaterWarn tauvWaterWarn)
{
@PostMapping("/add")
public Response add(@RequestBody TauvWaterWarn tauvWaterWarn) {
return response.success(tauvWaterWarnService.save(tauvWaterWarn));
}

@@ -68,9 +59,9 @@ public class TauvWaterWarnController extends BaseController
* 修改水质预警
*/
@RequiresPermissions("admin:warn:edit")
@PutMapping
public Response edit(@RequestBody TauvWaterWarn tauvWaterWarn)
{
@PostMapping("/edit")
public Response edit(@RequestBody TauvWaterWarn tauvWaterWarn) {
tauvWaterWarn.setWarnTime(DateUtil.now());
return response.success(tauvWaterWarnService.updateById(tauvWaterWarn));
}

@@ -79,8 +70,18 @@ public class TauvWaterWarnController extends BaseController
*/
@RequiresPermissions("admin:warn:remove")
@DeleteMapping("/{ids}")
public Response remove(@PathVariable Integer[] ids)
{
public Response remove(@PathVariable Integer[] ids) {
return response.success(tauvWaterWarnService.deleteByIds(ids, new TauvWaterWarn()));
}

/**
* 取消预警
* @param ids
* @return
*/
@PostMapping("/cancel")
@RequiresPermissions("admin:warn:cancel")
public Response cancelWarn(@RequestBody Integer[] ids) {
return tauvWaterWarnService.cancelWarn(ids);
}
}

+ 35
- 10
src/main/java/com/taauav/admin/entity/TauvWaterSpectrum.java Visa fil

@@ -1,11 +1,14 @@
package com.taauav.admin.entity;

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;

import java.util.Date;

/**
* 多光谱图对象 tauv_water_spectrum
*
@@ -19,24 +22,46 @@ public class TauvWaterSpectrum extends Entity {

private static final long serialVersionUID = 1L;

/** 巡检河道id */
/**
* 巡检河道id
*/
private Integer inspectDriverId;
/** 区属名称 */
/**
* 区属名称
*/
private String areaName;
/** 河湖名称 */
/**
* 河湖名称
*/
private String driverName;
/** 巡检时间 */
/**
* 巡检时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date inspectTime;
/** 化学需氧量多光谱路径 */
/**
* 化学需氧量多光谱路径
*/
private String codPic;
/** 氨氮多光谱路径 */
/**
* 氨氮多光谱路径
*/
private String nh3nPic;
/** 总磷多光谱路径 */
/**
* 总磷多光谱路径
*/
private String tpPic;
/** 总氮多光谱路径 */
/**
* 总氮多光谱路径
*/
private String tnPic;
/** 溶解氧多光谱路径 */
/**
* 溶解氧多光谱路径
*/
private String doPic;
/** 浊度多光谱路径 */
/**
* 浊度多光谱路径
*/
private String tubPic;
}

+ 40
- 9
src/main/java/com/taauav/admin/entity/TauvWaterWarn.java Visa fil

@@ -1,12 +1,15 @@
package com.taauav.admin.entity;

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;

import java.math.BigInteger;
import java.util.Date;

/**
* 水质预警对象 tauv_water_warn
*
@@ -20,22 +23,50 @@ public class TauvWaterWarn extends Entity {

private static final long serialVersionUID = 1L;

/** 巡检河道ID */
/**
* 巡检河道ID
*/
private Integer inspectDriverId;
/** 预警编号 */
/**
* 任务单号
*/
private String inspectNo;
/**
* 预警编号
*/
private String warnSn;
/** 区属ID */
/**
* 区属ID
*/
private BigInteger driverArea;
/** 河道ID */
/**
* 河道ID
*/
private Integer driverId;
/** 河流名称 */
/**
* 河流名称
*/
private String driverName;
/** 巡检日期 */
/**
* 巡检日期
*/
private Date inspectTime;
/** 预警类型:1水质富营养化 2水生藻类植物 */
/**
* 预警类型:1水质富营养化 2水生藻类植物
*/
private Integer warnType;
/** 报警内容 */
/**
* 报警内容
*/
private String warnContent;
/** 预警级别:1一级 2二级 3三级 4四级 5五级 */
/**
* 预警级别:1一级 2二级 3三级 4四级 5五级
*/
private Integer warnLevel;
/**
* 预警日期
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date warnTime;
}

+ 13
- 0
src/main/java/com/taauav/admin/service/ITauvWaterWarnService.java Visa fil

@@ -1,6 +1,7 @@
package com.taauav.admin.service;

import com.taauav.admin.entity.TauvWaterWarn;
import com.taauav.common.bean.Response;
import com.taauav.common.service.IBaseService;

/**
@@ -11,5 +12,17 @@ import com.taauav.common.service.IBaseService;
*/
public interface ITauvWaterWarnService extends IBaseService<TauvWaterWarn>
{
/**
* 添加编辑预警数据
* @param waterWarn
* @return
*/
Response editWarn(TauvWaterWarn waterWarn);

/**
* 取消预警
* @param ids
* @return
*/
Response cancelWarn(Integer[] ids);
}

+ 37
- 6
src/main/java/com/taauav/admin/service/impl/TauvReportServiceImpl.java Visa fil

@@ -3,14 +3,11 @@ package com.taauav.admin.service.impl;
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.mapper.TauvWaterDataMapper;
import com.taauav.admin.mapper.TauvWaterSpectrumMapper;
import com.taauav.admin.mapper.*;
import com.taauav.common.bean.Response;
import com.taauav.admin.dto.TauvReportDTO;
import com.taauav.admin.dto.TauvReportInputDTO;
import com.taauav.admin.entity.*;
import com.taauav.admin.mapper.TauvInspectDriverMapper;
import com.taauav.admin.mapper.TauvReportMapper;
import com.taauav.admin.service.*;
import com.taauav.common.service.impl.BaseServiceImpl;
import com.taauav.common.util.DateUtil;
@@ -69,6 +66,8 @@ public class TauvReportServiceImpl extends BaseServiceImpl<TauvReportMapper, Tau
private ITauvDriverService tauvDriverService;
@Autowired
private TauvWaterSpectrumMapper waterSpectrumMapper;
@Autowired
private TauvWaterWarnMapper waterWarnMapper;

/**
* 添加报告
@@ -690,6 +689,8 @@ public class TauvReportServiceImpl extends BaseServiceImpl<TauvReportMapper, Tau
if (status == 3) {
// 审核通过
inspectDriver.setStatus(4);
TauvInspectDriver inspectDriverInfo = inspectDriverMapper.selectById(inspectDriverId);
SysCity city = iSysCityService.getInfoById(inspectDriverInfo.getDriverArea());
// 多光谱数据入库
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("inspect_driver_id", inspectDriverId);
@@ -697,13 +698,30 @@ public class TauvReportServiceImpl extends BaseServiceImpl<TauvReportMapper, Tau
wrapper.last("limit 1");
TauvWaterSpectrum waterSpectrum = waterSpectrumMapper.selectOne(wrapper);
if (waterSpectrum == null) {
TauvInspectDriver inspectDriverInfo = inspectDriverMapper.selectById(inspectDriverId);
SysCity city = iSysCityService.getInfoById(inspectDriverInfo.getDriverArea());
waterSpectrum = new TauvWaterSpectrum();
waterSpectrum.setInspectDriverId(inspectDriverId);
waterSpectrum.setAreaName(city != null ? city.getName() : "");
waterSpectrum.setDriverName(inspectDriverInfo.getDriverName());
waterSpectrum.setInspectTime(inspectDriverInfo.getExecutionTime());
waterSpectrum.setCreateUser(ShiroUtils.getAdminId());
waterSpectrum.setCreateTime(DateUtil.now());
waterSpectrumMapper.insert(waterSpectrum);
}
// 预警数据入库
TauvWaterWarn waterWarn = waterWarnMapper.selectOne(wrapper);
if (waterWarn == null) {
waterWarn = new TauvWaterWarn();
waterWarn.setInspectDriverId(inspectDriverId);
waterWarn.setInspectNo(inspectDriverInfo.getInspectNo());
waterWarn.setDriverArea(inspectDriverInfo.getDriverArea());
waterWarn.setDriverId(inspectDriverInfo.getDriverId());
waterWarn.setDriverName(inspectDriverInfo.getDriverName());
waterWarn.setInspectTime(inspectDriverInfo.getExecutionTime());
waterWarn.setWarnSn(createWarnSn());
waterWarn.setCreateUser(ShiroUtils.getAdminId());
waterWarn.setCreateTime(DateUtil.now());
waterWarnMapper.insert(waterWarn);
}
} else if (status == 4) {
// 审核驳回
inspectDriver.setStatus(6);
@@ -951,4 +969,17 @@ public class TauvReportServiceImpl extends BaseServiceImpl<TauvReportMapper, Tau
return response.success("操作成功");
}
}

/**
* 创建预警编号
*
* @return
*/
private String createWarnSn() {
Calendar date = Calendar.getInstance();
String year = String.valueOf(date.get(Calendar.YEAR)).substring(2);
String month = String.format("%02d", date.get(Calendar.MONTH) + 1);
String code = "30" + year + month + (int) ((Math.random() * 9 + 1) * 100000);
return code;
}
}

+ 3
- 3
src/main/java/com/taauav/admin/service/impl/TauvWaterDataServiceImpl.java Visa fil

@@ -304,7 +304,7 @@ public class TauvWaterDataServiceImpl extends BaseServiceImpl<TauvWaterDataMappe
data.setCreateTime(DateUtil.now());
waterAlarmInfoService.save(data);
}
} else if (StringUtils.isNotNull(waterAlarm.getId())){
} else if (StringUtils.isNotNull(waterAlarm.getId())) {
// 新导入数据没有报警数据,删除原有报警数据
waterAlarmService.deleteById(waterAlarm.getId(), waterAlarm);
}
@@ -358,8 +358,8 @@ public class TauvWaterDataServiceImpl extends BaseServiceImpl<TauvWaterDataMappe
private String createAlarmSn() {
Calendar date = Calendar.getInstance();
String year = String.valueOf(date.get(Calendar.YEAR)).substring(2);
String month = String.valueOf(date.get(Calendar.MONTH) + 1);
String code = "20" + year + month + (Math.random() * 9 + 1) * 100000;
String month = String.format("%02d", date.get(Calendar.MONTH) + 1);
String code = "20" + year + month + (int) ((Math.random() * 9 + 1) * 100000);
return code;
}


+ 27
- 0
src/main/java/com/taauav/admin/service/impl/TauvWaterWarnServiceImpl.java Visa fil

@@ -1,12 +1,16 @@
package com.taauav.admin.service.impl;


import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.taauav.common.bean.Response;
import com.taauav.common.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import com.taauav.admin.mapper.TauvWaterWarnMapper;
import com.taauav.admin.entity.TauvWaterWarn;
import com.taauav.admin.service.ITauvWaterWarnService;

import javax.annotation.Resource;

/**
* 水质预警Service业务层处理
*
@@ -16,5 +20,28 @@ import com.taauav.admin.service.ITauvWaterWarnService;
@Service
public class TauvWaterWarnServiceImpl extends BaseServiceImpl<TauvWaterWarnMapper, TauvWaterWarn> implements ITauvWaterWarnService
{
@Resource
private Response response;

/**
* 添加编辑预警数据
* @param waterWarn
* @return
*/
@Override
public Response editWarn(TauvWaterWarn waterWarn) {
return null;
}

@Override
public Response cancelWarn(Integer[] ids) {
UpdateWrapper updateWrapper = new UpdateWrapper();
updateWrapper.in("id", ids);
updateWrapper.set("status", 3);
Boolean res = update(updateWrapper);
if (!res) {
return response.failure("操作失败");
}
return response.success("操作成功");
}
}

Laddar…
Avbryt
Spara