|
|
|
@ -1,6 +1,9 @@
|
|
|
|
|
package com.aucma.report.service.impl;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.lang.reflect.Array;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import com.aucma.report.mapper.BoxTemperatureHistoryMapper;
|
|
|
|
@ -90,4 +93,64 @@ public class BoxTemperatureHistoryServiceImpl implements IBoxTemperatureHistoryS
|
|
|
|
|
{
|
|
|
|
|
return boxTemperatureHistoryMapper.deleteBoxTemperatureHistoryByObjId(objId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String[]> getTestTemp(BoxTemperatureHistory boxTemperatureHistory) {
|
|
|
|
|
// BoxTemperatureHistory boxTemperatureHistory = new BoxTemperatureHistory();
|
|
|
|
|
// cpno = "B24051383025017990384";
|
|
|
|
|
// boxTemperatureHistory.setCpno(cpno);
|
|
|
|
|
// boxTemperatureHistory.setCpno("B24051383025017990384");
|
|
|
|
|
List<BoxTemperatureHistory> boxTemperatureHistories = boxTemperatureHistoryMapper.selectBoxTemperatureHistoryList(boxTemperatureHistory);
|
|
|
|
|
BoxTemperatureHistory boxTemp = boxTemperatureHistories.get(0);
|
|
|
|
|
|
|
|
|
|
//获取数据
|
|
|
|
|
String tempMes = boxTemp.getTempMes();
|
|
|
|
|
String powerMes = boxTemp.getPowerMes();
|
|
|
|
|
Date begindatetime = boxTemp.getBegindatetime();
|
|
|
|
|
|
|
|
|
|
List<String[]> stringList = getStringList(tempMes, begindatetime);
|
|
|
|
|
List<String[]> stringList1 = getStringList(powerMes, begindatetime);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return stringList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<String[]> getStringList(String MesStream,Date beginTime){
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
//通过分号 转成多个数组
|
|
|
|
|
String xaxis[] = MesStream.split(";");
|
|
|
|
|
String yaxis[] = xaxis[0].split(",");
|
|
|
|
|
//将数组转为二维数组,方便存入集合
|
|
|
|
|
String[][] twoArray = getTwoArray(xaxis);
|
|
|
|
|
List<String[]> tempList = new ArrayList<String[]>();
|
|
|
|
|
//根据二维数组每一贴获取所需的数组
|
|
|
|
|
for (int i=0;i<yaxis.length;i++){
|
|
|
|
|
String strings[] = new String[twoArray.length];
|
|
|
|
|
for (int j=0;j<twoArray.length;j++){
|
|
|
|
|
//转换时间
|
|
|
|
|
if (i==0){
|
|
|
|
|
long l = beginTime.getTime() + (j * 30 * 1000);
|
|
|
|
|
//获取后八位 不要年月
|
|
|
|
|
strings[j] = "\""+sdf.format(l).substring(sdf.format(l).length()-8,sdf.format(l).length())+"\"";
|
|
|
|
|
}else{
|
|
|
|
|
strings[j] = twoArray[j][i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tempList.add(strings);
|
|
|
|
|
}
|
|
|
|
|
for (int i=0;i< yaxis.length;i++){
|
|
|
|
|
System.out.println(Arrays.toString(tempList.get(i)));
|
|
|
|
|
}
|
|
|
|
|
return tempList;
|
|
|
|
|
}
|
|
|
|
|
//根据分号转为二维数组
|
|
|
|
|
public String[][] getTwoArray(String[] strings){
|
|
|
|
|
String[][] arrTwo = new String[strings.length][12];
|
|
|
|
|
for (int i=0;i<strings.length;i++){
|
|
|
|
|
arrTwo[i] = strings[i].split(",");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return arrTwo;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|