change -物联网实时数据添加计量设备名称列,修改实体类和mapper

boardTest
启龙 曹 10 months ago
parent 04a4dbb679
commit 1845c75e10

@ -46,6 +46,17 @@ public class EmsBaseEnergyTypeController extends BaseController
return getDataTable(list);
}
// /**
// * 根据能源类型id查询能源类型名称
// * @param energyTypeId
// * @return
// */
// public AjaxResult queryEnergyNameByEnergyTypeId(int energyTypeId)
// {
// String energyName = emsBaseEnergyTypeService.queryEnergyNameByEnergyTypeId(energyTypeId);
// return success(energyName);
// }
/**
*
*/

@ -58,4 +58,11 @@ public interface EmsBaseEnergyTypeMapper
* @return
*/
public int deleteEmsBaseEnergyTypeByObjIds(Long[] objIds);
/**
* id
* @param energyTypeId
* @return
*/
public String selectEmsBaseEnergyNameByEnergyTypeId(int energyTypeId);
}

@ -58,4 +58,11 @@ public interface EmsBaseMonitorInfoMapper
* @return
*/
public int deleteEmsBaseMonitorInfoByObjIds(Long[] objIds);
/**
*
* @param monitorCode
* @return
*/
public String selectEmsBaseMonitorTypeByMonitorCode(String monitorCode);
}

@ -58,4 +58,11 @@ public interface IEmsBaseEnergyTypeService
* @return
*/
public int deleteEmsBaseEnergyTypeByObjId(Long objId);
/**
* id
* @param energyTypeId
* @return
*/
String queryEnergyNameByEnergyTypeId(int energyTypeId);
}

@ -22,12 +22,18 @@ public interface IEmsBaseMonitorInfoService
/**
*
*
* @param emsBaseMonitorInfo
* @return
*/
public List<EmsBaseMonitorInfo> selectEmsBaseMonitorInfoList(EmsBaseMonitorInfo emsBaseMonitorInfo);
/**
*
* @param monitorCode
* @return
*/
public String selectEmsBaseMonitorTypeByMonitorCode(String monitorCode);
/**
*
*

@ -93,4 +93,14 @@ public class EmsBaseEnergyTypeServiceImpl implements IEmsBaseEnergyTypeService
{
return emsBaseEnergyTypeMapper.deleteEmsBaseEnergyTypeByObjId(objId);
}
/**
* id
* @param energyTypeId
* @return
*/
@Override
public String queryEnergyNameByEnergyTypeId(int energyTypeId) {
return emsBaseEnergyTypeMapper.selectEmsBaseEnergyNameByEnergyTypeId(energyTypeId);
}
}

@ -50,6 +50,16 @@ public class EmsBaseMonitorInfoServiceImpl implements IEmsBaseMonitorInfoService
return emsBaseMonitorInfoMapper.selectEmsBaseMonitorInfoList(emsBaseMonitorInfo);
}
/**
*
* @param monitorCode
* @return
*/
@Override
public String selectEmsBaseMonitorTypeByMonitorCode(String monitorCode) {
return emsBaseMonitorInfoMapper.selectEmsBaseMonitorTypeByMonitorCode(monitorCode);
}
/**
*
*

@ -2,6 +2,10 @@ package com.os.ems.record.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.os.ems.base.service.IEmsBaseEnergyTypeService;
import com.os.ems.base.service.IEmsBaseMonitorInfoService;
import com.os.ems.record.domain.EmsIOTData;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -33,6 +37,10 @@ public class TWTempertureDataController extends BaseController
{
@Autowired
private ITWTempertureDataService tWTempertureDataService;
@Autowired
private IEmsBaseMonitorInfoService emsBaseMonitorInfoService;
@Autowired
private IEmsBaseEnergyTypeService emsBaseEnergyTypeService;
/**
*
@ -46,6 +54,33 @@ public class TWTempertureDataController extends BaseController
return getDataTable(list);
}
/**
*
* @param tWTempertureData
* @return
*/
@GetMapping("/iotInstantList")
public AjaxResult iotInstantList(TWTempertureData tWTempertureData){
EmsIOTData emsIOTData = new EmsIOTData();
int energyTypeid = Integer.parseInt(emsBaseMonitorInfoService.selectEmsBaseMonitorTypeByMonitorCode(tWTempertureData.getMonitorId()));
String energyName = emsBaseEnergyTypeService.queryEnergyNameByEnergyTypeId(energyTypeid);
if("温湿度".equals(energyName)){
emsIOTData.monitorTypeArr.add("温度");
emsIOTData.monitorTypeArr.add("湿度");
}
else{
emsIOTData.monitorTypeArr.add(energyName);
}
emsIOTData.setType("line");
emsIOTData.setSmooth(true);
emsIOTData.setShowAllSymbol(true);
emsIOTData.setSymbol("circle");
emsIOTData.setSymbolSize(2);
List<TWTempertureData> list = tWTempertureDataService.selectIotInstantList(tWTempertureData);
emsIOTData.setDataList(list);
return success(emsIOTData);
}
/**
*
*/

