Commit 86761849 authored by Administrator's avatar Administrator

2024-7.8 干滩图标添加报警

parent 1ef394d2
......@@ -4,6 +4,7 @@ package me.zhengjie.gemho.controller.data;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import me.zhengjie.annotation.AnonymousAccess;
import me.zhengjie.gemho.entity.data.MpData;
import me.zhengjie.gemho.service.data.MpDataService;
import me.zhengjie.gemho.util.PageResult;
......
......@@ -32,11 +32,12 @@ 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' and td.tailingid=#{tailingid} ORDER BY ta.time DESC")
ArrayList<HashMap<String, Object>> getalarminfo(String tailingid);
@Update(value = "update tab_abnormal set state = '2' ,jcreason= #{jcreason},jcbjtime=#{jcbjtime},reason=#{reason},ifselect=1 where equipno =#{equipno} and state = 1 ")
@Update(value = "update tab_abnormal set state = '2' ,jcreason= #{jcreason},jcbjtime=#{jcbjtime},reason=#{reason},updatetime=#{now},ifselect=1 where equipno =#{equipno} and state = 1 ")
int jcbj(@Param(value = "jcreason") String jcreason,
@Param(value = "jcbjtime") String jcbjtime,
@Param(value = "reason") String reason,
@Param(value = "equipno") String equipno);
@Param(value = "equipno") String equipno,
@Param(value = "now") String now);
@Select(value = "select b.name,b.code ,\n" +
"sum(case when alarmlevel =1 then 1 else 0 end )as \"red\",\n" +
......
......@@ -52,6 +52,7 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
private final ArtificialDataMapper artificialDataMapper;
private final JczxMapper jczxMapper;
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
@Override
public DataVo day(String date, String values, String deviceid, String subitem) {
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......@@ -175,7 +176,7 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
for (Field declaredField : data1.getClass().getDeclaredFields()) {
if (declaredField.getName().equals(dbdata)) {
hashMap.put(dbdata, Double.parseDouble((String) declaredField.get(data1)));
rgdate=sdf2.parse(sdf2.format(data1.getTime()));
rgdate = sdf2.parse(sdf2.format(data1.getTime()));
}
}
break;
......@@ -245,7 +246,7 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
for (Field declaredField : data1.getClass().getDeclaredFields()) {
if (declaredField.getName().equals(dbdata)) {
hashMap.put(dbdata, Double.parseDouble((String) declaredField.get(data1)));
rgdate=sdf2.parse(sdf2.format(data1.getTime()));
rgdate = sdf2.parse(sdf2.format(data1.getTime()));
}
}
break;
......@@ -315,24 +316,24 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
record.setJcvalue(artificialData.getValue());
record.setJctime(time1);
//计算差值
if (checkArtificial.equals("16")){
if (checkArtificial.equals("16")) {
Double aDouble = Double.valueOf(record.getAngle());
Double aDouble1 = Double.valueOf(record.getJcvalue());
Double difference = aDouble-aDouble1;
Double difference = aDouble - aDouble1;
double v = (difference < 0) ? -difference : difference;
record.setDifference(String.valueOf(v));
}else if (checkArtificial.equals("17")){
} else if (checkArtificial.equals("17")) {
Double aDouble = Double.valueOf(record.getLenth());
Double aDouble1 = Double.valueOf(record.getJcvalue());
Double difference = aDouble-aDouble1;
Double difference = aDouble - aDouble1;
double v = (difference < 0) ? -difference : difference;
record.setDifference(String.valueOf(v));
}else if (checkArtificial.equals("18")){
} else if (checkArtificial.equals("18")) {
Double aDouble = Double.valueOf(record.getAngle());
Double aDouble1 = Double.valueOf(record.getJcvalue());
Double difference = aDouble-aDouble1;
Double difference = aDouble - aDouble1;
double v = (difference < 0) ? -difference : difference;
record.setDifference(String.format("%.2f",v));
record.setDifference(String.format("%.2f", v));
}
}
}
......@@ -397,10 +398,12 @@ public class DbDataServiceImpl extends ServiceImpl<DbDataMapper, DbData> impleme
results.add(result);
}
}
HashMap<String, Object> dealalarm = DataUtil.dealalarm(dataQueryCriteria.getCode());
imgDataVo.setLists(results);
imgDataVo.setSensorname(sensorname);
imgDataVo.setNames(dbdata);
imgDataVo.setDanwei(danwei);
imgDataVo.setAlarm(dealalarm);
return imgDataVo;
}
......
package me.zhengjie.gemho.x_generato.modules.security.security;
import lombok.extern.slf4j.Slf4j;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.stream.Collectors;
@Slf4j
public class AuthRequestWrapper extends HttpServletRequestWrapper {
private String body;
public AuthRequestWrapper(HttpServletRequest request) {
super(request);
try(BufferedReader reader = request.getReader()){
body= reader.lines().collect(Collectors.joining());
}catch (Exception e){
log.error("!!-- read request from requestbody error",e);
}
}
@Override
public BufferedReader getReader() {
return new BufferedReader(new InputStreamReader(this.getInputStream()));
}
@Override
public ServletInputStream getInputStream() {
final ByteArrayInputStream byteArrayIns = new ByteArrayInputStream(body.getBytes());
ServletInputStream servletIns = new ServletInputStream() {
@Override
public boolean isFinished() {
return false;
}
@Override
public boolean isReady() {
return false;
}
@Override
public void setReadListener(ReadListener readListener) {
}
@Override
public int read() {
return byteArrayIns.read();
}
};
return servletIns;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
}
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