Commit a7a49d1b authored by kiritoausna's avatar kiritoausna

2022-5-6

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