@ -0,0 +1,102 @@
package com.os.ems.record.domain;
import org.apache.commons.math3.analysis.function.Add;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
public class EmsIOTData {
/**
*
*/
public ArrayList<String> monitorTypeArr;
private String name;
private String type;
private boolean smooth;
private boolean showAllSymbol;
private String symbol;
private int symbolSize;
private String symbolType;
private List<TWTempertureData> dataList;
public EmsIOTData() {
this.monitorTypeArr = new ArrayList<>();
}
public ArrayList<String> getMonitorTypeArr() {
return monitorTypeArr;
}
public void setMonitorTypeArr(ArrayList<String> monitorTypeArr) {
this.monitorTypeArr = monitorTypeArr;
}
public List<TWTempertureData> getDataList() {
return dataList;
}
public void setDataList(List<TWTempertureData> dataList) {
this.dataList = dataList;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public boolean isSmooth() {
return smooth;
}
public void setSmooth(boolean smooth) {
this.smooth = smooth;
}
public boolean isShowAllSymbol() {
return showAllSymbol;
}
public void setShowAllSymbol(boolean showAllSymbol) {
this.showAllSymbol = showAllSymbol;
}
public String getSymbol() {
return symbol;
}
public void setSymbol(String symbol) {
this.symbol = symbol;
}
public int getSymbolSize() {
return symbolSize;
}
public void setSymbolSize(int symbolSize) {
this.symbolSize = symbolSize;
}
public String getSymbolType() {
return symbolType;
}
public void setSymbolType(String symbolType) {
this.symbolType = symbolType;
}
}

@ -25,6 +25,10 @@ public class TWTempertureData extends BaseEntity
@Excel(name = "计量设备编号")
private String monitorId;
/**计量设备名称**/
@Excel(name = "计量设备名称")
private String monitorName;
/** 采集时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "采集时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@ -122,6 +126,14 @@ public class TWTempertureData extends BaseEntity
this.illuminance = illuminance;
}
public String getMonitorName() {
return monitorName;
}
public void setMonitorName(String monitorName) {
this.monitorName = monitorName;
}
public BigDecimal getIlluminance()
{
return illuminance;

@ -58,4 +58,11 @@ public interface TWTempertureDataMapper
* @return
*/
public int deleteTWTempertureDataByObjids(Long[] objids);
/**
*
* @param tWTempertureData
* @return
*/
List<TWTempertureData> selectIotInstantList(TWTempertureData tWTempertureData);
}

@ -58,4 +58,11 @@ public interface ITWTempertureDataService
* @return
*/
public int deleteTWTempertureDataByObjid(Long objid);
/**
*
* @param tWTempertureData
* @return
*/
List<TWTempertureData> selectIotInstantList(TWTempertureData tWTempertureData);
}

@ -90,4 +90,14 @@ public class TWTempertureDataServiceImpl implements ITWTempertureDataService
{
return tWTempertureDataMapper.deleteTWTempertureDataByObjid(objid);
}
/**
*
* @param tWTempertureData
* @return
*/
@Override
public List<TWTempertureData> selectIotInstantList(TWTempertureData tWTempertureData) {
return tWTempertureDataMapper.selectIotInstantList(tWTempertureData);
}
}

@ -45,6 +45,12 @@
where obj_id = #{objId}
</select>
<select id="selectEmsBaseEnergyNameByEnergyTypeId">
select energy_name
from ems_base_energy_type
where energy_type_id = #{energyTypeId}
</select>
<insert id="insertEmsBaseEnergyType" parameterType="EmsBaseEnergyType" useGeneratedKeys="true" keyProperty="objId">
insert into ems_base_energy_type
<trim prefix="(" suffix=")" suffixOverrides=",">

@ -72,7 +72,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectEmsBaseMonitorInfoVo"/>
where obj_id = #{objId}
</select>
<select id="selectEmsBaseMonitorTypeByMonitorCode" parameterType="String">
select monitor_type
from ems_base_monitor_info
where monitor_code = #{monitorType}
</select>
<insert id="insertEmsBaseMonitorInfo" parameterType="EmsBaseMonitorInfo" useGeneratedKeys="true" keyProperty="objId">
insert into ems_base_monitor_info
<trim prefix="(" suffix=")" suffixOverrides=",">

