|
@@ -5,6 +5,7 @@ import net.sf.json.JSONArray;
|
|
|
import net.sf.json.JSONObject;
|
|
|
import org.apache.commons.codec.binary.Base64;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
+import org.hibernate.dialect.Sybase11Dialect;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
import org.jeecg.common.util.RedisUtil;
|
|
|
import org.jeecg.modules.common.GuanCommonConstant;
|
|
@@ -785,7 +786,13 @@ public class WebAccessService {
|
|
|
curve.setSubList(subList);
|
|
|
}
|
|
|
else {
|
|
|
- curve.setSubList(null);
|
|
|
+ // 赋一个空值
|
|
|
+ CurveSubDTO subdto = new CurveSubDTO();
|
|
|
+ subdto.setLogtime(new Date());
|
|
|
+ subdto.setTagvalue(param.getTagName());
|
|
|
+ List<CurveSubDTO> subList = new ArrayList<>();
|
|
|
+ subList.add((subdto));
|
|
|
+ curve.setSubList(subList);
|
|
|
}
|
|
|
curveList.add(curve);
|
|
|
}
|
|
@@ -890,7 +897,13 @@ public class WebAccessService {
|
|
|
curve.setSubList(subList);
|
|
|
}
|
|
|
else {
|
|
|
- curve.setSubList(null);
|
|
|
+ // 赋一个空值
|
|
|
+ CurveSubDTO subdto = new CurveSubDTO();
|
|
|
+ subdto.setLogtime(new Date());
|
|
|
+ subdto.setTagvalue(param.getTagName());
|
|
|
+ List<CurveSubDTO> subList = new ArrayList<>();
|
|
|
+ subList.add((subdto));
|
|
|
+ curve.setSubList(subList);
|
|
|
}
|
|
|
curveList.add(curve);
|
|
|
}
|
|
@@ -901,6 +914,106 @@ public class WebAccessService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 获取全程曲线(查询)
|
|
|
+ * @param startTime 开始时间
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<CurveDTO> searchWholeCurve(Date startTime, Date endTime) {
|
|
|
+ // 获取大屏参数设置
|
|
|
+ GuanDashboardParam paramat = new GuanDashboardParam();
|
|
|
+ paramat.setStatus("1"); // 状态为启用
|
|
|
+ paramat.setIflog("Y"); // 需要获取历史记录
|
|
|
+ List<GuanDashboardParam> dashboardParamList = dashboardParamMapper.selectAllDashboardParam(paramat);
|
|
|
+ if (dashboardParamList == null || dashboardParamList.size() < 1) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 组合参数信息
|
|
|
+ List<CurveDTO> curveList = new ArrayList<CurveDTO>();
|
|
|
+ Integer qcIntervals = null; // 全程曲线的 每笔数据之间隔时间
|
|
|
+ Integer qcRecord = null; // 全程曲线的 获取记录条数
|
|
|
+ if (endTime == null || "".equals(endTime)) {
|
|
|
+ endTime = new Date();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 开始时间
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(endTime); // 设置当前的时间戳
|
|
|
+ // calendar.add(Calendar.SECOND, -syyxsj);
|
|
|
+ // Date startTime = calendar.getTime(); // 试验开始时间(也是 全程曲线开始时间)
|
|
|
+ GuanTest guanTest = guanTestMapper.selectTop1Test();
|
|
|
+ startTime = startTime == null ? guanTest.getStarttime() : startTime; // 试验开始时间(也是 全程曲线开始时间)
|
|
|
+ Integer syyxsj = Integer.parseInt(((endTime.getTime() - startTime.getTime()) / 1000) + "");
|
|
|
+
|
|
|
+ for (GuanDashboardParam param : dashboardParamList) {
|
|
|
+ // 没有点位名
|
|
|
+ if (param.getTagName() == null || "".equals(param.getTagName())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!param.getParamName().equals("辐射强度值-全程") && !param.getParamName().equals("湿度实值-全程") &&
|
|
|
+ !param.getParamName().equals("温度实值-全程")) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ JSONObject jo = null;
|
|
|
+ CurveDTO curve = new CurveDTO();
|
|
|
+ curve.setTagname(param.getTagName());
|
|
|
+
|
|
|
+ // 2 获取 全程曲线 参数
|
|
|
+ curve.setType("全程");
|
|
|
+ // 2.1 每笔数据之间隔时间
|
|
|
+ qcIntervals = 1;
|
|
|
+
|
|
|
+ // 2.2 获取记录条数
|
|
|
+ if (qcRecord == null) {
|
|
|
+ qcRecord = Integer.parseInt((ChronoUnit.MINUTES.between(
|
|
|
+ LocalDateTime.parse(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(startTime).replace(" ", "T")),
|
|
|
+ LocalDateTime.parse(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(endTime).replace(" ", "T"))
|
|
|
+ ) / qcIntervals) + "");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2.3 组合参数
|
|
|
+ jo = generateDataLogObject(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(startTime),
|
|
|
+ param.getIntervaltype() == null || "".equals(param.getIntervaltype()) ? "M" : param.getIntervaltype(),
|
|
|
+ qcIntervals,
|
|
|
+ qcRecord,
|
|
|
+ param.getDatatype() == null || "".equals(param.getDatatype()) ? "0" : param.getDatatype(),
|
|
|
+ param.getTagName());
|
|
|
+
|
|
|
+ // 获取信息
|
|
|
+ JSONObject dataLog = GetDataLog(jo);
|
|
|
+ curve.setName(param.getParamName());
|
|
|
+ curve.setTagname(param.getTagName());
|
|
|
+ log.info(dataLog.getJSONArray("DataLog").toString());
|
|
|
+ if (dataLog.getJSONArray("DataLog").size() > 0) {
|
|
|
+ List<String> values = dataLog.getJSONArray("DataLog").getJSONObject(0).getJSONArray("Values");
|
|
|
+ List<CurveSubDTO> subList = new ArrayList<>();
|
|
|
+ if (values != null && values.size() > 0) {
|
|
|
+ for (String value : values) {
|
|
|
+ CurveSubDTO sub = new CurveSubDTO();
|
|
|
+ sub.setTagvalue(value);
|
|
|
+ subList.add(sub);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ curve.setSubList(subList);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ // 赋一个空值
|
|
|
+ CurveSubDTO subdto = new CurveSubDTO();
|
|
|
+ subdto.setLogtime(new Date());
|
|
|
+ subdto.setTagvalue(param.getTagName());
|
|
|
+ List<CurveSubDTO> subList = new ArrayList<>();
|
|
|
+ subList.add((subdto));
|
|
|
+ curve.setSubList(subList);
|
|
|
+ }
|
|
|
+ curveList.add(curve);
|
|
|
+ }
|
|
|
+ // 设置全程曲线时间分布
|
|
|
+ genTime(startTime, endTime, qcIntervals, "MM-dd HH:mm:ss", curveList, "全程");
|
|
|
+
|
|
|
+ return curveList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 生成曲线的时间
|
|
|
*
|
|
|
* @param startTime 开始时间
|