Merge remote-tracking branch 'origin/master'

master
wj 2 years ago
commit e1bb47c5f7
  1. 1
      .gitignore
  2. 6
      psdc-business/src/main/java/com/psdc/entity/PsdcDevice.java
  3. 2
      psdc-business/src/main/java/com/psdc/entity/res/PsdcThermometerDataRes.java
  4. 4
      psdc-business/src/main/java/com/psdc/mapper/PsdcThermometerHtdataMapper.java
  5. 67
      psdc-business/src/main/java/com/psdc/service/impl/PsdcThermometerHtdataServiceImpl.java
  6. 20
      psdc-business/src/main/resources/mapper/business/PsdcThermometerHtdataMapper.xml
  7. 3
      psdc-business/src/main/resources/mapper/business/PsdcThermometerRtdataMapper.xml
  8. 8
      psdc-ui/src/views/analyse/nhtj/index.vue
  9. 11
      psdc-ui/src/views/system/device/index.vue
  10. 2084
      psdc-ui/yarn.lock

1
.gitignore vendored

@ -4,3 +4,4 @@ target
node_modules
psdc-ui/yarn.lock
dist
/psdc-ui/yarn.lock

@ -1,6 +1,7 @@
package com.psdc.entity;
import com.psdc.annotation.Excel;
import com.psdc.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ -17,10 +18,11 @@ import java.util.Map;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PsdcDevice {
public class PsdcDevice extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 设备id */
@Excel(name = "设备Id", cellType = Excel.ColumnType.NUMERIC)
@Excel(name = "设备Id", cellType = Excel.ColumnType.NUMERIC, prompt = "设备编号")
private Integer deviceId ;
/** 父设备Id */
private Integer parentId;

@ -32,6 +32,8 @@ public class PsdcThermometerDataRes {
private Double thermometerValueOut ;
/** 数据更新时间 */
private String upDateTime ;
/** 设备安装位置 */
private String installAddress;
/** 当天历史温度集合 */
private List<Double> tempTodayList ;

@ -38,6 +38,10 @@ public interface PsdcThermometerHtdataMapper{
@Param(value = "beginTime") String begin_time,
@Param(value = "endTime") String end_time);
List<PsdcThermometerHtdata> selTodayThermometer2(@Param(value = "installAddress") String installAddress,
@Param(value = "beginTime") String begin_time,
@Param(value = "endTime") String end_time);
/**
* 统计总行数

@ -122,36 +122,61 @@ public class PsdcThermometerHtdataServiceImpl implements IPsdcThermometerHtdataS
String te = sdf.format(date) + " 23:59:59"; // 今天结束检索时间
List<Map> ary = new ArrayList<>();
List<PsdcThermometerDataRes> dataResList = psdcThermometerRtdataMapper.selWenDu(SecurityUtils.getUserId(), modelId, sdf3.format(date));
for (PsdcThermometerDataRes dec : dataResList ){
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(); // 时间轴
// 循环遍历今天历史数据对象集合
for (PsdcThermometerHtdata h : htdata) {
if (null != h.getThermometerValue()) {
listTemp.add(h.getThermometerValue());
Double houseInTemp = 0.0; // 实验室内平均温度
int countIn = 0;
Double houseOutTemp = 0.0; // 实验室外平均温度
int countOut = 0;
if (dataResList.size() > 0 && null != dataResList) {
for (PsdcThermometerDataRes dsc : dataResList) {
if (dsc.getInstallAddress().contains("室内")) {
houseInTemp = houseInTemp + dsc.getThermometerValue();
countIn = countIn + 1;
}
if (dsc.getInstallAddress().contains("室外")) {
houseOutTemp = houseOutTemp + dsc.getThermometerValue();
countOut = countOut + 1;
}
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);
}
List<Double> listTempIn = new ArrayList(); // 今天室内历史温度集合
List<Double> listTempOut = new ArrayList(); // 今天室外历史温度集合
List<String> timesIn = new ArrayList(); // 今天室内历史温度时间轴
List<String> timesOut = new ArrayList(); // 今天室外历史温度时间轴
List<PsdcThermometerHtdata> tempInList = psdcThermometerHtdataMapper.selTodayThermometer2("室内", tb, te);
houseInTemp = getaDouble(houseInTemp, countIn, listTempIn, timesIn, tempInList);
List<PsdcThermometerHtdata> tempOutList = psdcThermometerHtdataMapper.selTodayThermometer2("室外", tb, te);
houseOutTemp = getaDouble(houseOutTemp, countOut, listTempOut, timesOut, tempOutList);
Map<String, Object> mapIn = new HashMap();
mapIn.put("houseInTemp", houseInTemp);
mapIn.put("listTempIn", listTempIn);
mapIn.put("timesIn", timesIn);
ary.add(mapIn);
Map<String, Object> mapOut = new HashMap();
mapOut.put("houseOutTemp", houseOutTemp);
mapOut.put("listTempOut", listTempOut);
mapOut.put("timesOut", timesOut);
ary.add(mapOut);
return ary;
}
private Double getaDouble(Double houseTemp, int count, List<Double> listTemp, List<String> times, List<PsdcThermometerHtdata> tempList) {
if (tempList.size() == 0) {
count = 1;
}
for (PsdcThermometerHtdata scr1 : tempList) {
Double evIn = scr1.getThermometerValue() / count;
listTemp.add(evIn);
times.add(scr1.getUpdateTime());
}
houseTemp = houseTemp / count;
return houseTemp;
}
/**
* 查询电磁锅炉进水出水温度
*

@ -35,6 +35,26 @@
</select>
<select id="selTodayThermometer2" resultMap="PsdcThermometerHtdataMap">
Select thermometer_htdata_id, SUM(thermometer_value) As thermometer_value, pth.update_time
From psdc_thermometer_htdata pth
LEFT JOIN psdc_device pd On pd.device_id = pth.device_id
<where>
<if test="installAddress != null and installAddress != ''">
pd.device_address LIKE concat('%', #{installAddress}, '%')
</if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
And date_format(pth.update_time,'%Y-%m-%d %H:%i:%S') &gt;= date_format(#{beginTime},'%Y-%m-%d %H:%i:%S')
</if>
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
And date_format(pth.update_time,'%Y-%m-%d %H:%i:%S') &lt;= date_format(#{endTime},'%Y-%m-%d %H:%i:%S')
</if>
</where>
GROUP BY PTH.update_time
ORDER BY pth.update_time
</select>
<!--分页查询指定行数据-->
<select id="queryAllByLimit" resultMap="PsdcThermometerHtdataMap">
Select

@ -15,6 +15,7 @@
<result property="deviceName" column="device_name" />
<result property="deviceRunStatus" column="device_runstatus" />
<result property="upDateTime" column="upDateTime" />
<result property="installAddress" column="device_address" />
<result property="thermometerValue" column="thermometer_value" />
<result property="thermometerValueIn" column="thermometer_value_in" />
<result property="thermometerValueOut" column="thermometer_value_out" />
@ -36,7 +37,7 @@
</select>
<select id="selWenDu" resultMap="PsdcThermometerRtdataMap2">
Select pd.device_id, pd.device_name, ptr.thermometer_value, DATE_FORMAT(ptr.update_time,'%Y-%m-%d %H') As upDateTime
Select pd.device_id, pd.device_name, IFNULL(ptr.thermometer_value, 0.0) As thermometer_value, pd.device_address, 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}

@ -209,7 +209,15 @@ function getTableFun(){
"pageNum": currentPage.value,
"pageSize": pageSize.value
}).then((res)=>{
total.value = res.total;
for(let i in res.rows){
if(res.rows[i].monthDate){
res.rows[i].monthDate=res.rows[i].monthDate.slice(0,7)
}else if(res.rows[i].yearDate){
res.rows[i].yearDate=res.rows[i].yearDate.slice(0,4)
}
}
dataTable.value = res.rows
console.log('发电量数据',dataTable.value)
})

@ -300,8 +300,7 @@ const data = reactive({
timingList:[],
queryParams: '',
queryParams1: {
"deviceId": 0,
"deviceModel": "温度传感器"
"deviceModel": null
},
sceneCode:null,
dateRange:[],
@ -503,11 +502,9 @@ function cancel2() {
/** 导出按钮操作 */
function handleExport() {
proxy.download("system/device/index/daochuDevs", {
...JSON.stringify({
"deviceId": 0,
"deviceModel": null
}),
data.queryParams1.deviceModel = data.sceneCode
proxy.download("system/device/index/daochuDevs",{
...queryParams1.value
},`device_${new Date().getTime()}.xlsx`);
};
/** 新增策略处理 */

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save