@ -18,27 +18,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="confirmPersonID" column="confirmPersonID" />
<result property="confirmTime" column="confirmTime" />
<result property="confirmFlag" column="confirmFlag" />
<result property="monitorName" column="monitor_name" />
</resultMap>
<sql id="selectTWTempertureDataVo">
select objid, monitorId, collectTime, tempreture, humidity, illuminance, noise, concentration, recodeTime, alarmType, confirmPersonID, confirmTime, confirmFlag from T_W_TempertureData
select twtd.objid,
twtd.monitorId,
twtd.collectTime,
twtd.tempreture,
twtd.humidity,
twtd.illuminance,
twtd.noise,
twtd.concentration,
twtd.recodeTime,
twtd.alarmType,
twtd.confirmPersonID,
twtd.confirmTime,
twtd.confirmFlag,
ebmi.monitor_name
from T_W_TempertureData twtd
left join ems_base_monitor_info ebmi on twtd.monitorId = ebmi.monitor_code
</sql>
<select id="selectTWTempertureDataList" parameterType="TWTempertureData" resultMap="TWTempertureDataResult">
<include refid="selectTWTempertureDataVo"/>
<where>
<if test="monitorId != null and monitorId != ''"> and monitorId = #{monitorId}</if>
<if test="collectTime != null "> and collectTime = #{collectTime}</if>
<if test="tempreture != null "> and tempreture = #{tempreture}</if>
<if test="humidity != null "> and humidity = #{humidity}</if>
<if test="illuminance != null "> and illuminance = #{illuminance}</if>
<if test="noise != null "> and noise = #{noise}</if>
<if test="concentration != null "> and concentration = #{concentration}</if>
<if test="recodeTime != null "> and recodeTime = #{recodeTime}</if>
<if test="alarmType != null "> and alarmType = #{alarmType}</if>
<if test="confirmPersonID != null "> and confirmPersonID = #{confirmPersonID}</if>
<if test="confirmTime != null "> and confirmTime = #{confirmTime}</if>
<if test="confirmFlag != null "> and confirmFlag = #{confirmFlag}</if>
<if test="monitorId != null and monitorId != ''"> and twtd.monitorId = #{monitorId}</if>
<if test="collectTime != null "> and twtd.collectTime = #{collectTime}</if>
<if test="tempreture != null "> and twtd.tempreture = #{tempreture}</if>
<if test="humidity != null "> and twtd.humidity = #{humidity}</if>
<if test="illuminance != null "> and twtd.illuminance = #{illuminance}</if>
<if test="noise != null "> and twtd.noise = #{noise}</if>
<if test="concentration != null "> and twtd.concentration = #{concentration}</if>
<if test="recodeTime != null "> and twtd.recodeTime = #{recodeTime}</if>
<if test="alarmType != null "> and twtd.alarmType = #{alarmType}</if>
<if test="confirmPersonID != null "> and twtd.confirmPersonID = #{confirmPersonID}</if>
<if test="confirmTime != null "> and twtd.confirmTime = #{confirmTime}</if>
<if test="confirmFlag != null "> and twtd.confirmFlag = #{confirmFlag}</if>
</where>
</select>
@ -46,7 +62,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectTWTempertureDataVo"/>
where objid = #{objid}
</select>
<select id="selectIotInstantList" parameterType="TWTempertureData" resultMap="TWTempertureDataResult">
<include refid="selectTWTempertureDataVo"></include>
<where>
<if test="monitorId != null and monitorId != ''">and twtd.monitorId = #{monitorId}</if>
<if test="params.beginCollectTime != null and params.beginCollectTime != '' and params.endCollectTime != null and params.endCollectTime != ''">
and collectTime between #{params.beginCollectTime} and #{params.endCollectTime}</if>
<if test="params.beginRecordTime != null and params.beginRecordTime != '' and params.endRecordTime != null and params.endRecordTime != ''">
and recodeTime between #{params.beginRecordTime} and #{params.endRecordTime}</if>
</where>
order by twtd.collectTime
</select>
<insert id="insertTWTempertureData" parameterType="TWTempertureData" useGeneratedKeys="true" keyProperty="objid">
insert into T_W_TempertureData
<trim prefix="(" suffix=")" suffixOverrides=",">

Loading…
Cancel
Save