Commit a7a49d1b authored by kiritoausna's avatar kiritoausna

2022-5-6

parent 885b80f9
...@@ -18,6 +18,8 @@ package me.zhengjie; ...@@ -18,6 +18,8 @@ package me.zhengjie;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import me.zhengjie.annotation.rest.AnonymousGetMapping; import me.zhengjie.annotation.rest.AnonymousGetMapping;
import me.zhengjie.utils.SpringContextHolder; import me.zhengjie.utils.SpringContextHolder;
import org.apache.ibatis.annotations.Mapper;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
...@@ -44,6 +46,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; ...@@ -44,6 +46,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication @SpringBootApplication
@EnableTransactionManagement @EnableTransactionManagement
@EnableJpaAuditing(auditorAwareRef = "auditorAware") @EnableJpaAuditing(auditorAwareRef = "auditorAware")
@MapperScan("me.zhengjie.gemho.mapper")
public class AppRun implements CommandLineRunner { public class AppRun implements CommandLineRunner {
@Value("${netty.tcp.server.port}") @Value("${netty.tcp.server.port}")
private String port; private String port;
......
...@@ -14,6 +14,7 @@ import org.springframework.http.HttpStatus; ...@@ -14,6 +14,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -37,17 +38,17 @@ public class ArtificialDataController { ...@@ -37,17 +38,17 @@ public class ArtificialDataController {
@ApiOperation(value = "人工监测数据表分页列表", response = ArtificialData.class) @ApiOperation(value = "人工监测数据表分页列表", response = ArtificialData.class)
@GetMapping() @GetMapping()
public ResponseEntity<Object> list(DataQueryCriteria dataQueryCriteria) { public ResponseEntity<Object> list(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
HashMap<String, Object> data = artificialDataService.plist(dataQueryCriteria); HashMap<String, Object> data = artificialDataService.plist(dataQueryCriteria,request);
return new ResponseEntity<>(new PageResult().success(data), HttpStatus.OK); return new ResponseEntity<>(new PageResult().success(data), HttpStatus.OK);
} }
@Log(value = "新增人工监测数据") @Log(value = "新增人工监测数据")
@ApiOperation(value = "人工监测数据表新增") @ApiOperation(value = "人工监测数据表新增")
@PostMapping() @PostMapping()
public Object add(@Valid @RequestBody ArtificialData param) { public Object add(@Valid @RequestBody ArtificialData param,HttpServletRequest request) {
param.setAddtime(new Date()); param.setAddtime(new Date());
boolean result = artificialDataService.add(param); boolean result = artificialDataService.add(param,request);
if (result) { if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK); return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else { } else {
...@@ -58,9 +59,9 @@ public class ArtificialDataController { ...@@ -58,9 +59,9 @@ public class ArtificialDataController {
@Log(value = "修改人工监测数据") @Log(value = "修改人工监测数据")
@ApiOperation(value = "人工监测数据表修改") @ApiOperation(value = "人工监测数据表修改")
@PutMapping() @PutMapping()
public Object modify(@Valid @RequestBody ArtificialData param) { public Object modify(@Valid @RequestBody ArtificialData param,HttpServletRequest request) {
param.setAddtime(new Date()); param.setAddtime(new Date());
boolean result = artificialDataService.modify(param); boolean result = artificialDataService.modify(param,request);
if (result) { if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK); return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else { } else {
......
...@@ -14,6 +14,7 @@ import org.springframework.http.HttpStatus; ...@@ -14,6 +14,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -38,16 +39,16 @@ public class ArtificialPointController { ...@@ -38,16 +39,16 @@ public class ArtificialPointController {
@ApiOperation(value = "人工监测点位表分页列表", response = ArtificialPoint.class) @ApiOperation(value = "人工监测点位表分页列表", response = ArtificialPoint.class)
@GetMapping() @GetMapping()
public ResponseEntity<Object> list(DataQueryCriteria dataQueryCriteria) { public ResponseEntity<Object> list(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
HashMap<String, Object> data = artificialPointService.plist(dataQueryCriteria); HashMap<String, Object> data = artificialPointService.plist(dataQueryCriteria,request);
return new ResponseEntity<>(new PageResult().success(data), HttpStatus.OK); return new ResponseEntity<>(new PageResult().success(data), HttpStatus.OK);
} }
@Log(value = "新增人工监测点位") @Log(value = "新增人工监测点位")
@ApiOperation(value = "人工监测点位表新增") @ApiOperation(value = "人工监测点位表新增")
@PostMapping() @PostMapping()
public Object add(@Valid @RequestBody ArtificialPoint param) { public Object add(@Valid @RequestBody ArtificialPoint param,HttpServletRequest request) {
boolean result = artificialPointService.add(param); boolean result = artificialPointService.add(param,request);
if (result) { if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK); return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else { } else {
...@@ -58,9 +59,9 @@ public class ArtificialPointController { ...@@ -58,9 +59,9 @@ public class ArtificialPointController {
@Log(value = "修改人工监测点位") @Log(value = "修改人工监测点位")
@ApiOperation(value = "人工监测点位表修改") @ApiOperation(value = "人工监测点位表修改")
@PutMapping() @PutMapping()
public Object modify(@Valid @RequestBody ArtificialPoint param) { public Object modify(@Valid @RequestBody ArtificialPoint param,HttpServletRequest request) {
param.setTime(new Date()); param.setTime(new Date());
boolean result = artificialPointService.modify(param); boolean result = artificialPointService.modify(param,request);
if (result) { if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK); return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else { } else {
......
...@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -42,7 +43,7 @@ public class DataVisController { ...@@ -42,7 +43,7 @@ public class DataVisController {
@ResponseBody @ResponseBody
@RequestMapping("md") @RequestMapping("md")
public ResponseEntity<Object> getall(@RequestBody List<Children> children) { public ResponseEntity<Object> getall(@RequestBody List<Children> children, HttpServletRequest request) {
ArrayList<DataVo> dataVos = new ArrayList<>(); ArrayList<DataVo> dataVos = new ArrayList<>();
HashMap<String, DataVo> map = new HashMap<>(); HashMap<String, DataVo> map = new HashMap<>();
for (Children child : children) { for (Children child : children) {
...@@ -97,7 +98,7 @@ public class DataVisController { ...@@ -97,7 +98,7 @@ public class DataVisController {
break; break;
} }
case "t_8": { case "t_8": {
ResponseEntity<Object> all = szDataController.getAll(child.getRange(), child.getValues(), child.getDeviceid(), child.getSubitem()); ResponseEntity<Object> all = szDataController.getAll(child.getRange(), child.getValues(), child.getDeviceid(), child.getSubitem(),request);
RealVo body = (RealVo) all.getBody(); RealVo body = (RealVo) all.getBody();
DataVo dataVo = body.getBody(); DataVo dataVo = body.getBody();
map.put("t_8"+child.getRange(),dataVo); map.put("t_8"+child.getRange(),dataVo);
......
...@@ -14,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -14,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -82,9 +81,9 @@ public class DbDataController { ...@@ -82,9 +81,9 @@ public class DbDataController {
*/ */
@ApiOperation("获取干滩的历史数据") @ApiOperation("获取干滩的历史数据")
@GetMapping("history") @GetMapping("history")
public ResponseEntity<Object> gethistory(DataQueryCriteria dataQueryCriteria) { public ResponseEntity<Object> gethistory(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
try { try {
HashMap<String, Object> map = dbDataService.pageall(dataQueryCriteria); HashMap<String, Object> map = dbDataService.pageall(dataQueryCriteria, request);
return new ResponseEntity<>(new PageResult().success(map), HttpStatus.OK); return new ResponseEntity<>(new PageResult().success(map), HttpStatus.OK);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -101,8 +100,8 @@ public class DbDataController { ...@@ -101,8 +100,8 @@ public class DbDataController {
@ApiOperation("导出菜单数据") @ApiOperation("导出菜单数据")
@GetMapping("download") @GetMapping("download")
public void exportDept(HttpServletResponse response,DataQueryCriteria dataQueryCriteria) throws Exception { public void exportDept(HttpServletResponse response, DataQueryCriteria dataQueryCriteria, HttpServletRequest request) throws Exception {
dbDataService.download(dataQueryCriteria, response); dbDataService.download(dataQueryCriteria, response, request);
} }
} }
...@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -48,7 +49,7 @@ public class RealDataController { ...@@ -48,7 +49,7 @@ public class RealDataController {
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
@GetMapping @GetMapping
public ResponseEntity<Object> real() { public ResponseEntity<Object> real(HttpServletRequest request) {
//创建返回对象 //创建返回对象
ArrayList<RealDataVo> realDataVos = new ArrayList<>(); ArrayList<RealDataVo> realDataVos = new ArrayList<>();
ArrayList<RealDataVo> realDataVos1 = new ArrayList<>(); ArrayList<RealDataVo> realDataVos1 = new ArrayList<>();
...@@ -64,7 +65,7 @@ public class RealDataController { ...@@ -64,7 +65,7 @@ public class RealDataController {
QueryWrapper<SlData> slDataQueryWrapper = new QueryWrapper<>();*/ QueryWrapper<SlData> slDataQueryWrapper = new QueryWrapper<>();*/
//获取当前登录用户 根据当前用户获取尾矿库id //获取当前登录用户 根据当前用户获取尾矿库id
String username = SecurityUtils.getCurrentUsername(); String username = SecurityUtils.getCurrentUsername();
String gettailno = onlineUserService.gettailno(username); String gettailno = onlineUserService.gettailno(username,request);
//获取相应尾矿库下的所有设备 //获取相应尾矿库下的所有设备
List<String> equipnos = drybeachequipinforService.getequipno(gettailno); List<String> equipnos = drybeachequipinforService.getequipno(gettailno);
//获取所有检测项 //获取所有检测项
...@@ -77,35 +78,35 @@ public class RealDataController { ...@@ -77,35 +78,35 @@ public class RealDataController {
for (SysType sysType : list) { for (SysType sysType : list) {
switch (sysType.getCode()) { switch (sysType.getCode()) {
case "1": case "1":
List<RealDataVo> dbdatas = dbDataService.real(sysType.getTypeno()); List<RealDataVo> dbdatas = dbDataService.real(sysType.getTypeno(),request);
realDataVos.addAll(dbdatas); realDataVos.addAll(dbdatas);
break; break;
case "2": case "2":
List<RealDataVo> wtdatas = wtDataService.real(sysType.getTypeno()); List<RealDataVo> wtdatas = wtDataService.real(sysType.getTypeno(),request);
realDataVos.addAll(wtdatas); realDataVos.addAll(wtdatas);
break; break;
case "3": case "3":
List<RealDataVo> mpdatas = mpDataService.real(sysType.getTypeno()); List<RealDataVo> mpdatas = mpDataService.real(sysType.getTypeno(),request);
realDataVos.addAll(mpdatas); realDataVos.addAll(mpdatas);
break; break;
case "4": case "4":
List<RealDataVo> dmdatas = dmDataService.real(sysType.getTypeno()); List<RealDataVo> dmdatas = dmDataService.real(sysType.getTypeno(),request);
realDataVos.addAll(dmdatas); realDataVos.addAll(dmdatas);
break; break;
case "5": case "5":
List<RealDataVo> stdatas = stDataService.real(sysType.getTypeno()); List<RealDataVo> stdatas = stDataService.real(sysType.getTypeno(),request);
realDataVos.addAll(stdatas); realDataVos.addAll(stdatas);
break; break;
case "6": case "6":
List<RealDataVo> rgdatas = rgDataService.real(sysType.getTypeno()); List<RealDataVo> rgdatas = rgDataService.real(sysType.getTypeno(),request);
realDataVos.addAll(rgdatas); realDataVos.addAll(rgdatas);
break; break;
case "7": case "7":
List<RealDataVo> psldatas = pslDataService.real(sysType.getTypeno()); List<RealDataVo> psldatas = pslDataService.real(sysType.getTypeno(),request);
realDataVos.addAll(psldatas); realDataVos.addAll(psldatas);
break; break;
case "9": case "9":
List<RealDataVo> sldatas = slDataService.real(sysType.getTypeno()); List<RealDataVo> sldatas = slDataService.real(sysType.getTypeno(),request);
realDataVos.addAll(sldatas); realDataVos.addAll(sldatas);
break; break;
} }
......
...@@ -15,6 +15,7 @@ import org.springframework.http.HttpStatus; ...@@ -15,6 +15,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
...@@ -41,10 +42,10 @@ public class SzDataController { ...@@ -41,10 +42,10 @@ public class SzDataController {
public ResponseEntity<Object> getAll(@ApiParam("日期范围") String range, public ResponseEntity<Object> getAll(@ApiParam("日期范围") String range,
@ApiParam("监测值") String values, @ApiParam("监测值") String values,
@ApiParam("设备id") String deviceid, @ApiParam("设备id") String deviceid,
@ApiParam("检测项") String subitem) { @ApiParam("检测项") String subitem, HttpServletRequest request) {
ArrayList<HashMap<String, Object>> maps = new ArrayList<>(); ArrayList<HashMap<String, Object>> maps = new ArrayList<>();
try { try {
maps = szDataService.real(deviceid); maps = szDataService.real(deviceid,request);
return new ResponseEntity<>(new PageResult().nopagesuccess(maps), HttpStatus.OK); return new ResponseEntity<>(new PageResult().nopagesuccess(maps), HttpStatus.OK);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -41,18 +41,18 @@ public class InsDataController { ...@@ -41,18 +41,18 @@ public class InsDataController {
@ApiOperation(value = "分页列表", response = InsData.class) @ApiOperation(value = "分页列表", response = InsData.class)
@GetMapping() @GetMapping()
public ResponseEntity<Object> list(DataQueryCriteria dataQueryCriteria) { public ResponseEntity<Object> list(DataQueryCriteria dataQueryCriteria,HttpServletRequest request) {
HashMap<String, Object> data = insDataService.plist(dataQueryCriteria); HashMap<String, Object> data = insDataService.plist(dataQueryCriteria,request);
return new ResponseEntity<>(new PageResult().success(data), HttpStatus.OK); return new ResponseEntity<>(new PageResult().success(data), HttpStatus.OK);
} }
@ApiOperation(value = "新增") @ApiOperation(value = "新增")
@PostMapping() @PostMapping()
public Object add(@Valid @RequestBody InsData param) { public Object add(@Valid @RequestBody InsData param,HttpServletRequest request) {
param.setAdd_time(new Date()); param.setAdd_time(new Date());
param.setUpdate_time(new Date()); param.setUpdate_time(new Date());
boolean result = insDataService.add(param); boolean result = insDataService.add(param,request);
if (result) { if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK); return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else { } else {
...@@ -62,9 +62,9 @@ public class InsDataController { ...@@ -62,9 +62,9 @@ public class InsDataController {
@ApiOperation(value = "修改") @ApiOperation(value = "修改")
@PutMapping() @PutMapping()
public Object modify(@Valid @RequestBody InsData param) { public Object modify(@Valid @RequestBody InsData param,HttpServletRequest request) {
param.setUpdate_time(new Date()); param.setUpdate_time(new Date());
boolean result = insDataService.modify(param); boolean result = insDataService.modify(param,request);
if (result) { if (result) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK); return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} else { } else {
......
...@@ -21,6 +21,7 @@ import org.springframework.http.HttpStatus; ...@@ -21,6 +21,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -52,14 +53,14 @@ public class SysAreaController { ...@@ -52,14 +53,14 @@ public class SysAreaController {
@ApiOperation(value = "获取区域模块配置") @ApiOperation(value = "获取区域模块配置")
@GetMapping @GetMapping
public ResponseEntity<Object> getall() { public ResponseEntity<Object> getall(HttpServletRequest request) {
HashMap<String, Object> hashMap = new HashMap<>(); HashMap<String, Object> hashMap = new HashMap<>();
List<SysArea> list = sysAreaService.list(); List<SysArea> list = sysAreaService.list();
List<SysViews> list1 = sysViewsService.list(); List<SysViews> list1 = sysViewsService.list();
//获取当前用户 //获取当前用户
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
//根据用户获取尾矿库编号 //根据用户获取尾矿库编号
String gettailno = onlineUserService.gettailno(currentUsername); String gettailno = onlineUserService.gettailno(currentUsername, request);
List<SysSelect> list2 = sysSelectService.getbytail(gettailno); List<SysSelect> list2 = sysSelectService.getbytail(gettailno);
HashMap<String, ArrayList<SysSelect>> sysselectmap = new HashMap<>(); HashMap<String, ArrayList<SysSelect>> sysselectmap = new HashMap<>();
for (SysSelect sysSelect : list2) { for (SysSelect sysSelect : list2) {
...@@ -90,16 +91,16 @@ public class SysAreaController { ...@@ -90,16 +91,16 @@ public class SysAreaController {
@ApiOperation(value = "大屏获取数据的接口") @ApiOperation(value = "大屏获取数据的接口")
@GetMapping("visual") @GetMapping("visual")
public ResponseEntity<Object> visual() { public ResponseEntity<Object> visual(HttpServletRequest request) {
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
List<SysArea> visual = sysSelectService.visual(); List<SysArea> visual = sysSelectService.visual(request);
return new ResponseEntity<>(new PageResult().nopagesuccess(visual), HttpStatus.OK); return new ResponseEntity<>(new PageResult().nopagesuccess(visual), HttpStatus.OK);
} }
@ApiOperation(value = "大屏标题") @ApiOperation(value = "大屏标题")
@GetMapping("title") @GetMapping("title")
public ResponseEntity<Object> title() { public ResponseEntity<Object> title(HttpServletRequest request) {
String screenTitle = tailpondinforService.getScreenTitle(); String screenTitle = tailpondinforService.getScreenTitle(request);
HashMap<String, String> map = new HashMap<>(); HashMap<String, String> map = new HashMap<>();
map.put("title", screenTitle); map.put("title", screenTitle);
return new ResponseEntity<>(new PageResult().nopagesuccess(map), HttpStatus.OK); return new ResponseEntity<>(new PageResult().nopagesuccess(map), HttpStatus.OK);
...@@ -108,9 +109,9 @@ public class SysAreaController { ...@@ -108,9 +109,9 @@ public class SysAreaController {
@Log("修改大屏标题") @Log("修改大屏标题")
@ApiOperation(value = "大屏标题") @ApiOperation(value = "大屏标题")
@PostMapping("title") @PostMapping("title")
public ResponseEntity<Object> updateTitle(@RequestBody HashMap<String, String> requestMap) { public ResponseEntity<Object> updateTitle(@RequestBody HashMap<String, String> requestMap, HttpServletRequest request) {
String title = requestMap.get("title"); String title = requestMap.get("title");
tailpondinforService.updateTitle(title); tailpondinforService.updateTitle(title, request);
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK); return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} }
} }
......
...@@ -10,6 +10,7 @@ import org.springframework.http.HttpStatus; ...@@ -10,6 +10,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
/** /**
...@@ -29,8 +30,8 @@ public class SysSelectController { ...@@ -29,8 +30,8 @@ public class SysSelectController {
@Log(value = "修改配置大屏检测项") @Log(value = "修改配置大屏检测项")
@PostMapping @PostMapping
public ResponseEntity<Object> add(@RequestBody HashMap<String, Object> map) { public ResponseEntity<Object> add(@RequestBody HashMap<String, Object> map, HttpServletRequest request) {
boolean updata = sysSelectService.updata(map); boolean updata = sysSelectService.updata(map,request);
if (updata) { if (updata) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK); return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} }
......
...@@ -21,6 +21,7 @@ import org.springframework.http.HttpStatus; ...@@ -21,6 +21,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -53,8 +54,8 @@ public class SysSummaryController { ...@@ -53,8 +54,8 @@ public class SysSummaryController {
*/ */
@ApiOperation(value = "查询", response = SysSummary.class) @ApiOperation(value = "查询", response = SysSummary.class)
@GetMapping @GetMapping
public ResponseEntity<Object> getall(DataQueryCriteria dataQueryCriteria) { public ResponseEntity<Object> getall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
HashMap<String, Object> hashMap = sysSummaryService.getall(dataQueryCriteria); HashMap<String, Object> hashMap = sysSummaryService.getall(dataQueryCriteria, request);
return new ResponseEntity<>(new PageResult().success(hashMap), HttpStatus.OK); return new ResponseEntity<>(new PageResult().success(hashMap), HttpStatus.OK);
} }
...@@ -67,9 +68,9 @@ public class SysSummaryController { ...@@ -67,9 +68,9 @@ public class SysSummaryController {
@Log(value = "新增检测项") @Log(value = "新增检测项")
@ApiOperation(value = "新增") @ApiOperation(value = "新增")
@PostMapping @PostMapping
public ResponseEntity<Object> add(@RequestBody SysSummary sysSummary) { public ResponseEntity<Object> add(@RequestBody SysSummary sysSummary, HttpServletRequest request) {
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
String gettailno = onlineUserService.gettailno(currentUsername); String gettailno = onlineUserService.gettailno(currentUsername, request);
sysSummary.setCreatetime(LocalDateTime.now()); sysSummary.setCreatetime(LocalDateTime.now());
sysSummary.setUpdatetime(LocalDateTime.now()); sysSummary.setUpdatetime(LocalDateTime.now());
String title = sysSummary.getTitle(); String title = sysSummary.getTitle();
...@@ -141,10 +142,10 @@ public class SysSummaryController { ...@@ -141,10 +142,10 @@ public class SysSummaryController {
@Log(value = "删除检测项") @Log(value = "删除检测项")
@ApiOperation(value = "删除") @ApiOperation(value = "删除")
@DeleteMapping @DeleteMapping
public ResponseEntity<Object> shanchu(@RequestBody HashMap<String, String> map) { public ResponseEntity<Object> shanchu(@RequestBody HashMap<String, String> map, HttpServletRequest request) {
try { try {
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
String gettailno = onlineUserService.gettailno(currentUsername); String gettailno = onlineUserService.gettailno(currentUsername, request);
Integer id = Integer.valueOf(map.get("id")); Integer id = Integer.valueOf(map.get("id"));
boolean deletebyid = sysSummaryService.deletebyid(id); boolean deletebyid = sysSummaryService.deletebyid(id);
if (deletebyid) { if (deletebyid) {
...@@ -159,9 +160,9 @@ public class SysSummaryController { ...@@ -159,9 +160,9 @@ public class SysSummaryController {
@ApiOperation(value = "获取模块配置信息下拉列表") @ApiOperation(value = "获取模块配置信息下拉列表")
@GetMapping("code") @GetMapping("code")
public ResponseEntity<Object> getcode(@ApiParam(value = "模块id") String mdcode) { public ResponseEntity<Object> getcode(@ApiParam(value = "模块id") String mdcode, HttpServletRequest request) {
try { try {
HashMap<String, Object> getcode = sysSummaryService.getcode(mdcode); HashMap<String, Object> getcode = sysSummaryService.getcode(mdcode, request);
return new ResponseEntity<>(new PageResult().success(getcode), HttpStatus.OK); return new ResponseEntity<>(new PageResult().success(getcode), HttpStatus.OK);
} catch (Exception e) { } catch (Exception e) {
System.out.println(e); System.out.println(e);
......
...@@ -3,7 +3,6 @@ package me.zhengjie.gemho.controller.tab; ...@@ -3,7 +3,6 @@ package me.zhengjie.gemho.controller.tab;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import me.zhengjie.annotation.Log; import me.zhengjie.annotation.Log;
import me.zhengjie.gemho.service.tab.DrybeachequipinforService; import me.zhengjie.gemho.service.tab.DrybeachequipinforService;
import me.zhengjie.gemho.service.tab.TabAbnormalService; import me.zhengjie.gemho.service.tab.TabAbnormalService;
...@@ -15,6 +14,8 @@ import org.springframework.http.HttpStatus; ...@@ -15,6 +14,8 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -38,17 +39,17 @@ public class AbnormalController { ...@@ -38,17 +39,17 @@ public class AbnormalController {
@ApiOperation(value = "获取预警列表") @ApiOperation(value = "获取预警列表")
@GetMapping() @GetMapping()
public ResponseEntity<Object> getAbnormalall() { public ResponseEntity<Object> getAbnormalall(HttpServletRequest request) {
ArrayList<HashMap<String, Object>> abnormal = tabAbnormalService.getAbnormal(); ArrayList<HashMap<String, Object>> abnormal = tabAbnormalService.getAbnormal(request);
return new ResponseEntity<>(new PageResult().nopagesuccess(abnormal), HttpStatus.OK); return new ResponseEntity<>(new PageResult().nopagesuccess(abnormal), HttpStatus.OK);
} }
@Log("接触报警") @Log("接触报警")
@ApiOperation(value = "解除预警") @ApiOperation(value = "解除预警")
@PostMapping @PutMapping("histoty")
public ResponseEntity<Object> jcbj(@RequestBody HashMap<String, String> map) { public ResponseEntity<Object> jcbj(@RequestBody HashMap<String, String> map) {
String equipno = map.get("equipno"); String equipno = map.get("equipno");
String time = map.get("time"); String time = map.get("jchours");
String reason = map.get("reason"); String reason = map.get("reason");
String jcreason = map.get("jcreason"); String jcreason = map.get("jcreason");
boolean jcbj = tabAbnormalService.jcbj(equipno, time, reason, jcreason); boolean jcbj = tabAbnormalService.jcbj(equipno, time, reason, jcreason);
...@@ -60,15 +61,15 @@ public class AbnormalController { ...@@ -60,15 +61,15 @@ public class AbnormalController {
@ApiOperation(value = "风险统计") @ApiOperation(value = "风险统计")
@GetMapping("statistics") @GetMapping("statistics")
public ResponseEntity<Object> statistics(String date) { public ResponseEntity<Object> statistics(String date, HttpServletRequest request) {
List<HashMap<String, Object>> statistics = tabAbnormalService.statistics(date); List<HashMap<String, Object>> statistics = tabAbnormalService.statistics(date, request);
return new ResponseEntity<>(new PageResult().nopagesuccess(statistics), HttpStatus.OK); return new ResponseEntity<>(new PageResult().nopagesuccess(statistics), HttpStatus.OK);
} }
@ApiOperation(value = "检测项风险状态列表") @ApiOperation(value = "检测项风险状态列表")
@GetMapping("typelist") @GetMapping("typelist")
public ResponseEntity<Object> typelist() { public ResponseEntity<Object> typelist(HttpServletRequest request) {
List<HashMap<String, Object>> statistics1 = tabAbnormalService.statistics1(); List<HashMap<String, Object>> statistics1 = tabAbnormalService.statistics1(request);
HashMap<String, Integer> map = new HashMap<>(); HashMap<String, Integer> map = new HashMap<>();
for (HashMap<String, Object> stringObjectHashMap : statistics1) { for (HashMap<String, Object> stringObjectHashMap : statistics1) {
String devicetype = (String) stringObjectHashMap.get("code"); String devicetype = (String) stringObjectHashMap.get("code");
...@@ -98,7 +99,7 @@ public class AbnormalController { ...@@ -98,7 +99,7 @@ public class AbnormalController {
map.put(devicetype, 1); map.put(devicetype, 1);
} }
} }
List<HashMap<String, Object>> typelist = tabAbnormalService.typelist(); List<HashMap<String, Object>> typelist = tabAbnormalService.typelist(request);
for (HashMap<String, Object> statistic : typelist) { for (HashMap<String, Object> statistic : typelist) {
String code = (String) statistic.get("code"); String code = (String) statistic.get("code");
Integer integer = map.get(code); Integer integer = map.get(code);
...@@ -112,15 +113,15 @@ public class AbnormalController { ...@@ -112,15 +113,15 @@ public class AbnormalController {
@ApiOperation(value = "风险等级月统计") @ApiOperation(value = "风险等级月统计")
@GetMapping("monthtj") @GetMapping("monthtj")
public ResponseEntity<Object> monthtj() { public ResponseEntity<Object> monthtj(HttpServletRequest request) {
List<HashMap<String, Object>> monthtj = tabAbnormalService.monthtj(); List<HashMap<String, Object>> monthtj = tabAbnormalService.monthtj(request);
return new ResponseEntity<>(new PageResult().nopagesuccess(monthtj), HttpStatus.OK); return new ResponseEntity<>(new PageResult().nopagesuccess(monthtj), HttpStatus.OK);
} }
@ApiOperation(value = "获取设备的四级报警") @ApiOperation(value = "获取设备的四级报警")
@GetMapping("level") @GetMapping("level")
public ResponseEntity<Object> alarmlevel(DataQueryCriteria dataQueryCriteria) { public ResponseEntity<Object> alarmlevel(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
HashMap<String, Object> level = drybeachequipinforService.level(dataQueryCriteria); HashMap<String, Object> level = drybeachequipinforService.level(dataQueryCriteria,request);
return new ResponseEntity<>(new PageResult().nopagesuccess(level), HttpStatus.OK); return new ResponseEntity<>(new PageResult().nopagesuccess(level), HttpStatus.OK);
} }
...@@ -131,11 +132,18 @@ public class AbnormalController { ...@@ -131,11 +132,18 @@ public class AbnormalController {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK); return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} }
public static void main(String[] args) { @ApiOperation(value = "报警信息分页查询")
String s= ""; @GetMapping("histoty")
if(!"".equals(s)&&s!=null){ public ResponseEntity<Object> page(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
System.out.println("进入"); HashMap hashMap = tabAbnormalService.pList(dataQueryCriteria, request);
return new ResponseEntity<>(new PageResult().success(hashMap), HttpStatus.OK);
} }
@ApiOperation("导出报警列表数据")
@GetMapping("download")
public void exportDept(HttpServletResponse response, DataQueryCriteria dataQueryCriteria, HttpServletRequest request) throws Exception {
tabAbnormalService.download(dataQueryCriteria, response, request);
} }
} }
...@@ -26,6 +26,7 @@ import org.springframework.http.ResponseEntity; ...@@ -26,6 +26,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -154,9 +155,9 @@ public class DrybeachequipinforController { ...@@ -154,9 +155,9 @@ public class DrybeachequipinforController {
@ApiResponses(value = {@ApiResponse(code = 500, message = "请求失败", response = Drybeachequipinfor.class), @ApiResponses(value = {@ApiResponse(code = 500, message = "请求失败", response = Drybeachequipinfor.class),
@ApiResponse(code = 200, message = "请求成功", response = Drybeachequipinfor.class)}) @ApiResponse(code = 200, message = "请求成功", response = Drybeachequipinfor.class)})
@GetMapping @GetMapping
public ResponseEntity<Object> all(DataQueryCriteria dataQueryCriteria) { public ResponseEntity<Object> all(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
try { try {
HashMap<String, Object> hashMap = drybeachequipinforService.pageall(dataQueryCriteria); HashMap<String, Object> hashMap = drybeachequipinforService.pageall(dataQueryCriteria, request);
return new ResponseEntity<>(new PageResult().success(hashMap), HttpStatus.OK); return new ResponseEntity<>(new PageResult().success(hashMap), HttpStatus.OK);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
System.out.println(e); System.out.println(e);
...@@ -169,12 +170,12 @@ public class DrybeachequipinforController { ...@@ -169,12 +170,12 @@ public class DrybeachequipinforController {
@ApiOperation(value = "获取所有设备id", response = DryVo.class) @ApiOperation(value = "获取所有设备id", response = DryVo.class)
@GetMapping("ids") @GetMapping("ids")
public ResponseEntity<Object> getdevice() { public ResponseEntity<Object> getdevice(HttpServletRequest request) {
ArrayList<DryVo> dryVos = new ArrayList<>(); ArrayList<DryVo> dryVos = new ArrayList<>();
//获取当前用户 //获取当前用户
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
//获取当前尾矿库 //获取当前尾矿库
String gettailno = onlineUserService.gettailno(currentUsername); String gettailno = onlineUserService.gettailno(currentUsername, request);
QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>(); QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>();
drybeachequipinforQueryWrapper.eq("tailingid", gettailno); drybeachequipinforQueryWrapper.eq("tailingid", gettailno);
List<Drybeachequipinfor> list = drybeachequipinforService.list(drybeachequipinforQueryWrapper); List<Drybeachequipinfor> list = drybeachequipinforService.list(drybeachequipinforQueryWrapper);
...@@ -202,23 +203,23 @@ public class DrybeachequipinforController { ...@@ -202,23 +203,23 @@ public class DrybeachequipinforController {
@ApiOperation(value = "获取对应的设备下拉列表") @ApiOperation(value = "获取对应的设备下拉列表")
@GetMapping(value = "sensorList") @GetMapping(value = "sensorList")
public ResponseEntity<Object> senSorList(String code) { public ResponseEntity<Object> senSorList(String code, HttpServletRequest request) {
List<DrybeachequipinforVo> drybeachequipinforVos = drybeachequipinforService.sensorList(code); List<DrybeachequipinforVo> drybeachequipinforVos = drybeachequipinforService.sensorList(code, request);
return new ResponseEntity<>(new PageResult().nopagesuccess(drybeachequipinforVos), HttpStatus.OK); return new ResponseEntity<>(new PageResult().nopagesuccess(drybeachequipinforVos), HttpStatus.OK);
} }
@ApiOperation(value = "监测点用:设备下拉列表") @ApiOperation(value = "监测点用:设备下拉列表")
@GetMapping(value = "pointDrys") @GetMapping(value = "pointDrys")
public ResponseEntity<Object> pointDrys() { public ResponseEntity<Object> pointDrys(HttpServletRequest request) {
List<DrybeachequipinforVo> drybeachequipinforVos = drybeachequipinforService.pointDrys(); List<DrybeachequipinforVo> drybeachequipinforVos = drybeachequipinforService.pointDrys(request);
return new ResponseEntity<>(new PageResult().nopagesuccess(drybeachequipinforVos), HttpStatus.OK); return new ResponseEntity<>(new PageResult().nopagesuccess(drybeachequipinforVos), HttpStatus.OK);
} }
@ApiOperation(value = "在线设备统计") @ApiOperation(value = "在线设备统计")
@GetMapping("count") @GetMapping("count")
public ResponseEntity<Object> getdryInfo() { public ResponseEntity<Object> getdryInfo(HttpServletRequest request) {
HashMap<String, Integer> map = drybeachequipinforService.getdyinfo(); HashMap<String, Integer> map = drybeachequipinforService.getdyinfo(request);
return new ResponseEntity<>(new PageResult().success(map), HttpStatus.OK); return new ResponseEntity<>(new PageResult().success(map), HttpStatus.OK);
} }
......
...@@ -21,6 +21,7 @@ import org.springframework.http.ResponseEntity; ...@@ -21,6 +21,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -52,7 +53,7 @@ public class TailpondinforController { ...@@ -52,7 +53,7 @@ public class TailpondinforController {
@PreAuthorize("@el.check('admin')") @PreAuthorize("@el.check('admin')")
@ApiOperation(value = "新增尾矿库基础信息", response = PostOrPutResult.class) @ApiOperation(value = "新增尾矿库基础信息", response = PostOrPutResult.class)
@PostMapping @PostMapping
public ResponseEntity<Object> add(@RequestBody Tailpondinfor tailpondinfor) { public ResponseEntity<Object> add(@RequestBody Tailpondinfor tailpondinfor, HttpServletRequest request) {
try { try {
boolean biaoji = false; boolean biaoji = false;
//查询 //查询
...@@ -89,7 +90,7 @@ public class TailpondinforController { ...@@ -89,7 +90,7 @@ public class TailpondinforController {
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
boolean b = tailpondinforService.updataDefaultno(currentUsername, tailpondinfor.getTailingno()); boolean b = tailpondinforService.updataDefaultno(currentUsername, tailpondinfor.getTailingno());
if (b) { if (b) {
onlineUserService.saveWKKBase(currentUsername); onlineUserService.saveWKKBase(currentUsername, request);
} }
} }
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK); return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
...@@ -134,7 +135,7 @@ public class TailpondinforController { ...@@ -134,7 +135,7 @@ public class TailpondinforController {
@Log("修改尾矿库信息") @Log("修改尾矿库信息")
@ApiOperation(value = "修改尾矿库基础信息", response = PostOrPutResult.class) @ApiOperation(value = "修改尾矿库基础信息", response = PostOrPutResult.class)
@PutMapping @PutMapping
public ResponseEntity<Object> updateone(@RequestBody Tailpondinfor tailpondinfor) { public ResponseEntity<Object> updateone(@RequestBody Tailpondinfor tailpondinfor, HttpServletRequest request) {
try { try {
boolean biaoji = false; boolean biaoji = false;
String replace = tailpondinfor.getSubtailingno().replace("_", ""); String replace = tailpondinfor.getSubtailingno().replace("_", "");
...@@ -155,7 +156,7 @@ public class TailpondinforController { ...@@ -155,7 +156,7 @@ public class TailpondinforController {
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
boolean b = tailpondinforService.updataDefaultno(currentUsername, tailpondinfor.getTailingno()); boolean b = tailpondinforService.updataDefaultno(currentUsername, tailpondinfor.getTailingno());
if (b) { if (b) {
onlineUserService.saveWKKBase(currentUsername); onlineUserService.saveWKKBase(currentUsername, request);
} }
} }
...@@ -204,19 +205,19 @@ public class TailpondinforController { ...@@ -204,19 +205,19 @@ public class TailpondinforController {
@Log("切换尾矿库") @Log("切换尾矿库")
@ApiOperation(value = "切换尾矿库") @ApiOperation(value = "切换尾矿库")
@PostMapping("usertailpon") @PostMapping("usertailpon")
public ResponseEntity<Object> change(@RequestBody HashMap<String, String> map) { public ResponseEntity<Object> change(@RequestBody HashMap<String, String> map, HttpServletRequest request) {
String tailingno = map.get("tailingno"); String tailingno = map.get("tailingno");
String username = SecurityUtils.getCurrentUsername(); String username = SecurityUtils.getCurrentUsername();
tailpondinforService.updataDefaultno(username, tailingno); tailpondinforService.updataDefaultno(username, tailingno);
onlineUserService.changeWkkBase(username, tailingno); onlineUserService.changeWkkBase(username, tailingno, request);
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK); return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} }
@ApiOperation(value = "获取当前尾矿库信息") @ApiOperation(value = "获取当前尾矿库信息")
@GetMapping("dryinfo") @GetMapping("dryinfo")
public ResponseEntity<Object> change() { public ResponseEntity<Object> change(HttpServletRequest request) {
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
String gettailno = onlineUserService.gettailno(currentUsername); String gettailno = onlineUserService.gettailno(currentUsername,request);
HashMap<String, Object> getzuobiao = tailpondinforService.getzuobiao(gettailno); HashMap<String, Object> getzuobiao = tailpondinforService.getzuobiao(gettailno);
return new ResponseEntity<>(new PageResult().nopagesuccess(getzuobiao), HttpStatus.OK); return new ResponseEntity<>(new PageResult().nopagesuccess(getzuobiao), HttpStatus.OK);
} }
......
...@@ -67,6 +67,8 @@ public class UserTailponController { ...@@ -67,6 +67,8 @@ public class UserTailponController {
ArrayList<UserTailpon> userTailpons = userTailponService.add(username, maps); ArrayList<UserTailpon> userTailpons = userTailponService.add(username, maps);
boolean b = userTailponService.saveBatch(userTailpons); boolean b = userTailponService.saveBatch(userTailpons);
if (b) { if (b) {
String tailingno = userTailpons.get(0).getTailingno();
tailpondinforService.updataDefaultno(username, tailingno);
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK); return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} }
return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR); return new ResponseEntity<>(new PostOrPutResult().failed(), HttpStatus.INTERNAL_SERVER_ERROR);
......
...@@ -17,6 +17,8 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -17,6 +17,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
@Api(tags = "基础信息: 天气") @Api(tags = "基础信息: 天气")
@RestController @RestController
@RequestMapping("tab/weather") @RequestMapping("tab/weather")
...@@ -27,9 +29,9 @@ public class WeatherController { ...@@ -27,9 +29,9 @@ public class WeatherController {
private OnlineUserService onlineUserService; private OnlineUserService onlineUserService;
@GetMapping @GetMapping
public ResponseEntity<Object> getWeather() { public ResponseEntity<Object> getWeather(HttpServletRequest request) {
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
String gettailno = onlineUserService.gettailno(currentUsername); String gettailno = onlineUserService.gettailno(currentUsername,request);
QueryWrapper<Tailpondinfor> tailpondinforQueryWrapper = new QueryWrapper<>(); QueryWrapper<Tailpondinfor> tailpondinforQueryWrapper = new QueryWrapper<>();
tailpondinforQueryWrapper.eq("tailingno", gettailno); tailpondinforQueryWrapper.eq("tailingno", gettailno);
Tailpondinfor one = tailpondinforService.getOne(tailpondinforQueryWrapper); Tailpondinfor one = tailpondinforService.getOne(tailpondinforQueryWrapper);
......
...@@ -15,6 +15,7 @@ import org.springframework.http.HttpStatus; ...@@ -15,6 +15,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
/** /**
...@@ -38,8 +39,8 @@ public class WebMonitorChartController { ...@@ -38,8 +39,8 @@ public class WebMonitorChartController {
@Log("新增/修改监测点模块信息") @Log("新增/修改监测点模块信息")
@ApiOperation(value = "新增/修改监测点模块信息") @ApiOperation(value = "新增/修改监测点模块信息")
@PostMapping @PostMapping
public ResponseEntity<Object> add(@RequestBody WebMonitorChart webMonitorChart) { public ResponseEntity<Object> add(@RequestBody WebMonitorChart webMonitorChart, HttpServletRequest request) {
boolean save = iWebMonitorChartService.deal(webMonitorChart); boolean save = iWebMonitorChartService.deal(webMonitorChart, request);
if (save) { if (save) {
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK); return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} }
...@@ -60,15 +61,15 @@ public class WebMonitorChartController { ...@@ -60,15 +61,15 @@ public class WebMonitorChartController {
@ApiOperation(value = "监测点模块信息") @ApiOperation(value = "监测点模块信息")
@GetMapping @GetMapping
public ResponseEntity<Object> get() { public ResponseEntity<Object> get(HttpServletRequest request) {
MonitorChartVo getmonbase = iWebMonitorChartService.getmonbase(); MonitorChartVo getmonbase = iWebMonitorChartService.getmonbase(request);
return new ResponseEntity<>(new PageResult().nopagesuccess(getmonbase), HttpStatus.OK); return new ResponseEntity<>(new PageResult().nopagesuccess(getmonbase), HttpStatus.OK);
} }
@ApiOperation(value = "监测点模块信息_大屏使用") @ApiOperation(value = "监测点模块信息_大屏使用")
@GetMapping("visual") @GetMapping("visual")
public ResponseEntity<Object> getvisual() { public ResponseEntity<Object> getvisual(HttpServletRequest request) {
MonitorChartVo getmonbase = iWebMonitorChartService.getmonbasevisual(); MonitorChartVo getmonbase = iWebMonitorChartService.getmonbasevisual(request);
return new ResponseEntity<>(new PageResult().nopagesuccess(getmonbase), HttpStatus.OK); return new ResponseEntity<>(new PageResult().nopagesuccess(getmonbase), HttpStatus.OK);
} }
} }
...@@ -15,6 +15,7 @@ import org.springframework.http.HttpStatus; ...@@ -15,6 +15,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
/** /**
...@@ -42,8 +43,8 @@ public class WebMonitorPointsController { ...@@ -42,8 +43,8 @@ public class WebMonitorPointsController {
@Log("配置监测点信息") @Log("配置监测点信息")
@ApiOperation(value = "配置监测点信息") @ApiOperation(value = "配置监测点信息")
@PostMapping @PostMapping
public ResponseEntity<Object> add(@RequestBody MonitorChartRq monitorChartVo) { public ResponseEntity<Object> add(@RequestBody MonitorChartRq monitorChartVo, HttpServletRequest request) {
webMonitorPointsService.deal(monitorChartVo); webMonitorPointsService.deal(monitorChartVo, request);
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK); return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
} }
......
package me.zhengjie.gemho.entity;
import me.zhengjie.gemho.util.PostOrPutResult;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author llj
* @since 2021-12-22
*/
@RestController
@RequestMapping("back")
public class DataBack {
public static Process linuxEnv(String command) {
Process ps = null;
try {
String[] commands = {"/bin/sh", "-c", command};
ps = Runtime.getRuntime().exec(commands);
} catch (Exception ex) {
ex.printStackTrace();
}
return ps;
}
public static Process windowsEnv(String command) {
Process ps = null;
try {
String[] commands = {"cmd", "/c", command};
ps = Runtime.getRuntime().exec(commands);
} catch (Exception ex) {
ex.printStackTrace();
}
return ps;
}
public static void dbBackup(String username, String authenticate, String dbName, String destination, String backName) {
File backupDir = new File(destination);
if (!backupDir.exists()) {
backupDir.mkdirs();
}
try {
File sqlFile = new File(backupDir, backName);
if (!sqlFile.exists()) {
sqlFile.createNewFile();
}
//mysqldump -h localhost -u root -p db_name > db_name.sql
StringBuffer buffer = new StringBuffer();
buffer.append("mysqldump");
buffer.append(" -h 8.142.46.126 ");
buffer.append(" --column-statistics=0 ");
buffer.append(" -u" + username);
buffer.append(" -p" + authenticate);
buffer.append(" " + dbName + " -r ");
buffer.append(sqlFile);
System.out.println("cmd命令为:" + buffer.toString());
Runtime runtime = Runtime.getRuntime();
System.out.println("开始备份:" + dbName);
//Process process = runtime.exec("cmd /c"+buffer.toString());
Process process = windowsEnv(buffer.toString());
if (process.waitFor() == 0) {
System.out.println("备份成功!");
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
@PostMapping
public ResponseEntity<Object> deal() {
System.out.println("备份数据库开始执行");
try {
String backName = new SimpleDateFormat("yyMMddHHmmss").format(new Date()) + ".sql";
dbBackup("root", "jinghe2021//", "mdm_1_db", "d:/file/", backName);
} catch (Exception ex) {
System.out.println("备份异常");
ex.printStackTrace();
}
System.out.println("备份数据库结束");
return new ResponseEntity<>(new PostOrPutResult().success(), HttpStatus.OK);
}
}
package me.zhengjie.gemho.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.time.LocalDate;
/**
* <p>
*
* </p>
*
* @author llj
* @since 2021-12-22
*/
@Getter
@Setter
@TableName("am_test")
public class Test implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private String name;
private String password;
public static void main(String[] args) {
LocalDate now = LocalDate.now();
}
}
...@@ -40,6 +40,10 @@ public class ArtificialData implements Serializable { ...@@ -40,6 +40,10 @@ public class ArtificialData implements Serializable {
* 监测结果 * 监测结果
*/ */
private String value; private String value;
/**
* 所属尾矿库
*/
private String tailingid;
/** /**
* 添加时间或修改时间 * 添加时间或修改时间
......
...@@ -42,6 +42,10 @@ public class ArtificialPoint implements Serializable { ...@@ -42,6 +42,10 @@ public class ArtificialPoint implements Serializable {
* 关联在线设备名称 * 关联在线设备名称
*/ */
private String equipname; private String equipname;
/**
* 所属尾矿库
*/
private String tailingid;
/** /**
* 地点备注 * 地点备注
......
...@@ -52,6 +52,10 @@ public class InsData implements Serializable { ...@@ -52,6 +52,10 @@ public class InsData implements Serializable {
*/ */
private String image; private String image;
/**
* 所属尾矿库
*/
private String tailingid;
/** /**
* 更新时间 * 更新时间
*/ */
......
...@@ -43,7 +43,7 @@ public class Abnormal implements Serializable { ...@@ -43,7 +43,7 @@ public class Abnormal implements Serializable {
/** /**
* 状态,(报警/解除报警) * 状态,(报警/解除报警)
*/ */
private String state; private Integer state;
/** /**
* 报警时间 * 报警时间
......
...@@ -436,7 +436,7 @@ public class Tailpondinfor implements Serializable { ...@@ -436,7 +436,7 @@ public class Tailpondinfor implements Serializable {
* 应急预案是否备案 是/否 * 应急预案是否备案 是/否
*/ */
@ApiModelProperty(value = "下游1公里内建筑物数量 单位:栋") @ApiModelProperty(value = "下游1公里内建筑物数量 单位:栋")
private String emergencyplanfiled; private int emergencyplanfiled;
/** /**
* 安全预评价单位 * 安全预评价单位
......
package me.zhengjie.gemho.mapper; package me.zhengjie.gemho.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import me.zhengjie.gemho.entity.Test; import me.zhengjie.gemho.entity.DataBack;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/** /**
...@@ -13,6 +13,6 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -13,6 +13,6 @@ import org.apache.ibatis.annotations.Mapper;
* @since 2021-12-22 * @since 2021-12-22
*/ */
@Mapper @Mapper
public interface TestMapper extends BaseMapper<Test> { public interface TestMapper extends BaseMapper<DataBack> {
} }
...@@ -5,8 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -5,8 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import me.zhengjie.gemho.entity.ins.InsData; import me.zhengjie.gemho.entity.ins.InsData;
import me.zhengjie.gemho.x_datavo.ins.InsDataVo; import me.zhengjie.gemho.x_datavo.ins.InsDataVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Map;
/** /**
* <p> * <p>
...@@ -19,5 +18,5 @@ import java.util.Map; ...@@ -19,5 +18,5 @@ import java.util.Map;
@Mapper @Mapper
public interface InsDataMapper extends BaseMapper<InsData> { public interface InsDataMapper extends BaseMapper<InsData> {
Page<InsDataVo> selectPages(Page<InsDataVo> page, String title); Page<InsDataVo> selectPages(Page<InsDataVo> page, @Param(value = "tailingid") String tailingid, @Param(value = "title") String title);
} }
...@@ -28,8 +28,8 @@ public interface DrybeachequipinforMapper extends BaseMapper<Drybeachequipinfor> ...@@ -28,8 +28,8 @@ public interface DrybeachequipinforMapper extends BaseMapper<Drybeachequipinfor>
@Update("update tb_drybeachequipinfor set state = 0 where equipno=#{equipno} ") @Update("update tb_drybeachequipinfor set state = 0 where equipno=#{equipno} ")
int jcbj(String equipno); int jcbj(String equipno);
@Select(value = "select tailingno as value ,tailingname as name from tb_tailpondinfor") @Select(value = "select b.tailingno as value ,b.tailingname as name FROM `tab_user_tailpon` a join tb_tailpondinfor b on a.tailingno=b.tailingno where a.username=#{username}")
ArrayList<Dic> gettailingid(); ArrayList<Dic> gettailingid(String username);
@Select(value = "select code as value ,name from sys_devicetype where must ='0' or type='t_8' ") @Select(value = "select code as value ,name from sys_devicetype where must ='0' or type='t_8' ")
ArrayList<Dic> getdevicetype(); ArrayList<Dic> getdevicetype();
...@@ -84,4 +84,6 @@ public interface DrybeachequipinforMapper extends BaseMapper<Drybeachequipinfor> ...@@ -84,4 +84,6 @@ public interface DrybeachequipinforMapper extends BaseMapper<Drybeachequipinfor>
int dealLevel(@Param(value = "equipno") String equipno, @Param(value = "onelevelalarm") String onelevelalarm, @Param(value = "twolevelalarm") String twolevelalarm, @Param(value = "threelevelalarm") String threelevelalarm, @Param(value = "fourlevelalarm") String fourlevelalarm); int dealLevel(@Param(value = "equipno") String equipno, @Param(value = "onelevelalarm") String onelevelalarm, @Param(value = "twolevelalarm") String twolevelalarm, @Param(value = "threelevelalarm") String threelevelalarm, @Param(value = "fourlevelalarm") String fourlevelalarm);
List<HashMap<String, Object>> dryStateCount(String tailingid); List<HashMap<String, Object>> dryStateCount(String tailingid);
Integer dryUnCount(String tailingid);
} }
...@@ -22,8 +22,8 @@ import java.util.List; ...@@ -22,8 +22,8 @@ import java.util.List;
@Mapper @Mapper
public interface TabAbnormalMapper extends BaseMapper<Abnormal> { public interface TabAbnormalMapper extends BaseMapper<Abnormal> {
@Select(value = "select ta.equipno as equipno , ta.evalue as evalue , ta.alarmlevel as alarmlevel ,td.equipname ,td.eqdanwei as eqdanwei ,DATE_FORMAT(ta.time,'%Y-%m-%d %H:%i:%s') as time from tab_abnormal ta join tb_drybeachequipinfor td on ta.equipno = td.equipno where ta.state='1' ORDER BY ta.time DESC") @Select(value = "select ta.equipno as equipno , ta.evalue as evalue , ta.alarmlevel as alarmlevel ,td.equipname ,td.eqdanwei as eqdanwei ,DATE_FORMAT(ta.time,'%Y-%m-%d %H:%i:%s') as time from tab_abnormal ta join tb_drybeachequipinfor td on ta.equipno = td.equipno where ta.state='1' and td.tailingid=#{tailingid} ORDER BY ta.time DESC")
ArrayList<HashMap<String, Object>> getalarminfo(); ArrayList<HashMap<String, Object>> getalarminfo(String tailingid);
@Update(value = "update tab_abnormal set state = '0' ,jcreason= #{jcreason},jcbjtime=#{jcbjtime},reason=#{reason} where equipno =#{equipno}") @Update(value = "update tab_abnormal set state = '0' ,jcreason= #{jcreason},jcbjtime=#{jcbjtime},reason=#{reason} where equipno =#{equipno}")
int jcbj(@Param(value = "jcreason") String jcreason, int jcbj(@Param(value = "jcreason") String jcreason,
......
...@@ -43,7 +43,7 @@ public interface TailpondinforMapper extends BaseMapper<Tailpondinfor> { ...@@ -43,7 +43,7 @@ public interface TailpondinforMapper extends BaseMapper<Tailpondinfor> {
@Select(value = "select username as value ,nick_name as name from sys_user where username !='admin' order by user_id desc") @Select(value = "select username as value ,nick_name as name from sys_user where username !='admin' order by user_id desc")
ArrayList<HashMap<String, Object>> getUsername(); ArrayList<HashMap<String, Object>> getUsername();
@Select(value = "SELECT a.* FROM `tb_tailpondinfor` a JOIN tab_user_tailpon b ON a.tailingno = b.tailingno JOIN sys_user c ON c.username = b.username WHERE c.username = #{username}") @Select(value = "SELECT a.* FROM `tb_tailpondinfor` a JOIN tab_user_tailpon b ON a.tailingno = b.tailingno JOIN sys_user c ON c.username = b.username WHERE c.username = #{username} order by id desc")
ArrayList<Tailpondinfor> getByUsername(String username); ArrayList<Tailpondinfor> getByUsername(String username);
@Select(value = "SELECT * from tb_tailpondinfor ") @Select(value = "SELECT * from tb_tailpondinfor ")
......
package me.zhengjie.gemho.service; package me.zhengjie.gemho.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.Test; import me.zhengjie.gemho.entity.DataBack;
/** /**
* <p> * <p>
...@@ -11,6 +11,6 @@ import me.zhengjie.gemho.entity.Test; ...@@ -11,6 +11,6 @@ import me.zhengjie.gemho.entity.Test;
* @author llj * @author llj
* @since 2021-12-22 * @since 2021-12-22
*/ */
public interface TestService extends IService<Test> { public interface TestService extends IService<DataBack> {
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.artificial.ArtificialData; import me.zhengjie.gemho.entity.artificial.ArtificialData;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria; import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
/** /**
...@@ -22,7 +23,7 @@ public interface ArtificialDataService extends IService<ArtificialData> { ...@@ -22,7 +23,7 @@ public interface ArtificialDataService extends IService<ArtificialData> {
* @param dataQueryCriteria * @param dataQueryCriteria
* @return * @return
*/ */
HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria); HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria, HttpServletRequest request);
/** /**
...@@ -31,7 +32,7 @@ public interface ArtificialDataService extends IService<ArtificialData> { ...@@ -31,7 +32,7 @@ public interface ArtificialDataService extends IService<ArtificialData> {
* @param param 根据需要进行传值 * @param param 根据需要进行传值
* @return * @return
*/ */
boolean add(ArtificialData param); boolean add(ArtificialData param,HttpServletRequest request);
/** /**
* 人工监测数据表修改 * 人工监测数据表修改
...@@ -39,6 +40,6 @@ public interface ArtificialDataService extends IService<ArtificialData> { ...@@ -39,6 +40,6 @@ public interface ArtificialDataService extends IService<ArtificialData> {
* @param param 根据需要进行传值 * @param param 根据需要进行传值
* @return * @return
*/ */
boolean modify(ArtificialData param); boolean modify(ArtificialData param,HttpServletRequest request);
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.artificial.ArtificialPoint; import me.zhengjie.gemho.entity.artificial.ArtificialPoint;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria; import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -23,7 +24,7 @@ public interface ArtificialPointService extends IService<ArtificialPoint> { ...@@ -23,7 +24,7 @@ public interface ArtificialPointService extends IService<ArtificialPoint> {
* @param dataQueryCriteria * @param dataQueryCriteria
* @return * @return
*/ */
HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria); HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria, HttpServletRequest request);
/** /**
...@@ -32,7 +33,7 @@ public interface ArtificialPointService extends IService<ArtificialPoint> { ...@@ -32,7 +33,7 @@ public interface ArtificialPointService extends IService<ArtificialPoint> {
* @param param 根据需要进行传值 * @param param 根据需要进行传值
* @return * @return
*/ */
boolean add(ArtificialPoint param); boolean add(ArtificialPoint param,HttpServletRequest request);
/** /**
* 人工监测点位表修改 * 人工监测点位表修改
...@@ -40,7 +41,7 @@ public interface ArtificialPointService extends IService<ArtificialPoint> { ...@@ -40,7 +41,7 @@ public interface ArtificialPointService extends IService<ArtificialPoint> {
* @param param 根据需要进行传值 * @param param 根据需要进行传值
* @return * @return
*/ */
boolean modify(ArtificialPoint param); boolean modify(ArtificialPoint param,HttpServletRequest request);
/** /**
* 人工监测点位下拉列表 * 人工监测点位下拉列表
......
...@@ -9,12 +9,14 @@ import me.zhengjie.gemho.mapper.artificial.ArtificialDataMapper; ...@@ -9,12 +9,14 @@ import me.zhengjie.gemho.mapper.artificial.ArtificialDataMapper;
import me.zhengjie.gemho.mapper.dic.JczxMapper; import me.zhengjie.gemho.mapper.dic.JczxMapper;
import me.zhengjie.gemho.service.artificial.ArtificialDataService; import me.zhengjie.gemho.service.artificial.ArtificialDataService;
import me.zhengjie.gemho.util.ServiceUtil; import me.zhengjie.gemho.util.ServiceUtil;
import me.zhengjie.gemho.util.TailNoForInfoUtil;
import me.zhengjie.gemho.x_datavo.artificial.ADataVo; import me.zhengjie.gemho.x_datavo.artificial.ADataVo;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria; import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -44,13 +46,16 @@ public class ArtificialDataServiceImpl extends ServiceImpl<ArtificialDataMapper, ...@@ -44,13 +46,16 @@ public class ArtificialDataServiceImpl extends ServiceImpl<ArtificialDataMapper,
* @return * @return
*/ */
@Override @Override
public HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria) { public HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
//获取当前尾矿库
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
//查询所有的检测子项 //查询所有的检测子项
List<Jczx> jczxes = jczxMapper.selectList(null); List<Jczx> jczxes = jczxMapper.selectList(null);
long size = dataQueryCriteria.getSize(); long size = dataQueryCriteria.getSize();
long page = dataQueryCriteria.getPage(); long page = dataQueryCriteria.getPage();
Page<ArtificialData> ArtificialDataPage = new Page<>(page + 1, size); Page<ArtificialData> ArtificialDataPage = new Page<>(page + 1, size);
QueryWrapper<ArtificialData> queryWrapper = new QueryWrapper<>(); QueryWrapper<ArtificialData> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("tailingid", tailInfoNo);
ServiceUtil.dataQuery(queryWrapper, dataQueryCriteria); ServiceUtil.dataQuery(queryWrapper, dataQueryCriteria);
ArtificialDataPage = artificialDataMapper.selectPage(ArtificialDataPage, queryWrapper); ArtificialDataPage = artificialDataMapper.selectPage(ArtificialDataPage, queryWrapper);
List<ArtificialData> records = ArtificialDataPage.getRecords(); List<ArtificialData> records = ArtificialDataPage.getRecords();
...@@ -89,7 +94,10 @@ public class ArtificialDataServiceImpl extends ServiceImpl<ArtificialDataMapper, ...@@ -89,7 +94,10 @@ public class ArtificialDataServiceImpl extends ServiceImpl<ArtificialDataMapper,
* @return * @return
*/ */
@Override @Override
public boolean add(ArtificialData param) { public boolean add(ArtificialData param,HttpServletRequest request) {
//获取当前尾矿库编码
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
param.setTailingid(tailInfoNo);
int result = artificialDataMapper.insert(param); int result = artificialDataMapper.insert(param);
if (result > 0) { if (result > 0) {
return true; return true;
...@@ -104,7 +112,10 @@ public class ArtificialDataServiceImpl extends ServiceImpl<ArtificialDataMapper, ...@@ -104,7 +112,10 @@ public class ArtificialDataServiceImpl extends ServiceImpl<ArtificialDataMapper,
* @return * @return
*/ */
@Override @Override
public boolean modify(ArtificialData param) { public boolean modify(ArtificialData param,HttpServletRequest request) {
//获取当前尾矿库编码
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
param.setTailingid(tailInfoNo);
QueryWrapper<ArtificialData> queryWrapper = new QueryWrapper<>(); QueryWrapper<ArtificialData> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", param.getId()); queryWrapper.eq("id", param.getId());
int result = artificialDataMapper.update(param, queryWrapper); int result = artificialDataMapper.update(param, queryWrapper);
......
...@@ -7,12 +7,14 @@ import me.zhengjie.gemho.entity.artificial.ArtificialPoint; ...@@ -7,12 +7,14 @@ import me.zhengjie.gemho.entity.artificial.ArtificialPoint;
import me.zhengjie.gemho.mapper.artificial.ArtificialPointMapper; import me.zhengjie.gemho.mapper.artificial.ArtificialPointMapper;
import me.zhengjie.gemho.service.artificial.ArtificialPointService; import me.zhengjie.gemho.service.artificial.ArtificialPointService;
import me.zhengjie.gemho.util.ServiceUtil; import me.zhengjie.gemho.util.ServiceUtil;
import me.zhengjie.gemho.util.TailNoForInfoUtil;
import me.zhengjie.gemho.x_datavo.artificial.PointListVo; import me.zhengjie.gemho.x_datavo.artificial.PointListVo;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria; import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -38,11 +40,14 @@ public class ArtificialPointServiceImpl extends ServiceImpl<ArtificialPointMappe ...@@ -38,11 +40,14 @@ public class ArtificialPointServiceImpl extends ServiceImpl<ArtificialPointMappe
* @return * @return
*/ */
@Override @Override
public HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria) { public HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
//获取当前尾矿库
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
long size = dataQueryCriteria.getSize(); long size = dataQueryCriteria.getSize();
long page = dataQueryCriteria.getPage(); long page = dataQueryCriteria.getPage();
Page<ArtificialPoint> ArtificialPointPage = new Page<>(page + 1, size); Page<ArtificialPoint> ArtificialPointPage = new Page<>(page + 1, size);
QueryWrapper<ArtificialPoint> queryWrapper = new QueryWrapper<>(); QueryWrapper<ArtificialPoint> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("tailingid", tailInfoNo);
ServiceUtil.dataQuery(queryWrapper, dataQueryCriteria); ServiceUtil.dataQuery(queryWrapper, dataQueryCriteria);
ArtificialPointPage = artificialPointMapper.selectPage(ArtificialPointPage, queryWrapper); ArtificialPointPage = artificialPointMapper.selectPage(ArtificialPointPage, queryWrapper);
List<ArtificialPoint> records = ArtificialPointPage.getRecords(); List<ArtificialPoint> records = ArtificialPointPage.getRecords();
...@@ -61,7 +66,10 @@ public class ArtificialPointServiceImpl extends ServiceImpl<ArtificialPointMappe ...@@ -61,7 +66,10 @@ public class ArtificialPointServiceImpl extends ServiceImpl<ArtificialPointMappe
* @return * @return
*/ */
@Override @Override
public boolean add(ArtificialPoint param) { public boolean add(ArtificialPoint param, HttpServletRequest request) {
//获取当前尾矿库
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
param.setTailingid(tailInfoNo);
int result = artificialPointMapper.insert(param); int result = artificialPointMapper.insert(param);
if (result > 0) { if (result > 0) {
return true; return true;
...@@ -76,7 +84,10 @@ public class ArtificialPointServiceImpl extends ServiceImpl<ArtificialPointMappe ...@@ -76,7 +84,10 @@ public class ArtificialPointServiceImpl extends ServiceImpl<ArtificialPointMappe
* @return * @return
*/ */
@Override @Override
public boolean modify(ArtificialPoint param) { public boolean modify(ArtificialPoint param, HttpServletRequest request) {
//获取当前尾矿库
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
param.setTailingid(tailInfoNo);
QueryWrapper<ArtificialPoint> queryWrapper = new QueryWrapper<>(); QueryWrapper<ArtificialPoint> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", param.getId()); queryWrapper.eq("id", param.getId());
int result = artificialPointMapper.update(param, queryWrapper); int result = artificialPointMapper.update(param, queryWrapper);
......
...@@ -61,7 +61,7 @@ public interface DbDataService extends IService<DbData> { ...@@ -61,7 +61,7 @@ public interface DbDataService extends IService<DbData> {
* @param dataQueryCriteria * @param dataQueryCriteria
* @return * @return
*/ */
HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria); HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request);
/** /**
* 图表数据 * 图表数据
...@@ -77,10 +77,10 @@ public interface DbDataService extends IService<DbData> { ...@@ -77,10 +77,10 @@ public interface DbDataService extends IService<DbData> {
* *
* @return * @return
*/ */
List<RealDataVo> real(String equipno); List<RealDataVo> real(String equipno, HttpServletRequest request);
/*** /***
* 导出干滩表格 * 导出干滩表格
*/ */
void download(DataQueryCriteria dataQueryCriteria, HttpServletResponse response) throws IOException; void download(DataQueryCriteria dataQueryCriteria, HttpServletResponse response,HttpServletRequest request) throws IOException;
} }
...@@ -7,6 +7,7 @@ import me.zhengjie.gemho.x_datavo.RealDataVo; ...@@ -7,6 +7,7 @@ import me.zhengjie.gemho.x_datavo.RealDataVo;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria; import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.data.ImgDataVo; import me.zhengjie.gemho.x_datavo.data.ImgDataVo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -66,7 +67,7 @@ public interface DmDataService extends IService<DmData> { ...@@ -66,7 +67,7 @@ public interface DmDataService extends IService<DmData> {
* *
* @return * @return
*/ */
List<RealDataVo> real(String equipno); List<RealDataVo> real(String equipno, HttpServletRequest request);
/** /**
* 图表数据与 * 图表数据与
......
...@@ -5,6 +5,7 @@ import me.zhengjie.gemho.entity.data.MpData; ...@@ -5,6 +5,7 @@ import me.zhengjie.gemho.entity.data.MpData;
import me.zhengjie.gemho.x_datavo.DataVo; import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.RealDataVo; import me.zhengjie.gemho.x_datavo.RealDataVo;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -69,5 +70,5 @@ public interface MpDataService extends IService<MpData> { ...@@ -69,5 +70,5 @@ public interface MpDataService extends IService<MpData> {
* *
* @return * @return
*/ */
List<RealDataVo> real(String equipno); List<RealDataVo> real(String equipno, HttpServletRequest request);
} }
...@@ -5,6 +5,7 @@ import me.zhengjie.gemho.entity.data.PslData; ...@@ -5,6 +5,7 @@ import me.zhengjie.gemho.entity.data.PslData;
import me.zhengjie.gemho.x_datavo.DataVo; import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.RealDataVo; import me.zhengjie.gemho.x_datavo.RealDataVo;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -69,5 +70,5 @@ public interface PslDataService extends IService<PslData> { ...@@ -69,5 +70,5 @@ public interface PslDataService extends IService<PslData> {
* 实时数据 * 实时数据
* @return * @return
*/ */
List<RealDataVo> real(String equipno); List<RealDataVo> real(String equipno, HttpServletRequest request);
} }
...@@ -5,6 +5,7 @@ import me.zhengjie.gemho.entity.data.RgData; ...@@ -5,6 +5,7 @@ import me.zhengjie.gemho.entity.data.RgData;
import me.zhengjie.gemho.x_datavo.DataVo; import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.RealDataVo; import me.zhengjie.gemho.x_datavo.RealDataVo;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -67,5 +68,5 @@ public interface RgDataService extends IService<RgData> { ...@@ -67,5 +68,5 @@ public interface RgDataService extends IService<RgData> {
* *
* @return * @return
*/ */
List<RealDataVo> real(String equipno); List<RealDataVo> real(String equipno, HttpServletRequest request);
} }
...@@ -5,6 +5,7 @@ import me.zhengjie.gemho.entity.data.SlData; ...@@ -5,6 +5,7 @@ import me.zhengjie.gemho.entity.data.SlData;
import me.zhengjie.gemho.x_datavo.DataVo; import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.RealDataVo; import me.zhengjie.gemho.x_datavo.RealDataVo;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -70,5 +71,5 @@ public interface SlDataService extends IService<SlData> { ...@@ -70,5 +71,5 @@ public interface SlDataService extends IService<SlData> {
* *
* @return * @return
*/ */
List<RealDataVo> real(String equipno); List<RealDataVo> real(String equipno, HttpServletRequest request);
} }
...@@ -5,6 +5,7 @@ import me.zhengjie.gemho.entity.data.StData; ...@@ -5,6 +5,7 @@ import me.zhengjie.gemho.entity.data.StData;
import me.zhengjie.gemho.x_datavo.DataVo; import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.RealDataVo; import me.zhengjie.gemho.x_datavo.RealDataVo;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -71,5 +72,5 @@ public interface StDataService extends IService<StData> { ...@@ -71,5 +72,5 @@ public interface StDataService extends IService<StData> {
* @param equipno * @param equipno
* @return * @return
*/ */
List<RealDataVo> real(String equipno); List<RealDataVo> real(String equipno, HttpServletRequest request);
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.data.SzData; import me.zhengjie.gemho.entity.data.SzData;
import me.zhengjie.gemho.x_datavo.DataVo; import me.zhengjie.gemho.x_datavo.DataVo;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -54,7 +55,7 @@ public interface SzDataService extends IService<SzData> { ...@@ -54,7 +55,7 @@ public interface SzDataService extends IService<SzData> {
* @param deviceid * @param deviceid
* @return * @return
*/ */
ArrayList<HashMap<String, Object>> real(String deviceid); ArrayList<HashMap<String, Object>> real(String deviceid, HttpServletRequest request);
/** /**
* 分页历史记录 * 分页历史记录
* *
......
...@@ -5,6 +5,7 @@ import me.zhengjie.gemho.entity.data.WtData; ...@@ -5,6 +5,7 @@ import me.zhengjie.gemho.entity.data.WtData;
import me.zhengjie.gemho.x_datavo.DataVo; import me.zhengjie.gemho.x_datavo.DataVo;
import me.zhengjie.gemho.x_datavo.RealDataVo; import me.zhengjie.gemho.x_datavo.RealDataVo;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -70,5 +71,5 @@ public interface WtDataService extends IService<WtData> { ...@@ -70,5 +71,5 @@ public interface WtDataService extends IService<WtData> {
* *
* @return * @return
*/ */
List<RealDataVo> real(String equipno); List<RealDataVo> real(String equipno, HttpServletRequest request);
} }
...@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.PropertySource; import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
...@@ -63,6 +64,7 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme ...@@ -63,6 +64,7 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
QueryWrapper<DbData> dbDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<DbData> dbDataQueryWrapper = new QueryWrapper<>();
dbDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); dbDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
DbData dbData = dbDataMapper.selectOne(dbDataQueryWrapper); DbData dbData = dbDataMapper.selectOne(dbDataQueryWrapper);
if (dbData != null) {
//获取最新时间 //获取最新时间
Date time = dbData.getTime(); Date time = dbData.getTime();
try { try {
...@@ -131,6 +133,8 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme ...@@ -131,6 +133,8 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
} }
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public DataVo week(String date, String values, String deviceid, String subitem) { public DataVo week(String date, String values, String deviceid, String subitem) {
...@@ -145,6 +149,7 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme ...@@ -145,6 +149,7 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
QueryWrapper<DbData> dbDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<DbData> dbDataQueryWrapper = new QueryWrapper<>();
dbDataQueryWrapper.orderByDesc("time").last("limit 1"); dbDataQueryWrapper.orderByDesc("time").last("limit 1");
DbData dbData = dbDataMapper.selectOne(dbDataQueryWrapper); DbData dbData = dbDataMapper.selectOne(dbDataQueryWrapper);
if (dbData != null) {
//获取最新时间 //获取最新时间
Date time = dbData.getTime(); Date time = dbData.getTime();
try { try {
...@@ -209,6 +214,8 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme ...@@ -209,6 +214,8 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public DataVo month(String date, String values, String deviceid, String subitem) { public DataVo month(String date, String values, String deviceid, String subitem) {
...@@ -223,6 +230,7 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme ...@@ -223,6 +230,7 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
QueryWrapper<DbData> dbDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<DbData> dbDataQueryWrapper = new QueryWrapper<>();
dbDataQueryWrapper.orderByDesc("time").last("limit 1"); dbDataQueryWrapper.orderByDesc("time").last("limit 1");
DbData dbData = dbDataMapper.selectOne(dbDataQueryWrapper); DbData dbData = dbDataMapper.selectOne(dbDataQueryWrapper);
if (dbData != null) {
//获取最新时间 //获取最新时间
Date time = dbData.getTime(); Date time = dbData.getTime();
try { try {
...@@ -286,14 +294,16 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme ...@@ -286,14 +294,16 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria) { public HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
long size = dataQueryCriteria.getSize(); long size = dataQueryCriteria.getSize();
long page = dataQueryCriteria.getPage(); long page = dataQueryCriteria.getPage();
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
QueryWrapper<DbData> dbDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<DbData> dbDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.dataQuery(dbDataQueryWrapper, dataQueryCriteria); ServiceUtil.dbquery(dbDataQueryWrapper, dataQueryCriteria, request);
Page<DbData> dbDataPage = new Page<>(page + 1, size); Page<DbData> dbDataPage = new Page<>(page + 1, size);
dbDataPage = dbDataMapper.selectPage(dbDataPage, dbDataQueryWrapper); dbDataPage = dbDataMapper.selectPage(dbDataPage, dbDataQueryWrapper);
List<DbData> records = dbDataPage.getRecords(); List<DbData> records = dbDataPage.getRecords();
...@@ -373,8 +383,8 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme ...@@ -373,8 +383,8 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
} }
@Override @Override
public List<RealDataVo> real(String equipno1) { public List<RealDataVo> real(String equipno1, HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
List<HashMap<String, Object>> reals = dbDataMapper.real(tailInfoNo); List<HashMap<String, Object>> reals = dbDataMapper.real(tailInfoNo);
HashMap<String, List<Map>> realdata = ReadJsonFileUtil.getMap("realdata"); HashMap<String, List<Map>> realdata = ReadJsonFileUtil.getMap("realdata");
Object keys1 = realdata.get("dbdata"); Object keys1 = realdata.get("dbdata");
...@@ -403,9 +413,9 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme ...@@ -403,9 +413,9 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
} }
@Override @Override
public void download(DataQueryCriteria dataQueryCriteria, HttpServletResponse response) throws IOException { public void download(DataQueryCriteria dataQueryCriteria, HttpServletResponse response, HttpServletRequest request) throws IOException {
//获取数据 //获取数据
HashMap<String, Object> pageall = pageall(dataQueryCriteria); HashMap<String, Object> pageall = pageall(dataQueryCriteria, request);
List<DbData> dbdatas = (List<DbData>) pageall.get("list"); List<DbData> dbdatas = (List<DbData>) pageall.get("list");
String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria); String checkArtificial = ServiceUtil.checkArtificial(dataQueryCriteria);
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
......
...@@ -19,6 +19,7 @@ import me.zhengjie.gemho.x_datavo.data.ImgDataVo; ...@@ -19,6 +19,7 @@ import me.zhengjie.gemho.x_datavo.data.ImgDataVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;
...@@ -127,9 +128,10 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme ...@@ -127,9 +128,10 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme
System.out.println(e); System.out.println(e);
e.printStackTrace(); e.printStackTrace();
} }
}
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public DataVo week(String date, String values, String deviceid, String subitem) { public DataVo week(String date, String values, String deviceid, String subitem) {
...@@ -140,7 +142,7 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme ...@@ -140,7 +142,7 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme
ArrayList<Result> results = new ArrayList<>(); ArrayList<Result> results = new ArrayList<>();
ArrayList<NameVo> nameVos = new ArrayList<>(); ArrayList<NameVo> nameVos = new ArrayList<>();
ArrayList<String> dmdata = DataUtil.dmdata(values); ArrayList<String> dmdata = DataUtil.dmdata(values);
//处理参数 //处理参数
nameVos = DataUtil.dmdatanames(nameVos, values); nameVos = DataUtil.dmdatanames(nameVos, values);
//获取最新的数据 //获取最新的数据
QueryWrapper<DmData> dbDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<DmData> dbDataQueryWrapper = new QueryWrapper<>();
...@@ -214,9 +216,10 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme ...@@ -214,9 +216,10 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
}
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public DataVo month(String date, String values, String deviceid, String subitem) { public DataVo month(String date, String values, String deviceid, String subitem) {
...@@ -233,6 +236,7 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme ...@@ -233,6 +236,7 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme
QueryWrapper<DmData> dbDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<DmData> dbDataQueryWrapper = new QueryWrapper<>();
dbDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); dbDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
DmData dmData = dmDataMapper.selectOne(dbDataQueryWrapper); DmData dmData = dmDataMapper.selectOne(dbDataQueryWrapper);
if (dmData != null) {
//获取最新时间 //获取最新时间
Date time = dmData.getTime(); Date time = dmData.getTime();
try { try {
...@@ -299,6 +303,8 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme ...@@ -299,6 +303,8 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme
} }
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria) { public HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria) {
...@@ -341,8 +347,8 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme ...@@ -341,8 +347,8 @@ public class DmDataServiceImpl extends ServiceImpl<DmDataMapper, DmData> impleme
} }
@Override @Override
public List<RealDataVo> real(String equipno1) { public List<RealDataVo> real(String equipno1, HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
List<HashMap<String, Object>> reals = dmDataMapper.real(tailInfoNo); List<HashMap<String, Object>> reals = dmDataMapper.real(tailInfoNo);
Map dbdata = ReadJsonFileUtil.getMap("realdata"); Map dbdata = ReadJsonFileUtil.getMap("realdata");
Object keys1 = dbdata.get("dmdata"); Object keys1 = dbdata.get("dmdata");
......
...@@ -15,6 +15,7 @@ import me.zhengjie.gemho.x_datavo.Result; ...@@ -15,6 +15,7 @@ import me.zhengjie.gemho.x_datavo.Result;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -50,6 +51,7 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme ...@@ -50,6 +51,7 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme
QueryWrapper<MpData> mpDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<MpData> mpDataQueryWrapper = new QueryWrapper<>();
mpDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); mpDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
MpData mpData = mpDataMapper.selectOne(mpDataQueryWrapper); MpData mpData = mpDataMapper.selectOne(mpDataQueryWrapper);
if (mpData != null) {
//获取最新时间 //获取最新时间
Date time = mpData.getTime(); Date time = mpData.getTime();
try { try {
...@@ -128,6 +130,8 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme ...@@ -128,6 +130,8 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme
} }
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public DataVo week(String date, String values, String deviceid) { public DataVo week(String date, String values, String deviceid) {
...@@ -145,6 +149,7 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme ...@@ -145,6 +149,7 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme
QueryWrapper<MpData> mpDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<MpData> mpDataQueryWrapper = new QueryWrapper<>();
mpDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); mpDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
MpData mpData = mpDataMapper.selectOne(mpDataQueryWrapper); MpData mpData = mpDataMapper.selectOne(mpDataQueryWrapper);
if (mpData != null) {
//获取最新时间 //获取最新时间
Date time = mpData.getTime(); Date time = mpData.getTime();
try { try {
...@@ -217,6 +222,8 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme ...@@ -217,6 +222,8 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public DataVo month(String date, String values, String deviceid) { public DataVo month(String date, String values, String deviceid) {
...@@ -234,6 +241,7 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme ...@@ -234,6 +241,7 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme
QueryWrapper<MpData> mpDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<MpData> mpDataQueryWrapper = new QueryWrapper<>();
mpDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); mpDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
MpData mpData = mpDataMapper.selectOne(mpDataQueryWrapper); MpData mpData = mpDataMapper.selectOne(mpDataQueryWrapper);
if (mpData != null) {
//获取最新时间 //获取最新时间
Date time = mpData.getTime(); Date time = mpData.getTime();
try { try {
...@@ -304,6 +312,8 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme ...@@ -304,6 +312,8 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public List<MpData> demo(String date, String values, String deviceid) { public List<MpData> demo(String date, String values, String deviceid) {
...@@ -325,8 +335,8 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme ...@@ -325,8 +335,8 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme
} }
@Override @Override
public List<RealDataVo> real(String equipno1) { public List<RealDataVo> real(String equipno1, HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
List<HashMap<String, Object>> reals = mpDataMapper.real(tailInfoNo); List<HashMap<String, Object>> reals = mpDataMapper.real(tailInfoNo);
Map dbdata = ReadJsonFileUtil.getMap("realdata"); Map dbdata = ReadJsonFileUtil.getMap("realdata");
Object keys1 = dbdata.get("mpdata"); Object keys1 = dbdata.get("mpdata");
...@@ -336,7 +346,7 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme ...@@ -336,7 +346,7 @@ public class MpDataServiceImpl extends ServiceImpl<MpDataMapper, MpData> impleme
String sensorname = (String) real.get("sensorname"); String sensorname = (String) real.get("sensorname");
String eqdanwei = (String) real.get("eqdanwei"); String eqdanwei = (String) real.get("eqdanwei");
String equipno = (String) real.get("equipno"); String equipno = (String) real.get("equipno");
String time =(String) real.get("time"); String time = (String) real.get("time");
real.remove("time"); real.remove("time");
real.remove("equipno"); real.remove("equipno");
real.remove("sensorname"); real.remove("sensorname");
......
...@@ -15,6 +15,7 @@ import me.zhengjie.gemho.x_datavo.Result; ...@@ -15,6 +15,7 @@ import me.zhengjie.gemho.x_datavo.Result;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -50,6 +51,7 @@ public class PslDataServiceImpl extends ServiceImpl<PslDataMapper, PslData> impl ...@@ -50,6 +51,7 @@ public class PslDataServiceImpl extends ServiceImpl<PslDataMapper, PslData> impl
QueryWrapper<PslData> pslDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<PslData> pslDataQueryWrapper = new QueryWrapper<>();
pslDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); pslDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
PslData pslData = pslDataMapper.selectOne(pslDataQueryWrapper); PslData pslData = pslDataMapper.selectOne(pslDataQueryWrapper);
if (pslData != null) {
//获取最新的时间 //获取最新的时间
Date time = pslData.getTime(); Date time = pslData.getTime();
//获取时间范围 //获取时间范围
...@@ -118,6 +120,8 @@ public class PslDataServiceImpl extends ServiceImpl<PslDataMapper, PslData> impl ...@@ -118,6 +120,8 @@ public class PslDataServiceImpl extends ServiceImpl<PslDataMapper, PslData> impl
} }
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public DataVo week(String date, String values, String deviceid, String subitem) { public DataVo week(String date, String values, String deviceid, String subitem) {
...@@ -133,6 +137,7 @@ public class PslDataServiceImpl extends ServiceImpl<PslDataMapper, PslData> impl ...@@ -133,6 +137,7 @@ public class PslDataServiceImpl extends ServiceImpl<PslDataMapper, PslData> impl
QueryWrapper<PslData> pslDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<PslData> pslDataQueryWrapper = new QueryWrapper<>();
pslDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); pslDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
PslData pslData = pslDataMapper.selectOne(pslDataQueryWrapper); PslData pslData = pslDataMapper.selectOne(pslDataQueryWrapper);
if (pslData != null) {
//获取最新时间 //获取最新时间
Date time = pslData.getTime(); Date time = pslData.getTime();
//获取时间区间 //获取时间区间
...@@ -196,6 +201,8 @@ public class PslDataServiceImpl extends ServiceImpl<PslDataMapper, PslData> impl ...@@ -196,6 +201,8 @@ public class PslDataServiceImpl extends ServiceImpl<PslDataMapper, PslData> impl
} }
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public DataVo month(String date, String values, String deviceid, String subitem) { public DataVo month(String date, String values, String deviceid, String subitem) {
...@@ -211,6 +218,7 @@ public class PslDataServiceImpl extends ServiceImpl<PslDataMapper, PslData> impl ...@@ -211,6 +218,7 @@ public class PslDataServiceImpl extends ServiceImpl<PslDataMapper, PslData> impl
QueryWrapper<PslData> pslDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<PslData> pslDataQueryWrapper = new QueryWrapper<>();
pslDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); pslDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
PslData pslData = pslDataMapper.selectOne(pslDataQueryWrapper); PslData pslData = pslDataMapper.selectOne(pslDataQueryWrapper);
if (pslData != null) {
//获取最新时间 //获取最新时间
Date time = pslData.getTime(); Date time = pslData.getTime();
//获取时间区间 //获取时间区间
...@@ -274,6 +282,8 @@ public class PslDataServiceImpl extends ServiceImpl<PslDataMapper, PslData> impl ...@@ -274,6 +282,8 @@ public class PslDataServiceImpl extends ServiceImpl<PslDataMapper, PslData> impl
} }
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size, String datasource) { public HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size, String datasource) {
...@@ -288,8 +298,8 @@ public class PslDataServiceImpl extends ServiceImpl<PslDataMapper, PslData> impl ...@@ -288,8 +298,8 @@ public class PslDataServiceImpl extends ServiceImpl<PslDataMapper, PslData> impl
} }
@Override @Override
public List<RealDataVo> real(String equipno1) { public List<RealDataVo> real(String equipno1, HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
List<HashMap<String, Object>> reals = pslDataMapper.real(tailInfoNo); List<HashMap<String, Object>> reals = pslDataMapper.real(tailInfoNo);
Map dbdata = ReadJsonFileUtil.getMap("realdata"); Map dbdata = ReadJsonFileUtil.getMap("realdata");
Object keys1 = dbdata.get("psldata"); Object keys1 = dbdata.get("psldata");
...@@ -299,7 +309,7 @@ public class PslDataServiceImpl extends ServiceImpl<PslDataMapper, PslData> impl ...@@ -299,7 +309,7 @@ public class PslDataServiceImpl extends ServiceImpl<PslDataMapper, PslData> impl
String sensorname = (String) real.get("sensorname"); String sensorname = (String) real.get("sensorname");
String eqdanwei = (String) real.get("eqdanwei"); String eqdanwei = (String) real.get("eqdanwei");
String equipno = (String) real.get("equipno"); String equipno = (String) real.get("equipno");
String time =(String) real.get("time"); String time = (String) real.get("time");
real.remove("time"); real.remove("time");
real.remove("equipno"); real.remove("equipno");
real.remove("sensorname"); real.remove("sensorname");
......
...@@ -15,6 +15,7 @@ import me.zhengjie.gemho.x_datavo.Result; ...@@ -15,6 +15,7 @@ import me.zhengjie.gemho.x_datavo.Result;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -60,10 +61,11 @@ public class RgDataServiceImpl extends ServiceImpl<RgDataMapper, RgData> impleme ...@@ -60,10 +61,11 @@ public class RgDataServiceImpl extends ServiceImpl<RgDataMapper, RgData> impleme
//获取数据库的最新数据 //获取数据库的最新数据
rgDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); rgDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
RgData rgData = rgDataMapper.selectOne(rgDataQueryWrapper); RgData rgData = rgDataMapper.selectOne(rgDataQueryWrapper);
DataVo dataVo = new DataVo();
if (rgData != null) {
//获取最新的时间 //获取最新的时间
Date time = rgData.getTime(); Date time = rgData.getTime();
//创建返回对象 //创建返回对象
DataVo dataVo = new DataVo();
NameVo nameVo = new NameVo(); NameVo nameVo = new NameVo();
try { try {
//获取数据的时间区间 //获取数据的时间区间
...@@ -135,6 +137,8 @@ public class RgDataServiceImpl extends ServiceImpl<RgDataMapper, RgData> impleme ...@@ -135,6 +137,8 @@ public class RgDataServiceImpl extends ServiceImpl<RgDataMapper, RgData> impleme
} }
return dataVo; return dataVo;
} }
return null;
}
/** /**
* 月统计 * 月统计
...@@ -162,10 +166,11 @@ public class RgDataServiceImpl extends ServiceImpl<RgDataMapper, RgData> impleme ...@@ -162,10 +166,11 @@ public class RgDataServiceImpl extends ServiceImpl<RgDataMapper, RgData> impleme
//int id = Integer.parseInt(deviceid); //int id = Integer.parseInt(deviceid);
rgDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); rgDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
RgData rgData = rgDataMapper.selectOne(rgDataQueryWrapper); RgData rgData = rgDataMapper.selectOne(rgDataQueryWrapper);
//获取最新的时间
Date time = rgData.getTime();
//创建返回对象 //创建返回对象
DataVo dataVo = new DataVo(); DataVo dataVo = new DataVo();
if (rgData != null) {
//获取最新的时间
Date time = rgData.getTime();
NameVo nameVo = new NameVo(); NameVo nameVo = new NameVo();
try { try {
//获取数据的时间区间 //获取数据的时间区间
...@@ -236,6 +241,8 @@ public class RgDataServiceImpl extends ServiceImpl<RgDataMapper, RgData> impleme ...@@ -236,6 +241,8 @@ public class RgDataServiceImpl extends ServiceImpl<RgDataMapper, RgData> impleme
} }
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size, String datasource) { public HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size, String datasource) {
...@@ -250,8 +257,8 @@ public class RgDataServiceImpl extends ServiceImpl<RgDataMapper, RgData> impleme ...@@ -250,8 +257,8 @@ public class RgDataServiceImpl extends ServiceImpl<RgDataMapper, RgData> impleme
} }
@Override @Override
public List<RealDataVo> real(String equipno1) { public List<RealDataVo> real(String equipno1, HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
List<HashMap<String, Object>> reals = rgDataMapper.real(tailInfoNo); List<HashMap<String, Object>> reals = rgDataMapper.real(tailInfoNo);
Map dbdata = ReadJsonFileUtil.getMap("realdata"); Map dbdata = ReadJsonFileUtil.getMap("realdata");
Object keys1 = dbdata.get("rgdata"); Object keys1 = dbdata.get("rgdata");
...@@ -261,7 +268,7 @@ public class RgDataServiceImpl extends ServiceImpl<RgDataMapper, RgData> impleme ...@@ -261,7 +268,7 @@ public class RgDataServiceImpl extends ServiceImpl<RgDataMapper, RgData> impleme
String sensorname = (String) real.get("sensorname"); String sensorname = (String) real.get("sensorname");
String eqdanwei = (String) real.get("eqdanwei"); String eqdanwei = (String) real.get("eqdanwei");
String equipno = (String) real.get("equipno"); String equipno = (String) real.get("equipno");
String time =(String) real.get("time"); String time = (String) real.get("time");
real.remove("time"); real.remove("time");
real.remove("equipno"); real.remove("equipno");
real.remove("sensorname"); real.remove("sensorname");
...@@ -299,10 +306,11 @@ public class RgDataServiceImpl extends ServiceImpl<RgDataMapper, RgData> impleme ...@@ -299,10 +306,11 @@ public class RgDataServiceImpl extends ServiceImpl<RgDataMapper, RgData> impleme
QueryWrapper<RgData> rgDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<RgData> rgDataQueryWrapper = new QueryWrapper<>();
rgDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); rgDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
RgData rgData = rgDataMapper.selectOne(rgDataQueryWrapper); RgData rgData = rgDataMapper.selectOne(rgDataQueryWrapper);
//获取最新日期
Date time = rgData.getTime();
//创建返回对象 //创建返回对象
DataVo dataVo = new DataVo(); DataVo dataVo = new DataVo();
if (rgData != null) {
//获取最新日期
Date time = rgData.getTime();
String format = sdf1.format(time); String format = sdf1.format(time);
try { try {
HashMap<String, String> map = getdayDate(time); HashMap<String, String> map = getdayDate(time);
...@@ -374,6 +382,8 @@ public class RgDataServiceImpl extends ServiceImpl<RgDataMapper, RgData> impleme ...@@ -374,6 +382,8 @@ public class RgDataServiceImpl extends ServiceImpl<RgDataMapper, RgData> impleme
return dataVo; return dataVo;
} }
return null;
}
public HashMap<String, String> getweekDate(Date date) throws ParseException { public HashMap<String, String> getweekDate(Date date) throws ParseException {
......
...@@ -15,6 +15,7 @@ import me.zhengjie.gemho.x_datavo.Result; ...@@ -15,6 +15,7 @@ import me.zhengjie.gemho.x_datavo.Result;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -58,6 +59,7 @@ public class SlDataServiceImpl extends ServiceImpl<SlDataMapper, SlData> impleme ...@@ -58,6 +59,7 @@ public class SlDataServiceImpl extends ServiceImpl<SlDataMapper, SlData> impleme
QueryWrapper<SlData> slDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<SlData> slDataQueryWrapper = new QueryWrapper<>();
slDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); slDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
SlData slData = slDataMapper.selectOne(slDataQueryWrapper); SlData slData = slDataMapper.selectOne(slDataQueryWrapper);
if (slData != null) {
//获取时间 //获取时间
Date time = slData.getTime(); Date time = slData.getTime();
//获取时间区间 //获取时间区间
...@@ -125,6 +127,8 @@ public class SlDataServiceImpl extends ServiceImpl<SlDataMapper, SlData> impleme ...@@ -125,6 +127,8 @@ public class SlDataServiceImpl extends ServiceImpl<SlDataMapper, SlData> impleme
} }
return dataVo; return dataVo;
} }
return null;
}
/** /**
* 周统计 * 周统计
...@@ -149,6 +153,7 @@ public class SlDataServiceImpl extends ServiceImpl<SlDataMapper, SlData> impleme ...@@ -149,6 +153,7 @@ public class SlDataServiceImpl extends ServiceImpl<SlDataMapper, SlData> impleme
QueryWrapper<SlData> slDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<SlData> slDataQueryWrapper = new QueryWrapper<>();
slDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); slDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
SlData slData = slDataMapper.selectOne(slDataQueryWrapper); SlData slData = slDataMapper.selectOne(slDataQueryWrapper);
if (slData != null) {
//获取时间 //获取时间
Date time = slData.getTime(); Date time = slData.getTime();
//获取时间区间 //获取时间区间
...@@ -213,6 +218,8 @@ public class SlDataServiceImpl extends ServiceImpl<SlDataMapper, SlData> impleme ...@@ -213,6 +218,8 @@ public class SlDataServiceImpl extends ServiceImpl<SlDataMapper, SlData> impleme
} }
return dataVo; return dataVo;
} }
return null;
}
/** /**
* 月统计 * 月统计
...@@ -237,6 +244,7 @@ public class SlDataServiceImpl extends ServiceImpl<SlDataMapper, SlData> impleme ...@@ -237,6 +244,7 @@ public class SlDataServiceImpl extends ServiceImpl<SlDataMapper, SlData> impleme
QueryWrapper<SlData> slDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<SlData> slDataQueryWrapper = new QueryWrapper<>();
slDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); slDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
SlData slData = slDataMapper.selectOne(slDataQueryWrapper); SlData slData = slDataMapper.selectOne(slDataQueryWrapper);
if (slData != null) {
//获取时间 //获取时间
Date time = slData.getTime(); Date time = slData.getTime();
//获取时间区间 //获取时间区间
...@@ -300,6 +308,8 @@ public class SlDataServiceImpl extends ServiceImpl<SlDataMapper, SlData> impleme ...@@ -300,6 +308,8 @@ public class SlDataServiceImpl extends ServiceImpl<SlDataMapper, SlData> impleme
} }
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size, String datasource) { public HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size, String datasource) {
...@@ -314,8 +324,8 @@ public class SlDataServiceImpl extends ServiceImpl<SlDataMapper, SlData> impleme ...@@ -314,8 +324,8 @@ public class SlDataServiceImpl extends ServiceImpl<SlDataMapper, SlData> impleme
} }
@Override @Override
public List<RealDataVo> real(String equipno1) { public List<RealDataVo> real(String equipno1, HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
List<RealDataVo> realDataVos = new ArrayList<>(); List<RealDataVo> realDataVos = new ArrayList<>();
List<HashMap<String, Object>> reals = slDataMapper.real(tailInfoNo); List<HashMap<String, Object>> reals = slDataMapper.real(tailInfoNo);
Map dbdata = ReadJsonFileUtil.getMap("realdata"); Map dbdata = ReadJsonFileUtil.getMap("realdata");
...@@ -325,7 +335,7 @@ public class SlDataServiceImpl extends ServiceImpl<SlDataMapper, SlData> impleme ...@@ -325,7 +335,7 @@ public class SlDataServiceImpl extends ServiceImpl<SlDataMapper, SlData> impleme
String sensorname = (String) real.get("sensorname"); String sensorname = (String) real.get("sensorname");
String eqdanwei = (String) real.get("eqdanwei"); String eqdanwei = (String) real.get("eqdanwei");
String equipno = (String) real.get("equipno"); String equipno = (String) real.get("equipno");
String time =(String) real.get("time"); String time = (String) real.get("time");
real.remove("time"); real.remove("time");
real.remove("equipno"); real.remove("equipno");
real.remove("sensorname"); real.remove("sensorname");
......
...@@ -15,6 +15,7 @@ import me.zhengjie.gemho.x_datavo.Result; ...@@ -15,6 +15,7 @@ import me.zhengjie.gemho.x_datavo.Result;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -49,6 +50,7 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme ...@@ -49,6 +50,7 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme
QueryWrapper<StData> stDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<StData> stDataQueryWrapper = new QueryWrapper<>();
stDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); stDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
StData stData = stDataMapper.selectOne(stDataQueryWrapper); StData stData = stDataMapper.selectOne(stDataQueryWrapper);
if (stData != null) {
Date time = stData.getTime(); Date time = stData.getTime();
//获取起始时间 //获取起始时间
try { try {
...@@ -115,6 +117,8 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme ...@@ -115,6 +117,8 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme
} }
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public DataVo week(String date, String values, String deviceid, String subitem) { public DataVo week(String date, String values, String deviceid, String subitem) {
...@@ -130,6 +134,7 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme ...@@ -130,6 +134,7 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme
QueryWrapper<StData> stDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<StData> stDataQueryWrapper = new QueryWrapper<>();
stDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); stDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
StData stData = stDataMapper.selectOne(stDataQueryWrapper); StData stData = stDataMapper.selectOne(stDataQueryWrapper);
if (stData != null) {
Date time = stData.getTime(); Date time = stData.getTime();
//获取起始时间 //获取起始时间
try { try {
...@@ -193,6 +198,8 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme ...@@ -193,6 +198,8 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme
} }
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public DataVo month(String date, String values, String deviceid, String subitem) { public DataVo month(String date, String values, String deviceid, String subitem) {
...@@ -208,6 +215,7 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme ...@@ -208,6 +215,7 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme
QueryWrapper<StData> stDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<StData> stDataQueryWrapper = new QueryWrapper<>();
stDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); stDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
StData stData = stDataMapper.selectOne(stDataQueryWrapper); StData stData = stDataMapper.selectOne(stDataQueryWrapper);
if (stData != null) {
Date time = stData.getTime(); Date time = stData.getTime();
//获取起始时间 //获取起始时间
try { try {
...@@ -270,6 +278,8 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme ...@@ -270,6 +278,8 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme
} }
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size, String datasource) { public HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size, String datasource) {
...@@ -284,8 +294,8 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme ...@@ -284,8 +294,8 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme
} }
@Override @Override
public List<RealDataVo> real(String equipno1) { public List<RealDataVo> real(String equipno1, HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
List<HashMap<String, Object>> reals = stDataMapper.real(tailInfoNo); List<HashMap<String, Object>> reals = stDataMapper.real(tailInfoNo);
Map dbdata = ReadJsonFileUtil.getMap("realdata"); Map dbdata = ReadJsonFileUtil.getMap("realdata");
Object keys1 = dbdata.get("stdata"); Object keys1 = dbdata.get("stdata");
...@@ -295,7 +305,7 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme ...@@ -295,7 +305,7 @@ public class StDataServiceImpl extends ServiceImpl<StDataMapper, StData> impleme
String sensorname = (String) real.get("sensorname"); String sensorname = (String) real.get("sensorname");
String eqdanwei = (String) real.get("eqdanwei"); String eqdanwei = (String) real.get("eqdanwei");
String equipno = (String) real.get("equipno"); String equipno = (String) real.get("equipno");
String time =(String) real.get("time"); String time = (String) real.get("time");
real.remove("time"); real.remove("time");
real.remove("equipno"); real.remove("equipno");
real.remove("sensorname"); real.remove("sensorname");
......
...@@ -15,6 +15,7 @@ import me.zhengjie.gemho.x_datavo.Result; ...@@ -15,6 +15,7 @@ import me.zhengjie.gemho.x_datavo.Result;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
...@@ -59,8 +60,8 @@ public class SzDataServiceImpl extends ServiceImpl<SzDataMapper, SzData> impleme ...@@ -59,8 +60,8 @@ public class SzDataServiceImpl extends ServiceImpl<SzDataMapper, SzData> impleme
} }
@Override @Override
public ArrayList<HashMap<String, Object>> real(String deviceid) { public ArrayList<HashMap<String, Object>> real(String deviceid, HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
ArrayList<HashMap<String, Object>> real = szDataMapper.real(tailInfoNo); ArrayList<HashMap<String, Object>> real = szDataMapper.real(tailInfoNo);
/* //获取最新数据 /* //获取最新数据
DataVo dataVo = new DataVo(); DataVo dataVo = new DataVo();
......
...@@ -15,6 +15,7 @@ import me.zhengjie.gemho.x_datavo.Result; ...@@ -15,6 +15,7 @@ import me.zhengjie.gemho.x_datavo.Result;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -50,6 +51,7 @@ public class WtDataServiceImpl extends ServiceImpl<WtDataMapper, WtData> impleme ...@@ -50,6 +51,7 @@ public class WtDataServiceImpl extends ServiceImpl<WtDataMapper, WtData> impleme
QueryWrapper<WtData> wtDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<WtData> wtDataQueryWrapper = new QueryWrapper<>();
wtDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); wtDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
WtData wtData = wtDataMapper.selectOne(wtDataQueryWrapper); WtData wtData = wtDataMapper.selectOne(wtDataQueryWrapper);
if (wtData != null) {
Date time = wtData.getTime(); Date time = wtData.getTime();
//获取起止时间 //获取起止时间
try { try {
...@@ -116,6 +118,8 @@ public class WtDataServiceImpl extends ServiceImpl<WtDataMapper, WtData> impleme ...@@ -116,6 +118,8 @@ public class WtDataServiceImpl extends ServiceImpl<WtDataMapper, WtData> impleme
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public DataVo week(String date, String values, String deviceid, String subitem) { public DataVo week(String date, String values, String deviceid, String subitem) {
...@@ -131,6 +135,7 @@ public class WtDataServiceImpl extends ServiceImpl<WtDataMapper, WtData> impleme ...@@ -131,6 +135,7 @@ public class WtDataServiceImpl extends ServiceImpl<WtDataMapper, WtData> impleme
QueryWrapper<WtData> wtDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<WtData> wtDataQueryWrapper = new QueryWrapper<>();
wtDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); wtDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
WtData wtData = wtDataMapper.selectOne(wtDataQueryWrapper); WtData wtData = wtDataMapper.selectOne(wtDataQueryWrapper);
if (wtData != null) {
Date time = wtData.getTime(); Date time = wtData.getTime();
//获取起止时间 //获取起止时间
try { try {
...@@ -194,6 +199,8 @@ public class WtDataServiceImpl extends ServiceImpl<WtDataMapper, WtData> impleme ...@@ -194,6 +199,8 @@ public class WtDataServiceImpl extends ServiceImpl<WtDataMapper, WtData> impleme
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public DataVo month(String date, String values, String deviceid, String subitem) { public DataVo month(String date, String values, String deviceid, String subitem) {
...@@ -209,6 +216,7 @@ public class WtDataServiceImpl extends ServiceImpl<WtDataMapper, WtData> impleme ...@@ -209,6 +216,7 @@ public class WtDataServiceImpl extends ServiceImpl<WtDataMapper, WtData> impleme
QueryWrapper<WtData> wtDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<WtData> wtDataQueryWrapper = new QueryWrapper<>();
wtDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1"); wtDataQueryWrapper.eq("sensorid", deviceid).orderByDesc("time").last("limit 1");
WtData wtData = wtDataMapper.selectOne(wtDataQueryWrapper); WtData wtData = wtDataMapper.selectOne(wtDataQueryWrapper);
if (wtData != null) {
Date time = wtData.getTime(); Date time = wtData.getTime();
//获取起止时间 //获取起止时间
try { try {
...@@ -273,9 +281,12 @@ public class WtDataServiceImpl extends ServiceImpl<WtDataMapper, WtData> impleme ...@@ -273,9 +281,12 @@ public class WtDataServiceImpl extends ServiceImpl<WtDataMapper, WtData> impleme
} }
return dataVo; return dataVo;
} }
return null;
}
@Override @Override
public HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String timeSpace, String sort, long page, long size, String datasource) { public HashMap<String, Object> pageall(String searchName, String searchValue, String limit, String
timeSpace, String sort, long page, long size, String datasource) {
QueryWrapper<WtData> wtDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<WtData> wtDataQueryWrapper = new QueryWrapper<>();
ServiceUtil.dbquery(wtDataQueryWrapper, searchName, searchValue, limit, timeSpace, sort, datasource); ServiceUtil.dbquery(wtDataQueryWrapper, searchName, searchValue, limit, timeSpace, sort, datasource);
Page<WtData> wtDataPage = new Page<>(page + 1, size); Page<WtData> wtDataPage = new Page<>(page + 1, size);
...@@ -287,8 +298,8 @@ public class WtDataServiceImpl extends ServiceImpl<WtDataMapper, WtData> impleme ...@@ -287,8 +298,8 @@ public class WtDataServiceImpl extends ServiceImpl<WtDataMapper, WtData> impleme
} }
@Override @Override
public List<RealDataVo> real(String equipno1) { public List<RealDataVo> real(String equipno1, HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
List<HashMap<String, Object>> reals = wtDataMapper.real(tailInfoNo); List<HashMap<String, Object>> reals = wtDataMapper.real(tailInfoNo);
Map dbdata = ReadJsonFileUtil.getMap("realdata"); Map dbdata = ReadJsonFileUtil.getMap("realdata");
Object keys1 = dbdata.get("wtdata"); Object keys1 = dbdata.get("wtdata");
......
...@@ -4,6 +4,7 @@ import me.zhengjie.gemho.entity.dic.Dic; ...@@ -4,6 +4,7 @@ import me.zhengjie.gemho.entity.dic.Dic;
import me.zhengjie.gemho.mapper.dic.DicMapper; import me.zhengjie.gemho.mapper.dic.DicMapper;
import me.zhengjie.gemho.mapper.tab.DrybeachequipinforMapper; import me.zhengjie.gemho.mapper.tab.DrybeachequipinforMapper;
import me.zhengjie.gemho.service.dic.DicService; import me.zhengjie.gemho.service.dic.DicService;
import me.zhengjie.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -73,8 +74,9 @@ public class DicServiceImpl implements DicService { ...@@ -73,8 +74,9 @@ public class DicServiceImpl implements DicService {
@Override @Override
public HashMap<String, ArrayList<Dic>> getdrybeachequipinfor() { public HashMap<String, ArrayList<Dic>> getdrybeachequipinfor() {
String currentUsername = SecurityUtils.getCurrentUsername();
HashMap<String, ArrayList<Dic>> map = new HashMap<>(); HashMap<String, ArrayList<Dic>> map = new HashMap<>();
ArrayList<Dic> gettailingid = drybeachequipinforMapper.gettailingid(); ArrayList<Dic> gettailingid = drybeachequipinforMapper.gettailingid(currentUsername);
ArrayList<Dic> getdevicetype = drybeachequipinforMapper.getdevicetype(); ArrayList<Dic> getdevicetype = drybeachequipinforMapper.getdevicetype();
map.put("tailingid", gettailingid); map.put("tailingid", gettailingid);
map.put("devicetype", getdevicetype); map.put("devicetype", getdevicetype);
......
...@@ -25,7 +25,7 @@ public interface InsDataService extends IService<InsData> { ...@@ -25,7 +25,7 @@ public interface InsDataService extends IService<InsData> {
* @param dataQueryCriteria * @param dataQueryCriteria
* @return * @return
*/ */
HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria); HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria,HttpServletRequest request);
/** /**
...@@ -34,7 +34,7 @@ public interface InsDataService extends IService<InsData> { ...@@ -34,7 +34,7 @@ public interface InsDataService extends IService<InsData> {
* @param param 根据需要进行传值 * @param param 根据需要进行传值
* @return * @return
*/ */
boolean add(InsData param); boolean add(InsData param,HttpServletRequest request);
/** /**
* 修改 * 修改
...@@ -42,7 +42,7 @@ public interface InsDataService extends IService<InsData> { ...@@ -42,7 +42,7 @@ public interface InsDataService extends IService<InsData> {
* @param param 根据需要进行传值 * @param param 根据需要进行传值
* @return * @return
*/ */
boolean modify(InsData param); boolean modify(InsData param,HttpServletRequest request);
/** /**
* 上传文件 * 上传文件
......
...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import me.zhengjie.gemho.entity.ins.InsData; import me.zhengjie.gemho.entity.ins.InsData;
import me.zhengjie.gemho.mapper.ins.InsDataMapper; import me.zhengjie.gemho.mapper.ins.InsDataMapper;
import me.zhengjie.gemho.service.ins.InsDataService; import me.zhengjie.gemho.service.ins.InsDataService;
import me.zhengjie.gemho.util.TailNoForInfoUtil;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria; import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.ins.InsDataVo; import me.zhengjie.gemho.x_datavo.ins.InsDataVo;
import me.zhengjie.utils.FileUtil; import me.zhengjie.utils.FileUtil;
...@@ -40,7 +41,9 @@ public class InsDataServiceImpl extends ServiceImpl<InsDataMapper, InsData> impl ...@@ -40,7 +41,9 @@ public class InsDataServiceImpl extends ServiceImpl<InsDataMapper, InsData> impl
private String filepath; private String filepath;
@Override @Override
public HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria) { public HashMap<String, Object> plist(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
//获取当前尾矿库
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
long size = dataQueryCriteria.getSize(); long size = dataQueryCriteria.getSize();
long page = dataQueryCriteria.getPage(); long page = dataQueryCriteria.getPage();
String vague = dataQueryCriteria.getVague(); String vague = dataQueryCriteria.getVague();
...@@ -58,7 +61,7 @@ public class InsDataServiceImpl extends ServiceImpl<InsDataMapper, InsData> impl ...@@ -58,7 +61,7 @@ public class InsDataServiceImpl extends ServiceImpl<InsDataMapper, InsData> impl
List<InsData> records = insDataPage.getRecords();*/ List<InsData> records = insDataPage.getRecords();*/
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
Page<InsDataVo> mapPage = new Page<>(page + 1, size); Page<InsDataVo> mapPage = new Page<>(page + 1, size);
Page<InsDataVo> mapPage1 = insDataMapper.selectPages(mapPage, title); Page<InsDataVo> mapPage1 = insDataMapper.selectPages(mapPage, tailInfoNo, title);
List<InsDataVo> records = mapPage1.getRecords(); List<InsDataVo> records = mapPage1.getRecords();
long total = mapPage1.getTotal(); long total = mapPage1.getTotal();
map.put("list", records); map.put("list", records);
...@@ -74,7 +77,10 @@ public class InsDataServiceImpl extends ServiceImpl<InsDataMapper, InsData> impl ...@@ -74,7 +77,10 @@ public class InsDataServiceImpl extends ServiceImpl<InsDataMapper, InsData> impl
* @return * @return
*/ */
@Override @Override
public boolean add(InsData param) { public boolean add(InsData param, HttpServletRequest request) {
//获取当前尾矿库
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
param.setTailingid(tailInfoNo);
int result = insDataMapper.insert(param); int result = insDataMapper.insert(param);
if (result > 0) { if (result > 0) {
return true; return true;
...@@ -89,7 +95,10 @@ public class InsDataServiceImpl extends ServiceImpl<InsDataMapper, InsData> impl ...@@ -89,7 +95,10 @@ public class InsDataServiceImpl extends ServiceImpl<InsDataMapper, InsData> impl
* @return * @return
*/ */
@Override @Override
public boolean modify(InsData param) { public boolean modify(InsData param, HttpServletRequest request) {
//获取当前尾矿库
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
param.setTailingid(tailInfoNo);
QueryWrapper<InsData> queryWrapper = new QueryWrapper<>(); QueryWrapper<InsData> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", param.getId()); queryWrapper.eq("id", param.getId());
int result = insDataMapper.update(param, queryWrapper); int result = insDataMapper.update(param, queryWrapper);
...@@ -113,17 +122,17 @@ public class InsDataServiceImpl extends ServiceImpl<InsDataMapper, InsData> impl ...@@ -113,17 +122,17 @@ public class InsDataServiceImpl extends ServiceImpl<InsDataMapper, InsData> impl
QueryWrapper<InsData> insDataQueryWrapper = new QueryWrapper<>(); QueryWrapper<InsData> insDataQueryWrapper = new QueryWrapper<>();
insDataQueryWrapper.eq("id", id); insDataQueryWrapper.eq("id", id);
InsData insData = insDataMapper.selectOne(insDataQueryWrapper); InsData insData = insDataMapper.selectOne(insDataQueryWrapper);
File file = new File(filepath+insData.getFile()); File file = new File(filepath + insData.getFile());
HttpServletResponse download = FileUtil.download(filepath+insData.getFile(), response); HttpServletResponse download = FileUtil.download(filepath + insData.getFile(), response);
return download; return download;
} }
public static void main(String[] args) { public static void main(String[] args) {
String fileName= "demo.txt"; String fileName = "demo.txt";
String suffixName = fileName.substring(fileName.lastIndexOf(".")); String suffixName = fileName.substring(fileName.lastIndexOf("."));
//重新生成文件名 //重新生成文件名
fileName = UUID.randomUUID()+suffixName; fileName = UUID.randomUUID() + suffixName;
System.out.println(fileName); System.out.println(fileName);
} }
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.sys.SysArea; import me.zhengjie.gemho.entity.sys.SysArea;
import me.zhengjie.gemho.entity.sys.SysSelect; import me.zhengjie.gemho.entity.sys.SysSelect;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -16,11 +17,11 @@ import java.util.List; ...@@ -16,11 +17,11 @@ import java.util.List;
* @since 2022-01-24 * @since 2022-01-24
*/ */
public interface SysSelectService extends IService<SysSelect> { public interface SysSelectService extends IService<SysSelect> {
boolean updata(HashMap<String, Object> map); boolean updata(HashMap<String, Object> map, HttpServletRequest request);
boolean shanchu(HashMap<String, Object> map); boolean shanchu(HashMap<String, Object> map);
List<SysArea> visual(); List<SysArea> visual(HttpServletRequest request);
List<SysSelect> getbytail(String gettailno); List<SysSelect> getbytail(String gettailno);
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.sys.SysSummary; import me.zhengjie.gemho.entity.sys.SysSummary;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria; import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap; import java.util.HashMap;
/** /**
...@@ -15,9 +16,9 @@ import java.util.HashMap; ...@@ -15,9 +16,9 @@ import java.util.HashMap;
* @since 2021-12-30 * @since 2021-12-30
*/ */
public interface SysSummaryService extends IService<SysSummary> { public interface SysSummaryService extends IService<SysSummary> {
HashMap<String, Object> getall(DataQueryCriteria dataQueryCriteria); HashMap<String, Object> getall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request);
HashMap<String, Object> getcode(String mdcode); HashMap<String, Object> getcode(String mdcode,HttpServletRequest request);
//判断是否是设备类型 //判断是否是设备类型
boolean iszero(String type); boolean iszero(String type);
......
...@@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -44,11 +45,11 @@ public class SysSelectServiceImpl extends ServiceImpl<SysSelectMapper, SysSelect ...@@ -44,11 +45,11 @@ public class SysSelectServiceImpl extends ServiceImpl<SysSelectMapper, SysSelect
private OnlineUserService onlineUserService; private OnlineUserService onlineUserService;
@Override @Override
public boolean updata(HashMap<String, Object> map) { public boolean updata(HashMap<String, Object> map, HttpServletRequest request) {
try { try {
//根据当前登录用户获取 尾矿库编码 //根据当前登录用户获取 尾矿库编码
String username = SecurityUtils.getCurrentUser().getUsername(); String username = SecurityUtils.getCurrentUser().getUsername();
String tailingno = onlineUserService.gettailno(username); String tailingno = onlineUserService.gettailno(username,request);
List ids = (List) map.get("values"); List ids = (List) map.get("values");
Object[] objects = ids.toArray(); Object[] objects = ids.toArray();
String idss = StringUtils.join(objects, ","); String idss = StringUtils.join(objects, ",");
...@@ -103,9 +104,9 @@ public class SysSelectServiceImpl extends ServiceImpl<SysSelectMapper, SysSelect ...@@ -103,9 +104,9 @@ public class SysSelectServiceImpl extends ServiceImpl<SysSelectMapper, SysSelect
} }
@Override @Override
public List<SysArea> visual() { public List<SysArea> visual(HttpServletRequest request) {
String username = SecurityUtils.getCurrentUser().getUsername(); String username = SecurityUtils.getCurrentUser().getUsername();
String tailingno = onlineUserService.gettailno(username); String tailingno = onlineUserService.gettailno(username,request);
List<Children> childrens = sysSelectMapper.getchildren(tailingno); List<Children> childrens = sysSelectMapper.getchildren(tailingno);
HashMap<Integer, ArrayList<Children>> map = new HashMap<>(); HashMap<Integer, ArrayList<Children>> map = new HashMap<>();
for (Children children : childrens) { for (Children children : childrens) {
......
...@@ -19,6 +19,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -19,6 +19,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.*; import java.util.*;
/** /**
...@@ -47,7 +48,7 @@ public class SysSummaryServiceImpl extends ServiceImpl<SysSummaryMapper, SysSumm ...@@ -47,7 +48,7 @@ public class SysSummaryServiceImpl extends ServiceImpl<SysSummaryMapper, SysSumm
private SysTypeMapper sysTypeMapper; private SysTypeMapper sysTypeMapper;
@Override @Override
public HashMap<String, Object> getall(DataQueryCriteria dataQueryCriteria) { public HashMap<String, Object> getall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
long page = dataQueryCriteria.getPage(); long page = dataQueryCriteria.getPage();
long size = dataQueryCriteria.getSize(); long size = dataQueryCriteria.getSize();
String vague = dataQueryCriteria.getVague(); String vague = dataQueryCriteria.getVague();
...@@ -67,7 +68,7 @@ public class SysSummaryServiceImpl extends ServiceImpl<SysSummaryMapper, SysSumm ...@@ -67,7 +68,7 @@ public class SysSummaryServiceImpl extends ServiceImpl<SysSummaryMapper, SysSumm
QueryWrapper<SysSummary> sysSummaryQueryWrapper = new QueryWrapper<>(); QueryWrapper<SysSummary> sysSummaryQueryWrapper = new QueryWrapper<>();
//获取当前登录用户,获取尾矿库编号 //获取当前登录用户,获取尾矿库编号
String username = SecurityUtils.getCurrentUser().getUsername(); String username = SecurityUtils.getCurrentUser().getUsername();
String tailingno = onlineUserService.gettailno(username); String tailingno = onlineUserService.gettailno(username,request);
Page<SysSummary> getbyeqno = null; Page<SysSummary> getbyeqno = null;
//根据设备编号获取相关的检测项 //根据设备编号获取相关的检测项
//sysSummaryQueryWrapper.in("deviceid", getno); //sysSummaryQueryWrapper.in("deviceid", getno);
...@@ -94,10 +95,10 @@ public class SysSummaryServiceImpl extends ServiceImpl<SysSummaryMapper, SysSumm ...@@ -94,10 +95,10 @@ public class SysSummaryServiceImpl extends ServiceImpl<SysSummaryMapper, SysSumm
} }
@Override @Override
public HashMap<String, Object> getcode(String mdcode) { public HashMap<String, Object> getcode(String mdcode,HttpServletRequest request) {
//根据当前登录用户获取 尾矿库编码 //根据当前登录用户获取 尾矿库编码
String username = SecurityUtils.getCurrentUser().getUsername(); String username = SecurityUtils.getCurrentUser().getUsername();
String tailingno = onlineUserService.gettailno(username); String tailingno = onlineUserService.gettailno(username,request);
List<Integer> getcode = new ArrayList<>(); List<Integer> getcode = new ArrayList<>();
if (mdcode != null) { if (mdcode != null) {
List<Integer> sumids = sysSelectMapper.getcode(mdcode, tailingno); List<Integer> sumids = sysSelectMapper.getcode(mdcode, tailingno);
......
package me.zhengjie.gemho.service.sys.impl; package me.zhengjie.gemho.service.sys.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import me.zhengjie.gemho.entity.Test; import me.zhengjie.gemho.entity.DataBack;
import me.zhengjie.gemho.mapper.TestMapper; import me.zhengjie.gemho.mapper.TestMapper;
import me.zhengjie.gemho.service.TestService; import me.zhengjie.gemho.service.TestService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -15,6 +15,6 @@ import org.springframework.stereotype.Service; ...@@ -15,6 +15,6 @@ import org.springframework.stereotype.Service;
* @since 2021-12-22 * @since 2021-12-22
*/ */
@Service @Service
public class TestServiceImpl extends ServiceImpl<TestMapper, Test> implements TestService { public class TestServiceImpl extends ServiceImpl<TestMapper, DataBack> implements TestService {
} }
...@@ -5,6 +5,7 @@ import me.zhengjie.gemho.entity.tab.Drybeachequipinfor; ...@@ -5,6 +5,7 @@ import me.zhengjie.gemho.entity.tab.Drybeachequipinfor;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria; import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.tab.DrybeachequipinforVo; import me.zhengjie.gemho.x_datavo.tab.DrybeachequipinforVo;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -18,13 +19,13 @@ import java.util.List; ...@@ -18,13 +19,13 @@ import java.util.List;
* @since 2021-12-22 * @since 2021-12-22
*/ */
public interface DrybeachequipinforService extends IService<Drybeachequipinfor> { public interface DrybeachequipinforService extends IService<Drybeachequipinfor> {
HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria); HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria,HttpServletRequest request);
boolean jcbj(String equipname); boolean jcbj(String equipname);
ArrayList<HashMap<String, String>> getDryCode(); ArrayList<HashMap<String, String>> getDryCode();
HashMap<String, Integer> getdyinfo(); HashMap<String, Integer> getdyinfo(HttpServletRequest request);
/** /**
* 删除设备并且删除检测项和配置信息 * 删除设备并且删除检测项和配置信息
...@@ -47,18 +48,19 @@ public interface DrybeachequipinforService extends IService<Drybeachequipinfor> ...@@ -47,18 +48,19 @@ public interface DrybeachequipinforService extends IService<Drybeachequipinfor>
* *
* @return * @return
*/ */
HashMap<String, Object> level(DataQueryCriteria dataQueryCriteria); HashMap<String, Object> level(DataQueryCriteria dataQueryCriteria, HttpServletRequest request);
/** /**
* 修改设备报警级别 * 修改设备报警级别
*/ */
void dealLevel(HashMap<String, String> map); void dealLevel(HashMap<String, String> map);
/** /**
* 设备在线状态统计 * 设备在线状态统计
*/ */
List<HashMap<String, Object>> dryStateCount(); List<HashMap<String, Object>> dryStateCount(HttpServletRequest request);
List<DrybeachequipinforVo> sensorList(String code); List<DrybeachequipinforVo> sensorList(String code, HttpServletRequest request);
List<DrybeachequipinforVo> pointDrys(); List<DrybeachequipinforVo> pointDrys(HttpServletRequest request);
} }
...@@ -2,7 +2,10 @@ package me.zhengjie.gemho.service.tab; ...@@ -2,7 +2,10 @@ package me.zhengjie.gemho.service.tab;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.tab.Abnormal; import me.zhengjie.gemho.entity.tab.Abnormal;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -23,34 +26,38 @@ public interface TabAbnormalService extends IService<Abnormal> { ...@@ -23,34 +26,38 @@ public interface TabAbnormalService extends IService<Abnormal> {
* *
* @return * @return
*/ */
ArrayList<HashMap<String, Object>> getAbnormal(); ArrayList<HashMap<String, Object>> getAbnormal(HttpServletRequest request);
/** /**
* 年统计各检测项 报警数量 * 年统计各检测项 报警数量
* *
* @return * @return
*/ */
List<HashMap<String, Object>> statistics(String date); List<HashMap<String, Object>> statistics(String date,HttpServletRequest request);
/** /**
* 未解除报警数量统计 * 未解除报警数量统计
* *
* @return * @return
*/ */
List<HashMap<String, Object>> statistics1(); List<HashMap<String, Object>> statistics1(HttpServletRequest request);
/** /**
* 检测线风向等级列表 * 检测线风向等级列表
* *
* @return * @return
*/ */
List<HashMap<String, Object>> typelist(); List<HashMap<String, Object>> typelist(HttpServletRequest request);
/** /**
* 各风险等级月统计 * 各风险等级月统计
* *
* @return * @return
*/ */
List<HashMap<String, Object>> monthtj(); List<HashMap<String, Object>> monthtj(HttpServletRequest request);
HashMap pList(DataQueryCriteria dataQueryCriteria, HttpServletRequest request);
void download(DataQueryCriteria dataQueryCriteria, HttpServletResponse response, HttpServletRequest request);
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.tab.Tailpondinfor; import me.zhengjie.gemho.entity.tab.Tailpondinfor;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria; import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -38,10 +39,10 @@ public interface TailpondinforService extends IService<Tailpondinfor> { ...@@ -38,10 +39,10 @@ public interface TailpondinforService extends IService<Tailpondinfor> {
* 获取大屏标题 * 获取大屏标题
* @return * @return
*/ */
String getScreenTitle(); String getScreenTitle(HttpServletRequest request);
/** /**
* 修改大屏标题 * 修改大屏标题
*/ */
void updateTitle(String title); void updateTitle(String title,HttpServletRequest request);
} }
...@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.util.*; import java.util.*;
/** /**
...@@ -41,13 +42,13 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo ...@@ -41,13 +42,13 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo
private OnlineUserService onlineUserService; private OnlineUserService onlineUserService;
@Override @Override
public HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria) { public HashMap<String, Object> pageall(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
long page = dataQueryCriteria.getPage(); long page = dataQueryCriteria.getPage();
long size = dataQueryCriteria.getSize(); long size = dataQueryCriteria.getSize();
HashMap<String, Object> hashMap = new HashMap<>(); HashMap<String, Object> hashMap = new HashMap<>();
QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>(); QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>();
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
String gettailno = onlineUserService.gettailno(currentUsername); String gettailno = onlineUserService.gettailno(currentUsername,request);
drybeachequipinforQueryWrapper.eq("tailingid", gettailno); drybeachequipinforQueryWrapper.eq("tailingid", gettailno);
ServiceUtil.query(drybeachequipinforQueryWrapper, dataQueryCriteria); ServiceUtil.query(drybeachequipinforQueryWrapper, dataQueryCriteria);
Page<Drybeachequipinfor> drybeachequipinforPage = new Page<>(page + 1, size); Page<Drybeachequipinfor> drybeachequipinforPage = new Page<>(page + 1, size);
...@@ -79,15 +80,21 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo ...@@ -79,15 +80,21 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo
} }
@Override @Override
public HashMap<String, Integer> getdyinfo() { public HashMap<String, Integer> getdyinfo(HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(); /* String tailInfoNo = TailNoForInfoUtil.getTailInfoNo();
int onlinecount = 0; int onlinecount = 0;
ArrayList<Integer> getonlinecount = drybeachequipinforMapper.getonlinecount(tailInfoNo); ArrayList<Integer> getonlinecount = drybeachequipinforMapper.getonlinecount(tailInfoNo);
for (Integer integer : getonlinecount) { for (Integer integer : getonlinecount) {
onlinecount += integer; onlinecount += integer;
} }
int getallcount = drybeachequipinforMapper.getallcount(tailInfoNo); int getallcount = drybeachequipinforMapper.getallcount(tailInfoNo);
int unlinecount = getallcount - onlinecount; int unlinecount = getallcount - onlinecount;*/
//获取不在线数量
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
Integer unlinecount = drybeachequipinforMapper.dryUnCount(tailInfoNo);
//获取所有设备
int getallcount = drybeachequipinforMapper.getallcount(tailInfoNo);
int onlinecount = getallcount - unlinecount;
HashMap<String, Integer> map = new HashMap<>(); HashMap<String, Integer> map = new HashMap<>();
map.put("online", onlinecount); map.put("online", onlinecount);
map.put("unline", unlinecount); map.put("unline", unlinecount);
...@@ -112,7 +119,7 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo ...@@ -112,7 +119,7 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo
} }
@Override @Override
public HashMap<String, Object> level(DataQueryCriteria dataQueryCriteria) { public HashMap<String, Object> level(DataQueryCriteria dataQueryCriteria,HttpServletRequest request) {
long page = dataQueryCriteria.getPage(); long page = dataQueryCriteria.getPage();
long size = dataQueryCriteria.getSize(); long size = dataQueryCriteria.getSize();
String vague = dataQueryCriteria.getVague(); String vague = dataQueryCriteria.getVague();
...@@ -128,7 +135,7 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo ...@@ -128,7 +135,7 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo
} }
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
//获取当前尾矿库编码 //获取当前尾矿库编码
String tailingid = TailNoForInfoUtil.getTailInfoNo(); String tailingid = TailNoForInfoUtil.getTailInfoNo(request);
Page<HashMap<String, Object>> drybeachequipinforPage = new Page<>(page + 1, size); Page<HashMap<String, Object>> drybeachequipinforPage = new Page<>(page + 1, size);
Page<HashMap<String, Object>> page1 = drybeachequipinforMapper.level(drybeachequipinforPage, tailingid, searchName, searchValue); Page<HashMap<String, Object>> page1 = drybeachequipinforMapper.level(drybeachequipinforPage, tailingid, searchName, searchValue);
List records = page1.getRecords(); List records = page1.getRecords();
...@@ -149,16 +156,21 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo ...@@ -149,16 +156,21 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo
} }
@Override @Override
public List<HashMap<String, Object>> dryStateCount() { public List<HashMap<String, Object>> dryStateCount(HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
List<HashMap<String, Object>> hashMaps = drybeachequipinforMapper.dryStateCount(tailInfoNo); List<HashMap<String, Object>> hashMaps = drybeachequipinforMapper.dryStateCount(tailInfoNo);
return hashMaps; return hashMaps;
} }
@Override @Override
public List<DrybeachequipinforVo> sensorList(String code) { public List<DrybeachequipinforVo> sensorList(String code,HttpServletRequest request) {
QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>(); QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>();
if (code != null) {
drybeachequipinforQueryWrapper.eq("devicetype", code); drybeachequipinforQueryWrapper.eq("devicetype", code);
}
//获取当前尾矿库
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
drybeachequipinforQueryWrapper.eq("tailingid", tailInfoNo);
List<Drybeachequipinfor> drybeachequipinfors = drybeachequipinforMapper.selectList(drybeachequipinforQueryWrapper); List<Drybeachequipinfor> drybeachequipinfors = drybeachequipinforMapper.selectList(drybeachequipinforQueryWrapper);
ArrayList<DrybeachequipinforVo> drybeachequipinforVos = new ArrayList<>(); ArrayList<DrybeachequipinforVo> drybeachequipinforVos = new ArrayList<>();
for (Drybeachequipinfor drybeachequipinfor : drybeachequipinfors) { for (Drybeachequipinfor drybeachequipinfor : drybeachequipinfors) {
...@@ -169,8 +181,12 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo ...@@ -169,8 +181,12 @@ public class DrybeachequipinforServiceImpl extends ServiceImpl<Drybeachequipinfo
} }
@Override @Override
public List<DrybeachequipinforVo> pointDrys() { public List<DrybeachequipinforVo> pointDrys(HttpServletRequest request) {
List<Drybeachequipinfor> drybeachequipinfors = drybeachequipinforMapper.selectList(null); QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>();
//获取当前尾矿库
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
drybeachequipinforQueryWrapper.eq("tailingid", tailInfoNo);
List<Drybeachequipinfor> drybeachequipinfors = drybeachequipinforMapper.selectList(drybeachequipinforQueryWrapper);
ArrayList<DrybeachequipinforVo> drybeachequipinforVos = new ArrayList<>(); ArrayList<DrybeachequipinforVo> drybeachequipinforVos = new ArrayList<>();
for (Drybeachequipinfor drybeachequipinfor : drybeachequipinfors) { for (Drybeachequipinfor drybeachequipinfor : drybeachequipinfors) {
DrybeachequipinforVo dryVo = new DrybeachequipinforVo().setEquipname(drybeachequipinfor.getEquipname()).setEquipno(drybeachequipinfor.getEquipno()); DrybeachequipinforVo dryVo = new DrybeachequipinforVo().setEquipname(drybeachequipinfor.getEquipname()).setEquipno(drybeachequipinfor.getEquipno());
......
package me.zhengjie.gemho.service.tab.impl; package me.zhengjie.gemho.service.tab.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 com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.SneakyThrows;
import me.zhengjie.gemho.entity.dic.AlarmLevel;
import me.zhengjie.gemho.entity.dic.AlarmState;
import me.zhengjie.gemho.entity.tab.Abnormal; import me.zhengjie.gemho.entity.tab.Abnormal;
import me.zhengjie.gemho.mapper.tab.DrybeachequipinforMapper; import me.zhengjie.gemho.mapper.tab.DrybeachequipinforMapper;
import me.zhengjie.gemho.mapper.tab.TabAbnormalMapper; import me.zhengjie.gemho.mapper.tab.TabAbnormalMapper;
import me.zhengjie.gemho.service.dic.IAlarmLevelService;
import me.zhengjie.gemho.service.dic.IAlarmStateService;
import me.zhengjie.gemho.service.tab.TabAbnormalService; import me.zhengjie.gemho.service.tab.TabAbnormalService;
import me.zhengjie.gemho.util.ServiceUtil;
import me.zhengjie.gemho.util.TailNoForInfoUtil; import me.zhengjie.gemho.util.TailNoForInfoUtil;
import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.utils.FileUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -26,6 +38,10 @@ public class TabAbnormalServiceImpl extends ServiceImpl<TabAbnormalMapper, Abnor ...@@ -26,6 +38,10 @@ public class TabAbnormalServiceImpl extends ServiceImpl<TabAbnormalMapper, Abnor
private TabAbnormalMapper tabAbnormalMapper; private TabAbnormalMapper tabAbnormalMapper;
@Autowired @Autowired
private DrybeachequipinforMapper drybeachequipinforMapper; private DrybeachequipinforMapper drybeachequipinforMapper;
@Autowired
private IAlarmLevelService iAlarmLevelService;
@Autowired
private IAlarmStateService iAlarmStateService;
@Override @Override
public boolean jcbj(String equipno, String time, String reason, String jcreason) { public boolean jcbj(String equipno, String time, String reason, String jcreason) {
...@@ -47,14 +63,16 @@ public class TabAbnormalServiceImpl extends ServiceImpl<TabAbnormalMapper, Abnor ...@@ -47,14 +63,16 @@ public class TabAbnormalServiceImpl extends ServiceImpl<TabAbnormalMapper, Abnor
} }
@Override @Override
public ArrayList<HashMap<String, Object>> getAbnormal() { public ArrayList<HashMap<String, Object>> getAbnormal(HttpServletRequest request) {
ArrayList<HashMap<String, Object>> getalarminfo = tabAbnormalMapper.getalarminfo(); //获取当前尾矿库编码
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
ArrayList<HashMap<String, Object>> getalarminfo = tabAbnormalMapper.getalarminfo(tailInfoNo);
return getalarminfo; return getalarminfo;
} }
@Override @Override
public List<HashMap<String, Object>> statistics(String date) { public List<HashMap<String, Object>> statistics(String date, HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
List<HashMap<String, Object>> statistics = null; List<HashMap<String, Object>> statistics = null;
if (date == null) { if (date == null) {
statistics = tabAbnormalMapper.statistics(tailInfoNo); statistics = tabAbnormalMapper.statistics(tailInfoNo);
...@@ -71,22 +89,22 @@ public class TabAbnormalServiceImpl extends ServiceImpl<TabAbnormalMapper, Abnor ...@@ -71,22 +89,22 @@ public class TabAbnormalServiceImpl extends ServiceImpl<TabAbnormalMapper, Abnor
} }
@Override @Override
public List<HashMap<String, Object>> statistics1() { public List<HashMap<String, Object>> statistics1(HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
List<HashMap<String, Object>> statistics1 = tabAbnormalMapper.statistics1(tailInfoNo); List<HashMap<String, Object>> statistics1 = tabAbnormalMapper.statistics1(tailInfoNo);
return statistics1; return statistics1;
} }
@Override @Override
public List<HashMap<String, Object>> typelist() { public List<HashMap<String, Object>> typelist(HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
List<HashMap<String, Object>> maps = tabAbnormalMapper.gettypelist(tailInfoNo); List<HashMap<String, Object>> maps = tabAbnormalMapper.gettypelist(tailInfoNo);
return maps; return maps;
} }
@Override @Override
public List<HashMap<String, Object>> monthtj() { public List<HashMap<String, Object>> monthtj(HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
List<String> strings = new ArrayList<>(); List<String> strings = new ArrayList<>();
List<String> strings1 = new ArrayList<>(); List<String> strings1 = new ArrayList<>();
strings.add("red"); strings.add("red");
...@@ -109,4 +127,57 @@ public class TabAbnormalServiceImpl extends ServiceImpl<TabAbnormalMapper, Abnor ...@@ -109,4 +127,57 @@ public class TabAbnormalServiceImpl extends ServiceImpl<TabAbnormalMapper, Abnor
return monthtj; return monthtj;
} }
@Override
public HashMap pList(DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
long page = dataQueryCriteria.getPage();
long size = dataQueryCriteria.getSize();
Page<Abnormal> abnormalPage = new Page<>(page + 1, size);
QueryWrapper<Abnormal> abnormalQueryWrapper = new QueryWrapper<>();
ServiceUtil.dataQuery(abnormalQueryWrapper, dataQueryCriteria);
//获取所有设备的编码
List<String> dryNo = TailNoForInfoUtil.getDryNo(request);
abnormalQueryWrapper.in("equipno", dryNo);
HashMap<String, Object> map = new HashMap<>();
Page<Abnormal> abnormalPage1 = tabAbnormalMapper.selectPage(abnormalPage, abnormalQueryWrapper);
map.put("list", abnormalPage1.getRecords());
map.put("total", abnormalPage1.getTotal());
return map;
}
@SneakyThrows
@Override
public void download(DataQueryCriteria dataQueryCriteria, HttpServletResponse response, HttpServletRequest request) {
List<Abnormal> alist = (List<Abnormal>) pList(dataQueryCriteria, request).get("list");
if (!alist.isEmpty()) {
HashMap<Integer, Object> levelMap = new HashMap<>();
HashMap<Integer, Object> statusMap = new HashMap<>();
//获取level
List<AlarmLevel> levels = iAlarmLevelService.list();
for (AlarmLevel level : levels) {
levelMap.put(level.getValue(), level.getName());
}
//获取status
List<AlarmState> status = iAlarmStateService.list();
for (AlarmState alarmState : status) {
statusMap.put(alarmState.getValue(), alarmState.getName());
}
List<Map<String, Object>> list = new ArrayList<>();
Map equipName = TailNoForInfoUtil.getEquipName(request);
for (Abnormal abnormal : alist) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("设备名称", equipName.get(abnormal.getEquipno()));
map.put("状态", statusMap.get(abnormal.getState()));
map.put("报警等级", levelMap.get(abnormal.getAlarmlevel()));
map.put("报警值", abnormal.getEvalue());
map.put("报警原因", abnormal.getReason());
map.put("解除报警原因", abnormal.getJcreason());
map.put("报警时间", abnormal.getTime());
map.put("解除报警时间", abnormal.getJcbjtime());
list.add(map);
}
FileUtil.downloadExcel(list, "报警信息", response);
}
}
} }
...@@ -14,6 +14,7 @@ import me.zhengjie.utils.SecurityUtils; ...@@ -14,6 +14,7 @@ import me.zhengjie.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -45,7 +46,7 @@ public class TailpondinforServiceImpl extends ServiceImpl<TailpondinforMapper, T ...@@ -45,7 +46,7 @@ public class TailpondinforServiceImpl extends ServiceImpl<TailpondinforMapper, T
ArrayList<String> gettailnos = userTailponMapper.gettailnos(currentUsername); ArrayList<String> gettailnos = userTailponMapper.gettailnos(currentUsername);
tailpondinforQueryWrapper.in("tailingno", gettailnos); tailpondinforQueryWrapper.in("tailingno", gettailnos);
} }
ServiceUtil.query(tailpondinforQueryWrapper,dataQueryCriteria); ServiceUtil.query(tailpondinforQueryWrapper, dataQueryCriteria);
Page<Tailpondinfor> tailpondinforPage = new Page<>(page + 1, size); Page<Tailpondinfor> tailpondinforPage = new Page<>(page + 1, size);
tailpondinforPage = tailpondinforMapper.selectPage(tailpondinforPage, tailpondinforQueryWrapper); tailpondinforPage = tailpondinforMapper.selectPage(tailpondinforPage, tailpondinforQueryWrapper);
List<Tailpondinfor> records = tailpondinforPage.getRecords(); List<Tailpondinfor> records = tailpondinforPage.getRecords();
...@@ -81,9 +82,9 @@ public class TailpondinforServiceImpl extends ServiceImpl<TailpondinforMapper, T ...@@ -81,9 +82,9 @@ public class TailpondinforServiceImpl extends ServiceImpl<TailpondinforMapper, T
if (tailpondinfors.isEmpty()) { if (tailpondinfors.isEmpty()) {
return null; return null;
} }
return tailpondinfors.get(tailpondinfors.size() - 1); Tailpondinfor tailpondinfor1 = tailpondinfors.get(tailpondinfors.size() - 1);
updataDefaultno(username, tailpondinfor1.getTailingno());
return tailpondinfor1;
} }
@Override @Override
...@@ -131,15 +132,15 @@ public class TailpondinforServiceImpl extends ServiceImpl<TailpondinforMapper, T ...@@ -131,15 +132,15 @@ public class TailpondinforServiceImpl extends ServiceImpl<TailpondinforMapper, T
} }
@Override @Override
public String getScreenTitle() { public String getScreenTitle(HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
String screenTitle = tailpondinforMapper.getScreenTitle(tailInfoNo); String screenTitle = tailpondinforMapper.getScreenTitle(tailInfoNo);
return screenTitle; return screenTitle;
} }
@Override @Override
public void updateTitle(String title) { public void updateTitle(String title, HttpServletRequest request) {
String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(); String tailInfoNo = TailNoForInfoUtil.getTailInfoNo(request);
tailpondinforMapper.updateTitle(title,tailInfoNo); tailpondinforMapper.updateTitle(title, tailInfoNo);
} }
} }
...@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.web.WebMonitorChart; import me.zhengjie.gemho.entity.web.WebMonitorChart;
import me.zhengjie.gemho.x_datavo.web.MonitorChartVo; import me.zhengjie.gemho.x_datavo.web.MonitorChartVo;
import javax.servlet.http.HttpServletRequest;
/** /**
* <p> * <p>
* 服务类 * 服务类
...@@ -19,7 +21,7 @@ public interface IWebMonitorChartService extends IService<WebMonitorChart> { ...@@ -19,7 +21,7 @@ public interface IWebMonitorChartService extends IService<WebMonitorChart> {
* *
* @return * @return
*/ */
boolean deal(WebMonitorChart webMonitorChart); boolean deal(WebMonitorChart webMonitorChart, HttpServletRequest request);
/** /**
* 清空检测项的图片 * 清空检测项的图片
...@@ -34,19 +36,21 @@ public interface IWebMonitorChartService extends IService<WebMonitorChart> { ...@@ -34,19 +36,21 @@ public interface IWebMonitorChartService extends IService<WebMonitorChart> {
* *
* @return * @return
*/ */
MonitorChartVo getmonbase(); MonitorChartVo getmonbase(HttpServletRequest request);
/** /**
* 获取监测点信息 * 获取监测点信息
* *
* @return * @return
*/ */
MonitorChartVo getmonbasevisual(); MonitorChartVo getmonbasevisual(HttpServletRequest request);
/** /**
* 根据当前尾矿库获取chart * 根据当前尾矿库获取chart
*
* @return * @return
*/ */
WebMonitorChart getbytailno(); WebMonitorChart getbytailno(HttpServletRequest request);
void updatehw(int height, int width, int id); void updatehw(int height, int width, int id);
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import me.zhengjie.gemho.entity.web.WebMonitorPoints; import me.zhengjie.gemho.entity.web.WebMonitorPoints;
import me.zhengjie.gemho.x_datavo.web.MonitorChartRq; import me.zhengjie.gemho.x_datavo.web.MonitorChartRq;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
...@@ -20,6 +21,6 @@ public interface IWebMonitorPointsService extends IService<WebMonitorPoints> { ...@@ -20,6 +21,6 @@ public interface IWebMonitorPointsService extends IService<WebMonitorPoints> {
void pchuli(ArrayList<WebMonitorPoints> webMonitorPoints ); void pchuli(ArrayList<WebMonitorPoints> webMonitorPoints );
void deal(MonitorChartRq monitorChartVo); void deal(MonitorChartRq monitorChartVo, HttpServletRequest request);
} }
...@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.util.*; import java.util.*;
/** /**
...@@ -55,10 +56,10 @@ public class WebMonitorChartServiceImpl extends ServiceImpl<WebMonitorChartMappe ...@@ -55,10 +56,10 @@ public class WebMonitorChartServiceImpl extends ServiceImpl<WebMonitorChartMappe
private DrybeachequipinforService drybeachequipinforService; private DrybeachequipinforService drybeachequipinforService;
@Override @Override
public boolean deal(WebMonitorChart webMonitorChart) { public boolean deal(WebMonitorChart webMonitorChart, HttpServletRequest request) {
boolean result = false; boolean result = false;
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
String tailno = onlineUserService.gettailno(currentUsername); String tailno = onlineUserService.gettailno(currentUsername, request);
webMonitorChart.setTailingno(tailno); webMonitorChart.setTailingno(tailno);
//判断是否存在 //判断是否存在
QueryWrapper<WebMonitorChart> webMonitorChartQueryWrapper = new QueryWrapper<>(); QueryWrapper<WebMonitorChart> webMonitorChartQueryWrapper = new QueryWrapper<>();
...@@ -88,10 +89,10 @@ public class WebMonitorChartServiceImpl extends ServiceImpl<WebMonitorChartMappe ...@@ -88,10 +89,10 @@ public class WebMonitorChartServiceImpl extends ServiceImpl<WebMonitorChartMappe
} }
@Override @Override
public MonitorChartVo getmonbase() { public MonitorChartVo getmonbase(HttpServletRequest request) {
//获取当前尾矿库编码 //获取当前尾矿库编码
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
String tailno = onlineUserService.gettailno(currentUsername); String tailno = onlineUserService.gettailno(currentUsername, request);
//构建返回结构 //构建返回结构
MonitorChartVo monitorChartVo = new MonitorChartVo(); MonitorChartVo monitorChartVo = new MonitorChartVo();
//获取监测点图标 //获取监测点图标
...@@ -132,10 +133,10 @@ public class WebMonitorChartServiceImpl extends ServiceImpl<WebMonitorChartMappe ...@@ -132,10 +133,10 @@ public class WebMonitorChartServiceImpl extends ServiceImpl<WebMonitorChartMappe
return monitorChartVo; return monitorChartVo;
} }
public MonitorChartVo getsimplemonbase() { public MonitorChartVo getsimplemonbase(HttpServletRequest request) {
//获取当前尾矿库编码 //获取当前尾矿库编码
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
String tailno = onlineUserService.gettailno(currentUsername); String tailno = onlineUserService.gettailno(currentUsername, request);
//构建返回结构 //构建返回结构
MonitorChartVo monitorChartVo = new MonitorChartVo(); MonitorChartVo monitorChartVo = new MonitorChartVo();
//获取对应尾矿库的图片 //获取对应尾矿库的图片
...@@ -171,14 +172,14 @@ public class WebMonitorChartServiceImpl extends ServiceImpl<WebMonitorChartMappe ...@@ -171,14 +172,14 @@ public class WebMonitorChartServiceImpl extends ServiceImpl<WebMonitorChartMappe
} }
@Override @Override
public MonitorChartVo getmonbasevisual() { public MonitorChartVo getmonbasevisual(HttpServletRequest request) {
//获取设备的状态 //获取设备的状态
List<HashMap<String, Object>> hashMaps = drybeachequipinforService.dryStateCount(); List<HashMap<String, Object>> hashMaps = drybeachequipinforService.dryStateCount(request);
//获取所有设备的实时数据 //获取所有设备的实时数据
List<RealDataVo> realData = (List<RealDataVo>) redisUtils.get("realData"); List<RealDataVo> realData = (List<RealDataVo>) redisUtils.get("realData");
//获取设备的实时报警状态 //获取设备的实时报警状态
List<HashMap<String, Object>> realalarm = tabAbnormalMapper.realalarm(); List<HashMap<String, Object>> realalarm = tabAbnormalMapper.realalarm();
MonitorChartVo monitorChartVo = getsimplemonbase(); MonitorChartVo monitorChartVo = getsimplemonbase(request);
List<WebMonitorPointsVo> points = monitorChartVo.getPoints(); List<WebMonitorPointsVo> points = monitorChartVo.getPoints();
for (WebMonitorPointsVo point : points) { for (WebMonitorPointsVo point : points) {
List<HashMap<String, Object>> items = point.getItems(); List<HashMap<String, Object>> items = point.getItems();
...@@ -226,9 +227,9 @@ public class WebMonitorChartServiceImpl extends ServiceImpl<WebMonitorChartMappe ...@@ -226,9 +227,9 @@ public class WebMonitorChartServiceImpl extends ServiceImpl<WebMonitorChartMappe
} }
@Override @Override
public WebMonitorChart getbytailno() { public WebMonitorChart getbytailno(HttpServletRequest request) {
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
String gettailno = onlineUserService.gettailno(currentUsername); String gettailno = onlineUserService.gettailno(currentUsername,request);
QueryWrapper<WebMonitorChart> webMonitorChartQueryWrapper = new QueryWrapper<>(); QueryWrapper<WebMonitorChart> webMonitorChartQueryWrapper = new QueryWrapper<>();
webMonitorChartQueryWrapper.eq("tailingno", gettailno); webMonitorChartQueryWrapper.eq("tailingno", gettailno);
WebMonitorChart webMonitorChart = webMonitorChartMapper.selectOne(webMonitorChartQueryWrapper); WebMonitorChart webMonitorChart = webMonitorChartMapper.selectOne(webMonitorChartQueryWrapper);
......
...@@ -18,6 +18,7 @@ import org.springframework.beans.BeanUtils; ...@@ -18,6 +18,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -68,7 +69,7 @@ public class WebMonitorPointsServiceImpl extends ServiceImpl<WebMonitorPointsMap ...@@ -68,7 +69,7 @@ public class WebMonitorPointsServiceImpl extends ServiceImpl<WebMonitorPointsMap
} }
@Override @Override
public void deal(MonitorChartRq monitorChartVo) { public void deal(MonitorChartRq monitorChartVo, HttpServletRequest request) {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
Page<Object> objectPage = new Page<>(); Page<Object> objectPage = new Page<>();
ArrayList<WebMonitorLink> webMonitorLinks = new ArrayList<>(); ArrayList<WebMonitorLink> webMonitorLinks = new ArrayList<>();
...@@ -78,7 +79,7 @@ public class WebMonitorPointsServiceImpl extends ServiceImpl<WebMonitorPointsMap ...@@ -78,7 +79,7 @@ public class WebMonitorPointsServiceImpl extends ServiceImpl<WebMonitorPointsMap
//添加监测点项 信息 //添加监测点项 信息
WebMonitorChart chart = monitorChartVo.getChart(); WebMonitorChart chart = monitorChartVo.getChart();
if (chart == null) { if (chart == null) {
chart = iWebMonitorChartService.getbytailno(); chart = iWebMonitorChartService.getbytailno(request);
} }
//修改chart信息 //修改chart信息
...@@ -113,7 +114,10 @@ public class WebMonitorPointsServiceImpl extends ServiceImpl<WebMonitorPointsMap ...@@ -113,7 +114,10 @@ public class WebMonitorPointsServiceImpl extends ServiceImpl<WebMonitorPointsMap
QueryWrapper<WebMonitorLink> webMonitorLinkQueryWrapper = new QueryWrapper<>(); QueryWrapper<WebMonitorLink> webMonitorLinkQueryWrapper = new QueryWrapper<>();
webMonitorLinkQueryWrapper.in("pointid", guids); webMonitorLinkQueryWrapper.in("pointid", guids);
iWebMonitorLinkService.removebyguids(guids); iWebMonitorLinkService.removebyguids(guids);
if (!webMonitorLinks.isEmpty()){
iWebMonitorLinkService.pinsert(webMonitorLinks); iWebMonitorLinkService.pinsert(webMonitorLinks);
} }
} }
}
} }
...@@ -14,6 +14,7 @@ import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria; ...@@ -14,6 +14,7 @@ import me.zhengjie.gemho.x_datavo.data.DataQueryCriteria;
import me.zhengjie.gemho.x_datavo.data.ImgDataVo; import me.zhengjie.gemho.x_datavo.data.ImgDataVo;
import me.zhengjie.utils.SpringContextHolder; import me.zhengjie.utils.SpringContextHolder;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -129,54 +130,68 @@ public class ServiceUtil { ...@@ -129,54 +130,68 @@ public class ServiceUtil {
} }
} }
public static void dbquery(QueryWrapper<?> queryWrapper, String searchName, String searchValue, String limit, String timeSpace, String sort, String datasource, String state) { public static void dbquery(QueryWrapper<?> queryWrapper, DataQueryCriteria dataQueryCriteria, HttpServletRequest request) {
//精准查询还是模糊查询 //获取精确查询字段
//起止时间 String exact1 = dataQueryCriteria.getExact();
int limit1 = 0; if (exact1 != null) {
Date start = new Date(); HashMap exact = JSON.parseObject(exact1, HashMap.class);
Date end = new Date(); //HashMap<String, Object> exact = dataQueryCriteria.getExact();
String starttime = null; //处理精确查询字段
String endtime = null; Set<String> strings = exact.keySet();
boolean check = false; if (!strings.isEmpty()) {
String desc = sort; for (String string : strings) {
//检查是否有起止时间 if (string.equals("state")) {
if (timeSpace != null) { exact.put("state", 1);
starttime = timeSpace.split(",")[0];
endtime = timeSpace.split(",")[1];
start = toDate(starttime + " 00:00:00");
end = toDate(endtime + " 23:59:59");
check = true;
} }
if (limit != null) { if (string.equals("monitorType")) {
limit1 = Integer.parseInt(limit); continue;
} }
queryWrapper.eq(string, exact.get(string));
if (datasource != null) {
queryWrapper.eq("datasource", Integer.parseInt(datasource));
} }
//判断是否有条件
if (searchName != null && searchValue != null) {
if (limit1 == 0) {
queryWrapper.like(searchName, searchValue);
} else {
queryWrapper.eq(searchName, searchValue);
} }
} }
//是否报警
if (state != null && !"".equals(state)) { //获取模糊查询字段
Integer integer = Integer.valueOf(state); String vague1 = dataQueryCriteria.getVague();
queryWrapper.eq("state", integer); if (vague1 != null) {
Map vague = JSON.parseObject(vague1, Map.class);
Set<String> strings1 = vague.keySet();
if (!strings1.isEmpty()) {
for (String s : strings1) {
queryWrapper.like(s, vague.get(s));
} }
//是否需时间查询 }
if (check) { }
//判断是否有时间字段
String timeSpace = dataQueryCriteria.getDaterange();
if (timeSpace != null) {
if (timeSpace.contains(",")) {
String starttime = timeSpace.split(",")[0] + " 00:00:00";
String endtime = timeSpace.split(",")[1] + " 23:59:59";
Date start = toDate(starttime);
Date end = toDate(endtime);
queryWrapper.ge("time", start).le("time", end);
} else {
Date start = toDate(timeSpace + " 00:00:00");
Date end = toDate(timeSpace + " 23:59:59");
queryWrapper.ge("time", start).le("time", end); queryWrapper.ge("time", start).le("time", end);
} }
//正序还是倒叙 }
if ("desc".equals(desc)) { //正序倒序
String sort = dataQueryCriteria.getSort();
if (sort != null) {
String s = sort.split(",")[1];
if (s.equals("desc")) {
queryWrapper.orderByDesc("time"); queryWrapper.orderByDesc("time");
} else { } else {
queryWrapper.orderByAsc("time"); queryWrapper.orderByAsc("time");
} }
} else {
queryWrapper.orderByAsc("time");
}
//获取当前尾矿库所有设备编码
List<String> dryNo = TailNoForInfoUtil.getDryNo(request);
queryWrapper.in("sensorid", dryNo);
} }
public static void dataQuery(QueryWrapper<?> queryWrapper, DataQueryCriteria dataQueryCriteria) { public static void dataQuery(QueryWrapper<?> queryWrapper, DataQueryCriteria dataQueryCriteria) {
......
package me.zhengjie.gemho.util; package me.zhengjie.gemho.util;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import me.zhengjie.gemho.entity.tab.Drybeachequipinfor;
import me.zhengjie.gemho.mapper.tab.DrybeachequipinforMapper;
import me.zhengjie.modules.security.service.OnlineUserService; import me.zhengjie.modules.security.service.OnlineUserService;
import me.zhengjie.utils.RedisUtils;
import me.zhengjie.utils.SecurityUtils; import me.zhengjie.utils.SecurityUtils;
import me.zhengjie.utils.SpringContextHolder; import me.zhengjie.utils.SpringContextHolder;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TailNoForInfoUtil { public class TailNoForInfoUtil {
public static String getTailInfoNo() { public static String getTailInfoNo(HttpServletRequest request) {
String currentUsername = SecurityUtils.getCurrentUsername(); String currentUsername = SecurityUtils.getCurrentUsername();
OnlineUserService onlineUserService = SpringContextHolder.getBean(OnlineUserService.class); OnlineUserService onlineUserService = SpringContextHolder.getBean(OnlineUserService.class);
String tailno = onlineUserService.gettailno(currentUsername); String tailno = onlineUserService.gettailno(currentUsername, request);
return tailno; return tailno;
} }
public static List<String> getDryNo(HttpServletRequest request) {
String currentUsername = SecurityUtils.getCurrentUsername();
OnlineUserService onlineUserService = SpringContextHolder.getBean(OnlineUserService.class);
String tailno = onlineUserService.gettailno(currentUsername, request);
//获取当前尾矿库所有的设备编码
DrybeachequipinforMapper drybeachequipinforMapper = SpringContextHolder.getBean(DrybeachequipinforMapper.class);
List<String> list = drybeachequipinforMapper.getequipno(tailno);
return list;
}
//获取设备名称
public static Map getEquipName(HttpServletRequest request) {
String currentUsername = SecurityUtils.getCurrentUsername();
OnlineUserService onlineUserService = SpringContextHolder.getBean(OnlineUserService.class);
String tailno = onlineUserService.gettailno(currentUsername ,request);
RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
Map map = (Map) redisUtils.get(tailno);
String equipname = null;
if (map != null) {
return map;
} else {
//保存设备编码和名称
DrybeachequipinforMapper drybeachequipinforMapper = SpringContextHolder.getBean(DrybeachequipinforMapper.class);
QueryWrapper<Drybeachequipinfor> drybeachequipinforQueryWrapper = new QueryWrapper<>();
drybeachequipinforQueryWrapper.eq("tailingid", tailno);
List<Drybeachequipinfor> drybeachequipinfors = drybeachequipinforMapper.selectList(drybeachequipinforQueryWrapper);
HashMap<String, String> map1 = new HashMap<>();
for (Drybeachequipinfor drybeachequipinfor : drybeachequipinfors) {
map1.put(drybeachequipinfor.getEquipno(), drybeachequipinfor.getEquipname());
}
redisUtils.set(tailno, map1);
return map1;
}
}
} }
...@@ -99,7 +99,7 @@ public class AuthorizationController { ...@@ -99,7 +99,7 @@ public class AuthorizationController {
final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal(); final JwtUserDto jwtUserDto = (JwtUserDto) authentication.getPrincipal();
// 保存在线信息 // 保存在线信息
onlineUserService.save(jwtUserDto, token, request); onlineUserService.save(jwtUserDto, token, request);
onlineUserService.saveWKKBase(jwtUserDto.getUsername()); onlineUserService.saveWKKBase(jwtUserDto.getUsername(), token);
// 返回 token 与 用户信息 // 返回 token 与 用户信息
Map<String, Object> authInfo = new HashMap<String, Object>(2) {{ Map<String, Object> authInfo = new HashMap<String, Object>(2) {{
put("token", properties.getTokenStartWith() + token); put("token", properties.getTokenStartWith() + token);
...@@ -145,7 +145,7 @@ public class AuthorizationController { ...@@ -145,7 +145,7 @@ public class AuthorizationController {
@AnonymousDeleteMapping(value = "/logout") @AnonymousDeleteMapping(value = "/logout")
public ResponseEntity<Object> logout(HttpServletRequest request) { public ResponseEntity<Object> logout(HttpServletRequest request) {
String username = SecurityUtils.getCurrentUsername(); String username = SecurityUtils.getCurrentUsername();
onlineUserService.logout(tokenProvider.getToken(request),username); onlineUserService.logout(tokenProvider.getToken(request), username);
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
} }
...@@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -19,6 +19,7 @@ import lombok.extern.slf4j.Slf4j;
import me.zhengjie.gemho.entity.tab.Tailpondinfor; import me.zhengjie.gemho.entity.tab.Tailpondinfor;
import me.zhengjie.gemho.service.tab.TailpondinforService; import me.zhengjie.gemho.service.tab.TailpondinforService;
import me.zhengjie.modules.security.config.bean.SecurityProperties; import me.zhengjie.modules.security.config.bean.SecurityProperties;
import me.zhengjie.modules.security.security.TokenProvider;
import me.zhengjie.modules.security.service.dto.JwtUserDto; import me.zhengjie.modules.security.service.dto.JwtUserDto;
import me.zhengjie.modules.security.service.dto.OnlineUserDto; import me.zhengjie.modules.security.service.dto.OnlineUserDto;
import me.zhengjie.utils.*; import me.zhengjie.utils.*;
...@@ -123,7 +124,7 @@ public class OnlineUserService { ...@@ -123,7 +124,7 @@ public class OnlineUserService {
*/ */
public void logout(String token, String username) { public void logout(String token, String username) {
String key = properties.getOnlineKey() + token; String key = properties.getOnlineKey() + token;
redisUtils.del(username + "wkk"); //redisUtils.del("wkk" + key);
redisUtils.del(key); redisUtils.del(key);
} }
...@@ -206,17 +207,31 @@ public class OnlineUserService { ...@@ -206,17 +207,31 @@ public class OnlineUserService {
* *
* @param username * @param username
*/ */
public void saveWKKBase(String username) { public void saveWKKBase(String username, HttpServletRequest request) {
TokenProvider tokenProvider = SpringContextHolder.getBean(TokenProvider.class);
String token = tokenProvider.getToken(request);
Long currentUserId = SecurityUtils.getCurrentUserId(); Long currentUserId = SecurityUtils.getCurrentUserId();
TailpondinforService tailpondinforService1 = SpringContextHolder.getBean(TailpondinforService.class); TailpondinforService tailpondinforService1 = SpringContextHolder.getBean(TailpondinforService.class);
Tailpondinfor tailpondinfor = tailpondinforService1.getByUser(username); Tailpondinfor tailpondinfor = tailpondinforService1.getByUser(username);
Long tokenValidityInSeconds = properties.getTokenValidityInSeconds(); Long tokenValidityInSeconds = properties.getTokenValidityInSeconds();
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++" + tokenValidityInSeconds); System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++" + tokenValidityInSeconds);
redisUtils.set(username + "wkk", tailpondinfor.getTailingno(), (properties.getTokenValidityInSeconds() / 1000) * 2); redisUtils.set("wkk" + username, tailpondinfor.getTailingno(), (properties.getTokenValidityInSeconds() / 1000) * 2);
//清空 菜单的缓存 //清空 菜单的缓存
redisUtils.del("menu::user:" + currentUserId); redisUtils.del("menu::user:" + currentUserId);
} }
public void saveWKKBase(String username, String token) {
Long currentUserId = SecurityUtils.getCurrentUserId();
TailpondinforService tailpondinforService1 = SpringContextHolder.getBean(TailpondinforService.class);
Tailpondinfor tailpondinfor = tailpondinforService1.getByUser(username);
Long tokenValidityInSeconds = properties.getTokenValidityInSeconds();
System.out.println("++++++++++++++++++++++++++++++++++++++++++++++++++++" + tokenValidityInSeconds);
redisUtils.set("wkk" + username, tailpondinfor.getTailingno(), (properties.getTokenValidityInSeconds() / 1000) * 2);
//清空 菜单的缓存
redisUtils.del("menu::user:" + currentUserId);
}
/** /**
* 清空菜单缓存 * 清空菜单缓存
*/ */
...@@ -232,8 +247,10 @@ public class OnlineUserService { ...@@ -232,8 +247,10 @@ public class OnlineUserService {
* @param tailingno * @param tailingno
*/ */
@Async @Async
public void changeWkkBase(String username, String tailingno) { public void changeWkkBase(String username, String tailingno, HttpServletRequest request) {
redisUtils.set(username + "wkk", tailingno, (properties.getTokenValidityInSeconds() / 1000) * 2); TokenProvider tokenProvider = SpringContextHolder.getBean(TokenProvider.class);
String token = tokenProvider.getToken(request);
redisUtils.set("wkk" + username, tailingno, (properties.getTokenValidityInSeconds() / 1000) * 2);
} }
/** /**
...@@ -242,8 +259,10 @@ public class OnlineUserService { ...@@ -242,8 +259,10 @@ public class OnlineUserService {
* @param username * @param username
* @return * @return
*/ */
public String gettailno(String username) { public String gettailno(String username, HttpServletRequest request) {
String tailno = (String) redisUtils.get(username + "wkk"); TokenProvider tokenProvider = SpringContextHolder.getBean(TokenProvider.class);
String token = tokenProvider.getToken(request);
String tailno = (String) redisUtils.get("wkk" + username);
return tailno; return tailno;
} }
} }
...@@ -34,6 +34,7 @@ import org.springframework.security.access.prepost.PreAuthorize; ...@@ -34,6 +34,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -62,8 +63,8 @@ public class MenuController { ...@@ -62,8 +63,8 @@ public class MenuController {
@GetMapping(value = "/build") @GetMapping(value = "/build")
@ApiOperation("获取前端所需菜单") @ApiOperation("获取前端所需菜单")
public ResponseEntity<Object> buildMenus() { public ResponseEntity<Object> buildMenus(HttpServletRequest request) {
List<MenuDto> menuDtoList = menuService.findByUser(SecurityUtils.getCurrentUserId()); List<MenuDto> menuDtoList = menuService.findByUser(SecurityUtils.getCurrentUserId(),request);
List<MenuDto> menuDtos = menuService.buildTree(menuDtoList); List<MenuDto> menuDtos = menuService.buildTree(menuDtoList);
return new ResponseEntity<>(menuService.buildMenus(menuDtos), HttpStatus.OK); return new ResponseEntity<>(menuService.buildMenus(menuDtos), HttpStatus.OK);
} }
......
...@@ -19,6 +19,7 @@ import me.zhengjie.modules.system.domain.Menu; ...@@ -19,6 +19,7 @@ import me.zhengjie.modules.system.domain.Menu;
import me.zhengjie.modules.system.service.dto.MenuDto; import me.zhengjie.modules.system.service.dto.MenuDto;
import me.zhengjie.modules.system.service.dto.MenuQueryCriteria; import me.zhengjie.modules.system.service.dto.MenuQueryCriteria;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
...@@ -121,5 +122,5 @@ public interface MenuService { ...@@ -121,5 +122,5 @@ public interface MenuService {
* @param currentUserId / * @param currentUserId /
* @return / * @return /
*/ */
List<MenuDto> findByUser(Long currentUserId); List<MenuDto> findByUser(Long currentUserId, HttpServletRequest request);
} }
...@@ -42,6 +42,7 @@ import org.springframework.data.domain.Sort; ...@@ -42,6 +42,7 @@ import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
...@@ -100,13 +101,13 @@ public class MenuServiceImpl implements MenuService { ...@@ -100,13 +101,13 @@ public class MenuServiceImpl implements MenuService {
*/ */
@Override @Override
@Cacheable(key = "'user:' + #p0") @Cacheable(key = "'user:' + #p0")
public List<MenuDto> findByUser(Long currentUserId) { public List<MenuDto> findByUser(Long currentUserId, HttpServletRequest request) {
List<RoleSmallDto> roles = roleService.findByUsersId(currentUserId); List<RoleSmallDto> roles = roleService.findByUsersId(currentUserId);
Set<Long> roleIds = roles.stream().map(RoleSmallDto::getId).collect(Collectors.toSet()); Set<Long> roleIds = roles.stream().map(RoleSmallDto::getId).collect(Collectors.toSet());
LinkedHashSet<Menu> menus = menuRepository.findByRoleIdsAndTypeNot(roleIds, 2); LinkedHashSet<Menu> menus = menuRepository.findByRoleIdsAndTypeNot(roleIds, 2);
OnlineUserService onlineUserService = SpringContextHolder.getBean(OnlineUserService.class); OnlineUserService onlineUserService = SpringContextHolder.getBean(OnlineUserService.class);
SysTypeMapper sysTypeMapper = SpringContextHolder.getBean(SysTypeMapper.class); SysTypeMapper sysTypeMapper = SpringContextHolder.getBean(SysTypeMapper.class);
String gettailno = onlineUserService.gettailno(SecurityUtils.getCurrentUsername()); String gettailno = onlineUserService.gettailno(SecurityUtils.getCurrentUsername(), request);
List<String> list = sysTypeMapper.getbytailno(gettailno); List<String> list = sysTypeMapper.getbytailno(gettailno);
List<String> list1 = sysTypeMapper.getname(); List<String> list1 = sysTypeMapper.getname();
......
...@@ -16,8 +16,9 @@ ...@@ -16,8 +16,9 @@
from ins_project ip from ins_project ip
join ins_children ic on ip.id = ic.project_id join ins_children ic on ip.id = ic.project_id
join ins_data id on id.child_id = ic.id join ins_data id on id.child_id = ic.id
where id.tailingid=#{tailingid}
<if test="title!=null and title!=''"> <if test="title!=null and title!=''">
where id.title like CONCAT('%',#{title},'%') and id.title like CONCAT('%',#{title},'%')
</if> </if>
</select> </select>
</mapper> </mapper>
...@@ -17,10 +17,19 @@ ...@@ -17,10 +17,19 @@
<select id="dryStateCount" resultType="hashmap"> <select id="dryStateCount" resultType="hashmap">
SELECT equipno, SELECT equipno,
case case
when DATE_FORMAT(datarealtime, '%Y-%m-%d %H:%m:%s') >= when DATE_FORMAT(datarealtime, '%Y-%m-%d %H:%m:%s') &gt;=
DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 30 MINUTE), '%Y-%m-%d %H:%m:%s') then 0 DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 30 MINUTE), '%Y-%m-%d %H:%m:%s') then 0
when initialstateno = '1' then 0
else 1 end as `state` else 1 end as `state`
FROM `tb_drybeachequipinfor` FROM `tb_drybeachequipinfor`
where tailingid = #{tailingid} where tailingid = #{tailingid}
</select> </select>
<select id="dryUnCount" resultType="integer">
SELECT COUNT(id) as unloin
FROM tb_drybeachequipinfor
where tailingid = #{tailingid} and initialstateno = '0'
and DATE_FORMAT(datarealtime, '%Y-%m-%d %H:%m:%s') &lt;= DATE_FORMAT(DATE_SUB(NOW(), INTERVAL 30 MINUTE), '%Y-%m-%d
%H:%m:%s')
or tailingid = #{tailingid} and initialstateno = '0' and datarealtime is Null
</select>
</mapper> </mapper>
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