Commit b1cbc7d8 authored by zhuangzhuang's avatar zhuangzhuang

9.28-增加预警阈值判断,增加数据下载国际化,对异常坐标点进行剔除

parent 8ce43ef4
package com.example.tdl.common;
import com.example.tdl.domain.vo.*;
import com.example.tdl.web.I18nController;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.CellStyle;
......@@ -10,8 +11,10 @@ import org.apache.poi.ss.util.RegionUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.time.chrono.IsoChronology;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
......@@ -24,16 +27,21 @@ public class WarehouseExcel {
private String userName;
private ResultWarehouseNoAndTDLSNAndTimeVo resultWarehouseNoAndTDLSNAndTimeVo;
private HttpServletRequest request;
private I18nController i18n;
// private List<DownloadWarehouseVo> downloadWarehouseVos;
public WarehouseExcel(String fileName, String userName, ResultWarehouseNoAndTDLSNAndTimeVo resultWarehouseNoAndTDLSNAndTimeVo) {
public WarehouseExcel(String fileName, String userName, ResultWarehouseNoAndTDLSNAndTimeVo resultWarehouseNoAndTDLSNAndTimeVo, HttpServletRequest request, I18nController i18n) {
this.fileName = fileName;
this.userName = userName;
this.resultWarehouseNoAndTDLSNAndTimeVo = resultWarehouseNoAndTDLSNAndTimeVo;
this.request = request;
this.i18n = i18n;
}
/*
......@@ -79,7 +87,7 @@ public class WarehouseExcel {
//设置列的格式
cell2.setCellStyle(rowStyle2);
//将标题添加到列中
cell2.setCellValue("年度:2018年");
cell2.setCellValue(i18n.getMessage(request,"year")+ ":2018");
}
sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 2));
for (int n = 3; n < 6; n++) {
......@@ -87,11 +95,13 @@ public class WarehouseExcel {
//设置列的格式
cell2.setCellStyle(rowStyle2);
//将标题添加到列中
cell2.setCellValue("库房适宜温度为"+resultWarehouseNoAndTDLSNAndTimeVo.getTemMin()+"℃-"+resultWarehouseNoAndTDLSNAndTimeVo.getTemMax()+"℃,湿度保持"+resultWarehouseNoAndTDLSNAndTimeVo.getHumidityMin()+"%-"+resultWarehouseNoAndTDLSNAndTimeVo.getHumidityMax()+"%,超标要做必要调节。");
Object[] args ={resultWarehouseNoAndTDLSNAndTimeVo.getTemMin(),resultWarehouseNoAndTDLSNAndTimeVo.getTemMax(),resultWarehouseNoAndTDLSNAndTimeVo.getHumidityMin(),resultWarehouseNoAndTDLSNAndTimeVo.getHumidityMax()};
cell2.setCellValue(i18n.getMessage(request,args,"suitable"));
}
sheet.addMergedRegion(new CellRangeAddress(1, 1, 3, 5));
cell2 = row2.createCell(6);
cell2.setCellValue("记录人:"+userName);
cell2.setCellValue(i18n.getMessage(request,"recorder")+":"+userName);
cell2.setCellStyle(rowStyle2);
row2.setHeight((short) (26 * 20));
......@@ -106,20 +116,20 @@ public class WarehouseExcel {
cell3 = row3.createCell(n);
cell3.setCellStyle(rowStyle3);
//将标题添加到列中
cell3.setCellValue("采样时间");
cell3.setCellValue(i18n.getMessage(request,"SamplingTime"));
}
sheet.addMergedRegion(new CellRangeAddress(2, 2, 0, 2));
cell3 = row3.createCell(3);
cell3.setCellValue("天气");
cell3.setCellValue(i18n.getMessage(request,"Weather"));
cell3.setCellStyle(rowStyle3);
cell3 = row3.createCell(4);
cell3.setCellValue("温度");
cell3.setCellValue(i18n.getMessage(request,"Temperature"));
cell3.setCellStyle(rowStyle3);
cell3 = row3.createCell(5);
cell3.setCellValue("湿度");
cell3.setCellValue(i18n.getMessage(request,"Humidity"));
cell3.setCellStyle(rowStyle3);
cell3 = row3.createCell(6);
cell3.setCellValue("是否预警");
cell3.setCellValue(i18n.getMessage(request,"EnableAllert"));
cell3.setCellStyle(rowStyle3);
row3.setHeight((short) (26 * 20));
......@@ -131,25 +141,25 @@ public class WarehouseExcel {
HSSFCell cell4 = null;
HSSFCellStyle rowStyle4 = getStyle(workbook);
cell4 = row4.createCell(0);
cell4.setCellValue("月");
cell4.setCellValue(i18n.getMessage(request,"Month"));
cell4.setCellStyle(rowStyle4);
cell4 = row4.createCell(1);
cell4.setCellValue("日");
cell4.setCellValue(i18n.getMessage(request,"Day"));
cell4.setCellStyle(rowStyle4);
cell4 = row4.createCell(2);
cell4.setCellValue("时分");
cell4.setCellValue(i18n.getMessage(request,"Time"));
cell4.setCellStyle(rowStyle4);
cell4 = row4.createCell(3);
cell4.setCellValue("天气");
cell4.setCellValue(i18n.getMessage(request,"Weather"));
cell4.setCellStyle(rowStyle4);
cell4 = row4.createCell(4);
cell4.setCellValue("温度(℃)");
cell4.setCellValue(i18n.getMessage(request,"Temperature"));
cell4.setCellStyle(rowStyle4);
cell4 = row4.createCell(5);
cell4.setCellValue("湿度(%RH)");
cell4.setCellValue(i18n.getMessage(request,"Humidity"));
cell4.setCellStyle(rowStyle4);
cell4 = row4.createCell(6);
cell4.setCellValue("是否预警");
cell4.setCellValue(i18n.getMessage(request,"EnableAllert"));
cell4.setCellStyle(rowStyle4);
sheet.addMergedRegion(new CellRangeAddress(2, 3, 3, 3));
sheet.addMergedRegion(new CellRangeAddress(2, 3, 4, 4));
......@@ -169,7 +179,7 @@ public class WarehouseExcel {
//设置列的格式
cell.setCellStyle(rowStyle);
//将标题添加到列中
cell.setCellValue(new HSSFRichTextString(resultWarehouseNoAndTDLSNAndTimeVo.getGatewaySN()+"该时间段没有数据"));
cell.setCellValue(new HSSFRichTextString(resultWarehouseNoAndTDLSNAndTimeVo.getGatewaySN()+i18n.getMessage(request,"NoData")));
}
//设置行高
row.setHeight((short) (26 * 20));
......@@ -180,22 +190,23 @@ public class WarehouseExcel {
for(int i = 0;i<resultWarehouseNoAndTDLSNAndTimeVo.getDownloadWarehouseVos().size();i++) {
HSSFRow row = sheet.createRow((short) rowCount + i);
HSSFCell cell = null;
Long time=Long.valueOf(resultWarehouseNoAndTDLSNAndTimeVo.getDownloadWarehouseVos().get(i).getTime());
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date=new Date(time);
Long seconds=Long.valueOf(resultWarehouseNoAndTDLSNAndTimeVo.getDownloadWarehouseVos().get(i).getTime());
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
String time = sdf.format(new Date(seconds));
String[] t = sdf.format(new Date(seconds)).split("-");
cell2 = row2.createCell(1);
cell2.setCellValue(date.getYear());
cell2.setCellValue(t[0]);
cell2.setCellStyle(rowStyle);
cell = row.createCell(0);
cell.setCellValue(date.getMonth()+1);
cell.setCellValue(t[1]);
cell.setCellStyle(rowStyle);
cell = row.createCell(1);
cell.setCellValue(date.getDay());
cell.setCellValue(t[2]);
cell.setCellStyle(rowStyle);
cell = row.createCell(2);
cell.setCellValue(date.getHours()+":"+date.getMinutes());
cell.setCellValue(t[3]+":"+t[4]);
cell.setCellStyle(rowStyle);
cell = row.createCell(3);
cell.setCellValue("-");
......
......@@ -7,6 +7,8 @@ public class DownloadForWarehouseVo {
private String warehouseNo;
private String offset;
public Long getStartTime() {
return startTime;
}
......@@ -31,4 +33,11 @@ public class DownloadForWarehouseVo {
this.warehouseNo = warehouseNo;
}
public String getOffset() {
return offset;
}
public void setOffset(String offset) {
this.offset = offset;
}
}
package com.example.tdl.domain.vo;
public class TransportationNoVo {
private String transportationNo;
private String offset;
public String getTransportationNo() {
return transportationNo;
}
public void setTransportationNo(String transportationNo) {
this.transportationNo = transportationNo;
}
public String getOffset() {
return offset;
}
public void setOffset(String offset) {
this.offset = offset;
}
}
......@@ -19,6 +19,7 @@ import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
......@@ -169,7 +170,11 @@ public class DataUtil {
if (result.getSeries() != null) {
for (QueryResult.Series series : result.getSeries()) {
if (series != null) {
values = series.getValues();
if(queryResult.getResults().size()>1){
values.add(series.getValues().get(0));
}else{
values=series.getValues();
}
}
}
}
......@@ -177,6 +182,8 @@ public class DataUtil {
return values;
}
public static String parseTime(String time) {
String dateResult = null;
try {
......@@ -201,20 +208,7 @@ public class DataUtil {
public static List<HistoryData> getHistoryDatas(QueryResult queryResult, String alias) {
String dateResult = null;
List<List<Object>> value = new ArrayList<>();
for (QueryResult.Result result : queryResult.getResults()) {
if (result.getSeries() != null) {
for (QueryResult.Series series : result.getSeries()) {
if (series != null) {
value.add(series.getValues().get(0));
} else {
continue;
}
}
} else {
continue;
}
}
List<List<Object>> value = getValues(queryResult);
List<HistoryData> historyDataList = new ArrayList<>();
for (int i = 0; i < value.size(); i++) {
HistoryData historyData = new HistoryData();
......@@ -226,6 +220,25 @@ public class DataUtil {
}
public static String UTCToCST(String UTCStr,String offset) {
Date date = null;
try {
if (UTCStr.length() != 20) {
date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(UTCStr);
} else {
date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(UTCStr);
}
} catch (Exception e) {
e.printStackTrace();
logger.info(e.toString());
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.HOUR, calendar.get(Calendar.HOUR) +Integer.valueOf(offset));
//calendar.getTime() 返回的是Date类型,也可以使用calendar.getTimeInMillis()获取时间戳
//format的格式可以任意
return String.valueOf(calendar.getTimeInMillis());
}
}
package com.example.tdl.util;
public class MapUtils {
//private static double EARTH_RADIUS = 6378.137;
private static double EARTH_RADIUS = 6371.393;
private static double rad(double d)
{
return d * Math.PI / 180.0;
}
/**
* 计算两个经纬度之间的距离
* @param lat1
* @param lng1
* @param lat2
* @param lng2
* @return
*/
public static double getDistance(double lat1, double lng1, double lat2, double lng2)
{
double radLat1 = rad(lat1);
double radLat2 = rad(lat2);
double a = radLat1 - radLat2;
double b = rad(lng1) - rad(lng2);
double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a/2),2) +
Math.cos(radLat1)*Math.cos(radLat2)*Math.pow(Math.sin(b/2),2)));
s = s * EARTH_RADIUS;
s = Math.round(s * 1000);
// System.out.println(s+"----------------");
return s;
}
//计算速度
public static double getSpeed(double lat1, double lng1, double lat2, double lng2,Long time){
double s = getDistance( lat1, lng1, lat2, lng2);
if(s <1000 || s> 10000){
return 0;
}
return s/time;
}
public static void main(String[] args) {
System.out.println(MapUtils.getDistance(29.490295,106.486654,29.615467,106.581515));
}
}
package com.example.tdl.util;
import org.apache.commons.lang3.StringUtils;
import java.io.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
......@@ -85,6 +87,9 @@ public class ZipCompressUtil {
ZipEntry zipEntry = null;
// 遍历源文件数组
for (int i = 0; i < srcFiles.length; i++) {
if(srcFiles[i]==null){
continue;
}
// 将源文件数组中的当前文件读入 FileInputStream 流中
fileInputStream = new FileInputStream(srcFiles[i]);
// 实例化 ZipEntry 对象,源文件数组中的当前文件
......
......@@ -122,11 +122,21 @@ public class AlarmController {
fb.setMessage(i18n.getMessage(request,"temMax"));
return gson.toJson(fb);
}
if(addAlarmVo.getTemMax()>85f){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"temMaxLimit"));
return gson.toJson(fb);
}
if (addAlarmVo.getTemMin()== null){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"temMin"));
return gson.toJson(fb);
}
if (addAlarmVo.getTemMin()<-25f){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"temMinLimit"));
return gson.toJson(fb);
}
if(addAlarmVo.getTemMin() >addAlarmVo.getTemMax()){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"wrongTemp"));
......@@ -142,6 +152,16 @@ public class AlarmController {
fb.setMessage(i18n.getMessage(request,"humidityMin"));
return gson.toJson(fb);
}
if (addAlarmVo.getHumidityMax()>100F){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"humidityMaxLimit"));
return gson.toJson(fb);
}
if (addAlarmVo.getHumidityMin()<0F){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"humidityMinLimit"));
return gson.toJson(fb);
}
if(addAlarmVo.getHumidityMin() >addAlarmVo.getHumidityMax()){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"wrongHumidity"));
......@@ -152,11 +172,21 @@ public class AlarmController {
fb.setMessage(i18n.getMessage(request,"tilt"));
return gson.toJson(fb);
}
if (addAlarmVo.getTilt()<0 || addAlarmVo.getTilt()>180 || addAlarmVo.getTilt()%30 !=0){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"tiltLimit"));
return gson.toJson(fb);
}
if (addAlarmVo.getShock()==null){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"shock"));
return gson.toJson(fb);
}
if (Float.valueOf(addAlarmVo.getShock())<1.5 || Float.valueOf(addAlarmVo.getShock())>13.8){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"shockLimit"));
return gson.toJson(fb);
}
if (alarmService.getByType(addAlarmVo.getAlarmType(),user.getCompanyNo())!=null){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"alarmExist"));
......@@ -210,11 +240,21 @@ public class AlarmController {
fb.setMessage(i18n.getMessage(request,"temMax"));
return gson.toJson(fb);
}
if(updateAlarmVo.getTemMax()>85f){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"temMaxLimit"));
return gson.toJson(fb);
}
if (updateAlarmVo.getTemMin()==null){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"temMin"));
return gson.toJson(fb);
}
if (updateAlarmVo.getTemMin()<-25f){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"temMinLimit"));
return gson.toJson(fb);
}
if(updateAlarmVo.getTemMin() >updateAlarmVo.getTemMax()){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"wrongTemp"));
......@@ -230,11 +270,26 @@ public class AlarmController {
fb.setMessage(i18n.getMessage(request,"humidityMin"));
return gson.toJson(fb);
}
if (updateAlarmVo.getHumidityMax()>100F){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"humidityMaxLimit"));
return gson.toJson(fb);
}
if (updateAlarmVo.getHumidityMin()<0F){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"humidityMinLimit"));
return gson.toJson(fb);
}
if(updateAlarmVo.getHumidityMin()>updateAlarmVo.getHumidityMax()){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"wrongHumidity"));
return gson.toJson(fb);
}
if (updateAlarmVo.getTilt()<0 || updateAlarmVo.getTilt()>180 || updateAlarmVo.getTilt()%30 !=0){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"tiltLimit"));
return gson.toJson(fb);
}
if (updateAlarmVo.getTilt()==null){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"tilt"));
......@@ -245,6 +300,11 @@ public class AlarmController {
fb.setMessage(i18n.getMessage(request,"shock"));
return gson.toJson(fb);
}
if (Float.valueOf(updateAlarmVo.getShock())<1.5 || Float.valueOf(updateAlarmVo.getShock())>13.8){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"shockLimit"));
return gson.toJson(fb);
}
if (alarmService.getByType(updateAlarmVo.getAlarmType(),user.getCompanyNo())!=null&&!updateAlarmVo.getAlarmType().equals(updateAlarmVo.getAlarmType())){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"modifiedAlarmExist"));
......
......@@ -4,10 +4,12 @@ import com.aliyun.oss.OSSClient;
import com.example.tdl.common.WarehouseExcel;
import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.*;
import com.example.tdl.entity.Config;
import com.example.tdl.service.*;
import com.example.tdl.service.redis.InfoRedisService;
import com.example.tdl.service.redis.TokenRedisService;
import com.example.tdl.util.AliyunOSSClientUtil;
import com.example.tdl.util.DataUtil;
import com.example.tdl.util.ZipCompressUtil;
import com.google.gson.Gson;
import io.swagger.annotations.ApiImplicitParam;
......@@ -64,6 +66,7 @@ public class DownloadController {
@ApiOperation(value = "仓库数据下载",notes = "仓库数据下载")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = true, dataType = "String"),
})
@RequestMapping(value = "/download",method = RequestMethod.POST)
public String downLoad(HttpServletResponse response,HttpServletRequest request,@RequestBody DownloadForWarehouseVo downloadForWarehouseVo) throws ParseException {
......@@ -101,7 +104,7 @@ public class DownloadController {
fb.setMessage(i18n.getMessage(request,"noData"));
return gson.toJson(fb);
}
File zipFile = new File("./export/" +downloadForWarehouseVo.getWarehouseNo()+"仓库温湿度观测记录.zip");
File zipFile = new File("./export/" +downloadForWarehouseVo.getWarehouseNo()+i18n.getMessage(request, "warehousedata")+".zip");
File[] srcFiles = new File[resultWarehouseNoAndTDLSNAndTimeVos.size()];
for (int a=0;a<resultWarehouseNoAndTDLSNAndTimeVos.size();a++) {
ResultWarehouseNoAndTDLSNAndTimeVo resultWarehouseNoAndTDLSNAndTimeVo=resultWarehouseNoAndTDLSNAndTimeVos.get(a);
......@@ -118,22 +121,22 @@ public class DownloadController {
if(queryResults.getResults().get(0).getSeries()==null){
continue;
}
String fileName =downloadForWarehouseVo.getWarehouseNo() + "仓库温湿度观测记录表-"+resultWarehouseNoAndTDLSNAndTimeVo.getTDLSN();
String fileName =downloadForWarehouseVo.getWarehouseNo() + i18n.getMessage(request, "warehousedata")+"-"+resultWarehouseNoAndTDLSNAndTimeVo.getTDLSN();
srcFiles[a] = new File("./export/"+fileName+".xls") ;
List<DownloadWarehouseVo> downloadWarehouseVos = getWarehouseData(queryResults);
List<DownloadWarehouseVo> downloadWarehouseVos = getWarehouseData(queryResults,downloadForWarehouseVo.getOffset());
for (int i = 0; i < downloadWarehouseVos.size(); i++) {
if (downloadWarehouseVos.get(i).getTemperature() > resultWarehouseNoAndTDLSNAndTimeVos.get(a).getTemMax() ||
downloadWarehouseVos.get(i).getTemperature() < resultWarehouseNoAndTDLSNAndTimeVos.get(a).getTemMin() ||
downloadWarehouseVos.get(i).getHumidity() > resultWarehouseNoAndTDLSNAndTimeVos.get(a).getHumidityMax() ||
downloadWarehouseVos.get(i).getHumidity() < resultWarehouseNoAndTDLSNAndTimeVos.get(a).getHumidityMin()) {
downloadWarehouseVos.get(i).setAlarm("报警");
downloadWarehouseVos.get(i).setAlarm(i18n.getMessage(request,"Alarm"));
} else {
downloadWarehouseVos.get(i).setAlarm("正常");
downloadWarehouseVos.get(i).setAlarm(i18n.getMessage(request,"Nomal"));
}
}
resultWarehouseNoAndTDLSNAndTimeVo.setDownloadWarehouseVos(downloadWarehouseVos);
try {
WarehouseExcel warehouseExcel = new WarehouseExcel(fileName,user.getUserName(),resultWarehouseNoAndTDLSNAndTimeVo);
WarehouseExcel warehouseExcel = new WarehouseExcel(fileName,user.getUserName(),resultWarehouseNoAndTDLSNAndTimeVo,request,i18n);
HSSFWorkbook wb = warehouseExcel.downloadExcel();
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
......@@ -162,7 +165,11 @@ public class DownloadController {
String md5Key = AliyunOSSClientUtil.uploadObject2OSS(ossClient, zipFile);
if (md5Key != null) {
for(int a =0;a<srcFiles.length;a++){
srcFiles[a].delete();
if(srcFiles[a] == null){
continue;
} else{
srcFiles[a].delete();
}
}
zipFile.delete();
fb.setCode(1);
......@@ -205,12 +212,12 @@ public class DownloadController {
return dirFile.delete();
}
public List<DownloadWarehouseVo> getWarehouseData(QueryResult queryResult){
List<List<Object>> values = getValues(queryResult);
public List<DownloadWarehouseVo> getWarehouseData(QueryResult queryResult,String offset){
List<List<Object>> values = DataUtil.getValues(queryResult);
List<DownloadWarehouseVo> downloadWarehouseVos = new ArrayList<>();
for(List<Object> value:values){
DownloadWarehouseVo downloadWarehouseVo = new DownloadWarehouseVo();
downloadWarehouseVo.setTime(parseTime(value.get(0).toString()));
downloadWarehouseVo.setTime(DataUtil.UTCToCST(String.valueOf(value.get(0)),offset));
downloadWarehouseVo.setPressure(Float.parseFloat(value.get(1).toString()));
downloadWarehouseVo.setTemperature(Float.parseFloat(value.get(2).toString()));
downloadWarehouseVo.setHumidity(Float.parseFloat(value.get(3).toString()));
......@@ -219,43 +226,4 @@ public class DownloadController {
return downloadWarehouseVos;
}
//解析数据格式
public List<List<Object>> getValues(QueryResult queryResult){
List<List<Object>> values = new ArrayList<>();
for(QueryResult.Result result : queryResult.getResults()){
if(result.getSeries() !=null){
for (QueryResult.Series series : result.getSeries()) {
if(series !=null){
values= series.getValues();
}
}
}
}
return values;
}
public String parseTime(String time){
String dateResult =null;
try {
dateResult = dateToStamp(time);
} catch (ParseException e) {
e.printStackTrace();
logger.info(e.toString());
fb.setCode(0);
fb.setMessage("解析时间异常");
}
return dateResult;
}
//将utc时间转换成时间戳
public String dateToStamp(String s) throws ParseException {
Date date =null ;
if(s.length() !=20 ) {
date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse(s);
}else{
date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(s);
}
return String.valueOf(date.getTime());
}
}
......@@ -295,4 +295,27 @@ wrongThemeColors=The format of the theme color is incorrect
comPictureDimension=Width*Height150*200
warePictureDimension=Width*Height150*120
truckPictureDimension=Width*Height90*60
data=Transport data
warehousedata=Warehouse temperature and humidity historic data
temMaxLimit=The upper temperature limit is 85\u2103
temMinLimit=The lower temperature limit is -25\u2103
humidityMaxLimit=The upper humidity limit is 100%
humidityMinLimit=The lower humidity limit is 0%
tiltLimit=The tilt therehold must be from 0\u00B0 to 180\u00B0 and must be a multiple of 30\u00B0
shockLimit=The shock therehold range is from 1.5g to 13.8g
downLoad=
suitable=The suitable temperature range for the warehouse is {0}\u2103-{1}\u2103, and the humidity is {2}%-{3}%, otherwise need to regulate.
Alarm=Alarm
Nomal=Nomal
year=Year
recorder=Recorder
SamplingTime=Sampling time
Month=Month
Day=Day
Time=Time
Weather=Weather
Humidity=Humidity(%rH)
Temperature=Temperature(\u2103)
EnableAllert=Enable allert
NoData=No data for this time period
......@@ -190,3 +190,11 @@ min=\u5206
sec=\u4E8C\u756A\u76EE
repeateAlias=\u4F1A\u793E\u306E\u7565\u8A9E\u306F\u7E70\u308A\u8FD4\u305B\u307E\u305B\u3093
alias=\u4F1A\u793E\u306E\u7565\u8A9E\u306F\u7A7A\u3067\u306F\u3042\u308A\u307E\u305B\u3093
data=\u8F38\u9001\u30C7\u30FC\u30BF
warehousedata=\u5009\u5EAB\u306E\u6E29\u5EA6\u304A\u3088\u3073\u6E7F\u5EA6\u306E\u89B3\u6E2C\u8A18\u9332
shockLimit=\u632F\u52D5\u306F1.5g\u304B\u308913.8g\u306E\u9593\u3067\u306A\u3051\u308C\u3070\u306A\u308A\u307E\u305B\u3093
tiltLimit=\u52FE\u914D\u306F0\u00B0\u304B\u3089180\u00B0\u306E\u9593\u3067\u306A\u3051\u308C\u3070\u306A\u3089\u305A\u300130\u306E\u500D\u6570\u3067\u306A\u3051\u308C\u3070\u306A\u308A\u307E\u305B\u3093
humidityMinLimit=\u6E7F\u5EA6\u306E\u4E0B\u9650\u306F0\uFF05\u3092\u4E0B\u56DE\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002
humidityMaxLimit=\u6E7F\u5EA6\u306E\u4E0A\u9650\u306F100\uFF05\u3092\u8D85\u3048\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002
temMinLimit=\u4E0B\u9650\u6E29\u5EA6\u306F-25\u2103\u4EE5\u4E0B\u306B\u3067\u304D\u307E\u305B\u3093
temMaxLimit=\u4E0A\u9650\u6E29\u5EA6\u306F85\u2103\u3092\u8D85\u3048\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093
......@@ -3,13 +3,19 @@ alarmType = \u9884\u8B66\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A
alarmScene = \u9884\u8B66\u573A\u666F\u4E0D\u80FD\u4E3A\u7A7A
wrongAlarmScene = \u8BF7\u9009\u62E9\u6B63\u786E\u7684\u9884\u8B66\u573A\u666F
temMax = \u6E29\u5EA6\u4E0A\u9650\u4E0D\u80FD\u4E3A\u7A7A
temMaxLimit = \u6E29\u5EA6\u4E0A\u9650\u4E0D\u80FD\u8D85\u8FC785\u2103
temMin = \u6E29\u5EA6\u4E0B\u9650\u4E0D\u80FD\u4E3A\u7A7A
temMinLimit = \u6E29\u5EA6\u4E0B\u9650\u4E0D\u80FD\u4F4E\u4E8E-25\u2103
wrongTemp=\u6E29\u5EA6\u4E0A\u9650\u4E0D\u80FD\u5C0F\u4E8E\u6E29\u5EA6\u4E0B\u9650
humidityMax = \u6E7F\u5EA6\u4E0A\u9650\u4E0D\u80FD\u4E3A\u7A7A
humidityMin = \u6E7F\u5EA6\u4E0B\u9650\u4E0D\u80FD\u4E3A\u7A7A
humidityMaxLimit = \u6E7F\u5EA6\u4E0A\u9650\u4E0D\u80FD\u8D85\u8FC7100%
humidityMinLimit = \u6E7F\u5EA6\u4E0B\u9650\u4E0D\u80FD\u4F4E\u4E8E0%
wrongHumidity=\u6E7F\u5EA6\u4E0A\u9650\u4E0D\u80FD\u5C0F\u4E8E\u6E7F\u5EA6\u4E0B\u9650
tilt = \u503E\u659C\u5EA6\u4E0D\u80FD\u4E3A\u7A7A
tiltLimit = \u503E\u659C\u5EA6\u5FC5\u987B\u57280\u00B0-180\u00B0\u4E4B\u95F4\uFF0C\u4E14\u5FC5\u987B\u662F30\u7684\u500D\u6570
shock = \u9707\u5EA6\u4E0D\u80FD\u4E3A\u7A7A
shockLimit=\u9707\u52A8\u5FC5\u987B\u57281.5g-13.8g\u4E4B\u95F4
alarmExist = \u6DFB\u52A0\u7684\u9884\u8B66\u7C7B\u578B\u5728\u8BE5\u573A\u666F\u4E2D\u5DF2\u5B58\u5728
addSuccess = \u6DFB\u52A0\u9884\u8B66\u4FE1\u606F\u6210\u529F
addFailure = \u6DFB\u52A0\u9884\u8B66\u4FE1\u606F\u5931\u8D25
......@@ -297,6 +303,25 @@ hour =\u5C0F\u65F6
min =\u5206\u949F
sec = \u79D2
data = \u8FD0\u8F93\u6570\u636E
timeparse = \u65F6\u95F4\u89E3\u6790\u5F02\u5E38
warehousedata = \u4ED3\u5E93\u6E29\u6E7F\u5EA6\u89C2\u6D4B\u8BB0\u5F55
Alarm = \u62A5\u8B66
Nomal = \u6B63\u5E38
year = \u5E74\u5EA6
recorder = \u8BB0\u5F55\u4EBA
SamplingTime = \u91C7\u6837\u65F6\u95F4
Month= \u6708
Day = \u65E5
Time = \u65F6\u5206
Weather = \u5929\u6C14
Humidity=\u6E7F\u5EA6(%rH)
Temperature=\u6E29\u5EA6(\u2103)
EnableAllert = \u662F\u5426\u9884\u8B66
suitable = \u5E93\u623F\u9002\u5B9C\u6E29\u5EA6\u4E3A{0}\u2103-{1}\u2103\uFF0C\u6E7F\u5EA6\u4FDD\u6301{2}%-{3}%,\u8D85\u6807\u8981\u505A\u5FC5\u8981\u8C03\u8282\u3002
NoData = \u8BE5\u65F6\u95F4\u6BB5\u6CA1\u6709\u6570\u636E
DataOverview=\u6570\u636E\u6982\u89C8
TransportationState=\u8FD0\u8F93\u72B6\u6001
SystemSetup=\u7CFB\u7EDF\u8BBE\u7F6E
......
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