Merge remote-tracking branch 'origin/master'

master
wj 2 years ago
commit 180e79a188
  1. 2
      psdc-business/src/main/java/com/psdc/entity/res/PsdcThermometerDataRes.java
  2. 44
      psdc-business/src/main/java/com/psdc/service/impl/PsdcThermometerHtdataServiceImpl.java
  3. 11
      psdc-business/src/main/resources/mapper/business/PsdcThermometerRtdataMapper.xml

@ -30,6 +30,8 @@ public class PsdcThermometerDataRes {
private Double thermometerValueIn ;
/** 目前实时出水温度 */
private Double thermometerValueOut ;
/** 数据更新时间 */
private String upDateTime ;
/** 当天历史温度集合 */
private List<Double> tempTodayList ;

@ -40,6 +40,8 @@ public class PsdcThermometerHtdataServiceImpl implements IPsdcThermometerHtdataS
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd HH");
@Override
public AjaxResult selTodayThermometer() {
@ -119,33 +121,31 @@ public class PsdcThermometerHtdataServiceImpl implements IPsdcThermometerHtdataS
String tb = sdf.format(date) + " 00:00:00"; // 今天开始检索时间
String te = sdf.format(date) + " 23:59:59"; // 今天结束检索时间
List<Map> ary = new ArrayList<>();
List<PsdcThermometerDataRes> dataResList = psdcThermometerRtdataMapper.selWenDu(SecurityUtils.getUserId(), modelId, sdf.format(new Date()));
List<PsdcThermometerDataRes> dataResList = psdcThermometerRtdataMapper.selWenDu(SecurityUtils.getUserId(), modelId, sdf3.format(date));
for (PsdcThermometerDataRes dec : dataResList ){
PsdcThermometerDataRes dataRes = psdcThermometerRtdataMapper.queryById(dec.getDeviceId(), sdf.format(date));
if (null != dataRes){
List<PsdcThermometerHtdata> htdata = psdcThermometerHtdataMapper.selTodayThermometer(dec.getDeviceId(), tb, te);
Map<String, Object> map3 = new HashMap();
List<PsdcThermometerHtdata> htdata = psdcThermometerHtdataMapper.selTodayThermometer(dec.getDeviceId(), tb, te);
List<Double> listTemp = new ArrayList(); // 今天历史温度集合
List<String> times = new ArrayList(); // 时间轴
List<Double> listTemp = new ArrayList(); // 今天历史温度集合
List<String> times = new ArrayList(); // 时间轴
// 循环遍历今天历史数据对象集合
for (PsdcThermometerHtdata h : htdata) {
if (null != h.getThermometerValue()) {
listTemp.add(h.getThermometerValue());
}
String t = h.getUpdateTime().split(" ")[1].substring(0, 5);
times.add(t);
// 循环遍历今天历史数据对象集合
for (PsdcThermometerHtdata h : htdata) {
if (null != h.getThermometerValue()) {
listTemp.add(h.getThermometerValue());
}
Map<String, Object> map3 = new HashMap();
map3.put("deviceId", dataRes.getDeviceId());
map3.put("deviceName", dataRes.getDeviceName());
map3.put("deviceTemp", dec.getThermometerValue());
map3.put("temps", listTemp);
map3.put("times", times);
ary.add(map3);
String t = h.getUpdateTime().split(" ")[1].substring(0, 5);
times.add(t);
}
map3.put("deviceId", dec.getDeviceId());
map3.put("deviceName", dec.getDeviceName());
map3.put("deviceTemp", dec.getThermometerValue());
map3.put("temps", listTemp);
map3.put("times", times);
ary.add(map3);
}

@ -14,6 +14,7 @@
<result property="deviceId" column="device_id" />
<result property="deviceName" column="device_name" />
<result property="deviceRunStatus" column="device_runstatus" />
<result property="upDateTime" column="upDateTime" />
<result property="thermometerValue" column="thermometer_value" />
<result property="thermometerValueIn" column="thermometer_value_in" />
<result property="thermometerValueOut" column="thermometer_value_out" />
@ -35,13 +36,11 @@
</select>
<select id="selWenDu" resultMap="PsdcThermometerRtdataMap2">
Select pd.device_id, pd.device_name, ptr.thermometer_value
From psdc_thermometer_rtdata ptr
Left Join psdc_device pd On pd.device_id = ptr.device_id
Select pd.device_id, pd.device_name, ptr.thermometer_value, DATE_FORMAT(ptr.update_time,'%Y-%m-%d %H') As upDateTime
From psdc_device pd
LEFT join psdc_thermometer_rtdata ptr on pd.device_id = ptr.device_id
And DATE_FORMAT(ptr.update_time,'%Y-%m-%d %H') = #{today}
Where pd.user_id = ${userId} And pd.parent_id = ${parentId}
<if test="today != null and today != ''">
And DATE_FORMAT(ptr.update_time,'%Y-%m-%d') = #{today}
</if>
</select>
<!--分页查询指定行数据-->

Loading…
Cancel
Save