Commit 885b80f9 authored by kiritoausna's avatar kiritoausna

2022-5-5

parent 99c38505
package me.zhengjie.gemho.controller.artificial;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.gemho.entity.artificial.ArtificialData;
import me.zhengjie.gemho.service.artificial.ArtificialDataService;
import me.zhengjie.gemho.util.PageResult;
import me.zhengjie.gemho.util.PostOrPutResult;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.Date;
import java.util.HashMap;
/**
* <p>
......@@ -10,10 +24,61 @@ import org.springframework.web.bind.annotation.RestController;
* </p>
*
* @author llj
* @since 2022-04-25
* @since 2022-04-26
*/
@Api(tags = "人工监测数据表")
@RequiredArgsConstructor
@RestController
@RequestMapping("/artificial-data")
@RequestMapping("artificial/data")
public class ArtificialDataController {
@Autowired
private ArtificialDataService artificialDataService;
@ApiOperation(value = "人工监测数据表分页列表", response = ArtificialData.class)
@GetMapping()
public ResponseEntity<Object> list(DataQueryCriteria dataQueryCriteria) {
HashMap<String, Object> data = artificialDataService.plist(dataQueryCriteria);
return new ResponseEntity<>(new PageResult().success(data), HttpStatus.OK);
}
@Log(value = "新增人工监测数据")
@ApiOperation(value = "人工监测数据表新增")
@PostMapping()
public Object add(@Valid @RequestBody ArtificialData param) {
param.setAddtime(new Date());
boolean result = artificialDataService.add(param);
if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else {
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@Log(value = "修改人工监测数据")
@ApiOperation(value = "人工监测数据表修改")
@PutMapping()
public Object modify(@Valid @RequestBody ArtificialData param) {
param.setAddtime(new Date());
boolean result = artificialDataService.modify(param);
if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else {
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@Log(value = "删除人工监测数据")
@ApiOperation(value = "人工监测数据表删除(单个条目)")
@DeleteMapping()
public Object remove(@RequestBody HashMap<String, Object> map) {
Integer id = Integer.valueOf(map.get("id").toString());
boolean result = artificialDataService.removeById(id);
if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else {
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
}
package me.zhengjie.gemho.controller.artificial;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.gemho.entity.artificial.ArtificialPoint;
import me.zhengjie.gemho.service.artificial.ArtificialPointService;
import me.zhengjie.gemho.util.PageResult;
import me.zhengjie.gemho.util.PostOrPutResult;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/**
* <p>
......@@ -10,10 +25,67 @@ import org.springframework.web.bind.annotation.RestController;
* </p>
*
* @author llj
* @since 2022-04-25
* @since 2022-04-26
*/
@Api(tags = "人工监测点位表")
@RequiredArgsConstructor
@RestController
@RequestMapping("/artificial-point")
@RequestMapping("artificial/point")
public class ArtificialPointController {
@Autowired
private ArtificialPointService artificialPointService;
@ApiOperation(value = "人工监测点位表分页列表", response = ArtificialPoint.class)
@GetMapping()
public ResponseEntity<Object> list(DataQueryCriteria dataQueryCriteria) {
HashMap<String, Object> data = artificialPointService.plist(dataQueryCriteria);
return new ResponseEntity<>(new PageResult().success(data), HttpStatus.OK);
}
@Log(value = "新增人工监测点位")
@ApiOperation(value = "人工监测点位表新增")
@PostMapping()
public Object add(@Valid @RequestBody ArtificialPoint param) {
boolean result = artificialPointService.add(param);
if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else {
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@Log(value = "修改人工监测点位")
@ApiOperation(value = "人工监测点位表修改")
@PutMapping()
public Object modify(@Valid @RequestBody ArtificialPoint param) {
param.setTime(new Date());
boolean result = artificialPointService.modify(param);
if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else {
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@Log(value = "删除人工监测点位")
@ApiOperation(value = "人工监测点位表删除(单个条目)")
@DeleteMapping()
public Object remove(@RequestBody HashMap<String, Object> map) {
Integer id = Integer.valueOf(map.get("id").toString());
boolean result = artificialPointService.removeById(id);
if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else {
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@ApiOperation(value = "人工监测点位的下拉列表")
@GetMapping(value = "pointList")
public ResponseEntity<Object> pointList() {
List list = artificialPointService.pointList();
return new ResponseEntity<>(new PageResult().nopagesuccess(list), HttpStatus.OK);
}
}
......@@ -4,26 +4,24 @@ package me.zhengjie.gemho.controller.data;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import me.zhengjie.annotation.Log;
import me.zhengjie.gemho.entity.data.DbData;
import me.zhengjie.gemho.service.data.DbDataService;
import me.zhengjie.gemho.util.PageResult;
import me.zhengjie.gemho.util.PostOrPutResult;
import me.zhengjie.gemho.util.RealVo;
import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.modules.system.service.dto.DeptQueryCriteria;
import me.zhengjie.gemho.x_datavo.data.ImgDataVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/**
* <p>
......@@ -75,79 +73,6 @@ public class DbDataController {
}
}
/**
* 新增干滩人工巡检数据
*
* @param dbData
* @return
*/
@Log(value = "新增干滩人工检测数据")
@ApiOperation(value = "新增干滩人工检测数据", response = PostOrPutResult.class)
@PostMapping
public ResponseEntity<Object> add(@RequestBody DbData dbData) {
try {
/*Date time = dbData.getTime();
String format = sdf.format(time);
dbData.setId(Integer.parseInt(format));
dbData.setCreatetime(new Date());
dbData.setUpdatetime(new Date());
dbData.setDatasource(0);*/
boolean save = dbDataService.save(dbData);
if (save) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
}
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
} catch (NumberFormatException e) {
e.printStackTrace();
}
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
/**
* 修改干滩人工巡检数据
*
* @param dbData
* @return
*/
@Log(value = "修改干滩人工检测数据")
@ApiOperation(value = "修改干滩人工巡检数据", response = PostOrPutResult.class)
@PutMapping
public ResponseEntity<Object> updata(@RequestBody DbData dbData) {
try {
dbData.setUpdatetime(new Date());
boolean b = dbDataService.saveOrUpdate(dbData);
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);
}
/**
* 删除干滩人工巡检数据记录
*
* @param map
* @return
*/
@Log(value = "删除干滩人工检测数据")
@ApiOperation(value = "删除干滩人工巡检数据", response = PostOrPutResult.class)
@DeleteMapping
public ResponseEntity<Object> deletedb(@RequestBody HashMap<String, Integer> map) {
try {
Integer id = map.get("id");
boolean b = dbDataService.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);
}
/**
* 获取干滩的历史数据
......@@ -167,31 +92,17 @@ public class DbDataController {
return new ResponseEntity<>(new PageResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
@ApiOperation(value = "设备的下拉列表")
@GetMapping("equiplist")
public ResponseEntity<Object> dbList() {
return null;
}
@ApiOperation(value = "图标历史")
@GetMapping("imghistory")
public ResponseEntity<Object> imgList(
@ApiParam(value = "查询条件字段") String searchName,
@ApiParam(value = "查询条件数值") String searchValue,
@ApiParam(value = "查询条件精准或者模糊") String limit,
@ApiParam(value = "查询条件时间区间") String timeSpace,
@ApiParam(value = "查询条件正序或者倒序") String sort,
@ApiParam(value = "数据来源", required = true) String datasource) {
return null;
public ResponseEntity<Object> imgList(DataQueryCriteria dataQueryCriteria) {
ImgDataVo dbData = dbDataService.imgList(dataQueryCriteria);
return new ResponseEntity<>(new PageResult().success(dbData), HttpStatus.OK);
}
@ApiOperation("导出菜单数据")
@GetMapping("download")
public void exportDept(HttpServletResponse response, DeptQueryCriteria criteria) throws Exception {
List<DbData> dbData = new ArrayList<>();
dbData = dbDataService.list();
dbDataService.download(dbData, response);
public void exportDept(HttpServletResponse response,DataQueryCriteria dataQueryCriteria) throws Exception {
dbDataService.download(dataQueryCriteria, response);
}
}
......@@ -4,19 +4,21 @@ package me.zhengjie.gemho.controller.data;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import me.zhengjie.gemho.entity.data.DmData;
import me.zhengjie.gemho.service.data.DmDataService;
import me.zhengjie.gemho.util.PageResult;
import me.zhengjie.gemho.util.PostOrPutResult;
import me.zhengjie.gemho.util.RealVo;
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.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
/**
......@@ -70,110 +72,39 @@ public class DmDataController {
}
}
/**
* 新增内部位移人工巡检数据
*
* @param dmData
* @return
*/
@ApiOperation(value = "新增内部位移人工巡检数据", response = PostOrPutResult.class)
@PostMapping
public ResponseEntity<Object> add(@RequestBody DmData dmData) {
try {
Date time = dmData.getTime();
String format = sdf.format(time);
dmData.setId(Integer.parseInt(format));
dmData.setCreatetime(new Date());
dmData.setUpdatetime(new Date());
dmData.setDatasource(0);
boolean save = dmDataService.save(dmData);
if (save) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
}
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
} catch (NumberFormatException e) {
e.printStackTrace();
}
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
/**
* 新增内部位移人工巡检数据
*
* @param dmData
* @return
*/
@ApiOperation(value = "修改内部位移人工巡检数据", response = PostOrPutResult.class)
@PutMapping
public ResponseEntity<Object> updata(@RequestBody DmData dmData) {
try {
dmData.setUpdatetime(new Date());
boolean b = dmDataService.saveOrUpdate(dmData);
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);
}
/**
* 删除内部位移人工巡检数据
*
* @param map
* @return
*/
@ApiOperation(value = "删除内部位移人工巡检数据", response = PostOrPutResult.class)
@DeleteMapping
public ResponseEntity<Object> deletedb(@RequestBody HashMap<String, Integer> map) {
try {
Integer id = map.get("id");
boolean b = dmDataService.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);
}
/**
* 获取内部位移的历史数据
*
* @param page
* @param size
* @param searchName
* @param searchValue
* @param limit
* @param timeSpace
* @param sort
* @param datasource
* @param dataQueryCriteria
* @return
*/
@ApiOperation("获取内部位移的历史数据")
@GetMapping("history")
public ResponseEntity<Object> gethistory(@ApiParam(value = "分页参数,页数", required = true) String page,
@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) {
public ResponseEntity<Object> gethistory(DataQueryCriteria dataQueryCriteria) {
try {
long l = Long.parseLong(page);
long l1 = Long.parseLong(size);
HashMap<String, Object> map = dmDataService.pageall(searchName, searchValue, limit, timeSpace, sort, l, l1, datasource);
HashMap<String, Object> map = dmDataService.pageall(dataQueryCriteria);
return new ResponseEntity<>(new PageResult().success(map), HttpStatus.OK);
} catch (NumberFormatException e) {
e.printStackTrace();
}
return new ResponseEntity<>(new PageResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
@ApiOperation(value = "图标历史")
@GetMapping("imghistory")
public ResponseEntity<Object> imgList(DataQueryCriteria dataQueryCriteria) {
ImgDataVo dbData = dmDataService.imgList(dataQueryCriteria);
return new ResponseEntity<>(new PageResult().success(dbData), HttpStatus.OK);
}
@ApiOperation(value = "导出excel")
@GetMapping("download")
public void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria) {
dmDataService.download(response, dataQueryCriteria);
}
;
}
package me.zhengjie.gemho.controller.dic;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.gemho.entity.dic.Jcjd;
import me.zhengjie.gemho.entity.dic.Jczx;
import me.zhengjie.gemho.service.dic.IJcjdService;
import me.zhengjie.gemho.service.dic.IJczxService;
import me.zhengjie.gemho.util.PageResult;
import org.springframework.http.HttpStatus;
......@@ -19,20 +16,19 @@ import java.util.List;
@RestController
@RequestMapping("dic/artificial")
public class ArtificialController {
private final IJcjdService iJcjdService;
private final IJczxService iJczxService;
@GetMapping("parent")
public ResponseEntity<Object> parent() {
List<Jcjd> list = iJcjdService.list();
return new ResponseEntity<>(new PageResult().nopagesuccess(list), HttpStatus.OK);
@ApiOperation(value = "人工监测项字典")
@GetMapping()
public ResponseEntity<Object> child(String id) {
List deal = iJczxService.deal(id);
return new ResponseEntity<>(new PageResult().nopagesuccess(deal), HttpStatus.OK);
}
@GetMapping("child")
public ResponseEntity<Object> child(String p_id) {
QueryWrapper<Jczx> jczxQueryWrapper = new QueryWrapper<>();
jczxQueryWrapper.eq("p_id", Integer.valueOf(p_id));
List<Jczx> list = iJczxService.list(jczxQueryWrapper);
return new ResponseEntity<>(new PageResult().nopagesuccess(list), HttpStatus.OK);
@ApiOperation(value = "人工监测项子项下拉列表")
@GetMapping("jczxList")
public ResponseEntity<Object> jczxList(String code) {
List deal = iJczxService.jczxList(code);
return new ResponseEntity<>(new PageResult().nopagesuccess(deal), HttpStatus.OK);
}
}
package me.zhengjie.gemho.controller.ins;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.gemho.entity.ins.InsChildren;
import me.zhengjie.gemho.service.ins.InsChildrenService;
import me.zhengjie.gemho.util.PageResult;
import me.zhengjie.gemho.util.PostOrPutResult;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author llj
* @since 2022-04-29
*/
@Api(tags = "")
@RequiredArgsConstructor
@RestController
@RequestMapping("ins/children")
public class InsChildrenController {
@Autowired
private InsChildrenService insChildrenService;
@ApiOperation(value = "分页列表", response = InsChildren.class)
@GetMapping()
public ResponseEntity<Object> list(DataQueryCriteria dataQueryCriteria) {
HashMap<String, Object> data = insChildrenService.plist(dataQueryCriteria);
return new ResponseEntity<>(new PageResult().success(data), HttpStatus.OK);
}
@ApiOperation(value = "新增")
@PostMapping()
public Object add(@Valid @RequestBody InsChildren param) {
param.setAdd_time(new Date());
param.setUpdate_time(new Date());
boolean result = insChildrenService.add(param);
if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else {
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@ApiOperation(value = "修改")
@PutMapping()
public Object modify(@Valid @RequestBody InsChildren param) {
param.setUpdate_time(new Date());
boolean result = insChildrenService.modify(param);
if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else {
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@ApiOperation(value = "删除(单个条目)")
@DeleteMapping()
public Object remove(@RequestBody HashMap<String, Object> map) {
Integer id = Integer.valueOf(map.get("id").toString());
boolean result = insChildrenService.removeById(id);
if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else {
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@ApiOperation(value = "二级目录下拉列表")
@GetMapping("listing")
public ResponseEntity<Object> listing(Integer id) {
List listing = insChildrenService.listing(id);
return new ResponseEntity<>(new PageResult().nopagesuccess(listing), HttpStatus.OK);
}
}
package me.zhengjie.gemho.controller.ins;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.gemho.entity.ins.InsData;
import me.zhengjie.gemho.service.ins.InsDataService;
import me.zhengjie.gemho.util.PageResult;
import me.zhengjie.gemho.util.PostOrPutResult;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.File;
import java.io.FileInputStream;
import java.util.Date;
import java.util.HashMap;
/**
* <p>
* 前端控制器
* </p>
*
* @author llj
* @since 2022-04-29
*/
@Api(tags = "")
@RequiredArgsConstructor
@RestController
@RequestMapping("ins/data")
public class InsDataController {
@Autowired
private InsDataService insDataService;
@ApiOperation(value = "分页列表", response = InsData.class)
@GetMapping()
public ResponseEntity<Object> list(DataQueryCriteria dataQueryCriteria) {
HashMap<String, Object> data = insDataService.plist(dataQueryCriteria);
return new ResponseEntity<>(new PageResult().success(data), HttpStatus.OK);
}
@ApiOperation(value = "新增")
@PostMapping()
public Object add(@Valid @RequestBody InsData param) {
param.setAdd_time(new Date());
param.setUpdate_time(new Date());
boolean result = insDataService.add(param);
if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else {
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@ApiOperation(value = "修改")
@PutMapping()
public Object modify(@Valid @RequestBody InsData param) {
param.setUpdate_time(new Date());
boolean result = insDataService.modify(param);
if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else {
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@ApiOperation(value = "删除(单个条目)")
@DeleteMapping()
public Object remove(@RequestBody HashMap<String, Object> map) {
Integer id = Integer.valueOf(map.get("id").toString());
boolean result = insDataService.removeById(id);
if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else {
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@ApiOperation(value = "文件上传")
@PostMapping("upload")
public ResponseEntity<Object> upload(@RequestParam MultipartFile file) {
String upload = insDataService.upload(file);
return new ResponseEntity<>(new PageResult().nopagesuccess(upload), HttpStatus.OK);
}
@ApiOperation(value = "文件上传")
@PostMapping("inupload")
public ResponseEntity<Object> inupload(FileInputStream fileInputStream,MultipartFile file) {
String upload = insDataService.upload(file);
return new ResponseEntity<>(upload, HttpStatus.OK);
}
@ApiOperation(value = "文件下载")
@GetMapping("download")
public void download(HttpServletResponse response, HttpServletRequest request,Integer id) {
HttpServletResponse download = insDataService.download(response, request, id);
// return download;
}
}
package me.zhengjie.gemho.controller.demo;
package me.zhengjie.gemho.controller.ins;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import me.zhengjie.gemho.entity.demo.MonitorPoints;
import me.zhengjie.gemho.service.demo.MonitorPointsService;
import lombok.RequiredArgsConstructor;
import me.zhengjie.gemho.entity.ins.InsProject;
import me.zhengjie.gemho.service.ins.InsProjectService;
import me.zhengjie.gemho.util.PageResult;
import me.zhengjie.gemho.util.PostOrPutResult;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
/**
* <p>
......@@ -21,35 +24,31 @@ import java.util.HashMap;
* </p>
*
* @author llj
* @since 2022-04-02
* @since 2022-04-29
*/
@Api(tags = "")
@RequiredArgsConstructor
@RestController
@RequestMapping("wweb/httpdemo")
public class MonitorPointsController {
@RequestMapping("ins/project")
public class InsProjectController {
@Autowired
private MonitorPointsService monitorPointsService;
private InsProjectService insProjectService;
@ApiOperation(value = "分页列表", response = MonitorPoints.class)
@GetMapping(value = "/page")
public ResponseEntity<Object> list(@ApiParam(value = "分页参数,页数") String page,
@ApiParam(value = "分页参数,数量") String size,
@ApiParam(value = "查询条件字段") String searchName,
@ApiParam(value = "查询条件数值") String searchValue,
@ApiParam(value = "查询条件精准或者模糊") String limit,
@ApiParam(value = "查询条件时间区间") String timeSpace,
@ApiParam(value = "查询条件正序或者倒序") String sort) {
HashMap<String, Object> data = monitorPointsService.list(searchName, searchValue, limit, timeSpace, sort, page, size);
@ApiOperation(value = "分页列表", response = InsProject.class)
@GetMapping()
public ResponseEntity<Object> list(DataQueryCriteria dataQueryCriteria) {
HashMap<String, Object> data = insProjectService.plist(dataQueryCriteria);
return new ResponseEntity<>(new PageResult().success(data), HttpStatus.OK);
}
@ApiOperation(value = "新增")
@PostMapping()
public Object add(@Valid @RequestBody MonitorPoints param) {
boolean result = monitorPointsService.add(param);
public Object add(@Valid @RequestBody InsProject param) {
param.setAdd_time(new Date());
param.setUpdate_time(new Date());
boolean result = insProjectService.add(param);
if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else {
......@@ -59,9 +58,9 @@ public class MonitorPointsController {
@ApiOperation(value = "修改")
@PutMapping()
public Object modify(@Valid @RequestBody MonitorPoints param) {
boolean result = monitorPointsService.modify(param);
public Object modify(@Valid @RequestBody InsProject param) {
param.setUpdate_time(new Date());
boolean result = insProjectService.modify(param);
if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else {
......@@ -73,7 +72,7 @@ public class MonitorPointsController {
@DeleteMapping()
public Object remove(@RequestBody HashMap<String, Object> map) {
Integer id = Integer.valueOf(map.get("id").toString());
boolean result = monitorPointsService.removeById(id);
boolean result = insProjectService.removeById(id);
if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else {
......@@ -81,10 +80,11 @@ public class MonitorPointsController {
}
}
@PostMapping("test")
public void testdemo(String json) {
System.out.println(json);
//return new ResponseEntity(new PageResult().success(json),HttpStatus.OK);
@ApiOperation(value = "目录下拉列表")
@GetMapping("listing")
public ResponseEntity<Object> listing() {
List listing = insProjectService.listing();
return new ResponseEntity<>(new PageResult().nopagesuccess(listing), HttpStatus.OK);
}
}
......@@ -13,6 +13,7 @@ import me.zhengjie.gemho.service.sys.SysSummaryService;
import me.zhengjie.gemho.service.tab.MonitorvideoService;
import me.zhengjie.gemho.util.PageResult;
import me.zhengjie.gemho.util.PostOrPutResult;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.modules.security.service.OnlineUserService;
import me.zhengjie.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -52,14 +53,8 @@ public class SysSummaryController {
*/
@ApiOperation(value = "查询", response = SysSummary.class)
@GetMapping
public ResponseEntity<Object> getall(@ApiParam(value = "分页参数,页数", required = true) String page,
@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) {
HashMap<String, Object> hashMap = sysSummaryService.getall(page, size, searchName, searchValue);
public ResponseEntity<Object> getall(DataQueryCriteria dataQueryCriteria) {
HashMap<String, Object> hashMap = sysSummaryService.getall(dataQueryCriteria);
return new ResponseEntity<>(new PageResult().success(hashMap), HttpStatus.OK);
}
......@@ -76,6 +71,7 @@ public class SysSummaryController {
String currentUsername = SecurityUtils.getCurrentUsername();
String gettailno = onlineUserService.gettailno(currentUsername);
sysSummary.setCreatetime(LocalDateTime.now());
sysSummary.setUpdatetime(LocalDateTime.now());
String title = sysSummary.getTitle();
String deviceid = sysSummary.getDeviceid();
QueryWrapper<SysSummary> sysSummaryQueryWrapper = new QueryWrapper<>();
......@@ -134,6 +130,7 @@ public class SysSummaryController {
//sysSummary.setRemark(monitorvideo.getV_id());
//sysSummary.setSubitem(null);
}
sysSummary.setUpdatetime(LocalDateTime.now());
boolean b = sysSummaryService.saveOrUpdate(sysSummary);
if (b) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
......
......@@ -9,6 +9,7 @@ import me.zhengjie.gemho.service.tab.DrybeachequipinforService;
import me.zhengjie.gemho.service.tab.TabAbnormalService;
import me.zhengjie.gemho.util.PageResult;
import me.zhengjie.gemho.util.PostOrPutResult;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
......@@ -118,16 +119,8 @@ public class AbnormalController {
@ApiOperation(value = "获取设备的四级报警")
@GetMapping("level")
public ResponseEntity<Object> alarmlevel(@ApiParam(value = "分页参数,页数") String page,
@ApiParam(value = "分页参数,数量") String size,
@ApiParam(value = "查询条件字段") String searchName,
@ApiParam(value = "查询条件数值") String searchValue,
@ApiParam(value = "查询条件精准或者模糊") String limit,
@ApiParam(value = "查询条件时间区间") String timeSpace,
@ApiParam(value = "查询条件正序或者倒序") String sort) {
Long page1 = Long.valueOf(page);
Long size1 = Long.valueOf(size);
HashMap<String, Object> level = drybeachequipinforService.level(searchName, searchValue, limit, timeSpace, sort, page1, size1);
public ResponseEntity<Object> alarmlevel(DataQueryCriteria dataQueryCriteria) {
HashMap<String, Object> level = drybeachequipinforService.level(dataQueryCriteria);
return new ResponseEntity<>(new PageResult().nopagesuccess(level), HttpStatus.OK);
}
......
......@@ -2,7 +2,10 @@ package me.zhengjie.gemho.controller.tab;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import me.zhengjie.annotation.Log;
import me.zhengjie.gemho.entity.sys.SysType;
import me.zhengjie.gemho.entity.tab.Drybeachequipinfor;
......@@ -13,6 +16,8 @@ import me.zhengjie.gemho.service.tab.TabAbnormalService;
import me.zhengjie.gemho.util.PageResult;
import me.zhengjie.gemho.util.PostOrPutResult;
import me.zhengjie.gemho.x_datavo.DryVo;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.tab.DrybeachequipinforVo;
import me.zhengjie.modules.security.service.OnlineUserService;
import me.zhengjie.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -125,7 +130,7 @@ public class DrybeachequipinforController {
@PutMapping
public ResponseEntity<Object> updateone(@RequestBody Drybeachequipinfor drybeachequipinfor) {
try {
drybeachequipinfor.setUpdatetime(new Date());
//drybeachequipinfor.setCreatetime(new Date());
boolean save = drybeachequipinforService.saveOrUpdate(drybeachequipinfor);
if (save) {
......@@ -149,26 +154,18 @@ public class DrybeachequipinforController {
@ApiResponses(value = {@ApiResponse(code = 500, message = "请求失败", response = Drybeachequipinfor.class),
@ApiResponse(code = 200, message = "请求成功", response = Drybeachequipinfor.class)})
@GetMapping
public ResponseEntity<Object> all(@ApiParam(value = "分页参数,页数") String page,
@ApiParam(value = "分页参数,数量") String size,
@ApiParam(value = "查询条件字段") String searchName,
@ApiParam(value = "查询条件数值") String searchValue,
@ApiParam(value = "查询条件精准或者模糊") String limit,
@ApiParam(value = "查询条件时间区间") String timeSpace,
@ApiParam(value = "查询条件正序或者倒序") String sort) {
public ResponseEntity<Object> all(DataQueryCriteria dataQueryCriteria) {
try {
int page1 = Integer.parseInt(page);
int size1 = Integer.parseInt(size);
HashMap<String, Object> hashMap = drybeachequipinforService.pageall(searchName, searchValue, limit, timeSpace, sort, page1, size1);
HashMap<String, Object> hashMap = drybeachequipinforService.pageall(dataQueryCriteria);
return new ResponseEntity<>(new PageResult().success(hashMap), HttpStatus.OK);
} catch (NumberFormatException e) {
System.out.println(e);
return new ResponseEntity<>(new PageResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
/*
/*
*/
*/
@ApiOperation(value = "获取所有设备id", response = DryVo.class)
@GetMapping("ids")
......@@ -203,12 +200,19 @@ public class DrybeachequipinforController {
return new ResponseEntity<>(dryVos, HttpStatus.OK);
}
public static void main(String[] args) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String format = simpleDateFormat.format(new Date());
int i = new Random().nextInt(8999) + 1000;
String eqno = format + i;
System.out.println(eqno);
@ApiOperation(value = "获取对应的设备下拉列表")
@GetMapping(value = "sensorList")
public ResponseEntity<Object> senSorList(String code) {
List<DrybeachequipinforVo> drybeachequipinforVos = drybeachequipinforService.sensorList(code);
return new ResponseEntity<>(new PageResult().nopagesuccess(drybeachequipinforVos), HttpStatus.OK);
}
@ApiOperation(value = "监测点用:设备下拉列表")
@GetMapping(value = "pointDrys")
public ResponseEntity<Object> pointDrys() {
List<DrybeachequipinforVo> drybeachequipinforVos = drybeachequipinforService.pointDrys();
return new ResponseEntity<>(new PageResult().nopagesuccess(drybeachequipinforVos), HttpStatus.OK);
}
@ApiOperation(value = "在线设备统计")
......
......@@ -2,12 +2,16 @@ package me.zhengjie.gemho.controller.tab;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import me.zhengjie.annotation.Log;
import me.zhengjie.gemho.entity.tab.Tailpondinfor;
import me.zhengjie.gemho.service.tab.TailpondinforService;
import me.zhengjie.gemho.util.PageResult;
import me.zhengjie.gemho.util.PostOrPutResult;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.modules.security.service.OnlineUserService;
import me.zhengjie.utils.SecurityUtils;
import me.zhengjie.utils.ThrowableUtil;
......@@ -139,6 +143,7 @@ public class TailpondinforController {
String s = tailingno.substring(length - 4, length);
tailpondinfor.setTailingno(replace + s);
tailpondinfor.setCreatetime(new Date());
tailpondinfor.setUpdatetime(new Date());
int defaults = tailpondinfor.getDefaults();
if (defaults == 1) {
biaoji = true;
......@@ -174,17 +179,9 @@ public class TailpondinforController {
@ApiResponse(code = 200, message = "请求成功", response = PageResult.class)})
@GetMapping
public ResponseEntity<Object> all(@ApiParam(value = "分页参数,页数") String page,
@ApiParam(value = "分页参数,数量") String size,
@ApiParam(value = "查询条件字段") String searchName,
@ApiParam(value = "查询条件数值") String searchValue,
@ApiParam(value = "查询条件精准或者模糊") String limit,
@ApiParam(value = "查询条件时间区间") String timeSpace,
@ApiParam(value = "查询条件正序或者倒序") String sort) {
public ResponseEntity<Object> all(DataQueryCriteria dataQueryCriteria) {
try {
int page1 = Integer.parseInt(page);
int size1 = Integer.parseInt(size);
HashMap<String, Object> hashMap = tailpondinforService.pageall(searchName, searchValue, limit, timeSpace, sort, page1, size1);
HashMap<String, Object> hashMap = tailpondinforService.pageall(dataQueryCriteria);
return new ResponseEntity<>(new PageResult().success(hashMap), HttpStatus.OK);
} catch (NumberFormatException e) {
System.out.println(e);
......@@ -203,6 +200,7 @@ public class TailpondinforController {
return new ResponseEntity<>(new PageResult().nopagefailed(ThrowableUtil.getStackTrace(e)), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@Log("切换尾矿库")
@ApiOperation(value = "切换尾矿库")
@PostMapping("usertailpon")
......
......@@ -3,14 +3,11 @@ package me.zhengjie.gemho.entity.artificial;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
......@@ -18,51 +15,41 @@ import java.time.LocalDateTime;
* </p>
*
* @author llj
* @since 2022-04-25
* @since 2022-04-26
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Getter
@Setter
@TableName("artificial_data")
@ApiModel(value="ArtificialData对象", description="人工监测数据表")
public class ArtificialData implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "监测项id")
@TableField("jcitemid")
private Integer jcitemid;
@ApiModelProperty(value = "监测子项id")
@TableField("jcziitemid")
private Integer jcziitemid;
@ApiModelProperty(value = "监测内容及要求id")
@TableField("jcneirongid")
private Integer jcneirongid;
@ApiModelProperty(value = "监测仪器")
@TableField("jcyiqi")
private Integer jcyiqi;
@ApiModelProperty(value = "监测精度")
@TableField("jcjingdu")
private Integer jcjingdu;
@ApiModelProperty(value = "监测结果")
@TableField("jcjieguo")
private String jcjieguo;
@ApiModelProperty(value = "添加时间或修改时间")
@TableField("addtime")
private LocalDateTime addtime;
@ApiModelProperty(value = "监测时间")
@TableField("jctime")
private LocalDateTime jctime;
/**
* 监测点id
*/
private Integer point_id;
/**
* 监测子项id
*/
private int jczx_id;
/**
* 监测结果
*/
private String value;
/**
* 添加时间或修改时间
*/
private Date addtime;
/**
* 监测时间
*/
private Date time;
}
......@@ -3,14 +3,11 @@ package me.zhengjie.gemho.entity.artificial;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
......@@ -18,13 +15,11 @@ import java.time.LocalDateTime;
* </p>
*
* @author llj
* @since 2022-04-25
* @since 2022-04-26
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Getter
@Setter
@TableName("artificial_point")
@ApiModel(value="ArtificialPoint对象", description="人工监测点位表")
public class ArtificialPoint implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -32,21 +27,31 @@ public class ArtificialPoint implements Serializable {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "监测项")
@TableField("jcitem")
private String jcitem;
@ApiModelProperty(value = "人工监测点名称")
@TableField("jcdname")
/**
* 人工监测点名称
*/
private String jcdname;
@ApiModelProperty(value = "地点备注")
@TableField("remarks")
/**
* 关联在线设备编码
*/
private String equipno;
/**
* 关联在线设备名称
*/
private String equipname;
/**
* 地点备注
*/
private String remarks;
@ApiModelProperty(value = "添加时间")
@TableField("addtime")
private LocalDateTime addtime;
/**
* 添加时间
*/
private Date time;
}
package me.zhengjie.gemho.entity.data;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
......@@ -9,8 +11,10 @@ import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
* <p>
......@@ -46,6 +50,7 @@ public class DbData implements Serializable {
/**
* 测量时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("测量时间")
public Date time;
......@@ -70,12 +75,14 @@ public class DbData implements Serializable {
/**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "数据创建时间", hidden = true)
public Date createtime;
/**
* 修改时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "数据修改时间", hidden = true)
public Date updatetime;
......@@ -97,19 +104,45 @@ public class DbData implements Serializable {
@ApiModelProperty(value = "数据来源", hidden = true)
public Integer datasource;
@TableField(exist = false)
private List Artificials;
@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;
public static void main(String[] args) {
DbData dbData = new DbData();
dbData.setLenth("1");
for (Field declaredField : dbData.getClass().getDeclaredFields()) {
try {
if (declaredField.get(dbData) != null && declaredField.get(dbData) != "") {
System.out.println(declaredField.getName());
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
LocalDateTime start = LocalDateTime.now();
LocalDateTime end = LocalDateTime.now().plusHours(1);
Duration duration = Duration.between(start, end);
// 相差的天数
long days = duration.toDays();
System.out.println("相差" + days + "天");
// 相差的小时数
long hours = duration.toHours();
System.out.println("相差" + hours + "小时");
// 相差的分钟数
long minutes = duration.toMinutes();
System.out.println("相差" + minutes + "分钟");
// 相差毫秒数
long millis = duration.toMillis();
System.out.println("相差" + millis + "毫秒");
// 相差的纳秒数
long nanos = duration.toNanos();
System.out.println("相差" + nanos + "纳秒");
}
}
package me.zhengjie.gemho.entity.data;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
......@@ -40,10 +41,15 @@ public class DmData implements Serializable {
*/
@ApiModelProperty("设备id")
public String sensorid;
/**
* 设备名称
*/
@ApiModelProperty("设备名称")
public String sensorname;
/**
* 测量时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("测量时间")
public Date time;
......@@ -51,14 +57,14 @@ public class DmData implements Serializable {
* 轴a方向偏移(m) 累计偏移值,从管底向管口累加
*/
@ApiModelProperty("轴a方向偏移(m) 累计偏移值,从管底向管口累加")
// @TableField(value = "disp_a")
// @TableField(value = "disp_a")
public String dispA;
/**
* 轴b方向偏移(m) 累计偏移值,从管底向管口累加,单轴填0
*/
@ApiModelProperty("轴b方向偏移(m) 累计偏移值,从管底向管口累加,单轴填0")
// @TableField(value = "disp_b")
// @TableField(value = "disp_b")
public String dispB;
/**
......@@ -105,5 +111,15 @@ public class DmData implements Serializable {
@ApiModelProperty(value = "报警级别")
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.dic;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
......@@ -23,7 +24,7 @@ import java.io.Serializable;
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("c_jczx")
@ApiModel(value="Jczx对象", description="检测子项_字典")
@ApiModel(value = "Jczx对象", description = "检测子项_字典")
public class Jczx implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -40,10 +41,11 @@ public class Jczx implements Serializable {
@ApiModelProperty(value = "仪器")
private String implement;
@TableField(value = "`precision`")
@ApiModelProperty(value = "精度")
private String precision;
@TableField(value = "p_id")
private Integer pId;
......
package me.zhengjie.gemho.entity.ins;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author llj
* @since 2022-04-29
*/
@Getter
@Setter
@TableName("ins_children")
public class InsChildren implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 一级菜单ID
*/
private Integer project_id;
/**
* 检查形式(检查类型)
*/
private String type;
/**
* 检查内容
*/
private String content;
/**
* 更新时间
*/
private Date update_time;
/**
* 添加时间
*/
private Date add_time;
}
package me.zhengjie.gemho.entity.ins;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author llj
* @since 2022-04-29
*/
@Getter
@Setter
@TableName("ins_data")
public class InsData implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 标题
*/
private String title;
private Integer project_id;
/**
* 二级菜单ID
*/
private Integer child_id;
/**
* 文本
*/
private String text;
/**
* 文件
*/
private String file;
/**
* 图片
*/
private String image;
/**
* 更新时间
*/
private Date update_time;
/**
* 添加时间
*/
private Date add_time;
}
package me.zhengjie.gemho.entity.ins;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author llj
* @since 2022-04-29
*/
@Getter
@Setter
@TableName("ins_project")
public class InsProject implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 检查项目
*/
private String name;
/**
* 更新时间
*/
private Date update_time;
/**
* 添加时间
*/
private Date add_time;
}
......@@ -579,7 +579,7 @@ public class Tailpondinfor implements Serializable {
*/
@ApiModelProperty(value = "修改时间", hidden = true)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updatetime = new Date();
private Date updatetime;
}
package me.zhengjie.gemho.mapper.artificial;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import me.zhengjie.gemho.entity.artificial.ArtificialData;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
......@@ -9,8 +10,9 @@ import me.zhengjie.gemho.entity.artificial.ArtificialData;
* </p>
*
* @author llj
* @since 2022-04-25
* @since 2022-04-26
*/
@Mapper
public interface ArtificialDataMapper extends BaseMapper<ArtificialData> {
}
package me.zhengjie.gemho.mapper.artificial;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import me.zhengjie.gemho.entity.artificial.ArtificialPoint;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
......@@ -9,8 +10,9 @@ import me.zhengjie.gemho.entity.artificial.ArtificialPoint;
* </p>
*
* @author llj
* @since 2022-04-25
* @since 2022-04-26
*/
@Mapper
public interface ArtificialPointMapper extends BaseMapper<ArtificialPoint> {
}
package me.zhengjie.gemho.mapper.dic;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import me.zhengjie.gemho.entity.dic.Jcjd;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
......@@ -10,6 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @author llj
* @since 2022-04-25
*/
@Mapper
public interface JcjdMapper extends BaseMapper<Jcjd> {
}
package me.zhengjie.gemho.mapper.dic;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import me.zhengjie.gemho.entity.dic.Jczx;
import org.apache.ibatis.annotations.Mapper;
import java.util.HashMap;
import java.util.List;
/**
* <p>
......@@ -10,6 +15,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @author llj
* @since 2022-04-25
*/
@Mapper
public interface JczxMapper extends BaseMapper<Jczx> {
List<Jczx> deal(int id);
List<HashMap> jczxList(int p_id);
}
package me.zhengjie.gemho.mapper.ins;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import me.zhengjie.gemho.entity.ins.InsChildren;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author llj
* @since 2022-04-29
*/
@Mapper
public interface InsChildrenMapper extends BaseMapper<InsChildren> {
List listing(Integer project_id);
}
package me.zhengjie.gemho.mapper.ins;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import me.zhengjie.gemho.entity.ins.InsData;
import me.zhengjie.gemho.x_datavo.ins.InsDataVo;
import org.apache.ibatis.annotations.Mapper;
import java.util.Map;
/**
* <p>
* Mapper 接口
* </p>
*
* @author llj
* @since 2022-04-29
*/
@Mapper
public interface InsDataMapper extends BaseMapper<InsData> {
Page<InsDataVo> selectPages(Page<InsDataVo> page, String title);
}
package me.zhengjie.gemho.mapper.ins;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import me.zhengjie.gemho.entity.ins.InsProject;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author llj
* @since 2022-04-29
*/
@Mapper
public interface InsProjectMapper extends BaseMapper<InsProject> {
List listing();
}
......@@ -76,7 +76,7 @@ public interface DrybeachequipinforMapper extends BaseMapper<Drybeachequipinfor>
@Select(value = "<script>" +
"select equipno, equipname, onelevelalarm, twolevelalarm, threelevelalarm, fourlevelalarm from tb_drybeachequipinfor where tailingid = #{tailingid}" +
" <if test='searchValue!=\"\" and searchValue!=null '>\n" +
" and equipname=#{searchValue}\n" +
" and equipname like CONCAT('%',#{searchValue},'%')\n" +
" </if>" +
"</script>")
Page<HashMap<String, Object>> level(Page page, String tailingid, String searchName, String searchValue);
......
package me.zhengjie.gemho.service.artificial;
import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.artificial.ArtificialData;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import java.util.HashMap;
/**
* <p>
* 人工监测数据表 服务类
* </p>
*
* @author llj
* @since 2022-04-26
*/
public interface ArtificialDataService extends IService<ArtificialData> {
/**
* 人工监测数据表分页列表
*
* @param dataQueryCriteria
* @return
*/
HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria);
/**
* 人工监测数据表新增
*
* @param param 根据需要进行传值
* @return
*/
boolean add(ArtificialData param);
/**
* 人工监测数据表修改
*
* @param param 根据需要进行传值
* @return
*/
boolean modify(ArtificialData param);
}
package me.zhengjie.gemho.service.artificial;
import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.artificial.ArtificialPoint;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import java.util.HashMap;
import java.util.List;
/**
* <p>
* 人工监测点位表 服务类
* </p>
*
* @author llj
* @since 2022-04-26
*/
public interface ArtificialPointService extends IService<ArtificialPoint> {
/**
* 人工监测点位表分页列表
*
* @param dataQueryCriteria
* @return
*/
HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria);
/**
* 人工监测点位表新增
*
* @param param 根据需要进行传值
* @return
*/
boolean add(ArtificialPoint param);
/**
* 人工监测点位表修改
*
* @param param 根据需要进行传值
* @return
*/
boolean modify(ArtificialPoint param);
/**
* 人工监测点位下拉列表
*/
List pointList();
}
package me.zhengjie.gemho.service.artificial;
import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.artificial.ArtificialData;
/**
* <p>
* 人工监测数据表 服务类
* </p>
*
* @author llj
* @since 2022-04-25
*/
public interface IArtificialDataService extends IService<ArtificialData> {
}
package me.zhengjie.gemho.service.artificial;
import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.artificial.ArtificialPoint;
/**
* <p>
* 人工监测点位表 服务类
* </p>
*
* @author llj
* @since 2022-04-25
*/
public interface IArtificialPointService extends IService<ArtificialPoint> {
}
package me.zhengjie.gemho.service.artificial.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import me.zhengjie.gemho.entity.artificial.ArtificialData;
import me.zhengjie.gemho.entity.dic.Jczx;
import me.zhengjie.gemho.mapper.artificial.ArtificialDataMapper;
import me.zhengjie.gemho.service.artificial.IArtificialDataService;
import me.zhengjie.gemho.mapper.dic.JczxMapper;
import me.zhengjie.gemho.service.artificial.ArtificialDataService;
import me.zhengjie.gemho.util.ServiceUtil;
import me.zhengjie.gemho.x_datavo.artificial.ADataVo;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* <p>
* 人工监测数据表 服务实现类
* </p>
*
* @author llj
* @since 2022-04-25
* @since 2022-04-26
*/
@Service
public class ArtificialDataServiceImpl extends ServiceImpl<ArtificialDataMapper, ArtificialData> implements IArtificialDataService {
public class ArtificialDataServiceImpl extends ServiceImpl<ArtificialDataMapper, ArtificialData> implements ArtificialDataService {
@Autowired
private ArtificialDataMapper artificialDataMapper;
@Autowired
private JczxMapper jczxMapper;
/**
* 人工监测数据表分页列表
*
* @param dataQueryCriteria
* @return
*/
@Override
public HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria) {
//查询所有的检测子项
List<Jczx> jczxes = jczxMapper.selectList(null);
long size = dataQueryCriteria.getSize();
long page = dataQueryCriteria.getPage();
Page<ArtificialData> ArtificialDataPage = new Page<>(page + 1, size);
QueryWrapper<ArtificialData> queryWrapper = new QueryWrapper<>();
ServiceUtil.dataQuery(queryWrapper, dataQueryCriteria);
ArtificialDataPage = artificialDataMapper.selectPage(ArtificialDataPage, queryWrapper);
List<ArtificialData> records = ArtificialDataPage.getRecords();
long total = ArtificialDataPage.getTotal();
//构建返回结构
ArrayList<ADataVo> aDataVos = new ArrayList<>();
if (!records.isEmpty()) {
for (ArtificialData record : records) {
int jczx_id = record.getJczx_id();
for (Jczx jczx : jczxes) {
Integer id = jczx.getId();
if (id == jczx_id) {
ADataVo aDataVo = new ADataVo();
BeanUtils.copyProperties(record, aDataVo);
aDataVo.setContent(jczx.getContent());
aDataVo.setImplement(jczx.getImplement());
aDataVo.setPrecision(jczx.getPrecision());
aDataVo.setJcziitemname(jczx.getName());
aDataVos.add(aDataVo);
}
}
}
}
HashMap<String, Object> map = new HashMap<>();
map.put("list", aDataVos);
map.put("total", total);
return map;
}
/**
* 人工监测数据表新增
*
* @param param 根据需要进行传值
* @return
*/
@Override
public boolean add(ArtificialData param) {
int result = artificialDataMapper.insert(param);
if (result > 0) {
return true;
}
return false;
}
/**
* 人工监测数据表修改
*
* @param param 根据需要进行传值
* @return
*/
@Override
public boolean modify(ArtificialData param) {
QueryWrapper<ArtificialData> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", param.getId());
int result = artificialDataMapper.update(param, queryWrapper);
if (result > 0) {
return true;
}
return false;
}
}
package me.zhengjie.gemho.service.artificial.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import me.zhengjie.gemho.entity.artificial.ArtificialPoint;
import me.zhengjie.gemho.mapper.artificial.ArtificialPointMapper;
import me.zhengjie.gemho.service.artificial.IArtificialPointService;
import me.zhengjie.gemho.service.artificial.ArtificialPointService;
import me.zhengjie.gemho.util.ServiceUtil;
import me.zhengjie.gemho.x_datavo.artificial.PointListVo;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* <p>
* 人工监测点位表 服务实现类
* </p>
*
* @author llj
* @since 2022-04-25
* @since 2022-04-26
*/
@Service
public class ArtificialPointServiceImpl extends ServiceImpl<ArtificialPointMapper, ArtificialPoint> implements IArtificialPointService {
public class ArtificialPointServiceImpl extends ServiceImpl<ArtificialPointMapper, ArtificialPoint> implements ArtificialPointService {
@Autowired
private ArtificialPointMapper artificialPointMapper;
/**
* 人工监测点位表分页列表
*
* @param dataQueryCriteria
* @return
*/
@Override
public HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria) {
long size = dataQueryCriteria.getSize();
long page = dataQueryCriteria.getPage();
Page<ArtificialPoint> ArtificialPointPage = new Page<>(page + 1, size);
QueryWrapper<ArtificialPoint> queryWrapper = new QueryWrapper<>();
ServiceUtil.dataQuery(queryWrapper, dataQueryCriteria);
ArtificialPointPage = artificialPointMapper.selectPage(ArtificialPointPage, queryWrapper);
List<ArtificialPoint> records = ArtificialPointPage.getRecords();
long total = ArtificialPointPage.getTotal();
HashMap<String, Object> map = new HashMap<>();
map.put("list", records);
map.put("total", total);
return map;
}
/**
* 人工监测点位表新增
*
* @param param 根据需要进行传值
* @return
*/
@Override
public boolean add(ArtificialPoint param) {
int result = artificialPointMapper.insert(param);
if (result > 0) {
return true;
}
return false;
}
/**
* 人工监测点位表修改
*
* @param param 根据需要进行传值
* @return
*/
@Override
public boolean modify(ArtificialPoint param) {
QueryWrapper<ArtificialPoint> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", param.getId());
int result = artificialPointMapper.update(param, queryWrapper);
if (result > 0) {
return true;
}
return false;
}
@Override
public List pointList() {
ArrayList<PointListVo> pointListVos = new ArrayList<>();
List<ArtificialPoint> artificialPoints = artificialPointMapper.selectList(null);
for (ArtificialPoint artificialPoint : artificialPoints) {
PointListVo pointListVo = new PointListVo();
BeanUtils.copyProperties(artificialPoint, pointListVo);
pointListVos.add(pointListVo);
}
return pointListVos;
}
}
......@@ -5,7 +5,9 @@ import me.zhengjie.gemho.entity.data.DbData;
import me.zhengjie.gemho.x_datavo.DataVo;
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.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
......@@ -55,6 +57,7 @@ public interface DbDataService extends IService<DbData> {
/**
* 获取干滩的历史数据
*
* @param dataQueryCriteria
* @return
*/
......@@ -63,16 +66,10 @@ public interface DbDataService extends IService<DbData> {
/**
* 图表数据
*
* @param searchName
* @param searchValue
* @param limit
* @param timeSpace
* @param sort
* @param datasource
* @param state
* @param dataQueryCriteria
* @return
*/
List<DbData> imgList(String searchName, String searchValue, String limit, String timeSpace, String sort, String datasource, String state);
ImgDataVo imgList(DataQueryCriteria dataQueryCriteria);
/**
......@@ -85,5 +82,5 @@ public interface DbDataService extends IService<DbData> {
/***
* 导出干滩表格
*/
void download(List<DbData> dbdatas, HttpServletResponse response) throws IOException;
void download(DataQueryCriteria dataQueryCriteria, HttpServletResponse response) throws IOException;
}
......@@ -4,7 +4,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.data.DmData;
import me.zhengjie.gemho.x_datavo.DataVo;
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.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
......@@ -53,17 +56,10 @@ public interface DmDataService extends IService<DmData> {
/**
* 历史数据
*
* @param searchName
* @param searchValue
* @param limit
* @param timeSpace
* @param sort
* @param page
* @param size
* @param datasource
* @param dataQueryCriteria
* @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);
/**
* 实时数据
......@@ -71,4 +67,15 @@ public interface DmDataService extends IService<DmData> {
* @return
*/
List<RealDataVo> real(String equipno);
/**
* 图表数据与
*
* @param dataQueryCriteria
* @return
*/
ImgDataVo imgList(DataQueryCriteria dataQueryCriteria);
void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria);
}
......@@ -3,8 +3,13 @@ package me.zhengjie.gemho.service.data.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import me.zhengjie.gemho.entity.artificial.ArtificialData;
import me.zhengjie.gemho.entity.data.DbData;
import me.zhengjie.gemho.entity.tab.Drybeachequipinfor;
import me.zhengjie.gemho.mapper.artificial.ArtificialDataMapper;
import me.zhengjie.gemho.mapper.data.DbDataMapper;
import me.zhengjie.gemho.mapper.dic.JczxMapper;
import me.zhengjie.gemho.mapper.tab.DrybeachequipinforMapper;
import me.zhengjie.gemho.service.data.DbDataService;
import me.zhengjie.gemho.util.*;
......@@ -13,6 +18,7 @@ import me.zhengjie.gemho.x_datavo.NameVo;
import me.zhengjie.gemho.x_datavo.RealDataVo;
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.context.annotation.PropertySource;
......@@ -33,6 +39,7 @@ import java.util.*;
* @author llj
* @since 2022-01-05
*/
@RequiredArgsConstructor
@PropertySource("classpath:realdata.properties") // 指定具体的配置文件
@Service
public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> implements DbDataService {
......@@ -40,6 +47,8 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
private DbDataMapper dbDataMapper;
@Autowired
private DrybeachequipinforMapper drybeachequipinforMapper;
private final ArtificialDataMapper artificialDataMapper;
private final JczxMapper jczxMapper;
@Override
public DataVo day(String date, String values, String deviceid, String subitem) {
......@@ -246,7 +255,7 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
}
}
}
/* if (!dbData2.isEmpty()) {
/* if (!dbData2.isEmpty()) {
for (DbData data2 : dbData2) {
String format = sdf.format(data2.getTime());
if (string.equals(format)) {
......@@ -258,9 +267,7 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
break;
}
}
}
*/
}*/
Date parse = sdf1.parse(string + " 00:00:00");
result.setValues(hashMap);
result.setDate(parse);
......@@ -289,17 +296,80 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
ServiceUtil.dataQuery(dbDataQueryWrapper, dataQueryCriteria);
Page<DbData> dbDataPage = new Page<>(page + 1, size);
dbDataPage = dbDataMapper.selectPage(dbDataPage, dbDataQueryWrapper);
map.put("list", dbDataPage.getRecords());
map.put("total", dbDataPage.getTotal());
List<DbData> records = dbDataPage.getRecords();
long total = dbDataPage.getTotal();
//判断是否需要人工监测数据
String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria);
if (checkArtificial != null) {
//获取所有的检测子项id 和 name的hashmap
HashMap<Integer, String> jczx = ServiceUtil.jczx();
HashMap<String, Integer> point = ServiceUtil.artificialPoint();
List<ArtificialData> artificialDataList = ServiceUtil.artificialDataDeal(page, size, checkArtificial, dataQueryCriteria);
for (DbData record : records) {
Date time = record.getTime();
for (ArtificialData artificialData : artificialDataList) {
boolean b = false;
Date time1 = artificialData.getTime();
//判断数据是否在同一小时内
if (time1 != null) {
b = DateUtil.timeInterval(time, time1);
}
//判断当前设备是否绑定的监测点是否一致
boolean check = point.get(record.getSensorid()) == artificialData.getPoint_id();
if (b && check) {
record.setJcziitemname(jczx.get(artificialData.getJczx_id()));
record.setJcvalue(artificialData.getValue());
record.setJctime(time1);
}
}
}
}
map.put("list", records);
map.put("total", total);
return map;
}
@Override
public List<DbData> imgList(String searchName, String searchValue, String limit, String timeSpace, String sort, String datasource, String state) {
public ImgDataVo imgList(DataQueryCriteria dataQueryCriteria) {
String code = dataQueryCriteria.getCode();
if (code == null) {
QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>();
drybeachequipinforQueryWrapper.eq("devicetype", "1").orderByDesc("id");
Drybeachequipinfor drybeachequipinfor = drybeachequipinforMapper.selectList(drybeachequipinforQueryWrapper).get(0);
dataQueryCriteria.setCode(drybeachequipinfor.getEquipno());
}
QueryWrapper<DbData> dbDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.dbquery(dbDataQueryWrapper, searchName, searchValue, limit, timeSpace, sort, datasource);
ServiceUtil.imgQuery(dbDataQueryWrapper, dataQueryCriteria);
List<DbData> dbData = dbDataMapper.selectList(dbDataQueryWrapper);
return dbData;
//封装处理数据
HashMap<String, List<Map>> realdata = ReadJsonFileUtil.getMap("realdata");
List<Map> dbdata = realdata.get("dbdata");
ImgDataVo imgDataVo = new ImgDataVo();
ArrayList<Result> results = new ArrayList<>();
for (DbData dbDatum : dbData) {
HashMap map = new HashMap<String, Object>();
for (Field declaredField : dbDatum.getClass().getDeclaredFields()) {
for (Map dbmap : dbdata) {
String key = dbmap.get("key").toString();
if (declaredField.getName().equals(key)) {
try {
map.put(declaredField.getName(), declaredField.get(dbDatum));
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
;
}
}
Result result = new Result();
result.setDate(dbDatum.getTime());
result.setValues(map);
results.add(result);
}
imgDataVo.setLists(results);
imgDataVo.setSensorname(dataQueryCriteria.getSensorname());
imgDataVo.setNames(dbdata);
return imgDataVo;
}
@Override
......@@ -333,7 +403,11 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
}
@Override
public void download(List<DbData> dbdatas, HttpServletResponse response) throws IOException {
public void download(DataQueryCriteria dataQueryCriteria, HttpServletResponse response) throws IOException {
//获取数据
HashMap<String, Object> pageall = pageall(dataQueryCriteria);
List<DbData> dbdatas = (List<DbData>) pageall.get("list");
String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria);
List<Map<String, Object>> list = new ArrayList<>();
for (DbData dbdata : dbdatas) {
Map<String, Object> map = new LinkedHashMap<>();
......@@ -344,9 +418,14 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
map.put("坡度角", dbdata.getAngle());
map.put("安全超高", dbdata.getSafeheight());
map.put("是否报警", dbdata.getState() == 0 ? "否" : "是");
if (checkArtificial != null) {
map.put("人工监测项", dbdata.getJcziitemname());
map.put("人工监测值", dbdata.getJcvalue());
map.put("人工监测时间", dbdata.getJctime());
}
list.add(map);
}
FileUtil.downloadExcel(list, response);
FileUtil.downloadExcel(list, "监测数据: 干滩", response);
}
public String deal(Date date) throws ParseException {
......@@ -360,4 +439,5 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
return stringListHashMap[i];
}
}
......@@ -3,7 +3,9 @@ package me.zhengjie.gemho.service.data.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import me.zhengjie.gemho.entity.artificial.ArtificialData;
import me.zhengjie.gemho.entity.data.DmData;
import me.zhengjie.gemho.entity.tab.Drybeachequipinfor;
import me.zhengjie.gemho.mapper.data.DmDataMapper;
import me.zhengjie.gemho.mapper.tab.DrybeachequipinforMapper;
import me.zhengjie.gemho.service.data.DmDataService;
......@@ -12,9 +14,12 @@ import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.NameVo;
import me.zhengjie.gemho.x_datavo.RealDataVo;
import me.zhengjie.gemho.x_datavo.Result;
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.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Field;
import java.text.ParseException;
import java.text.SimpleDateFormat;
......@@ -296,13 +301,41 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme
}
@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) {
long page = dataQueryCriteria.getPage();
long size = dataQueryCriteria.getSize();
HashMap<String, Object> map = new HashMap<>();
QueryWrapper<DmData> dmDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.dbquery(dmDataQueryWrapper, searchName, searchValue, limit, timeSpace, sort, datasource);
ServiceUtil.dataQuery(dmDataQueryWrapper, dataQueryCriteria);
Page<DmData> dmDataPage = new Page<>(page + 1, size);
dmDataPage = dmDataMapper.selectPage(dmDataPage, dmDataQueryWrapper);
map.put("list", dmDataPage.getRecords());
List<DmData> records = dmDataPage.getRecords();
//处理人工监测数据
String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria);
if (checkArtificial != null) {
HashMap<Integer, String> jczx = ServiceUtil.jczx();
HashMap<String, Integer> point = ServiceUtil.artificialPoint();
List<ArtificialData> artificialDataList = ServiceUtil.artificialDataDeal(page, size, checkArtificial, dataQueryCriteria);
for (DmData record : records) {
Date time = record.getTime();
for (ArtificialData artificialData : artificialDataList) {
boolean b = false;
Date time1 = artificialData.getTime();
//判断数据是否在同一小时内
if (time1 != null) {
b = DateUtil.timeInterval(time, time1);
}
//判断当前设备是否绑定的监测点是否一致
boolean check = point.get(record.getSensorid()) == artificialData.getPoint_id();
if (b && check) {
record.setJcziitemname(jczx.get(artificialData.getJczx_id()));
record.setJcvalue(artificialData.getValue());
record.setJctime(time1);
}
}
}
}
map.put("list", records);
map.put("total", dmDataPage.getTotal());
return map;
}
......@@ -337,6 +370,23 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme
return realDataVos;
}
@Override
public ImgDataVo imgList(DataQueryCriteria dataQueryCriteria) {
String sensorname = dataQueryCriteria.getSensorname();
if (sensorname == null) {
QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>();
drybeachequipinforQueryWrapper.eq("devicetype", "4").orderByDesc("id");
Drybeachequipinfor drybeachequipinfor = drybeachequipinforMapper.selectList(drybeachequipinforQueryWrapper).get(0);
dataQueryCriteria.setSensorname(drybeachequipinfor.getEquipname());
}
QueryWrapper<DmData> dmDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.imgQuery(dmDataQueryWrapper, dataQueryCriteria);
List<DmData> dmData = dmDataMapper.selectList(dmDataQueryWrapper);
//处理封装数据
ImgDataVo dmdata = ServiceUtil.deal("dmdata", dataQueryCriteria.getSensorname(), dmData);
return dmdata;
}
public String deal(Date date) throws ParseException {
String[] stringListHashMap = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"};
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
......@@ -347,4 +397,16 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme
int i = instance.get(Calendar.DAY_OF_WEEK) - 1;
return stringListHashMap[i];
}
@Override
public void download(HttpServletResponse response, DataQueryCriteria dataQueryCriteria) {
//获取数据
List<DmData> list = (List<DmData>) pageall(dataQueryCriteria).get("list");
String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria);
for (DmData dmData : list) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("设备编号", dmData.getSensorid());
map.put("设备名称", dmData.getSensorname());
}
}
}
package me.zhengjie.gemho.service.demo;
import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.demo.MonitorPoints;
import java.util.HashMap;
/**
* <p>
* 服务类
* </p>
*
* @author llj
* @since 2022-04-02
*/
public interface MonitorPointsService extends IService<MonitorPoints> {
/**
* 分页列表
* @param searchName
* @param searchValue
* @param limit
* @param timeSpace
* @param sort
* @param page
* @param size
* @return
*/
HashMap<String, Object> list(String searchName, String searchValue, String limit, String timeSpace, String sort,String page,String size);
/**
* 新增
* @param param 根据需要进行传值
* @return
*/
boolean add(MonitorPoints param);
/**
* 修改
* @param param 根据需要进行传值
* @return
*/
boolean modify(MonitorPoints param);
}
package me.zhengjie.gemho.service.demo.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import me.zhengjie.gemho.entity.demo.MonitorPoints;
import me.zhengjie.gemho.mapper.demo.MonitorPointsMapper;
import me.zhengjie.gemho.service.demo.MonitorPointsService;
import me.zhengjie.gemho.util.ServiceUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author llj
* @since 2022-04-02
*/
@Service
public class MonitorPointsServiceImpl extends ServiceImpl<MonitorPointsMapper, MonitorPoints> implements MonitorPointsService {
@Autowired
private MonitorPointsMapper monitorPointsMapper;
/**
* 分页列表
* @param searchName
* @param searchValue
* @param limit
* @param timeSpace
* @param sort
* @param page
* @param size
* @return
*/
@Override
public HashMap<String, Object> list(String searchName, String searchValue, String limit, String timeSpace, String sort,String page,String size) {
long l1 = Long.parseLong(page) + 1;
long l2 = Long.parseLong(size);
Page<MonitorPoints> MonitorPointsPage = new Page<>(l1, l2);
QueryWrapper<MonitorPoints> queryWrapper = new QueryWrapper<>();
ServiceUtil.query(queryWrapper, searchName, searchValue, limit, timeSpace, sort);
MonitorPointsPage=monitorPointsMapper.selectPage(MonitorPointsPage, queryWrapper);
List<MonitorPoints> records = MonitorPointsPage.getRecords();
long total = MonitorPointsPage.getTotal();
HashMap<String, Object> map = new HashMap<>();
map.put("list", records);
map.put("total", total);
return map;
}
/**
* 新增
* @param param 根据需要进行传值
* @return
*/
@Override
public boolean add(MonitorPoints param) {
int result =monitorPointsMapper.insert(param);
if(result>0){
return true;
}
return false;
}
/**
* 修改
* @param param 根据需要进行传值
* @return
*/
@Override
public boolean modify(MonitorPoints param) {
QueryWrapper<MonitorPoints> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id",param.getId());
int result = monitorPointsMapper.update(param,queryWrapper);
if(result>0){
return true;
}
return false;
}}
......@@ -3,6 +3,8 @@ package me.zhengjie.gemho.service.dic;
import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.dic.Jczx;
import java.util.List;
/**
* <p>
* 检测子项_字典 服务类
......@@ -12,5 +14,7 @@ import me.zhengjie.gemho.entity.dic.Jczx;
* @since 2022-04-25
*/
public interface IJczxService extends IService<Jczx> {
List deal(String id);
List jczxList(String id);
}
package me.zhengjie.gemho.service.dic.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import me.zhengjie.gemho.entity.dic.Jcjd;
import me.zhengjie.gemho.mapper.dic.JcjdMapper;
import me.zhengjie.gemho.service.dic.IJcjdService;
import org.springframework.stereotype.Service;
......
package me.zhengjie.gemho.service.dic.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import me.zhengjie.gemho.entity.dic.Jczx;
import me.zhengjie.gemho.mapper.artificial.ArtificialPointMapper;
import me.zhengjie.gemho.mapper.dic.JczxMapper;
import me.zhengjie.gemho.mapper.tab.DrybeachequipinforMapper;
import me.zhengjie.gemho.service.dic.IJczxService;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
/**
* <p>
* 检测子项_字典 服务实现类
......@@ -13,7 +20,25 @@ import org.springframework.stereotype.Service;
* @author llj
* @since 2022-04-25
*/
@RequiredArgsConstructor
@Service
public class JczxServiceImpl extends ServiceImpl<JczxMapper, Jczx> implements IJczxService {
private final ArtificialPointMapper artificialPointMapper;
private final DrybeachequipinforMapper drybeachequipinforMapper;
private final JczxMapper jczxMapper;
@Override
public List deal(String id) {
System.out.println();
Integer integer = Integer.valueOf(id);
List<Jczx> deal = jczxMapper.deal(integer);
return deal;
}
@Override
public List jczxList(String id) {
Integer p_id = Integer.valueOf(id.toString());
List<HashMap> hashMaps = jczxMapper.jczxList(p_id);
return hashMaps;
}
}
package me.zhengjie.gemho.service.ins;
import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.ins.InsChildren;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import java.util.HashMap;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author llj
* @since 2022-04-29
*/
public interface InsChildrenService extends IService<InsChildren> {
/**
* 分页列表
*
* @param dataQueryCriteria
* @return
*/
HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria);
/**
* 新增
*
* @param param 根据需要进行传值
* @return
*/
boolean add(InsChildren param);
/**
* 修改
*
* @param param 根据需要进行传值
* @return
*/
boolean modify(InsChildren param);
List listing(Integer id);
}
package me.zhengjie.gemho.service.ins;
import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.ins.InsData;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
/**
* <p>
* 服务类
* </p>
*
* @author llj
* @since 2022-04-29
*/
public interface InsDataService extends IService<InsData> {
/**
* 分页列表
*
* @param dataQueryCriteria
* @return
*/
HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria);
/**
* 新增
*
* @param param 根据需要进行传值
* @return
*/
boolean add(InsData param);
/**
* 修改
*
* @param param 根据需要进行传值
* @return
*/
boolean modify(InsData param);
/**
* 上传文件
*
* @param file
* @return
*/
String upload(MultipartFile file);
HttpServletResponse download(HttpServletResponse response, HttpServletRequest request, Integer id);
}
package me.zhengjie.gemho.service.demo;
package me.zhengjie.gemho.service.ins;
import me.zhengjie.gemho.entity.ins.InsProject;
import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.demo.MonitorChart;
import java.util.HashMap;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
* <p>
......@@ -11,22 +14,16 @@ import java.util.HashMap;
* </p>
*
* @author llj
* @since 2022-04-02
* @since 2022-04-29
*/
public interface MonitorChartService extends IService<MonitorChart> {
public interface InsProjectService extends IService<InsProject> {
/**
* 分页列表
* @param searchName
* @param searchValue
* @param limit
* @param timeSpace
* @param sort
* @param page
* @param size
* @param dataQueryCriteria
* @return
*/
HashMap<String, Object> list(String searchName, String searchValue, String limit, String timeSpace, String sort,String page,String size);
HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria);
/**
......@@ -34,13 +31,15 @@ HashMap<String, Object> list(String searchName, String searchValue, String limit
* @param param 根据需要进行传值
* @return
*/
boolean add(MonitorChart param);
boolean add(InsProject param);
/**
* 修改
* @param param 根据需要进行传值
* @return
*/
boolean modify(MonitorChart param);
boolean modify(InsProject param);
List listing();
}
package me.zhengjie.gemho.service.demo.impl;
package me.zhengjie.gemho.service.ins.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import me.zhengjie.gemho.entity.demo.MonitorChart;
import me.zhengjie.gemho.mapper.demo.MonitorChartMapper;
import me.zhengjie.gemho.service.demo.MonitorChartService;
import me.zhengjie.gemho.entity.ins.InsChildren;
import me.zhengjie.gemho.mapper.ins.InsChildrenMapper;
import me.zhengjie.gemho.service.ins.InsChildrenService;
import me.zhengjie.gemho.util.ServiceUtil;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -19,36 +20,24 @@ import java.util.List;
* </p>
*
* @author llj
* @since 2022-04-02
* @since 2022-04-29
*/
@Service
public class MonitorChartServiceImpl extends ServiceImpl<MonitorChartMapper, MonitorChart> implements MonitorChartService {
public class InsChildrenServiceImpl extends ServiceImpl<InsChildrenMapper, InsChildren> implements InsChildrenService {
@Autowired
private MonitorChartMapper monitorChartMapper;
private InsChildrenMapper insChildrenMapper;
/**
* 分页列表
*
* @param searchName
* @param searchValue
* @param limit
* @param timeSpace
* @param sort
* @param page
* @param size
* @return
*/
@Override
public HashMap<String, Object> list(String searchName, String searchValue, String limit, String timeSpace, String sort, String page, String size) {
long l1 = Long.parseLong(page) + 1;
long l2 = Long.parseLong(size);
Page<MonitorChart> MonitorChartPage = new Page<>(l1, l2);
QueryWrapper<MonitorChart> queryWrapper = new QueryWrapper<>();
ServiceUtil.query(queryWrapper, searchName, searchValue, limit, timeSpace, sort);
MonitorChartPage = monitorChartMapper.selectPage(MonitorChartPage, queryWrapper);
List<MonitorChart> records = MonitorChartPage.getRecords();
long total = MonitorChartPage.getTotal();
public HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria) {
long size = dataQueryCriteria.getSize();
long page = dataQueryCriteria.getPage();
Page<InsChildren> InsChildrenPage = new Page<>(page + 1, size);
QueryWrapper<InsChildren> queryWrapper = new QueryWrapper<>();
ServiceUtil.insQuery(queryWrapper, dataQueryCriteria);
InsChildrenPage = insChildrenMapper.selectPage(InsChildrenPage, queryWrapper);
List<InsChildren> records = InsChildrenPage.getRecords();
long total = InsChildrenPage.getTotal();
HashMap<String, Object> map = new HashMap<>();
map.put("list", records);
map.put("total", total);
......@@ -63,8 +52,8 @@ public class MonitorChartServiceImpl extends ServiceImpl<MonitorChartMapper, Mon
* @return
*/
@Override
public boolean add(MonitorChart param) {
int result = monitorChartMapper.insert(param);
public boolean add(InsChildren param) {
int result = insChildrenMapper.insert(param);
if (result > 0) {
return true;
}
......@@ -78,13 +67,20 @@ public class MonitorChartServiceImpl extends ServiceImpl<MonitorChartMapper, Mon
* @return
*/
@Override
public boolean modify(MonitorChart param) {
QueryWrapper<MonitorChart> queryWrapper = new QueryWrapper<>();
public boolean modify(InsChildren param) {
QueryWrapper<InsChildren> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", param.getId());
int result = monitorChartMapper.update(param, queryWrapper);
int result = insChildrenMapper.update(param, queryWrapper);
if (result > 0) {
return true;
}
return false;
}
@Override
public List listing(Integer id) {
List listing = insChildrenMapper.listing(id);
//根据父级id 查询
return listing;
}
}
package me.zhengjie.gemho.service.ins.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import me.zhengjie.gemho.entity.ins.InsData;
import me.zhengjie.gemho.mapper.ins.InsDataMapper;
import me.zhengjie.gemho.service.ins.InsDataService;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.ins.InsDataVo;
import me.zhengjie.utils.FileUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
/**
* <p>
* 服务实现类
* </p>
*
* @author llj
* @since 2022-04-29
*/
@Service
public class InsDataServiceImpl extends ServiceImpl<InsDataMapper, InsData> implements InsDataService {
@Autowired
private InsDataMapper insDataMapper;
@Value("${filepath}")
private String filepath;
@Override
public HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria) {
long size = dataQueryCriteria.getSize();
long page = dataQueryCriteria.getPage();
String vague = dataQueryCriteria.getVague();
String title = null;
if (vague != null) {
HashMap hashMap = JSON.parseObject(vague, HashMap.class);
title = hashMap.get("title").toString();
}
/* Page<InsData> insDataPage = new Page<>(page + 1, size);
QueryWrapper<InsData> insDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.insQuery(insDataQueryWrapper, dataQueryCriteria);
insDataPage = insDataMapper.selectPage(insDataPage, insDataQueryWrapper);
long total = insDataPage.getTotal();
List<InsData> records = insDataPage.getRecords();*/
HashMap<String, Object> map = new HashMap<>();
Page<InsDataVo> mapPage = new Page<>(page + 1, size);
Page<InsDataVo> mapPage1 = insDataMapper.selectPages(mapPage, title);
List<InsDataVo> records = mapPage1.getRecords();
long total = mapPage1.getTotal();
map.put("list", records);
map.put("total", total);
return map;
}
/**
* 新增
*
* @param param 根据需要进行传值
* @return
*/
@Override
public boolean add(InsData param) {
int result = insDataMapper.insert(param);
if (result > 0) {
return true;
}
return false;
}
/**
* 修改
*
* @param param 根据需要进行传值
* @return
*/
@Override
public boolean modify(InsData param) {
QueryWrapper<InsData> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", param.getId());
int result = insDataMapper.update(param, queryWrapper);
if (result > 0) {
return true;
}
return false;
}
@Override
public String upload(MultipartFile file) {
File upload = FileUtil.upload(file, filepath);
String name = upload.getName();
return name;
}
@Override
public HttpServletResponse download(HttpServletResponse response, HttpServletRequest request, Integer id) {
//根据 id查询 file 路径
QueryWrapper<InsData> insDataQueryWrapper = new QueryWrapper<>();
insDataQueryWrapper.eq("id", id);
InsData insData = insDataMapper.selectOne(insDataQueryWrapper);
File file = new File(filepath+insData.getFile());
HttpServletResponse download = FileUtil.download(filepath+insData.getFile(), response);
return download;
}
public static void main(String[] args) {
String fileName= "demo.txt";
String suffixName = fileName.substring(fileName.lastIndexOf("."));
//重新生成文件名
fileName = UUID.randomUUID()+suffixName;
System.out.println(fileName);
}
}
package me.zhengjie.gemho.service.ins.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import me.zhengjie.gemho.entity.ins.InsProject;
import me.zhengjie.gemho.mapper.ins.InsProjectMapper;
import me.zhengjie.gemho.service.ins.InsProjectService;
import me.zhengjie.gemho.util.ServiceUtil;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author llj
* @since 2022-04-29
*/
@Service
public class InsProjectServiceImpl extends ServiceImpl<InsProjectMapper, InsProject> implements InsProjectService {
@Autowired
private InsProjectMapper insProjectMapper;
@Override
public HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria) {
long size = dataQueryCriteria.getSize();
long page = dataQueryCriteria.getPage();
Page<InsProject> InsProjectPage = new Page<>(page + 1, size);
QueryWrapper<InsProject> queryWrapper = new QueryWrapper<>();
ServiceUtil.insQuery(queryWrapper, dataQueryCriteria);
InsProjectPage = insProjectMapper.selectPage(InsProjectPage, queryWrapper);
List<InsProject> records = InsProjectPage.getRecords();
long total = InsProjectPage.getTotal();
HashMap<String, Object> map = new HashMap<>();
map.put("list", records);
map.put("total", total);
return map;
}
/**
* 新增
*
* @param param 根据需要进行传值
* @return
*/
@Override
public boolean add(InsProject param) {
int result = insProjectMapper.insert(param);
if (result > 0) {
return true;
}
return false;
}
/**
* 修改
*
* @param param 根据需要进行传值
* @return
*/
@Override
public boolean modify(InsProject param) {
QueryWrapper<InsProject> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", param.getId());
int result = insProjectMapper.update(param, queryWrapper);
if (result > 0) {
return true;
}
return false;
}
@Override
public List listing() {
List listing = insProjectMapper.listing();
return listing;
}
}
......@@ -2,6 +2,7 @@ package me.zhengjie.gemho.service.sys;
import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.sys.SysSummary;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import java.util.HashMap;
......@@ -14,7 +15,7 @@ import java.util.HashMap;
* @since 2021-12-30
*/
public interface SysSummaryService extends IService<SysSummary> {
HashMap<String, Object> getall(String page, String size, String searchName, String searchValue);
HashMap<String, Object> getall(DataQueryCriteria dataQueryCriteria);
HashMap<String, Object> getcode(String mdcode);
......
package me.zhengjie.gemho.service.sys.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -11,16 +12,14 @@ import me.zhengjie.gemho.mapper.sys.SysViewsMapper;
import me.zhengjie.gemho.mapper.tab.DrybeachequipinforMapper;
import me.zhengjie.gemho.mapper.tab.UserTailponMapper;
import me.zhengjie.gemho.service.sys.SysSummaryService;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.modules.security.service.OnlineUserService;
import me.zhengjie.utils.SecurityUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* <p>
......@@ -48,14 +47,23 @@ public class SysSummaryServiceImpl extends ServiceImpl<SysSummaryMapper, SysSumm
private SysTypeMapper sysTypeMapper;
@Override
public HashMap<String, Object> getall(String page, String size, String searchName, String searchValue) {
public HashMap<String, Object> getall(DataQueryCriteria dataQueryCriteria) {
long page = dataQueryCriteria.getPage();
long size = dataQueryCriteria.getSize();
String vague = dataQueryCriteria.getVague();
String searchValue = null;
if (vague != null) {
Map map = JSON.parseObject(vague, Map.class);
Set set = map.keySet();
for (Object o : set) {
searchValue = map.get(o.toString()).toString();
}
}
//创建返回用对象
ArrayList<SysSummary> sysSummaries = new ArrayList<>();
long l = Long.parseLong(page);
long l1 = Long.parseLong(size);
Page<SysSummary> sysSummaryPage = new Page<SysSummary>(l + 1, l1);
Page<SysSummary> sysSummaryPage1 = new Page<SysSummary>(l + 1, l1);
Page<SysSummary> sysSummaryPage2 = new Page<SysSummary>(l + 1, l1);
Page<SysSummary> sysSummaryPage = new Page<SysSummary>(page + 1, size);
Page<SysSummary> sysSummaryPage1 = new Page<SysSummary>(page + 1, size);
Page<SysSummary> sysSummaryPage2 = new Page<SysSummary>(page + 1, size);
QueryWrapper<SysSummary> sysSummaryQueryWrapper = new QueryWrapper<>();
//获取当前登录用户,获取尾矿库编号
String username = SecurityUtils.getCurrentUser().getUsername();
......
......@@ -2,6 +2,8 @@ package me.zhengjie.gemho.service.tab;
import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.tab.Drybeachequipinfor;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.tab.DrybeachequipinforVo;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -16,7 +18,7 @@ import java.util.List;
* @since 2021-12-22
*/
public interface DrybeachequipinforService extends IService<Drybeachequipinfor> {
HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, int page, int size);
HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria);
boolean jcbj(String equipname);
......@@ -45,7 +47,7 @@ public interface DrybeachequipinforService extends IService<Drybeachequipinfor>
*
* @return
*/
HashMap<String, Object> level(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size);
HashMap<String, Object> level(DataQueryCriteria dataQueryCriteria);
/**
* 修改设备报警级别
......@@ -55,4 +57,8 @@ public interface DrybeachequipinforService extends IService<Drybeachequipinfor>
* 设备在线状态统计
*/
List<HashMap<String, Object>> dryStateCount();
List<DrybeachequipinforVo> sensorList(String code);
List<DrybeachequipinforVo> pointDrys();
}
......@@ -2,6 +2,7 @@ package me.zhengjie.gemho.service.tab;
import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.tab.Tailpondinfor;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -17,7 +18,7 @@ import java.util.List;
*/
public interface TailpondinforService extends IService<Tailpondinfor> {
HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, int page, int size);
HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria);
Tailpondinfor getByUser(String username);
......
package me.zhengjie.gemho.service.tab.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -10,15 +11,15 @@ import me.zhengjie.gemho.mapper.tab.DrybeachequipinforMapper;
import me.zhengjie.gemho.service.tab.DrybeachequipinforService;
import me.zhengjie.gemho.util.ServiceUtil;
import me.zhengjie.gemho.util.TailNoForInfoUtil;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.tab.DrybeachequipinforVo;
import me.zhengjie.modules.security.service.OnlineUserService;
import me.zhengjie.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.*;
/**
* <p>
......@@ -40,13 +41,15 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo
private OnlineUserService onlineUserService;
@Override
public HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, int page, int size) {
public HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria) {
long page = dataQueryCriteria.getPage();
long size = dataQueryCriteria.getSize();
HashMap<String, Object> hashMap = new HashMap<>();
QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>();
String currentUsername = SecurityUtils.getCurrentUsername();
String gettailno = onlineUserService.gettailno(currentUsername);
drybeachequipinforQueryWrapper.eq("tailingid", gettailno);
ServiceUtil.query(drybeachequipinforQueryWrapper, searchName, searchValue, limit, timeSpace, sort);
ServiceUtil.query(drybeachequipinforQueryWrapper, dataQueryCriteria);
Page<Drybeachequipinfor> drybeachequipinforPage = new Page<>(page + 1, size);
drybeachequipinforPage = drybeachequipinforMapper.selectPage(drybeachequipinforPage, drybeachequipinforQueryWrapper);
hashMap.put("list", drybeachequipinforPage.getRecords());
......@@ -109,7 +112,20 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo
}
@Override
public HashMap<String, Object> level(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size) {
public HashMap<String, Object> level(DataQueryCriteria dataQueryCriteria) {
long page = dataQueryCriteria.getPage();
long size = dataQueryCriteria.getSize();
String vague = dataQueryCriteria.getVague();
String searchValue = null;
String searchName = null;
if (vague != null) {
Map map = JSON.parseObject(vague, Map.class);
Set set = map.keySet();
for (Object o : set) {
searchName = o.toString();
searchValue = map.get(o.toString()).toString();
}
}
HashMap<String, Object> map = new HashMap<>();
//获取当前尾矿库编码
String tailingid = TailNoForInfoUtil.getTailInfoNo();
......@@ -138,4 +154,28 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo
List<HashMap<String, Object>> hashMaps = drybeachequipinforMapper.dryStateCount(tailInfoNo);
return hashMaps;
}
@Override
public List<DrybeachequipinforVo> sensorList(String code) {
QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>();
drybeachequipinforQueryWrapper.eq("devicetype", code);
List<Drybeachequipinfor> drybeachequipinfors = drybeachequipinforMapper.selectList(drybeachequipinforQueryWrapper);
ArrayList<DrybeachequipinforVo> drybeachequipinforVos = new ArrayList<>();
for (Drybeachequipinfor drybeachequipinfor : drybeachequipinfors) {
DrybeachequipinforVo dryVo = new DrybeachequipinforVo().setEquipname(drybeachequipinfor.getEquipname()).setEquipno(drybeachequipinfor.getEquipno());
drybeachequipinforVos.add(dryVo);
}
return drybeachequipinforVos;
}
@Override
public List<DrybeachequipinforVo> pointDrys() {
List<Drybeachequipinfor> drybeachequipinfors = drybeachequipinforMapper.selectList(null);
ArrayList<DrybeachequipinforVo> drybeachequipinforVos = new ArrayList<>();
for (Drybeachequipinfor drybeachequipinfor : drybeachequipinfors) {
DrybeachequipinforVo dryVo = new DrybeachequipinforVo().setEquipname(drybeachequipinfor.getEquipname()).setEquipno(drybeachequipinfor.getEquipno());
drybeachequipinforVos.add(dryVo);
}
return drybeachequipinforVos;
}
}
......@@ -9,6 +9,7 @@ import me.zhengjie.gemho.mapper.tab.UserTailponMapper;
import me.zhengjie.gemho.service.tab.TailpondinforService;
import me.zhengjie.gemho.util.ServiceUtil;
import me.zhengjie.gemho.util.TailNoForInfoUtil;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -33,7 +34,9 @@ public class TailpondinforServiceImpl extends ServiceImpl<TailpondinforMapper, T
private UserTailponMapper userTailponMapper;
@Override
public HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, int page, int size) {
public HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria) {
long page = dataQueryCriteria.getPage();
long size = dataQueryCriteria.getSize();
HashMap<String, Object> hashMap = new HashMap<>();
QueryWrapper<Tailpondinfor> tailpondinforQueryWrapper = new QueryWrapper<>();
//获取当前登录用户
......@@ -42,7 +45,7 @@ public class TailpondinforServiceImpl extends ServiceImpl<TailpondinforMapper, T
ArrayList<String> gettailnos = userTailponMapper.gettailnos(currentUsername);
tailpondinforQueryWrapper.in("tailingno", gettailnos);
}
ServiceUtil.query(tailpondinforQueryWrapper, searchName, searchValue, limit, timeSpace, sort);
ServiceUtil.query(tailpondinforQueryWrapper,dataQueryCriteria);
Page<Tailpondinfor> tailpondinforPage = new Page<>(page + 1, size);
tailpondinforPage = tailpondinforMapper.selectPage(tailpondinforPage, tailpondinforQueryWrapper);
List<Tailpondinfor> records = tailpondinforPage.getRecords();
......
......@@ -2,6 +2,10 @@ package me.zhengjie.gemho.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
public class DateUtil {
......@@ -128,4 +132,31 @@ public class DateUtil {
//System.out.println(JSONObject.toJSON(list));
return map;
}
/**
* 比较两个时间的时间间隔是否在一小时之内
*
* @param time
* @param time1
* @return
*/
public static boolean timeInterval(Date time, Date time1) {
LocalDateTime localDateTime = dateToLocalDateTime(time);
LocalDateTime localDateTime1 = dateToLocalDateTime(time1);
Duration duration = Duration.between(localDateTime, localDateTime1);
long l = duration.toHours();
if (l <= 1) {
return true;
}
return false;
}
;
public static LocalDateTime dateToLocalDateTime(Date time) {
ZoneId zone = ZoneId.systemDefault();
Instant instant = time.toInstant();
LocalDateTime localDateTime = instant.atZone(zone).toLocalDateTime();
return localDateTime;
}
}
\ No newline at end of file
......@@ -28,7 +28,7 @@ public class PageResult {
return new PageResult(200, map, "");
}
public static PageResult nopagesuccess(List<?> list) {
public PageResult nopagesuccess(List<?> list) {
return new PageResult(200, list, "操作成功");
}
......
package me.zhengjie.gemho.x_datavo.artificial;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
public class ADataVo {
private Integer id;
/**
* 监测点id
*/
private Integer point_id;
/**
* 监测子项id
*/
private int jczx_id;
/**
* 监测子项
*/
private String jcziitemname;
/**
* 监测内容及要求
*/
private String content;
/**
* 监测仪器
*/
private String implement;
/**
* 监测精度
*/
@TableField(value = "`precision`")
private String precision;
/**
* 监测结果
*/
private String value;
/**
* 添加时间或修改时间
*/
private Date addtime;
/**
* 监测时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date time;
}
package me.zhengjie.gemho.x_datavo.artificial;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* 用于返回数据
*/
@Data
public class ArtificialDataVo {
private String jcziitemname;
private String value;
@JsonFormat(pattern = "yyyy-mm-dd HH:mm:ss")
private Date jctime;
}
package me.zhengjie.gemho.x_datavo.artificial;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class PointListVo {
private String jcdname;
private int id;
}
......@@ -11,7 +11,9 @@ public class DataQueryCriteria {
private long page;
private long size;
//排序
private String code;
private String sort;
private String daterange;
private String sensorname;
}
package me.zhengjie.gemho.x_datavo.data;
import lombok.Data;
import me.zhengjie.gemho.x_datavo.Result;
import java.util.HashMap;
import java.util.List;
@Data
public class ImgDataVo {
private String title;
private String range;
private String sensorname;
private HashMap<String, Object> alarm;
private Object names;
private List<Result> lists;
}
package me.zhengjie.gemho.x_datavo.ins;
import lombok.Data;
import java.util.Date;
@Data
public class InsDataVo {
private Integer id;
private String title;
private int child_id;
private int project_id;
private String content;
private String type;
private String file;
private String image;
private String text;
private Date add_time;
private Date update_time;
}
package me.zhengjie.gemho.x_datavo.tab;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class DrybeachequipinforVo {
private String equipno;
private String equipname;
}
......@@ -22,7 +22,9 @@ import java.util.List;
public class MyGenerator {
public static void main(String[] args) {
List<String> tables = new ArrayList<>();
tables.add("web_monitor_points");
tables.add("ins_project");
tables.add("ins_data");
tables.add("ins_children");
tables.size();
FastAutoGenerator.create(
//数据源配置,url需要修改
......@@ -50,12 +52,12 @@ public class MyGenerator {
.packageConfig(builder -> {
builder.parent("me.zhengjie.gemho") // 设置父包名,根据实制项目路径修改
//.moduleName("sys")
.entity("entity.demo")
.service("service.demo")
.serviceImpl("service.demo.impl")
.mapper("mapper.demo")
.entity("entity.ins")
.service("service.ins")
.serviceImpl("service.ins.impl")
.mapper("mapper.ins")
//.xml("mapper.xml")
.controller("controller.demo")
.controller("controller.ins")
//.other("other")
.pathInfo(Collections.singletonMap(OutputFile.mapperXml, System.getProperty("user.dir") + "/src/main/resources/mapper"));
})
......@@ -63,7 +65,7 @@ public class MyGenerator {
//策略配置
.strategyConfig(builder -> {
builder.addInclude(tables) // 设置需要生成的表名 可以为集合 一次生成多个
.addTablePrefix("web_")//过滤表名 如表名为tab_user 实体类名为 user
.addTablePrefix("")//过滤表名 如表名为tab_user 实体类名为 user
.serviceBuilder()
.formatServiceFileName("%sService")//service 名称
.formatServiceImplFileName("%sServiceImpl") // serviceImpl 名称
......@@ -86,6 +88,6 @@ public class MyGenerator {
})
.execute();
//HttpRequest.post("").body("").execute().body();
System.out.println(System.getProperty("user.dir") );
System.out.println(System.getProperty("user.dir"));
}
}
......@@ -65,4 +65,7 @@ mybatis-plus:
netty:
tcp:
server:
port: 502
\ No newline at end of file
port: 502
filepath: d:/file/
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="me.zhengjie.gemho.mapper.dic.JczxMapper">
<select id="deal" resultType="hashmap">
SELECT cj.*
FROM `artificial_point` ap
join tb_drybeachequipinfor td on ap.equipno = td.equipno
join c_jczx cj on td.devicetype = cj.p_id
where ap.id = #{id}
</select>
<select id="jczxList" resultType="hashmap">
SELECT id as id, name as name
FROM `c_jczx`
where p_id = #{p_id}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="me.zhengjie.gemho.mapper.ins.InsChildrenMapper">
<select id="listing" resultType="hashmap">
select id, content, type
from ins_children
<if test="project_id !=null and project_id!='' ">
where project_id = #{project_id}
</if>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="me.zhengjie.gemho.mapper.ins.InsDataMapper">
<select id="selectPages" resultType="me.zhengjie.gemho.x_datavo.ins.InsDataVo">
select id.id,
id.child_id,
id.project_id,
id.title,
ic.content,
ic.type,
id.file,
id.image,
id.text,
id.add_time,
id.update_time
from ins_project ip
join ins_children ic on ip.id = ic.project_id
join ins_data id on id.child_id = ic.id
<if test="title!=null and title!=''">
where id.title like CONCAT('%',#{title},'%')
</if>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="me.zhengjie.gemho.mapper.ins.InsProjectMapper">
<select id="listing" resultType="hashmap">
select id, name
from ins_project
</select>
</mapper>
......@@ -11,6 +11,8 @@ import org.springframework.http.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import lombok.RequiredArgsConstructor;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
<#if restControllerStyle>
<#else>
import org.springframework.stereotype.Controller;
......@@ -32,6 +34,7 @@ import java.util.List;
* @since ${date}
*/
@Api(tags = "${table.comment}")
@RequiredArgsConstructor
<#if restControllerStyle>
@RestController
<#else>
......@@ -52,14 +55,8 @@ private ${table.serviceName} ${table.serviceName?uncap_first};
@ApiOperation(value = "${table.comment}分页列表", response = ${entity}.class)
@GetMapping(value = "/page")
public ResponseEntity<Object> list(@ApiParam(value = "分页参数,页数") String page,
@ApiParam(value = "分页参数,数量") String size,
@ApiParam(value = "查询条件字段") String searchName,
@ApiParam(value = "查询条件数值") String searchValue,
@ApiParam(value = "查询条件精准或者模糊") String limit,
@ApiParam(value = "查询条件时间区间") String timeSpace,
@ApiParam(value = "查询条件正序或者倒序") String sort) {
HashMap<String, Object> data = ${table.serviceName?uncap_first}.list(searchName, searchValue, limit, timeSpace, sort, page, size);
public ResponseEntity<Object> list(DataQueryCriteria dataQueryCriteria) {
HashMap<String, Object> data = ${table.serviceName?uncap_first}.plist(dataQueryCriteria);
return new ResponseEntity<>(new PageResult().success(data), HttpStatus.OK);
}
......
......@@ -3,6 +3,7 @@ package ${package.Service};
import ${package.Entity}.${entity};
import ${superServiceClassPackage};
import java.util.HashMap;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
......@@ -22,16 +23,10 @@ import java.util.List;
/**
* ${table.comment!}分页列表
* @param searchName
* @param searchValue
* @param limit
* @param timeSpace
* @param sort
* @param page
* @param size
* @param dataQueryCriteria
* @return
*/
HashMap<String, Object> list(String searchName, String searchValue, String limit, String timeSpace, String sort,String page,String size);
HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria);
/**
......
......@@ -45,12 +45,12 @@ private ${table.mapperName} ${table.mapperName?uncap_first};
* @return
*/
@Override
public HashMap<String, Object> list(String searchName, String searchValue, String limit, String timeSpace, String sort,String page,String size) {
long l1 = Long.parseLong(page) + 1;
long l2 = Long.parseLong(size);
Page<${entity}> ${entity}Page = new Page<>(l1, l2);
public HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria) {
long size = dataQueryCriteria.getSize();
long page = dataQueryCriteria.getPage();
Page<${entity}> ${entity}Page = new Page<>(page+1, size);
QueryWrapper<${entity}> queryWrapper = new QueryWrapper<>();
ServiceUtil.query(queryWrapper, searchName, searchValue, limit, timeSpace, sort);
ServiceUtil.dataQuery(queryWrapper, dataQueryCriteria);
${entity}Page=${table.mapperName?uncap_first}.selectPage(${entity}Page, queryWrapper);
List<${entity}> records = ${entity}Page.getRecords();
long total = ${entity}Page.getTotal();
......
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