Commit a9a15a16 authored by kiritoausna's avatar kiritoausna

2022-5-10

parent a7a49d1b
...@@ -40,15 +40,16 @@ public class ArtificialPointController { ...@@ -40,15 +40,16 @@ public class ArtificialPointController {
@ApiOperation(value = "人工监测点位表分页列表", response = ArtificialPoint.class) @ApiOperation(value = "人工监测点位表分页列表", response = ArtificialPoint.class)
@GetMapping() @GetMapping()
public ResponseEntity<Object> list(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) { public ResponseEntity<Object> list(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
HashMap<String, Object> data = artificialPointService.plist(dataQueryCriteria,request); HashMap<String, Object> data = artificialPointService.plist(dataQueryCriteria, request);
return new ResponseEntity<>(new PageResult().success(data), HttpStatus.OK); return new ResponseEntity<>(new PageResult().success(data), HttpStatus.OK);
} }
@Log(value = "新增人工监测点位") @Log(value = "新增人工监测点位")
@ApiOperation(value = "人工监测点位表新增") @ApiOperation(value = "人工监测点位表新增")
@PostMapping() @PostMapping()
public Object add(@Valid @RequestBody ArtificialPoint param,HttpServletRequest request) { public Object add(@Valid @RequestBody ArtificialPoint param, HttpServletRequest request) {
boolean result = artificialPointService.add(param,request); param.setTime(new Date());
boolean result = artificialPointService.add(param, request);
if (result) { if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK); return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else { } else {
...@@ -59,9 +60,9 @@ public class ArtificialPointController { ...@@ -59,9 +60,9 @@ public class ArtificialPointController {
@Log(value = "修改人工监测点位") @Log(value = "修改人工监测点位")
@ApiOperation(value = "人工监测点位表修改") @ApiOperation(value = "人工监测点位表修改")
@PutMapping() @PutMapping()
public Object modify(@Valid @RequestBody ArtificialPoint param,HttpServletRequest request) { public Object modify(@Valid @RequestBody ArtificialPoint param, HttpServletRequest request) {
param.setTime(new Date()); param.setTime(new Date());
boolean result = artificialPointService.modify(param,request); boolean result = artificialPointService.modify(param, request);
if (result) { if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK); return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else { } else {
......
...@@ -93,8 +93,8 @@ public class DbDataController { ...@@ -93,8 +93,8 @@ public class DbDataController {
@ApiOperation(value = "图标历史") @ApiOperation(value = "图标历史")
@GetMapping("imghistory") @GetMapping("imghistory")
public ResponseEntity<Object> imgList(DataQueryCriteria dataQueryCriteria) { public ResponseEntity<Object> imgList(DataQueryCriteria dataQueryCriteria,HttpServletRequest request) {
ImgDataVo dbData = dbDataService.imgList(dataQueryCriteria); ImgDataVo dbData = dbDataService.imgList(dataQueryCriteria,request);
return new ResponseEntity<>(new PageResult().success(dbData), HttpStatus.OK); return new ResponseEntity<>(new PageResult().success(dbData), HttpStatus.OK);
} }
......
...@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.HashMap; import java.util.HashMap;
...@@ -81,9 +82,9 @@ public class DmDataController { ...@@ -81,9 +82,9 @@ public class DmDataController {
*/ */
@ApiOperation("获取内部位移的历史数据") @ApiOperation("获取内部位移的历史数据")
@GetMapping("history") @GetMapping("history")
public ResponseEntity<Object> gethistory(DataQueryCriteria dataQueryCriteria) { public ResponseEntity<Object> gethistory(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
try { try {
HashMap<String, Object> map = dmDataService.pageall(dataQueryCriteria); HashMap<String, Object> map = dmDataService.pageall(dataQueryCriteria, request);
return new ResponseEntity<>(new PageResult().success(map), HttpStatus.OK); return new ResponseEntity<>(new PageResult().success(map), HttpStatus.OK);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -93,18 +94,16 @@ public class DmDataController { ...@@ -93,18 +94,16 @@ public class DmDataController {
@ApiOperation(value = "图标历史") @ApiOperation(value = "图标历史")
@GetMapping("imghistory") @GetMapping("imghistory")
public ResponseEntity<Object> imgList(DataQueryCriteria dataQueryCriteria) { public ResponseEntity<Object> imgList(DataQueryCriteria dataQueryCriteria,HttpServletRequest request) {
ImgDataVo dbData = dmDataService.imgList(dataQueryCriteria); ImgDataVo dbData = dmDataService.imgList(dataQueryCriteria,request);
return new ResponseEntity<>(new PageResult().success(dbData), HttpStatus.OK); return new ResponseEntity<>(new PageResult().success(dbData), HttpStatus.OK);
} }
@ApiOperation(value = "导出excel") @ApiOperation(value = "导出excel")
@GetMapping("download") @GetMapping("download")
public void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria) { public void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
dmDataService.download(response, dataQueryCriteria); dmDataService.download(response, dataQueryCriteria,request);
} }
;
} }
...@@ -10,11 +10,15 @@ import me.zhengjie.gemho.util.PageResult; ...@@ -10,11 +10,15 @@ import me.zhengjie.gemho.util.PageResult;
import me.zhengjie.gemho.util.PostOrPutResult; import me.zhengjie.gemho.util.PostOrPutResult;
import me.zhengjie.gemho.util.RealVo; import me.zhengjie.gemho.util.RealVo;
import me.zhengjie.gemho.x_datavo.DataVo; import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.data.ImgDataVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -140,30 +144,15 @@ public class MpDataController { ...@@ -140,30 +144,15 @@ public class MpDataController {
/** /**
* 获取表面位移的历史数据 * 获取表面位移的历史数据
* *
* @param page * @param dataQueryCriteria
* @param size * @param request
* @param searchName
* @param searchValue
* @param limit
* @param timeSpace
* @param sort
* @param datasource
* @return * @return
*/ */
@ApiOperation("获取表面位移的历史数据") @ApiOperation("获取表面位移的历史数据")
@GetMapping("history") @GetMapping("history")
public ResponseEntity<Object> gethistory(@ApiParam(value = "分页参数,页数", required = true) String page, public ResponseEntity<Object> gethistory(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
@ApiParam(value = "分页参数,数量", required = true) String size,
@ApiParam(value = "查询条件字段") String searchName,
@ApiParam(value = "查询条件数值") String searchValue,
@ApiParam(value = "查询条件精准或者模糊") String limit,
@ApiParam(value = "查询条件时间区间") String timeSpace,
@ApiParam(value = "查询条件正序或者倒序") String sort,
@ApiParam(value = "数据来源, 1 历史数据 2人工巡检历史数据", required = true) String datasource) {
try { try {
long l = Long.parseLong(page); HashMap<String, Object> map = mpDataService.pageall(dataQueryCriteria, request);
long l1 = Long.parseLong(size);
HashMap<String, Object> map = mpDataService.pageall(searchName, searchValue, limit, timeSpace, sort, l, l1, datasource);
return new ResponseEntity<>(new PageResult().success(map), HttpStatus.OK); return new ResponseEntity<>(new PageResult().success(map), HttpStatus.OK);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -171,5 +160,17 @@ public class MpDataController { ...@@ -171,5 +160,17 @@ public class MpDataController {
return new ResponseEntity<>(new PageResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR); return new ResponseEntity<>(new PageResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
} }
@ApiOperation(value = "图标历史")
@GetMapping("imghistory")
public ResponseEntity<Object> imgList(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
ImgDataVo dbData = mpDataService.imgList(dataQueryCriteria, request);
return new ResponseEntity<>(new PageResult().success(dbData), HttpStatus.OK);
}
@ApiOperation(value = "导出excel")
@GetMapping("download")
public void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
mpDataService.download(response, dataQueryCriteria,request);
}
} }
...@@ -10,11 +10,15 @@ import me.zhengjie.gemho.util.PageResult; ...@@ -10,11 +10,15 @@ import me.zhengjie.gemho.util.PageResult;
import me.zhengjie.gemho.util.PostOrPutResult; import me.zhengjie.gemho.util.PostOrPutResult;
import me.zhengjie.gemho.util.RealVo; import me.zhengjie.gemho.util.RealVo;
import me.zhengjie.gemho.x_datavo.DataVo; import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.data.ImgDataVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -58,81 +62,30 @@ public class StDataController { ...@@ -58,81 +62,30 @@ public class StDataController {
return new ResponseEntity<>(new RealVo().failed(), HttpStatus.INTERNAL_SERVER_ERROR); return new ResponseEntity<>(new RealVo().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
} }
@ApiOperation(value = "新增浸润线人工巡检数据")
@PostMapping
public ResponseEntity<Object> add(@RequestBody StData stData) {
try {
Date time = stData.getTime();
String format = sdf.format(time);
int i = Integer.parseInt(format);
stData.setId(i);
stData.setDatasource(0);
stData.setCreatetime(new Date());
stData.setUpdatetime(new Date());
boolean b = stDataService.saveOrUpdate(stData);
if (b) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
}
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.OK);
} catch (NumberFormatException e) {
e.printStackTrace();
}
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.OK);
}
@ApiOperation(value = "删除浸润线人工巡检数据")
@DeleteMapping
public ResponseEntity<Object> deletedata(@RequestBody HashMap<String, Integer> map) {
try {
Integer id = map.get("id");
boolean b = stDataService.removeById(id);
if (b) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
}
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
} catch (Exception e) {
e.printStackTrace();
}
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
@ApiOperation(value = "修改人工巡检数据")
@PutMapping
public ResponseEntity<Object> updata(@RequestBody StData stData) {
try {
stData.setUpdatetime(new Date());
boolean b = stDataService.saveOrUpdate(stData);
if (b) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
}
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
} catch (Exception e) {
e.printStackTrace();
}
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
@ApiOperation(value = "分页查看") @ApiOperation(value = "分页查看")
@GetMapping("history") @GetMapping("history")
public ResponseEntity<Object> getall(@ApiParam(value = "分页参数,页数", required = true) String page, public ResponseEntity<Object> getall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
@ApiParam(value = "分页参数,数量", required = true) String size,
@ApiParam(value = "查询条件字段") String searchName,
@ApiParam(value = "查询条件数值") String searchValue,
@ApiParam(value = "查询条件精准或者模糊") String limit,
@ApiParam(value = "查询条件时间区间") String timeSpace,
@ApiParam(value = "查询条件正序或者倒序") String sort,
@ApiParam(value = "数据来源, 1 历史数据 2人工巡检历史数据", required = true) String datasource) {
try { try {
long l = Long.parseLong(page); HashMap<String, Object> map = stDataService.pageall(dataQueryCriteria, request);
long l1 = Long.parseLong(size);
HashMap<String, Object> map = stDataService.pageall(searchName, searchValue, limit, timeSpace, sort, l, l1, datasource);
return new ResponseEntity<>(new PageResult().success(map), HttpStatus.OK); return new ResponseEntity<>(new PageResult().success(map), HttpStatus.OK);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
e.printStackTrace(); e.printStackTrace();
} }
return new ResponseEntity<>(new PageResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR); return new ResponseEntity<>(new PageResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
} }
@ApiOperation(value = "图标历史")
@GetMapping("imghistory")
public ResponseEntity<Object> imgList(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
ImgDataVo dbData = stDataService.imgList(dataQueryCriteria, request);
return new ResponseEntity<>(new PageResult().success(dbData), HttpStatus.OK);
}
@ApiOperation(value = "导出excel")
@GetMapping("download")
public void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
stDataService.download(response, dataQueryCriteria,request);
}
} }
...@@ -10,11 +10,15 @@ import me.zhengjie.gemho.util.PageResult; ...@@ -10,11 +10,15 @@ import me.zhengjie.gemho.util.PageResult;
import me.zhengjie.gemho.util.PostOrPutResult; import me.zhengjie.gemho.util.PostOrPutResult;
import me.zhengjie.gemho.util.RealVo; import me.zhengjie.gemho.util.RealVo;
import me.zhengjie.gemho.x_datavo.DataVo; import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.data.ImgDataVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -114,25 +118,29 @@ public class WtDataController { ...@@ -114,25 +118,29 @@ public class WtDataController {
@ApiOperation(value = "分页查看") @ApiOperation(value = "分页查看")
@GetMapping("history") @GetMapping("history")
public ResponseEntity<Object> getall(@ApiParam(value = "分页参数,页数", required = true) String page, public ResponseEntity<Object> getall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
@ApiParam(value = "分页参数,数量", required = true) String size,
@ApiParam(value = "查询条件字段") String searchName,
@ApiParam(value = "查询条件数值") String searchValue,
@ApiParam(value = "查询条件精准或者模糊") String limit,
@ApiParam(value = "查询条件时间区间") String timeSpace,
@ApiParam(value = "查询条件正序或者倒序") String sort,
@ApiParam(value = "数据来源, 1 历史数据 2人工巡检历史数据", required = true) String datasource) {
try { try {
long l = Long.parseLong(page); HashMap<String, Object> map = wtDataService.pageall(dataQueryCriteria, request);
long l1 = Long.parseLong(size);
HashMap<String, Object> map = wtDataService.pageall(searchName, searchValue, limit, timeSpace, sort, l, l1, datasource);
return new ResponseEntity<>(new PageResult().success(map), HttpStatus.OK); return new ResponseEntity<>(new PageResult().success(map), HttpStatus.OK);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
e.printStackTrace(); e.printStackTrace();
} }
return new ResponseEntity<>(new PageResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR); return new ResponseEntity<>(new PageResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
} }
@ApiOperation(value = "图标历史")
@GetMapping("imghistory")
public ResponseEntity<Object> imgList(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
ImgDataVo dbData = wtDataService.imgList(dataQueryCriteria, request);
return new ResponseEntity<>(new PageResult().success(dbData), HttpStatus.OK);
}
@ApiOperation(value = "导出excel")
@GetMapping("download")
public void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
wtDataService.download(response, dataQueryCriteria,request);
}
} }
......
...@@ -60,7 +60,6 @@ public class UserTailponController { ...@@ -60,7 +60,6 @@ public class UserTailponController {
return new ResponseEntity<>(new PageResult().nopagesuccess(hashMap), HttpStatus.OK); return new ResponseEntity<>(new PageResult().nopagesuccess(hashMap), HttpStatus.OK);
} }
@Log("绑定用户尾矿库信息")
@ApiOperation(value = "绑定用户和尾矿信息") @ApiOperation(value = "绑定用户和尾矿信息")
@PostMapping() @PostMapping()
public ResponseEntity<Object> add(String username, ArrayList<HashMap<String, String>> maps) { public ResponseEntity<Object> add(String username, ArrayList<HashMap<String, String>> maps) {
......
package me.zhengjie.gemho.entity.data; package me.zhengjie.gemho.entity.data;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
...@@ -40,6 +41,10 @@ public class MpData implements Serializable { ...@@ -40,6 +41,10 @@ public class MpData implements Serializable {
*/ */
@ApiModelProperty("设备id") @ApiModelProperty("设备id")
public String sensorid; public String sensorid;
/**
* 设备名称
*/
public String sensorname;
/** /**
* 测量时间 * 测量时间
...@@ -171,4 +176,15 @@ public class MpData implements Serializable { ...@@ -171,4 +176,15 @@ public class MpData implements Serializable {
public String bjjb; public String bjjb;
@TableField(exist = false)
private String jcziitemname;
@TableField(exist = false)
private String jcvalue;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
@TableField(exist = false)
private Date jctime;
} }
package me.zhengjie.gemho.entity.data; package me.zhengjie.gemho.entity.data;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -40,6 +42,8 @@ public class StData implements Serializable { ...@@ -40,6 +42,8 @@ public class StData implements Serializable {
@ApiModelProperty("设备id") @ApiModelProperty("设备id")
public String sensorid; public String sensorid;
public String sensorname;
/** /**
* 测量时间 * 测量时间
*/ */
...@@ -89,4 +93,15 @@ public class StData implements Serializable { ...@@ -89,4 +93,15 @@ public class StData implements Serializable {
public String bjjb; public String bjjb;
@TableField(exist = false)
public String jcziitemname;
@TableField(exist = false)
public String jcvalue;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
@TableField(exist = false)
public Date jctime;
} }
package me.zhengjie.gemho.entity.data; package me.zhengjie.gemho.entity.data;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -40,6 +42,8 @@ public class WtData implements Serializable { ...@@ -40,6 +42,8 @@ public class WtData implements Serializable {
@ApiModelProperty(value = "设备id") @ApiModelProperty(value = "设备id")
public String sensorid; public String sensorid;
public String sensorname;
/** /**
* 测量时间 * 测量时间
*/ */
...@@ -83,4 +87,14 @@ public class WtData implements Serializable { ...@@ -83,4 +87,14 @@ public class WtData implements Serializable {
public Integer datasource; public Integer datasource;
@TableField(exist = false)
private String jcziitemname;
@TableField(exist = false)
private String jcvalue;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
@TableField(exist = false)
private Date jctime;
} }
...@@ -19,7 +19,7 @@ import java.io.Serializable; ...@@ -19,7 +19,7 @@ import java.io.Serializable;
*/ */
@Getter @Getter
@Setter @Setter
@TableName("sys_devicetype") @TableName("tab_devicetype")
public class SysType implements Serializable { public class SysType implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
...@@ -28,19 +28,19 @@ public interface SysSummaryMapper extends BaseMapper<SysSummary> { ...@@ -28,19 +28,19 @@ public interface SysSummaryMapper extends BaseMapper<SysSummary> {
@Select(value = "select id from sys_summary where mdcode =#{mdcode} ") @Select(value = "select id from sys_summary where mdcode =#{mdcode} ")
List<Integer> getcode(String mdcode); List<Integer> getcode(String mdcode);
@Select(value = "select a.id as id ,a.title as title from sys_summary a JOIN sys_devicetype b on a.type=b.type where b.must = '1' and a.name=#{tailingno} " + @Select(value = "select a.id as id ,a.title as title from sys_summary a JOIN tab_devicetype b on a.type=b.type where b.must = '1' and a.name=#{tailingno} " +
"UNION\n" + "UNION\n" +
"select a.id as id,a.title as title from sys_summary a JOIN sys_devicetype b on a.type=b.type where a.deviceid in (select equipno FROM tb_drybeachequipinfor where tailingid = #{tailingno}) ORDER BY id DESC") "select a.id as id,a.title as title from sys_summary a JOIN tab_devicetype b on a.type=b.type where a.deviceid in (select equipno FROM tb_drybeachequipinfor where tailingid = #{tailingno}) ORDER BY id DESC")
List<Map<String, Object>> getUncode(String tailingno); List<Map<String, Object>> getUncode(String tailingno);
@Select(value = "select a.id as id ,a.title as title from sys_summary a JOIN sys_devicetype b on a.type=b.type where b.must = '2' and a.name = #{tailingno}") @Select(value = "select a.id as id ,a.title as title from sys_summary a JOIN tab_devicetype b on a.type=b.type where b.must = '2' and a.name = #{tailingno}")
List<Map<String, Object>> getUncodem(String tailingno); List<Map<String, Object>> getUncodem(String tailingno);
@Select(value = "SELECT * FROM `sys_summary` where type!='t_14' and name =#{tailingno}\n" + @Select(value = "SELECT * FROM `sys_summary` where type!='t_14' and name =#{tailingno}\n" +
"UNION\n" + "UNION\n" +
"SELECT a.* FROM `sys_summary` a JOIN monitorvideo b ON a.id = b.v_sumid where name =#{tailingno}\n" + "SELECT a.* FROM `sys_summary` a JOIN monitorvideo b ON a.id = b.v_sumid where name =#{tailingno}\n" +
"UNION\n" + "UNION\n" +
"select a.* from sys_summary a JOIN sys_devicetype b on a.type=b.type where a.deviceid in (select equipno FROM tb_drybeachequipinfor where tailingid =#{tailingno}) ORDER BY id DESC") "select a.* from sys_summary a JOIN tab_devicetype b on a.type=b.type where a.deviceid in (select equipno FROM tb_drybeachequipinfor where tailingid =#{tailingno}) ORDER BY id DESC")
Page<SysSummary> getbyeqno(Page page, @Param("tailingno") String tailingno); Page<SysSummary> getbyeqno(Page page, @Param("tailingno") String tailingno);
...@@ -48,13 +48,13 @@ public interface SysSummaryMapper extends BaseMapper<SysSummary> { ...@@ -48,13 +48,13 @@ public interface SysSummaryMapper extends BaseMapper<SysSummary> {
"UNION\n" + "UNION\n" +
"SELECT a.* FROM `sys_summary` a JOIN monitorvideo b ON a.id = b.v_sumid where name =#{tailingno}\n" + "SELECT a.* FROM `sys_summary` a JOIN monitorvideo b ON a.id = b.v_sumid where name =#{tailingno}\n" +
"UNION\n" + "UNION\n" +
"select a.* from sys_summary a JOIN sys_devicetype b on a.type=b.type where a.deviceid in (select equipno FROM tb_drybeachequipinfor where tailingid =#{tailingno}) ORDER BY id DESC) r where r.title like CONCAT(CONCAT('%', #{searchValue}), '%')") "select a.* from sys_summary a JOIN tab_devicetype b on a.type=b.type where a.deviceid in (select equipno FROM tb_drybeachequipinfor where tailingid =#{tailingno}) ORDER BY id DESC) r where r.title like CONCAT(CONCAT('%', #{searchValue}), '%')")
Page<SysSummary> getbyeqnobyseach(Page page, @Param("tailingno") String tailingno, String searchValue); Page<SysSummary> getbyeqnobyseach(Page page, @Param("tailingno") String tailingno, String searchValue);
/* @Select(value = "SELECT a.* FROM `sys_summary` a JOIN monitorvideo b ON a.id = b.v_sumid where name =#{tailingno}") /* @Select(value = "SELECT a.* FROM `sys_summary` a JOIN monitorvideo b ON a.id = b.v_sumid where name =#{tailingno}")
Page<SysSummary> getbyeqno(Page page, @Param("tailingno") String tailingno); Page<SysSummary> getbyeqno(Page page, @Param("tailingno") String tailingno);
@Select(value = "select a.* from sys_summary a JOIN sys_devicetype b on a.type=b.type where a.deviceid in (select equipno FROM tb_drybeachequipinfor where tailingid =#{tailingno}) ORDER BY id DESC") @Select(value = "select a.* from sys_summary a JOIN tab_devicetype b on a.type=b.type where a.deviceid in (select equipno FROM tb_drybeachequipinfor where tailingid =#{tailingno}) ORDER BY id DESC")
Page<SysSummary> getbyeqno1(Page page, @Param("tailingno") String tailingno); Page<SysSummary> getbyeqno1(Page page, @Param("tailingno") String tailingno);
@Select(value = "SELECT * FROM `sys_summary` where type!='t_14' and name =#{tailingno}") @Select(value = "SELECT * FROM `sys_summary` where type!='t_14' and name =#{tailingno}")
......
...@@ -18,12 +18,12 @@ import java.util.List; ...@@ -18,12 +18,12 @@ import java.util.List;
@Mapper @Mapper
public interface SysTypeMapper extends BaseMapper<SysType> { public interface SysTypeMapper extends BaseMapper<SysType> {
@Select(value = " SELECT must FROM `sys_devicetype` where type=#{type}") @Select(value = " SELECT must FROM `tab_devicetype` where type=#{type}")
int getMust(String type); int getMust(String type);
@Select(value = "select b.name from tb_drybeachequipinfor a join sys_devicetype b on a.devicetype=b.`code` where tailingid=#{tailingid}") @Select(value = "select b.name from tb_drybeachequipinfor a join tab_devicetype b on a.devicetype=b.`code` where tailingid=#{tailingid}")
List<String> getbytailno(String tailingid); List<String> getbytailno(String tailingid);
@Select(value = "SELECT name FROM `sys_devicetype` where must = 0 or name ='水质'") @Select(value = "SELECT name FROM `tab_devicetype` where must = 0 or name ='水质'")
List<String> getname(); List<String> getname();
} }
...@@ -31,7 +31,10 @@ public interface DrybeachequipinforMapper extends BaseMapper<Drybeachequipinfor> ...@@ -31,7 +31,10 @@ public interface DrybeachequipinforMapper extends BaseMapper<Drybeachequipinfor>
@Select(value = "select b.tailingno as value ,b.tailingname as name FROM `tab_user_tailpon` a join tb_tailpondinfor b on a.tailingno=b.tailingno where a.username=#{username}") @Select(value = "select b.tailingno as value ,b.tailingname as name FROM `tab_user_tailpon` a join tb_tailpondinfor b on a.tailingno=b.tailingno where a.username=#{username}")
ArrayList<Dic> gettailingid(String username); ArrayList<Dic> gettailingid(String username);
@Select(value = "select code as value ,name from sys_devicetype where must ='0' or type='t_8' ") @Select(value = "select tailingno as value ,tailingname as name from tb_tailpondinfor")
ArrayList<Dic> gettailingid();
@Select(value = "select code as value ,name from tab_devicetype where must ='0' or type='t_8' ")
ArrayList<Dic> getdevicetype(); ArrayList<Dic> getdevicetype();
@Select(value = "select equipno from tb_drybeachequipinfor where tailingid = #{tailingid}") @Select(value = "select equipno from tb_drybeachequipinfor where tailingid = #{tailingid}")
...@@ -62,7 +65,7 @@ public interface DrybeachequipinforMapper extends BaseMapper<Drybeachequipinfor> ...@@ -62,7 +65,7 @@ public interface DrybeachequipinforMapper extends BaseMapper<Drybeachequipinfor>
"SELECT count(distinct sensorid)AS `online` from tb_sl_data a join tb_drybeachequipinfor b on a.sensorid=b.equipno WHERE a.time >=DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%m-%d')and b.tailingid=#{tailingid}") "SELECT count(distinct sensorid)AS `online` from tb_sl_data a join tb_drybeachequipinfor b on a.sensorid=b.equipno WHERE a.time >=DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%m-%d')and b.tailingid=#{tailingid}")
ArrayList<Integer> getonlinecount(String tailingid); ArrayList<Integer> getonlinecount(String tailingid);
@Select(value = "select a.type from sys_devicetype a join tb_drybeachequipinfor b on a.`code`= b.devicetype where b.equipno=#{equipno}") @Select(value = "select a.type from tab_devicetype a join tb_drybeachequipinfor b on a.`code`= b.devicetype where b.equipno=#{equipno}")
String getdrytype(String equipno); String getdrytype(String equipno);
int deleteall(String equipno); int deleteall(String equipno);
......
...@@ -36,7 +36,7 @@ public interface TabAbnormalMapper extends BaseMapper<Abnormal> { ...@@ -36,7 +36,7 @@ public interface TabAbnormalMapper extends BaseMapper<Abnormal> {
"sum(case when alarmlevel =2 then 1 else 0 end )as \"orange\",\n" + "sum(case when alarmlevel =2 then 1 else 0 end )as \"orange\",\n" +
"sum(case when alarmlevel =3 then 1 else 0 end )as \"yellow\",\n" + "sum(case when alarmlevel =3 then 1 else 0 end )as \"yellow\",\n" +
"sum(case when alarmlevel =4 then 1 else 0 end )as \"blue\" \n" + "sum(case when alarmlevel =4 then 1 else 0 end )as \"blue\" \n" +
"FROM (SELECT * from tab_abnormal where DATE_FORMAT(time,'%y') =DATE_FORMAT(NOW(),'%y') ) a right join (SELECT tdr.equipno as equipno ,tdr.devicetype as `code` ,ssd.`name` as `name` FROM `tb_drybeachequipinfor` tdr join sys_devicetype ssd on tdr.devicetype =ssd.`code` WHERE tdr.tailingid=#{tailno}) b on a.equipno= b.equipno GROUP BY b.code") "FROM (SELECT * from tab_abnormal where DATE_FORMAT(time,'%y') =DATE_FORMAT(NOW(),'%y') ) a right join (SELECT tdr.equipno as equipno ,tdr.devicetype as `code` ,ssd.`name` as `name` FROM `tb_drybeachequipinfor` tdr join tab_devicetype ssd on tdr.devicetype =ssd.`code` WHERE tdr.tailingid=#{tailno}) b on a.equipno= b.equipno GROUP BY b.code")
List<HashMap<String, Object>> statistics(String tailno); List<HashMap<String, Object>> statistics(String tailno);
@Select(value = "select count(a.equipno) as count ,b.equipname,b.equipno ,\n" + @Select(value = "select count(a.equipno) as count ,b.equipname,b.equipno ,\n" +
...@@ -53,7 +53,7 @@ public interface TabAbnormalMapper extends BaseMapper<Abnormal> { ...@@ -53,7 +53,7 @@ public interface TabAbnormalMapper extends BaseMapper<Abnormal> {
"sum(case when alarmlevel =2 then 1 else 0 end )as \"2\",\n" + "sum(case when alarmlevel =2 then 1 else 0 end )as \"2\",\n" +
"sum(case when alarmlevel =3 then 1 else 0 end )as \"3\",\n" + "sum(case when alarmlevel =3 then 1 else 0 end )as \"3\",\n" +
"sum(case when alarmlevel =4 then 1 else 0 end )as \"4\" \n" + "sum(case when alarmlevel =4 then 1 else 0 end )as \"4\" \n" +
"FROM (SELECT * from tab_abnormal where DATE_FORMAT(time,'%y') =DATE_FORMAT(NOW(),'%y') and state = 1) a right join (SELECT tdr.equipno as equipno ,tdr.devicetype as `code` ,ssd.`name` as `name` FROM `tb_drybeachequipinfor` tdr join sys_devicetype ssd on tdr.devicetype =ssd.`code` WHERE tdr.tailingid=#{tailno}) b on a.equipno= b.equipno GROUP BY b.code") "FROM (SELECT * from tab_abnormal where DATE_FORMAT(time,'%y') =DATE_FORMAT(NOW(),'%y') and state = 1) a right join (SELECT tdr.equipno as equipno ,tdr.devicetype as `code` ,ssd.`name` as `name` FROM `tb_drybeachequipinfor` tdr join tab_devicetype ssd on tdr.devicetype =ssd.`code` WHERE tdr.tailingid=#{tailno}) b on a.equipno= b.equipno GROUP BY b.code")
List<HashMap<String, Object>> statistics1(String tailno); List<HashMap<String, Object>> statistics1(String tailno);
...@@ -73,7 +73,7 @@ public interface TabAbnormalMapper extends BaseMapper<Abnormal> { ...@@ -73,7 +73,7 @@ public interface TabAbnormalMapper extends BaseMapper<Abnormal> {
"\telse ta.alarmlevel\n" + "\telse ta.alarmlevel\n" +
" end\n" + " end\n" +
" as alarmlevel\n" + " as alarmlevel\n" +
" from (select * from tab_abnormal ORDER BY alarmlevel DESC) ta RIGHT join (SELECT tdr.equipno as equipno ,tdr.devicetype as `code` ,ssd.`name` as `name` FROM `tb_drybeachequipinfor` tdr join sys_devicetype ssd on tdr.devicetype =ssd.`code` WHERE tdr.tailingid=#{tailno}) sd on sd.`equipno`=ta.equipno GROUP BY sd.`code`") " from (select * from tab_abnormal ORDER BY alarmlevel DESC) ta RIGHT join (SELECT tdr.equipno as equipno ,tdr.devicetype as `code` ,ssd.`name` as `name` FROM `tb_drybeachequipinfor` tdr join tab_devicetype ssd on tdr.devicetype =ssd.`code` WHERE tdr.tailingid=#{tailno}) sd on sd.`equipno`=ta.equipno GROUP BY sd.`code`")
List<HashMap<String, Object>> gettypelist(String tailno); List<HashMap<String, Object>> gettypelist(String tailno);
@Select(value = "select case ta.alarmlevel when '1' then 'red'\n" + @Select(value = "select case ta.alarmlevel when '1' then 'red'\n" +
......
...@@ -69,7 +69,7 @@ public interface DbDataService extends IService<DbData> { ...@@ -69,7 +69,7 @@ public interface DbDataService extends IService<DbData> {
* @param dataQueryCriteria * @param dataQueryCriteria
* @return * @return
*/ */
ImgDataVo imgList(DataQueryCriteria dataQueryCriteria); ImgDataVo imgList(DataQueryCriteria dataQueryCriteria, HttpServletRequest request);
/** /**
...@@ -82,5 +82,5 @@ public interface DbDataService extends IService<DbData> { ...@@ -82,5 +82,5 @@ public interface DbDataService extends IService<DbData> {
/*** /***
* 导出干滩表格 * 导出干滩表格
*/ */
void download(DataQueryCriteria dataQueryCriteria, HttpServletResponse response,HttpServletRequest request) throws IOException; void download(DataQueryCriteria dataQueryCriteria, HttpServletResponse response, HttpServletRequest request) throws IOException;
} }
...@@ -60,7 +60,7 @@ public interface DmDataService extends IService<DmData> { ...@@ -60,7 +60,7 @@ public interface DmDataService extends IService<DmData> {
* @param dataQueryCriteria * @param dataQueryCriteria
* @return * @return
*/ */
HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria); HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria,HttpServletRequest request);
/** /**
* 实时数据 * 实时数据
...@@ -75,8 +75,8 @@ public interface DmDataService extends IService<DmData> { ...@@ -75,8 +75,8 @@ public interface DmDataService extends IService<DmData> {
* @param dataQueryCriteria * @param dataQueryCriteria
* @return * @return
*/ */
ImgDataVo imgList(DataQueryCriteria dataQueryCriteria); ImgDataVo imgList(DataQueryCriteria dataQueryCriteria,HttpServletRequest request);
void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria); void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria,HttpServletRequest request);
} }
...@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.data.MpData; import me.zhengjie.gemho.entity.data.MpData;
import me.zhengjie.gemho.x_datavo.DataVo; import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.RealDataVo; import me.zhengjie.gemho.x_datavo.RealDataVo;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.data.ImgDataVo;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -50,25 +53,31 @@ public interface MpDataService extends IService<MpData> { ...@@ -50,25 +53,31 @@ public interface MpDataService extends IService<MpData> {
List<MpData> demo(String date, String values, String deviceid); List<MpData> demo(String date, String values, String deviceid);
/**
* 实时数据
*
* @return
*/
List<RealDataVo> real(String equipno, HttpServletRequest request);
/** /**
* 分页历史 * 分页历史
* *
* @param searchName * @param dataQueryCriteria
* @param searchValue * @param request
* @param limit
* @param timeSpace
* @param sort
* @param page
* @param size
* @param datasource
* @return * @return
*/ */
HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size, String datasource); HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request);
/** /**
* 实时数据 * 图表数据
* *
* @param dataQueryCriteria
* @param request
* @return * @return
*/ */
List<RealDataVo> real(String equipno, HttpServletRequest request); ImgDataVo imgList(DataQueryCriteria dataQueryCriteria, HttpServletRequest request);
void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria, HttpServletRequest request);
} }
...@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.data.StData; import me.zhengjie.gemho.entity.data.StData;
import me.zhengjie.gemho.x_datavo.DataVo; import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.RealDataVo; import me.zhengjie.gemho.x_datavo.RealDataVo;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.data.ImgDataVo;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -53,18 +56,11 @@ public interface StDataService extends IService<StData> { ...@@ -53,18 +56,11 @@ public interface StDataService extends IService<StData> {
/** /**
* 分页历史记录 * 分页历史记录
* * @param dataQueryCriteria
* @param searchName * @param request
* @param searchValue
* @param limit
* @param timeSpace
* @param sort
* @param page
* @param size
* @param datasource
* @return * @return
*/ */
HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size, String datasource); HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request);
/** /**
* 实时数据 * 实时数据
...@@ -73,4 +69,15 @@ public interface StDataService extends IService<StData> { ...@@ -73,4 +69,15 @@ public interface StDataService extends IService<StData> {
* @return * @return
*/ */
List<RealDataVo> real(String equipno, HttpServletRequest request); List<RealDataVo> real(String equipno, HttpServletRequest request);
/**
* 图表数据
*
* @param dataQueryCriteria
* @param request
* @return
*/
ImgDataVo imgList(DataQueryCriteria dataQueryCriteria, HttpServletRequest request);
void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria, HttpServletRequest request);
} }
...@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.data.WtData; import me.zhengjie.gemho.entity.data.WtData;
import me.zhengjie.gemho.x_datavo.DataVo; import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.RealDataVo; import me.zhengjie.gemho.x_datavo.RealDataVo;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.data.ImgDataVo;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -50,21 +53,26 @@ public interface WtDataService extends IService<WtData> { ...@@ -50,21 +53,26 @@ public interface WtDataService extends IService<WtData> {
* @return * @return
*/ */
DataVo month(String date, String values, String deviceid, String subitem); DataVo month(String date, String values, String deviceid, String subitem);
/**
* 分页历史
*
* @param dataQueryCriteria
* @param request
* @return
*/
HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request);
/** /**
* 分页历史记录 * 图表数据
* *
* @param searchName * @param dataQueryCriteria
* @param searchValue * @param request
* @param limit
* @param timeSpace
* @param sort
* @param page
* @param size
* @param datasource
* @return * @return
*/ */
HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size, String datasource); ImgDataVo imgList(DataQueryCriteria dataQueryCriteria, HttpServletRequest request);
void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria, HttpServletRequest request);
/** /**
* 实时数据 * 实时数据
......
...@@ -308,6 +308,8 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme ...@@ -308,6 +308,8 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
dbDataPage = dbDataMapper.selectPage(dbDataPage, dbDataQueryWrapper); dbDataPage = dbDataMapper.selectPage(dbDataPage, dbDataQueryWrapper);
List<DbData> records = dbDataPage.getRecords(); List<DbData> records = dbDataPage.getRecords();
long total = dbDataPage.getTotal(); long total = dbDataPage.getTotal();
//获取编码-名字map
HashMap<String, String> noName = ServiceUtil.getNoName(request);
//判断是否需要人工监测数据 //判断是否需要人工监测数据
String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria); String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria);
if (checkArtificial != null) { if (checkArtificial != null) {
...@@ -316,6 +318,7 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme ...@@ -316,6 +318,7 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
HashMap<String, Integer> point = ServiceUtil.artificialPoint(); HashMap<String, Integer> point = ServiceUtil.artificialPoint();
List<ArtificialData> artificialDataList = ServiceUtil.artificialDataDeal(page, size, checkArtificial, dataQueryCriteria); List<ArtificialData> artificialDataList = ServiceUtil.artificialDataDeal(page, size, checkArtificial, dataQueryCriteria);
for (DbData record : records) { for (DbData record : records) {
record.setSensorname(noName.get(record.getSensorid()));
Date time = record.getTime(); Date time = record.getTime();
for (ArtificialData artificialData : artificialDataList) { for (ArtificialData artificialData : artificialDataList) {
boolean b = false; boolean b = false;
...@@ -333,6 +336,10 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme ...@@ -333,6 +336,10 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
} }
} }
} }
} else {
for (DbData record : records) {
record.setSensorname(noName.get(record.getSensorid()));
}
} }
map.put("list", records); map.put("list", records);
map.put("total", total); map.put("total", total);
...@@ -340,22 +347,28 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme ...@@ -340,22 +347,28 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
} }
@Override @Override
public ImgDataVo imgList(DataQueryCriteria dataQueryCriteria) { public ImgDataVo imgList(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
String code = dataQueryCriteria.getCode(); String code = dataQueryCriteria.getCode();
if (code == null) { if (code == null) {
//获取当前尾矿库
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>(); QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>();
drybeachequipinforQueryWrapper.eq("devicetype", "1").orderByDesc("id"); drybeachequipinforQueryWrapper.eq("devicetype", "1").eq("tailingid", tailInfoNo).orderByDesc("id");
Drybeachequipinfor drybeachequipinfor = drybeachequipinforMapper.selectList(drybeachequipinforQueryWrapper).get(0); Drybeachequipinfor drybeachequipinfor = drybeachequipinforMapper.selectList(drybeachequipinforQueryWrapper).get(0);
dataQueryCriteria.setCode(drybeachequipinfor.getEquipno()); dataQueryCriteria.setCode(drybeachequipinfor.getEquipno());
} }
QueryWrapper<DbData> dbDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<DbData> dbDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.imgQuery(dbDataQueryWrapper, dataQueryCriteria); ServiceUtil.imgQuery(dbDataQueryWrapper, dataQueryCriteria);
List<DbData> dbData = dbDataMapper.selectList(dbDataQueryWrapper); List<DbData> dbData = dbDataMapper.selectList(dbDataQueryWrapper);
//获取编码-名
HashMap<String, String> noName = ServiceUtil.getNoName(request);
String sensorname = noName.get(dataQueryCriteria.getCode());
//封装处理数据 //封装处理数据
HashMap<String, List<Map>> realdata = ReadJsonFileUtil.getMap("realdata"); HashMap<String, List<Map>> realdata = ReadJsonFileUtil.getMap("realdata");
List<Map> dbdata = realdata.get("dbdata"); List<Map> dbdata = realdata.get("dbdata");
ImgDataVo imgDataVo = new ImgDataVo(); ImgDataVo imgDataVo = new ImgDataVo();
ArrayList<Result> results = new ArrayList<>(); ArrayList<Result> results = new ArrayList<>();
if (!dbData.isEmpty()) {
for (DbData dbDatum : dbData) { for (DbData dbDatum : dbData) {
HashMap map = new HashMap<String, Object>(); HashMap map = new HashMap<String, Object>();
for (Field declaredField : dbDatum.getClass().getDeclaredFields()) { for (Field declaredField : dbDatum.getClass().getDeclaredFields()) {
...@@ -376,8 +389,9 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme ...@@ -376,8 +389,9 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
result.setValues(map); result.setValues(map);
results.add(result); results.add(result);
} }
}
imgDataVo.setLists(results); imgDataVo.setLists(results);
imgDataVo.setSensorname(dataQueryCriteria.getSensorname()); imgDataVo.setSensorname(sensorname);
imgDataVo.setNames(dbdata); imgDataVo.setNames(dbdata);
return imgDataVo; return imgDataVo;
} }
......
...@@ -3,6 +3,7 @@ package me.zhengjie.gemho.service.data.impl; ...@@ -3,6 +3,7 @@ package me.zhengjie.gemho.service.data.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.SneakyThrows;
import me.zhengjie.gemho.entity.artificial.ArtificialData; import me.zhengjie.gemho.entity.artificial.ArtificialData;
import me.zhengjie.gemho.entity.data.DmData; import me.zhengjie.gemho.entity.data.DmData;
import me.zhengjie.gemho.entity.tab.Drybeachequipinfor; import me.zhengjie.gemho.entity.tab.Drybeachequipinfor;
...@@ -16,6 +17,7 @@ import me.zhengjie.gemho.x_datavo.RealDataVo; ...@@ -16,6 +17,7 @@ import me.zhengjie.gemho.x_datavo.RealDataVo;
import me.zhengjie.gemho.x_datavo.Result; import me.zhengjie.gemho.x_datavo.Result;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria; import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.data.ImgDataVo; import me.zhengjie.gemho.x_datavo.data.ImgDataVo;
import me.zhengjie.utils.FileUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -307,15 +309,17 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme ...@@ -307,15 +309,17 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme
} }
@Override @Override
public HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria) { public HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
long page = dataQueryCriteria.getPage(); long page = dataQueryCriteria.getPage();
long size = dataQueryCriteria.getSize(); long size = dataQueryCriteria.getSize();
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
QueryWrapper<DmData> dmDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<DmData> dmDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.dataQuery(dmDataQueryWrapper, dataQueryCriteria); ServiceUtil.dbquery(dmDataQueryWrapper, dataQueryCriteria, request);
Page<DmData> dmDataPage = new Page<>(page + 1, size); Page<DmData> dmDataPage = new Page<>(page + 1, size);
dmDataPage = dmDataMapper.selectPage(dmDataPage, dmDataQueryWrapper); dmDataPage = dmDataMapper.selectPage(dmDataPage, dmDataQueryWrapper);
List<DmData> records = dmDataPage.getRecords(); List<DmData> records = dmDataPage.getRecords();
//获取编码-名字map
HashMap<String, String> noName = ServiceUtil.getNoName(request);
//处理人工监测数据 //处理人工监测数据
String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria); String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria);
if (checkArtificial != null) { if (checkArtificial != null) {
...@@ -323,6 +327,7 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme ...@@ -323,6 +327,7 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme
HashMap<String, Integer> point = ServiceUtil.artificialPoint(); HashMap<String, Integer> point = ServiceUtil.artificialPoint();
List<ArtificialData> artificialDataList = ServiceUtil.artificialDataDeal(page, size, checkArtificial, dataQueryCriteria); List<ArtificialData> artificialDataList = ServiceUtil.artificialDataDeal(page, size, checkArtificial, dataQueryCriteria);
for (DmData record : records) { for (DmData record : records) {
record.setSensorname(noName.get(record.getSensorid()));
Date time = record.getTime(); Date time = record.getTime();
for (ArtificialData artificialData : artificialDataList) { for (ArtificialData artificialData : artificialDataList) {
boolean b = false; boolean b = false;
...@@ -340,6 +345,10 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme ...@@ -340,6 +345,10 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme
} }
} }
} }
} else {
for (DmData record : records) {
record.setSensorname(noName.get(record.getSensorid()));
}
} }
map.put("list", records); map.put("list", records);
map.put("total", dmDataPage.getTotal()); map.put("total", dmDataPage.getTotal());
...@@ -377,19 +386,24 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme ...@@ -377,19 +386,24 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme
} }
@Override @Override
public ImgDataVo imgList(DataQueryCriteria dataQueryCriteria) { public ImgDataVo imgList(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
String sensorname = dataQueryCriteria.getSensorname(); String code = dataQueryCriteria.getCode();
if (sensorname == null) { if (code == null) {
//获取当前尾矿库编码
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>(); QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>();
drybeachequipinforQueryWrapper.eq("devicetype", "4").orderByDesc("id"); drybeachequipinforQueryWrapper.eq("devicetype", "4").eq("tailingid", tailInfoNo).orderByDesc("id");
Drybeachequipinfor drybeachequipinfor = drybeachequipinforMapper.selectList(drybeachequipinforQueryWrapper).get(0); Drybeachequipinfor drybeachequipinfor = drybeachequipinforMapper.selectList(drybeachequipinforQueryWrapper).get(0);
dataQueryCriteria.setSensorname(drybeachequipinfor.getEquipname()); dataQueryCriteria.setCode(drybeachequipinfor.getEquipno());
} }
QueryWrapper<DmData> dmDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<DmData> dmDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.imgQuery(dmDataQueryWrapper, dataQueryCriteria); ServiceUtil.imgQuery(dmDataQueryWrapper, dataQueryCriteria);
List<DmData> dmData = dmDataMapper.selectList(dmDataQueryWrapper); List<DmData> dmData = dmDataMapper.selectList(dmDataQueryWrapper);
//获取编码-名
HashMap<String, String> noName = ServiceUtil.getNoName(request);
String sensorname = noName.get(dataQueryCriteria.getCode());
//处理封装数据 //处理封装数据
ImgDataVo dmdata = ServiceUtil.deal("dmdata", dataQueryCriteria.getSensorname(), dmData); ImgDataVo dmdata = ServiceUtil.deal("dmdata", sensorname, dmData);
return dmdata; return dmdata;
} }
...@@ -404,15 +418,23 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme ...@@ -404,15 +418,23 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme
return stringListHashMap[i]; return stringListHashMap[i];
} }
@SneakyThrows
@Override @Override
public void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria) { public void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
//获取数据 //获取数据
List<DmData> list = (List<DmData>) pageall(dataQueryCriteria).get("list"); List<DmData> list = (List<DmData>) pageall(dataQueryCriteria, request).get("list");
String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria); String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria);
ArrayList<Map<String, Object>> maps = new ArrayList<>();
for (DmData dmData : list) { for (DmData dmData : list) {
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
map.put("设备编号", dmData.getSensorid()); map.put("设备编号", dmData.getSensorid());
map.put("设备名称", dmData.getSensorname()); map.put("设备名称", dmData.getSensorname());
map.put("a轴变化量", dmData.getDispA());
map.put("b轴变化量", dmData.getDispB());
map.put("是否报警", dmData.getState() == 0 ? "否" : "是");
map.put("监测时间", dmData.getTime());
maps.add(map);
} }
FileUtil.downloadExcel(maps, "数据监测: 内部位移", response);
} }
} }
...@@ -3,7 +3,11 @@ package me.zhengjie.gemho.service.data.impl; ...@@ -3,7 +3,11 @@ package me.zhengjie.gemho.service.data.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.SneakyThrows;
import me.zhengjie.gemho.entity.artificial.ArtificialData;
import me.zhengjie.gemho.entity.data.MpData; import me.zhengjie.gemho.entity.data.MpData;
import me.zhengjie.gemho.entity.tab.Drybeachequipinfor;
import me.zhengjie.gemho.mapper.artificial.ArtificialDataMapper;
import me.zhengjie.gemho.mapper.data.MpDataMapper; import me.zhengjie.gemho.mapper.data.MpDataMapper;
import me.zhengjie.gemho.mapper.tab.DrybeachequipinforMapper; import me.zhengjie.gemho.mapper.tab.DrybeachequipinforMapper;
import me.zhengjie.gemho.service.data.MpDataService; import me.zhengjie.gemho.service.data.MpDataService;
...@@ -12,10 +16,14 @@ import me.zhengjie.gemho.x_datavo.DataVo; ...@@ -12,10 +16,14 @@ import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.NameVo; import me.zhengjie.gemho.x_datavo.NameVo;
import me.zhengjie.gemho.x_datavo.RealDataVo; import me.zhengjie.gemho.x_datavo.RealDataVo;
import me.zhengjie.gemho.x_datavo.Result; import me.zhengjie.gemho.x_datavo.Result;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.data.ImgDataVo;
import me.zhengjie.utils.FileUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -35,6 +43,8 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme ...@@ -35,6 +43,8 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme
private MpDataMapper mpDataMapper; private MpDataMapper mpDataMapper;
@Autowired @Autowired
private DrybeachequipinforMapper drybeachequipinforMapper; private DrybeachequipinforMapper drybeachequipinforMapper;
@Autowired
private ArtificialDataMapper artificialDataMapper;
@Override @Override
public DataVo day(String date, String values, String deviceid) { public DataVo day(String date, String values, String deviceid) {
...@@ -323,13 +333,56 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme ...@@ -323,13 +333,56 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme
} }
@Override @Override
public HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size, String datasource) { public HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
long page = dataQueryCriteria.getPage();
long size = dataQueryCriteria.getSize();
//构建返回map
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
//构建查询条件
QueryWrapper<MpData> mpDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<MpData> mpDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.dbquery(mpDataQueryWrapper, searchName, searchValue, limit, timeSpace, sort, datasource); ServiceUtil.dbquery(mpDataQueryWrapper, dataQueryCriteria, request);
//分页对象
Page<MpData> mpDataPage = new Page<>(page + 1, size); Page<MpData> mpDataPage = new Page<>(page + 1, size);
mpDataPage = mpDataMapper.selectPage(mpDataPage, mpDataQueryWrapper); mpDataPage = mpDataMapper.selectPage(mpDataPage, mpDataQueryWrapper);
map.put("list", mpDataPage.getRecords()); List<MpData> records = mpDataPage.getRecords();
String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria);
//获取编码-名字map
HashMap<String, String> noName = ServiceUtil.getNoName(request);
//处理人工巡检
if (checkArtificial != null) {
//获取所有的检测子项id 和 name的hashmap
HashMap<Integer, String> jczx = ServiceUtil.jczx();
HashMap<String, Integer> point = ServiceUtil.artificialPoint();
//
QueryWrapper<ArtificialData> artificialDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.artificialQuery(artificialDataQueryWrapper, dataQueryCriteria, checkArtificial);
List<ArtificialData> artificialDataPageRecords = artificialDataMapper.selectList(artificialDataQueryWrapper);
//
for (MpData record : records) {
record.setSensorname(noName.get(record.getSensorid()));
Date time = record.getTime();
for (ArtificialData artificialDataPageRecord : artificialDataPageRecords) {
Date time1 = artificialDataPageRecord.getTime();
boolean b = false;
//判断数据是否在同一小时内
if (time1 != null) {
b = DateUtil.timeInterval(time, time1);
}
//判断当前设备是否绑定的监测点是否一致
boolean check = point.get(record.getSensorid()) == artificialDataPageRecord.getPoint_id();
if (b && check) {
record.setJcziitemname(jczx.get(artificialDataPageRecord.getJczx_id()));
record.setJcvalue(artificialDataPageRecord.getValue());
record.setJctime(time1);
}
}
}
} else {
for (MpData record : records) {
record.setSensorname(noName.get(record.getSensorid()));
}
}
map.put("list", records);
map.put("total", mpDataPage.getTotal()); map.put("total", mpDataPage.getTotal());
return map; return map;
} }
...@@ -364,6 +417,58 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme ...@@ -364,6 +417,58 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme
return realDataVos; return realDataVos;
} }
@Override
public ImgDataVo imgList(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
String code = dataQueryCriteria.getCode();
if (code == null) {
//获取当前尾矿库
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>();
drybeachequipinforQueryWrapper.eq("devicetype", "3").eq("tailingid", tailInfoNo).orderByDesc("id");
Drybeachequipinfor drybeachequipinfor = drybeachequipinforMapper.selectList(drybeachequipinforQueryWrapper).get(0);
dataQueryCriteria.setCode(drybeachequipinfor.getEquipno());
}
QueryWrapper<MpData> mpDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.imgQuery(mpDataQueryWrapper, dataQueryCriteria);
List<MpData> mpData = mpDataMapper.selectList(mpDataQueryWrapper);
//获取编码-名
HashMap<String, String> noName = ServiceUtil.getNoName(request);
String sensorname = noName.get(dataQueryCriteria.getCode());
//处理封装数据
ImgDataVo mpdata = ServiceUtil.deal("mpdata1", sensorname, mpData);
return mpdata;
}
@SneakyThrows
@Override
public void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
List<MpData> mpData = (List<MpData>) pageall(dataQueryCriteria, request).get("list");
//判断是否需要人工
boolean result = false;
String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria);
if (checkArtificial != null) {
result = true;
}
ArrayList<Map<String, Object>> list = new ArrayList<>();
for (MpData mpDatum : mpData) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("设备名称", mpDatum.getSensorname());
map.put("设备ID", mpDatum.getSensorid());
map.put("x变化量", mpDatum.getDispx());
map.put("y变化量", mpDatum.getDispy());
map.put("z变化量", mpDatum.getDisph());
map.put("是否报警", mpDatum.getState() == 0 ? "否" : "是");
map.put("监测时间", mpDatum.getTime());
if (result) {
map.put("人工监测项", mpDatum.getJcziitemname());
map.put("人工监测值", mpDatum.getJcvalue());
map.put("人工监测时间", mpDatum.getJctime());
}
list.add(map);
}
FileUtil.downloadExcel(list, "监测数据: 表面位移", response);
}
public String deal(Date date) throws ParseException { public String deal(Date date) throws ParseException {
String[] stringListHashMap = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"}; String[] stringListHashMap = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"};
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
......
...@@ -3,7 +3,10 @@ package me.zhengjie.gemho.service.data.impl; ...@@ -3,7 +3,10 @@ package me.zhengjie.gemho.service.data.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.SneakyThrows;
import me.zhengjie.gemho.entity.artificial.ArtificialData;
import me.zhengjie.gemho.entity.data.StData; import me.zhengjie.gemho.entity.data.StData;
import me.zhengjie.gemho.entity.tab.Drybeachequipinfor;
import me.zhengjie.gemho.mapper.data.StDataMapper; import me.zhengjie.gemho.mapper.data.StDataMapper;
import me.zhengjie.gemho.mapper.tab.DrybeachequipinforMapper; import me.zhengjie.gemho.mapper.tab.DrybeachequipinforMapper;
import me.zhengjie.gemho.service.data.StDataService; import me.zhengjie.gemho.service.data.StDataService;
...@@ -12,10 +15,14 @@ import me.zhengjie.gemho.x_datavo.DataVo; ...@@ -12,10 +15,14 @@ import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.NameVo; import me.zhengjie.gemho.x_datavo.NameVo;
import me.zhengjie.gemho.x_datavo.RealDataVo; import me.zhengjie.gemho.x_datavo.RealDataVo;
import me.zhengjie.gemho.x_datavo.Result; import me.zhengjie.gemho.x_datavo.Result;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.data.ImgDataVo;
import me.zhengjie.utils.FileUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -281,18 +288,6 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme ...@@ -281,18 +288,6 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme
return null; return null;
} }
@Override
public HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size, String datasource) {
QueryWrapper<StData> stDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.dbquery(stDataQueryWrapper, searchName, searchValue, limit, timeSpace, sort, datasource);
Page<StData> stDataPage = new Page<>(page + 1, size);
stDataPage = stDataMapper.selectPage(stDataPage, stDataQueryWrapper);
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("list", stDataPage.getRecords());
hashMap.put("total", stDataPage.getTotal());
return hashMap;
}
@Override @Override
public List<RealDataVo> real(String equipno1, HttpServletRequest request) { public List<RealDataVo> real(String equipno1, HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
...@@ -323,6 +318,106 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme ...@@ -323,6 +318,106 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme
return realDataVos; return realDataVos;
} }
@SneakyThrows
@Override
public HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
long page = dataQueryCriteria.getPage();
long size = dataQueryCriteria.getSize();
QueryWrapper<StData> stDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.dbquery(stDataQueryWrapper, dataQueryCriteria, request);
Page<StData> stDataPage = new Page<>(page + 1, size);
stDataPage = stDataMapper.selectPage(stDataPage, stDataQueryWrapper);
List<StData> records = stDataPage.getRecords();
HashMap<String, Object> hashMap = new HashMap<>();
//获取编号名字map
HashMap<String, String> noName = ServiceUtil.getNoName(request);
//判断是否需要处理人工巡检数据
String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria);
if (checkArtificial != null) {
//获取 所需的map
HashMap<Integer, String> jczx = ServiceUtil.jczx();
HashMap<String, Integer> stringIntegerHashMap = ServiceUtil.artificialPoint();
List<ArtificialData> artificialData = ServiceUtil.artificialDataDeal(page, size, checkArtificial, dataQueryCriteria);
for (StData record : records) {
record.setSensorname(noName.get(record.getSensorid()));
Date time = record.getTime();
for (ArtificialData artificialDataPageRecord : artificialData) {
Date time1 = artificialDataPageRecord.getTime();
boolean b = false;
//判断数据是否在同一小时内
if (time1 != null) {
b = DateUtil.timeInterval(time, time1);
}
//判断当前设备是否绑定的监测点是否一致
boolean check = stringIntegerHashMap.get(record.getSensorid()) == artificialDataPageRecord.getPoint_id();
if (b && check) {
record.setJcziitemname(jczx.get(artificialDataPageRecord.getJczx_id()));
record.setJcvalue(artificialDataPageRecord.getValue());
record.setJctime(time1);
}
}
}
} else {
for (StData record : records) {
record.setSensorname(noName.get(record.getSensorid()));
}
}
hashMap.put("list", records);
hashMap.put("total", stDataPage.getTotal());
return hashMap;
}
@Override
public ImgDataVo imgList(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
String code = dataQueryCriteria.getCode();
if (code == null) {
//获取当前尾矿库
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>();
drybeachequipinforQueryWrapper.eq("devicetype", "5").eq("tailingid", tailInfoNo).orderByDesc("id");
Drybeachequipinfor drybeachequipinfor = drybeachequipinforMapper.selectList(drybeachequipinforQueryWrapper).get(0);
dataQueryCriteria.setCode(drybeachequipinfor.getEquipno());
}
QueryWrapper<StData> stDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.imgQuery(stDataQueryWrapper, dataQueryCriteria);
List<StData> stData = stDataMapper.selectList(stDataQueryWrapper);
//获取编码-名
HashMap<String, String> noName = ServiceUtil.getNoName(request);
String sensorname = noName.get(dataQueryCriteria.getCode());
//处理封装数据
ImgDataVo mpdata = ServiceUtil.deal("stdata", sensorname, stData);
return mpdata;
}
@SneakyThrows
@Override
public void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
List<StData> stData = (List<StData>) pageall(dataQueryCriteria, request).get("list");
//判断是否需要人工
boolean result = false;
String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria);
if (checkArtificial != null) {
result = true;
}
ArrayList<Map<String, Object>> list = new ArrayList<>();
for (StData stDatum : stData) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("设备名称", stDatum.getSensorname());
map.put("设备ID", stDatum.getSensorid());
map.put("水位", stDatum.getStage());
map.put("埋深", stDatum.getDepth());
map.put("是否报警", stDatum.getState() == 0 ? "否" : "是");
map.put("监测时间", stDatum.getTime());
if (result) {
map.put("人工监测项", stDatum.getJcziitemname());
map.put("人工监测值", stDatum.getJcvalue());
map.put("人工监测时间", stDatum.getJctime());
}
list.add(map);
}
FileUtil.downloadExcel(list, "监测数据: 表面位移", response);
}
public String deal(Date date) throws ParseException { public String deal(Date date) throws ParseException {
String[] stringListHashMap = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"}; String[] stringListHashMap = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"};
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
......
...@@ -3,7 +3,10 @@ package me.zhengjie.gemho.service.data.impl; ...@@ -3,7 +3,10 @@ package me.zhengjie.gemho.service.data.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.SneakyThrows;
import me.zhengjie.gemho.entity.artificial.ArtificialData;
import me.zhengjie.gemho.entity.data.WtData; import me.zhengjie.gemho.entity.data.WtData;
import me.zhengjie.gemho.entity.tab.Drybeachequipinfor;
import me.zhengjie.gemho.mapper.data.WtDataMapper; import me.zhengjie.gemho.mapper.data.WtDataMapper;
import me.zhengjie.gemho.mapper.tab.DrybeachequipinforMapper; import me.zhengjie.gemho.mapper.tab.DrybeachequipinforMapper;
import me.zhengjie.gemho.service.data.WtDataService; import me.zhengjie.gemho.service.data.WtDataService;
...@@ -12,10 +15,14 @@ import me.zhengjie.gemho.x_datavo.DataVo; ...@@ -12,10 +15,14 @@ import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.NameVo; import me.zhengjie.gemho.x_datavo.NameVo;
import me.zhengjie.gemho.x_datavo.RealDataVo; import me.zhengjie.gemho.x_datavo.RealDataVo;
import me.zhengjie.gemho.x_datavo.Result; import me.zhengjie.gemho.x_datavo.Result;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.data.ImgDataVo;
import me.zhengjie.utils.FileUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -285,18 +292,103 @@ public class WtDataServiceImpl extends ServiceImpl<WtDataMapper, WtData> impleme ...@@ -285,18 +292,103 @@ public class WtDataServiceImpl extends ServiceImpl<WtDataMapper, WtData> impleme
} }
@Override @Override
public HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String public HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
timeSpace, String sort, long page, long size, String datasource) { long page = dataQueryCriteria.getPage();
long size = dataQueryCriteria.getSize();
QueryWrapper<WtData> wtDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<WtData> wtDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.dbquery(wtDataQueryWrapper, searchName, searchValue, limit, timeSpace, sort, datasource); ServiceUtil.dbquery(wtDataQueryWrapper, dataQueryCriteria, request);
Page<WtData> wtDataPage = new Page<>(page + 1, size); Page<WtData> wtDataPage = new Page<>(page + 1, size);
wtDataPage = wtDataMapper.selectPage(wtDataPage, wtDataQueryWrapper); wtDataPage = wtDataMapper.selectPage(wtDataPage, wtDataQueryWrapper);
HashMap<String, Object> hashMap = new HashMap<>(); HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("list", wtDataPage.getRecords()); List<WtData> records = wtDataPage.getRecords();
//获取编号名字map
HashMap<String, String> noName = ServiceUtil.getNoName(request);
//判断是否需要处理人工巡检数据
String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria);
if (checkArtificial != null) {
//获取 所需的map
HashMap<Integer, String> jczx = ServiceUtil.jczx();
HashMap<String, Integer> stringIntegerHashMap = ServiceUtil.artificialPoint();
List<ArtificialData> artificialData = ServiceUtil.artificialDataDeal(page, size, checkArtificial, dataQueryCriteria);
for (WtData record : records) {
record.setSensorname(noName.get(record.getSensorid()));
Date time = record.getTime();
for (ArtificialData artificialDataPageRecord : artificialData) {
Date time1 = artificialDataPageRecord.getTime();
boolean b = false;
//判断数据是否在同一小时内
if (time1 != null) {
b = DateUtil.timeInterval(time, time1);
}
//判断当前设备是否绑定的监测点是否一致
boolean check = stringIntegerHashMap.get(record.getSensorid()) == artificialDataPageRecord.getPoint_id();
if (b && check) {
record.setJcziitemname(jczx.get(artificialDataPageRecord.getJczx_id()));
record.setJcvalue(artificialDataPageRecord.getValue());
record.setJctime(time1);
}
}
}
} else {
for (WtData record : records) {
record.setSensorname(noName.get(record.getSensorid()));
}
}
hashMap.put("list", records);
hashMap.put("total", wtDataPage.getTotal()); hashMap.put("total", wtDataPage.getTotal());
return hashMap; return hashMap;
} }
@Override
public ImgDataVo imgList(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
String code = dataQueryCriteria.getCode();
if (code == null) {
//获取当前尾矿库
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>();
drybeachequipinforQueryWrapper.eq("devicetype", "2").eq("tailingid", tailInfoNo).orderByDesc("id");
Drybeachequipinfor drybeachequipinfor = drybeachequipinforMapper.selectList(drybeachequipinforQueryWrapper).get(0);
dataQueryCriteria.setCode(drybeachequipinfor.getEquipno());
}
QueryWrapper<WtData> wtDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.imgQuery(wtDataQueryWrapper, dataQueryCriteria);
List<WtData> wtData = wtDataMapper.selectList(wtDataQueryWrapper);
//获取编码-名
HashMap<String, String> noName = ServiceUtil.getNoName(request);
String sensorname = noName.get(dataQueryCriteria.getCode());
//处理封装数据
ImgDataVo mpdata = ServiceUtil.deal("wtdata", sensorname, wtData);
return mpdata;
}
@SneakyThrows
@Override
public void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
List<WtData> wtData = (List<WtData>) pageall(dataQueryCriteria, request).get("list");
boolean result = false;
String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria);
if (checkArtificial != null) {
result = true;
}
ArrayList<Map<String, Object>> list = new ArrayList<>();
for (WtData wtDatum : wtData) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("设备名称", wtDatum.getSensorname());
map.put("设备ID", wtDatum.getSensorid());
map.put("水位", wtDatum.getStage());
map.put("是否报警", wtDatum.getState() == 0 ? "否" : "是");
map.put("监测时间", wtDatum.getTime());
if (result) {
map.put("人工监测项", wtDatum.getJcziitemname());
map.put("人工监测值", wtDatum.getJcvalue());
map.put("人工监测时间", wtDatum.getJctime());
}
list.add(map);
}
FileUtil.downloadExcel(list, "监测数据: 库水位", response);
}
@Override @Override
public List<RealDataVo> real(String equipno1, HttpServletRequest request) { public List<RealDataVo> real(String equipno1, HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
......
...@@ -76,9 +76,14 @@ public class DicServiceImpl implements DicService { ...@@ -76,9 +76,14 @@ public class DicServiceImpl implements DicService {
public HashMap<String, ArrayList<Dic>> getdrybeachequipinfor() { public HashMap<String, ArrayList<Dic>> getdrybeachequipinfor() {
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
HashMap<String, ArrayList<Dic>> map = new HashMap<>(); HashMap<String, ArrayList<Dic>> map = new HashMap<>();
if (currentUsername.equals("admin")) {
ArrayList<Dic> gettailingid = drybeachequipinforMapper.gettailingid();
map.put("tailingid", gettailingid);
} else {
ArrayList<Dic> gettailingid = drybeachequipinforMapper.gettailingid(currentUsername); ArrayList<Dic> gettailingid = drybeachequipinforMapper.gettailingid(currentUsername);
ArrayList<Dic> getdevicetype = drybeachequipinforMapper.getdevicetype();
map.put("tailingid", gettailingid); map.put("tailingid", gettailingid);
}
ArrayList<Dic> getdevicetype = drybeachequipinforMapper.getdevicetype();
map.put("devicetype", getdevicetype); map.put("devicetype", getdevicetype);
return map; return map;
} }
......
...@@ -48,7 +48,7 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo ...@@ -48,7 +48,7 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo
HashMap<String, Object> hashMap = new HashMap<>(); HashMap<String, Object> hashMap = new HashMap<>();
QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>(); QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>();
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
String gettailno = onlineUserService.gettailno(currentUsername,request); String gettailno = onlineUserService.gettailno(currentUsername, request);
drybeachequipinforQueryWrapper.eq("tailingid", gettailno); drybeachequipinforQueryWrapper.eq("tailingid", gettailno);
ServiceUtil.query(drybeachequipinforQueryWrapper, dataQueryCriteria); ServiceUtil.query(drybeachequipinforQueryWrapper, dataQueryCriteria);
Page<Drybeachequipinfor> drybeachequipinforPage = new Page<>(page + 1, size); Page<Drybeachequipinfor> drybeachequipinforPage = new Page<>(page + 1, size);
...@@ -119,7 +119,7 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo ...@@ -119,7 +119,7 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo
} }
@Override @Override
public HashMap<String, Object> level(DataQueryCriteria dataQueryCriteria,HttpServletRequest request) { public HashMap<String, Object> level(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
long page = dataQueryCriteria.getPage(); long page = dataQueryCriteria.getPage();
long size = dataQueryCriteria.getSize(); long size = dataQueryCriteria.getSize();
String vague = dataQueryCriteria.getVague(); String vague = dataQueryCriteria.getVague();
...@@ -163,7 +163,7 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo ...@@ -163,7 +163,7 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo
} }
@Override @Override
public List<DrybeachequipinforVo> sensorList(String code,HttpServletRequest request) { public List<DrybeachequipinforVo> sensorList(String code, HttpServletRequest request) {
QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>(); QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>();
if (code != null) { if (code != null) {
drybeachequipinforQueryWrapper.eq("devicetype", code); drybeachequipinforQueryWrapper.eq("devicetype", code);
......
...@@ -64,7 +64,6 @@ public class WebMonitorPointsServiceImpl extends ServiceImpl<WebMonitorPointsMap ...@@ -64,7 +64,6 @@ public class WebMonitorPointsServiceImpl extends ServiceImpl<WebMonitorPointsMap
@Override @Override
public void pchuli(ArrayList<WebMonitorPoints> webMonitorPoints) { public void pchuli(ArrayList<WebMonitorPoints> webMonitorPoints) {
webMonitorPointsMapper.batchinsert(webMonitorPoints); webMonitorPointsMapper.batchinsert(webMonitorPoints);
} }
...@@ -115,7 +114,6 @@ public class WebMonitorPointsServiceImpl extends ServiceImpl<WebMonitorPointsMap ...@@ -115,7 +114,6 @@ public class WebMonitorPointsServiceImpl extends ServiceImpl<WebMonitorPointsMap
webMonitorLinkQueryWrapper.in("pointid", guids); webMonitorLinkQueryWrapper.in("pointid", guids);
iWebMonitorLinkService.removebyguids(guids); iWebMonitorLinkService.removebyguids(guids);
if (!webMonitorLinks.isEmpty()){ if (!webMonitorLinks.isEmpty()){
iWebMonitorLinkService.pinsert(webMonitorLinks); iWebMonitorLinkService.pinsert(webMonitorLinks);
} }
} }
......
...@@ -170,6 +170,9 @@ public class DataUtil { ...@@ -170,6 +170,9 @@ public class DataUtil {
//根据报警状态返回报警值 //根据报警状态返回报警值
//在报警表中查询该设备的报警状态 //在报警表中查询该设备的报警状态
Integer alarmLevel = tabAbnormalMapper.getalarmlevel(drybeachequipinfor.getEquipno()); Integer alarmLevel = tabAbnormalMapper.getalarmlevel(drybeachequipinfor.getEquipno());
if (alarmLevel == null) {
alarmLevel = 0;
}
/* if (alarmLevel != null) { /* if (alarmLevel != null) {
if (alarmLevel == 2 || alarmLevel == 1) { if (alarmLevel == 2 || alarmLevel == 1) {
drybeachequipinfor.setThreelevelalarm(0.0); drybeachequipinfor.setThreelevelalarm(0.0);
...@@ -186,13 +189,13 @@ public class DataUtil { ...@@ -186,13 +189,13 @@ public class DataUtil {
}*/ }*/
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
HashMap<String, Double> alarm = new HashMap<>(); HashMap<String, Double> alarm = new HashMap<>();
alarm.put("value",0.0); alarm.put("value", 0.0);
alarm.put("red", drybeachequipinfor.getOnelevelalarm()); alarm.put("red", drybeachequipinfor.getOnelevelalarm());
alarm.put("orange", drybeachequipinfor.getTwolevelalarm()); alarm.put("orange", drybeachequipinfor.getTwolevelalarm());
alarm.put("yellow", drybeachequipinfor.getThreelevelalarm()); alarm.put("yellow", drybeachequipinfor.getThreelevelalarm());
alarm.put("blue", drybeachequipinfor.getFourlevelalarm()); alarm.put("blue", drybeachequipinfor.getFourlevelalarm());
map.put("value",alarm); map.put("value", alarm);
map.put("alarmLevel",alarmLevel); map.put("alarmLevel", alarmLevel);
return map; return map;
} }
} }
...@@ -2,10 +2,10 @@ package me.zhengjie.gemho.util; ...@@ -2,10 +2,10 @@ package me.zhengjie.gemho.util;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
public class DateUtil { public class DateUtil {
...@@ -141,11 +141,12 @@ public class DateUtil { ...@@ -141,11 +141,12 @@ public class DateUtil {
* @return * @return
*/ */
public static boolean timeInterval(Date time, Date time1) { public static boolean timeInterval(Date time, Date time1) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH");
LocalDateTime localDateTime = dateToLocalDateTime(time); LocalDateTime localDateTime = dateToLocalDateTime(time);
LocalDateTime localDateTime1 = dateToLocalDateTime(time1); LocalDateTime localDateTime1 = dateToLocalDateTime(time1);
Duration duration = Duration.between(localDateTime, localDateTime1); String forTime = formatter.format(localDateTime);
long l = duration.toHours(); String forTime1 = formatter.format(localDateTime1);
if (l <= 1) { if (forTime.equals(forTime1)) {
return true; return true;
} }
return false; return false;
......
...@@ -2,16 +2,18 @@ package me.zhengjie.gemho.util; ...@@ -2,16 +2,18 @@ package me.zhengjie.gemho.util;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import me.zhengjie.gemho.entity.artificial.ArtificialData; import me.zhengjie.gemho.entity.artificial.ArtificialData;
import me.zhengjie.gemho.entity.artificial.ArtificialPoint; import me.zhengjie.gemho.entity.artificial.ArtificialPoint;
import me.zhengjie.gemho.entity.dic.Jczx; import me.zhengjie.gemho.entity.dic.Jczx;
import me.zhengjie.gemho.mapper.artificial.ArtificialDataMapper; import me.zhengjie.gemho.mapper.artificial.ArtificialDataMapper;
import me.zhengjie.gemho.mapper.artificial.ArtificialPointMapper; import me.zhengjie.gemho.mapper.artificial.ArtificialPointMapper;
import me.zhengjie.gemho.mapper.dic.JczxMapper; import me.zhengjie.gemho.mapper.dic.JczxMapper;
import me.zhengjie.gemho.service.tab.DrybeachequipinforService;
import me.zhengjie.gemho.x_datavo.Result; import me.zhengjie.gemho.x_datavo.Result;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria; import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.data.ImgDataVo; import me.zhengjie.gemho.x_datavo.data.ImgDataVo;
import me.zhengjie.gemho.x_datavo.tab.DrybeachequipinforVo;
import me.zhengjie.utils.RedisUtils;
import me.zhengjie.utils.SpringContextHolder; import me.zhengjie.utils.SpringContextHolder;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -319,10 +321,10 @@ public class ServiceUtil { ...@@ -319,10 +321,10 @@ public class ServiceUtil {
} }
public static void imgQuery(QueryWrapper<?> queryWrapper, DataQueryCriteria dataQueryCriteria) { public static void imgQuery(QueryWrapper<?> queryWrapper, DataQueryCriteria dataQueryCriteria) {
String sensorname = dataQueryCriteria.getSensorname(); /* String sensorname = dataQueryCriteria.getSensorname();
if (sensorname != null) { if (sensorname != null) {
queryWrapper.eq("sensorname", sensorname); queryWrapper.eq("sensorname", sensorname);
} }*/
String code = dataQueryCriteria.getCode(); String code = dataQueryCriteria.getCode();
if (code != null) { if (code != null) {
queryWrapper.eq("sensorid", code); queryWrapper.eq("sensorid", code);
...@@ -355,6 +357,12 @@ public class ServiceUtil { ...@@ -355,6 +357,12 @@ public class ServiceUtil {
} }
/**
* 判断是否需要人工巡检数据
*
* @param dataQueryCriteria
* @return
*/
public static String checkArtificial(DataQueryCriteria dataQueryCriteria) { public static String checkArtificial(DataQueryCriteria dataQueryCriteria) {
String exact1 = dataQueryCriteria.getExact(); String exact1 = dataQueryCriteria.getExact();
if (exact1 != null) { if (exact1 != null) {
...@@ -390,15 +398,75 @@ public class ServiceUtil { ...@@ -390,15 +398,75 @@ public class ServiceUtil {
return integerStringHashMap; return integerStringHashMap;
} }
/**
* 人工监测数据处初步处理
*
* @param page
* @param size
* @param checkArtificial
* @param dataQueryCriteria
* @return
*/
public static List<ArtificialData> artificialDataDeal(long page, long size, String checkArtificial, DataQueryCriteria dataQueryCriteria) { public static List<ArtificialData> artificialDataDeal(long page, long size, String checkArtificial, DataQueryCriteria dataQueryCriteria) {
ArtificialDataMapper artificialDataMapper = SpringContextHolder.getBean(ArtificialDataMapper.class); ArtificialDataMapper artificialDataMapper = SpringContextHolder.getBean(ArtificialDataMapper.class);
QueryWrapper<ArtificialData> artificialDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<ArtificialData> artificialDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.artificialQuery(artificialDataQueryWrapper, dataQueryCriteria, checkArtificial); ServiceUtil.artificialQuery(artificialDataQueryWrapper, dataQueryCriteria, checkArtificial);
Page<ArtificialData> artificialDataPage = new Page<>(page + 1, size); List<ArtificialData> artificialDataList = artificialDataMapper.selectList(artificialDataQueryWrapper);
List<ArtificialData> artificialDataList = artificialDataMapper.selectPage(artificialDataPage, artificialDataQueryWrapper).getRecords();
return artificialDataList; return artificialDataList;
} }
public static List<?> artificialDataDeal(long page, long size, String checkArtificial, DataQueryCriteria dataQueryCriteria, List<?> records, HashMap<String, String> noName) throws IllegalAccessException, NoSuchFieldException {
ArtificialDataMapper artificialDataMapper = SpringContextHolder.getBean(ArtificialDataMapper.class);
QueryWrapper<ArtificialData> artificialDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.artificialQuery(artificialDataQueryWrapper, dataQueryCriteria, checkArtificial);
List<ArtificialData> artificialDataList = artificialDataMapper.selectList(artificialDataQueryWrapper);
for (Object record : records) {
String sensorid = null;
Date time = null;
Field[] declaredFields = record.getClass().getDeclaredFields();
for (Field declaredField : declaredFields) {
if (declaredField.getName().equals("sensorid")) {
sensorid = declaredField.get(record).toString();
} else if (declaredField.getName().equals("time")) {
time = (Date) declaredField.get(record);
} else if (declaredField.getName().equals("sensorname")) {
declaredField.set(record, noName.get(sensorid));
}
}
for (ArtificialData artificialDataPageRecord : artificialDataList) {
Date time1 = artificialDataPageRecord.getTime();
boolean b = false;
//判断数据是否在同一小时内
if (time1 != null) {
b = DateUtil.timeInterval(time, time1);
}
HashMap<Integer, String> jczx = jczx();
HashMap<String, Integer> stringIntegerHashMap = artificialPoint();
//判断当前设备是否绑定的监测点是否一致
boolean check = stringIntegerHashMap.get(sensorid) == artificialDataPageRecord.getPoint_id();
if (b && check) {
for (Field declaredField : declaredFields) {
if (declaredField.getName().equals("jcziitemname")) {
declaredField.set(record, jczx.get(artificialDataPageRecord.getJczx_id()));
} else if (declaredField.getName().equals("jcvalue")) {
declaredField.set(record, artificialDataPageRecord.getValue());
} else if (declaredField.getName().equals("jctime")) {
declaredField.set(record, time1);
}
}
}
}
}
return records;
}
/**
* 人工监测查询条件
*
* @param queryWrapper
* @param dataQueryCriteria
* @param checkArtificial
*/
public static void artificialQuery(QueryWrapper<?> queryWrapper, DataQueryCriteria dataQueryCriteria, String checkArtificial) { public static void artificialQuery(QueryWrapper<?> queryWrapper, DataQueryCriteria dataQueryCriteria, String checkArtificial) {
queryWrapper.eq("jczx_id", Integer.valueOf(checkArtificial)); queryWrapper.eq("jczx_id", Integer.valueOf(checkArtificial));
String timeSpace = dataQueryCriteria.getDaterange(); String timeSpace = dataQueryCriteria.getDaterange();
...@@ -426,11 +494,23 @@ public class ServiceUtil { ...@@ -426,11 +494,23 @@ public class ServiceUtil {
} }
/**
* 处理图表数据
*
* @param str
* @param sensorname
* @param data
* @return
*/
public static ImgDataVo deal(String str, String sensorname, List<?> data) { public static ImgDataVo deal(String str, String sensorname, List<?> data) {
//获取json 数据
HashMap<String, List<Map>> realdata = ReadJsonFileUtil.getMap("realdata"); HashMap<String, List<Map>> realdata = ReadJsonFileUtil.getMap("realdata");
List<Map> dbdata = realdata.get(str); List<Map> dbdata = realdata.get(str);
//返回对象
ImgDataVo imgDataVo = new ImgDataVo(); ImgDataVo imgDataVo = new ImgDataVo();
ArrayList<Result> results = new ArrayList<>(); ArrayList<Result> results = new ArrayList<>();
//遍历数据
if (!data.isEmpty()) {
for (Object dbDatum : data) { for (Object dbDatum : data) {
Date time = null; Date time = null;
HashMap map = new HashMap<String, Object>(); HashMap map = new HashMap<String, Object>();
...@@ -459,9 +539,37 @@ public class ServiceUtil { ...@@ -459,9 +539,37 @@ public class ServiceUtil {
result.setValues(map); result.setValues(map);
results.add(result); results.add(result);
} }
}
imgDataVo.setLists(results); imgDataVo.setLists(results);
imgDataVo.setSensorname(sensorname); imgDataVo.setSensorname(sensorname);
imgDataVo.setNames(dbdata); imgDataVo.setNames(dbdata);
return imgDataVo; return imgDataVo;
} }
/**
* 获取编码-名的map
*
* @param request
* @return
*/
public static HashMap<String, String> getNoName(HttpServletRequest request) {
//获取当前尾矿库的编码
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
//读取redis
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
HashMap<String, String> map = (HashMap<String, String>) redisUtils.get("NoName" + tailInfoNo);
if (map != null) {
return map;
}
DrybeachequipinforService drybeachequipinforService = SpringContextHolder.getBean(DrybeachequipinforService.class);
List<DrybeachequipinforVo> drybeachequipinforVos = drybeachequipinforService.sensorList(null, request);
HashMap<String, String> hashMap = new HashMap<String, String>();
for (DrybeachequipinforVo drybeachequipinforVo : drybeachequipinforVos) {
hashMap.put(drybeachequipinforVo.getEquipno(), drybeachequipinforVo.getEquipname());
}
redisUtils.set("NoName" + tailInfoNo, hashMap);
return hashMap;
}
;
} }
...@@ -117,7 +117,7 @@ public class UserController { ...@@ -117,7 +117,7 @@ public class UserController {
// 默认密码 123456 // 默认密码 123456
resources.setPassword(passwordEncoder.encode("123456")); resources.setPassword(passwordEncoder.encode("123456"));
ArrayList<HashMap<String, String>> ponds = resources.getPonds(); ArrayList<HashMap<String, String>> ponds = resources.getPonds();
userTailponController.add(resources.getUsername(),ponds); userTailponController.add(resources.getUsername(), ponds);
userService.create(resources); userService.create(resources);
return new ResponseEntity<>(HttpStatus.CREATED); return new ResponseEntity<>(HttpStatus.CREATED);
} }
...@@ -129,7 +129,9 @@ public class UserController { ...@@ -129,7 +129,9 @@ public class UserController {
public ResponseEntity<Object> updateUser(@Validated(User.Update.class) @RequestBody User resources) throws Exception { public ResponseEntity<Object> updateUser(@Validated(User.Update.class) @RequestBody User resources) throws Exception {
checkLevel(resources); checkLevel(resources);
ArrayList<HashMap<String, String>> ponds = resources.getPonds(); ArrayList<HashMap<String, String>> ponds = resources.getPonds();
userTailponController.add(resources.getUsername(),ponds); if (ponds != null) {
userTailponController.add(resources.getUsername(), ponds);
}
userService.update(resources); userService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);
} }
......
...@@ -43,6 +43,20 @@ ...@@ -43,6 +43,20 @@
"name": "沉降值" "name": "沉降值"
} }
], ],
"mpdata1": [
{
"key": "dispx",
"name": "x方向偏移"
},
{
"key": "dispy",
"name": "y方向偏移"
},
{
"key": "disph",
"name": "沉降值"
}
],
"stdata": [ "stdata": [
{ {
"key": "stage", "key": "stage",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment