新增能源管理模块的实时功能后端代码

master
马雪伟 3 weeks ago
parent 83e370533c
commit 55b1f87ce7

@ -0,0 +1,103 @@
package com.hw.ems.base.controller;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.web.page.TableDataInfo;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.ems.base.domain.EmsBaseCollectDeviceInfo;
import com.hw.ems.base.service.IEmsBaseCollectDeviceInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* Controller
*
* @author Yinq
* @date 2024-05-20
*/
@RestController
@RequestMapping("/base/baseCollectDeviceInfo")
public class EmsBaseCollectDeviceInfoController extends BaseController {
@Autowired
private IEmsBaseCollectDeviceInfoService emsBaseCollectDeviceInfoService;
/**
*
*/
@GetMapping("/list")
public TableDataInfo list(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
startPage();
List<EmsBaseCollectDeviceInfo> list = emsBaseCollectDeviceInfoService.selectEmsBaseCollectDeviceInfoList(emsBaseCollectDeviceInfo);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/getCollectDeviceInfo")
public AjaxResult getCollectDeviceInfo(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
List<EmsBaseCollectDeviceInfo> list = emsBaseCollectDeviceInfoService.selectEmsBaseCollectDeviceInfoList(emsBaseCollectDeviceInfo);
return success(list);
}
/**
*
*/
@Log(title = "采集设备信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
List<EmsBaseCollectDeviceInfo> list = emsBaseCollectDeviceInfoService.selectEmsBaseCollectDeviceInfoList(emsBaseCollectDeviceInfo);
ExcelUtil<EmsBaseCollectDeviceInfo> util = new ExcelUtil<EmsBaseCollectDeviceInfo>(EmsBaseCollectDeviceInfo.class);
util.exportExcel(response, list, "采集设备信息数据");
}
/**
*
*/
@GetMapping(value = "/{objId}")
public AjaxResult getInfo(@PathVariable("objId") Long objId) {
return success(emsBaseCollectDeviceInfoService.selectEmsBaseCollectDeviceInfoByObjId(objId));
}
/**
*
*/
@Log(title = "采集设备信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
// emsBaseCollectDeviceInfo.setCreateBy(getUsername());
return toAjax(emsBaseCollectDeviceInfoService.insertEmsBaseCollectDeviceInfo(emsBaseCollectDeviceInfo));
}
/**
*
*/
@Log(title = "采集设备信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
// emsBaseCollectDeviceInfo.setUpdateBy(getUsername());
return toAjax(emsBaseCollectDeviceInfoService.updateEmsBaseCollectDeviceInfo(emsBaseCollectDeviceInfo));
}
/**
*
*/
@Log(title = "采集设备信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds) {
return toAjax(emsBaseCollectDeviceInfoService.deleteEmsBaseCollectDeviceInfoByObjIds(objIds));
}
}

@ -0,0 +1,118 @@
package com.hw.ems.base.controller;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.web.page.TableDataInfo;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.ems.base.domain.EmsBaseEnergyType;
import com.hw.ems.base.service.IEmsBaseEnergyTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* Controller
*
* @author Yinq
* @date 2024-05-08
*/
@RestController
@RequestMapping("/base/baseEnergyType")
public class EmsBaseEnergyTypeController extends BaseController
{
@Autowired
private IEmsBaseEnergyTypeService emsBaseEnergyTypeService;
/**
*
*/
@GetMapping("/list")
public TableDataInfo list(EmsBaseEnergyType emsBaseEnergyType)
{
startPage();
List<EmsBaseEnergyType> list = emsBaseEnergyTypeService.selectEmsBaseEnergyTypeList(emsBaseEnergyType);
return getDataTable(list);
}
// /**
// * 根据能源类型id查询能源类型名称
// * @param energyTypeId
// * @return
// */
// public AjaxResult queryEnergyNameByEnergyTypeId(int energyTypeId)
// {
// String energyName = emsBaseEnergyTypeService.queryEnergyNameByEnergyTypeId(energyTypeId);
// return success(energyName);
// }
/**
*
*/
@GetMapping("/getBaseEnergyTypeList")
public AjaxResult baseEnergyTypeList(EmsBaseEnergyType emsBaseEnergyType)
{
List<EmsBaseEnergyType> list = emsBaseEnergyTypeService.selectEmsBaseEnergyTypeList(emsBaseEnergyType);
return success(list);
}
/**
*
*/
@Log(title = "能源类型信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EmsBaseEnergyType emsBaseEnergyType)
{
List<EmsBaseEnergyType> list = emsBaseEnergyTypeService.selectEmsBaseEnergyTypeList(emsBaseEnergyType);
ExcelUtil<EmsBaseEnergyType> util = new ExcelUtil<EmsBaseEnergyType>(EmsBaseEnergyType.class);
util.exportExcel(response, list, "能源类型信息数据");
}
/**
*
*/
@GetMapping(value = "/{objId}")
public AjaxResult getInfo(@PathVariable("objId") Long objId)
{
return success(emsBaseEnergyTypeService.selectEmsBaseEnergyTypeByObjId(objId));
}
/**
*
*/
@Log(title = "能源类型信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EmsBaseEnergyType emsBaseEnergyType)
{
return toAjax(emsBaseEnergyTypeService.insertEmsBaseEnergyType(emsBaseEnergyType));
}
/**
*
*/
@Log(title = "能源类型信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EmsBaseEnergyType emsBaseEnergyType)
{
return toAjax(emsBaseEnergyTypeService.updateEmsBaseEnergyType(emsBaseEnergyType));
}
/**
*
*/
@Log(title = "能源类型信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds)
{
return toAjax(emsBaseEnergyTypeService.deleteEmsBaseEnergyTypeByObjIds(objIds));
}
}

@ -0,0 +1,103 @@
package com.hw.ems.base.controller;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.ems.base.domain.EmsBaseMonitorInfo;
import com.hw.ems.base.domain.TreeSelects;
import com.hw.ems.base.service.IEmsBaseMonitorInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* Controller
*
* @author Yinq
* @date 2024-05-08
*/
@RestController
@RequestMapping("/base/baseMonitorInfo")
public class EmsBaseMonitorInfoController extends BaseController
{
@Autowired
private IEmsBaseMonitorInfoService emsBaseMonitorInfoService;
/**
*
*/
@GetMapping("/list")
public AjaxResult list(EmsBaseMonitorInfo emsBaseMonitorInfo)
{
List<EmsBaseMonitorInfo> list = emsBaseMonitorInfoService.selectEmsBaseMonitorInfoList(emsBaseMonitorInfo);
return success(list);
}
/**
*
* */
@PostMapping("/monitorInfoTree")
public AjaxResult getMonitorInfoTree(@RequestBody EmsBaseMonitorInfo baseMonitorInfo) {
List<TreeSelects> list = emsBaseMonitorInfoService.selectBaseMonitorInfoTreeList(baseMonitorInfo);
return success(list);
}
/**
*
*/
@Log(title = "计量设备信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EmsBaseMonitorInfo emsBaseMonitorInfo)
{
List<EmsBaseMonitorInfo> list = emsBaseMonitorInfoService.selectEmsBaseMonitorInfoList(emsBaseMonitorInfo);
ExcelUtil<EmsBaseMonitorInfo> util = new ExcelUtil<EmsBaseMonitorInfo>(EmsBaseMonitorInfo.class);
util.exportExcel(response, list, "计量设备信息数据");
}
/**
*
*/
@GetMapping(value = "/{objId}")
public AjaxResult getInfo(@PathVariable("objId") Long objId)
{
return success(emsBaseMonitorInfoService.selectEmsBaseMonitorInfoByObjId(objId));
}
/**
*
*/
@Log(title = "计量设备信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EmsBaseMonitorInfo emsBaseMonitorInfo)
{
// emsBaseMonitorInfo.setCreateBy(getUsername());
return toAjax(emsBaseMonitorInfoService.insertEmsBaseMonitorInfo(emsBaseMonitorInfo));
}
/**
*
*/
@Log(title = "计量设备信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EmsBaseMonitorInfo emsBaseMonitorInfo)
{
// emsBaseMonitorInfo.setUpdateBy(getUsername());
return toAjax(emsBaseMonitorInfoService.updateEmsBaseMonitorInfo(emsBaseMonitorInfo));
}
/**
*
*/
@Log(title = "计量设备信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds)
{
return toAjax(emsBaseMonitorInfoService.deleteEmsBaseMonitorInfoByObjIds(objIds));
}
}

@ -0,0 +1,194 @@
package com.hw.ems.base.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* ems_base_collect_device_info
*
* @author Yinq
* @date 2024-05-20
*/
public class EmsBaseCollectDeviceInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long objId;
/**
*
*/
@Excel(name = "采集设备编号")
private String collectDeviceId;
/**
*
*/
@Excel(name = "采集设备名称")
private String collectDeviceName;
/**
*
*/
@Excel(name = "能源类型")
private Long energyTypeId;
/**
*
*/
@Excel(name = "能源类型名称")
private String energyTypeName;
/**
*
*/
@Excel(name = "型号")
private String model;
/**
*
*/
@Excel(name = "生产厂家")
private String manufacturer;
/**
*
*/
@Excel(name = "通讯地址")
private String ipAddress;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date produceDate;
/**
*
*/
@Excel(name = "安装地址")
private String settingAddress;
/**
* 0 1
*/
@Excel(name = "启用标识", readConverterExp = "0=启用,1=停用")
private String isFlag;
public String getEnergyTypeName() {
return energyTypeName;
}
public void setEnergyTypeName(String energyTypeName) {
this.energyTypeName = energyTypeName;
}
public void setObjId(Long objId) {
this.objId = objId;
}
public Long getObjId() {
return objId;
}
public void setCollectDeviceId(String collectDeviceId) {
this.collectDeviceId = collectDeviceId;
}
public String getCollectDeviceId() {
return collectDeviceId;
}
public void setCollectDeviceName(String collectDeviceName) {
this.collectDeviceName = collectDeviceName;
}
public String getCollectDeviceName() {
return collectDeviceName;
}
public void setEnergyTypeId(Long energyTypeId) {
this.energyTypeId = energyTypeId;
}
public Long getEnergyTypeId() {
return energyTypeId;
}
public void setModel(String model) {
this.model = model;
}
public String getModel() {
return model;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public String getManufacturer() {
return manufacturer;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public String getIpAddress() {
return ipAddress;
}
public void setProduceDate(Date produceDate) {
this.produceDate = produceDate;
}
public Date getProduceDate() {
return produceDate;
}
public void setSettingAddress(String settingAddress) {
this.settingAddress = settingAddress;
}
public String getSettingAddress() {
return settingAddress;
}
public void setIsFlag(String isFlag) {
this.isFlag = isFlag;
}
public String getIsFlag() {
return isFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("objId", getObjId())
.append("collectDeviceId", getCollectDeviceId())
.append("collectDeviceName", getCollectDeviceName())
.append("energyTypeId", getEnergyTypeId())
.append("model", getModel())
.append("manufacturer", getManufacturer())
.append("ipAddress", getIpAddress())
.append("produceDate", getProduceDate())
.append("settingAddress", getSettingAddress())
.append("isFlag", getIsFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

@ -0,0 +1,89 @@
package com.hw.ems.base.domain;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
/**
* ems_base_energy_type
*
* @author Yinq
* @date 2024-05-08
*/
public class EmsBaseEnergyType extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 能源类型编号 */
@Excel(name = "能源类型编号")
private Long energyTypeId;
/** 能源类型名称 */
@Excel(name = "能源类型名称")
private String energyName;
/** 单位 */
@Excel(name = "单位")
private String measureUnit;
/** 单价 */
@Excel(name = "单价")
private BigDecimal price;
public void setEnergyTypeId(Long energyTypeId)
{
this.energyTypeId = energyTypeId;
}
public Long getEnergyTypeId()
{
return energyTypeId;
}
public void setEnergyName(String energyName)
{
this.energyName = energyName;
}
public String getEnergyName()
{
return energyName;
}
public void setMeasureUnit(String measureUnit)
{
this.measureUnit = measureUnit;
}
public String getMeasureUnit()
{
return measureUnit;
}
public void setPrice(BigDecimal price)
{
this.price = price;
}
public BigDecimal getPrice()
{
return price;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("energyTypeId", getEnergyTypeId())
.append("energyName", getEnergyName())
.append("measureUnit", getMeasureUnit())
.append("price", getPrice())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,326 @@
package com.hw.ems.base.domain;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.ArrayList;
import java.util.List;
/**
* ems_base_monitor_info
*
* @author Yinq
* @date 2024-05-08
*/
public class EmsBaseMonitorInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 自增标识 */
private Long objId;
/** 计量设备编号 */
@Excel(name = "计量设备编号")
private String monitorCode;
/** 计量设备名称 */
@Excel(name = "计量设备名称")
private String monitorName;
/** 计量设备位置 */
@Excel(name = "计量设备位置")
private String monitorAddr;
/** 计量设备类型 */
@Excel(name = "能源类型")
private Long monitorType;
/** 计量设备状态0启用 1停用 */
@Excel(name = "计量设备状态", readConverterExp = "0=启用,1=停用")
private Long monitorStatus;
/** 采集设备编号F */
@Excel(name = "采集设备编号")
private String collectDeviceId;
/** 等级 */
@Excel(name = "等级")
private Long grade;
/** 传感器仪表 */
@Excel(name = "传感器仪表")
private String meterTypeId;
/** 修正值 */
@Excel(name = "修正值")
private Long correctValue;
/** PT值 */
@Excel(name = "PT值")
private Long pt;
/** CT值 */
@Excel(name = "CT值")
private Long ct;
/** 是否虚拟0是 1否 */
@Excel(name = "是否虚拟", readConverterExp = "0=是,1=否")
private String isAmmeter;
/** 通断复位 */
@Excel(name = "通断复位")
private Long isKeyMonitor;
/** 是否断路 */
@Excel(name = "是否断路")
private Long isCircuit;
/** 公摊表类型 */
@Excel(name = "公摊表类型")
private Long publicShareType;
/** 表具层级 */
@Excel(name = "表具层级")
private Long monitorHierarchy;
private List<EmsBaseMonitorInfo> children = new ArrayList<EmsBaseMonitorInfo>();
private String parentName;
private Long parentId;
private Integer orderNum;
private String ancestors;
private List<Long> monitorTypeList;
public List<Long> getMonitorTypeList() {
return monitorTypeList;
}
public void setMonitorTypeList(List<Long> monitorTypeList) {
this.monitorTypeList = monitorTypeList;
}
public List<EmsBaseMonitorInfo> getChildren() {
return children;
}
public void setChildren(List<EmsBaseMonitorInfo> children) {
this.children = children;
}
public String getParentName() {
return parentName;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Integer getOrderNum() {
return orderNum;
}
public void setOrderNum(Integer orderNum) {
this.orderNum = orderNum;
}
public String getAncestors() {
return ancestors;
}
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
public void setObjId(Long objId)
{
this.objId = objId;
}
public Long getObjId()
{
return objId;
}
public String getMonitorCode() {
return monitorCode;
}
public void setMonitorCode(String monitorCode) {
this.monitorCode = monitorCode;
}
public void setMonitorName(String monitorName)
{
this.monitorName = monitorName;
}
public String getMonitorName()
{
return monitorName;
}
public void setMonitorAddr(String monitorAddr)
{
this.monitorAddr = monitorAddr;
}
public String getMonitorAddr()
{
return monitorAddr;
}
public void setMonitorType(Long monitorType)
{
this.monitorType = monitorType;
}
public Long getMonitorType()
{
return monitorType;
}
public void setMonitorStatus(Long monitorStatus)
{
this.monitorStatus = monitorStatus;
}
public Long getMonitorStatus()
{
return monitorStatus;
}
public void setCollectDeviceId(String collectDeviceId)
{
this.collectDeviceId = collectDeviceId;
}
public String getCollectDeviceId()
{
return collectDeviceId;
}
public void setGrade(Long grade)
{
this.grade = grade;
}
public Long getGrade()
{
return grade;
}
public void setMeterTypeId(String meterTypeId)
{
this.meterTypeId = meterTypeId;
}
public String getMeterTypeId()
{
return meterTypeId;
}
public void setCorrectValue(Long correctValue)
{
this.correctValue = correctValue;
}
public Long getCorrectValue()
{
return correctValue;
}
public void setPt(Long pt)
{
this.pt = pt;
}
public Long getPt()
{
return pt;
}
public void setCt(Long ct)
{
this.ct = ct;
}
public Long getCt()
{
return ct;
}
public void setIsAmmeter(String isAmmeter)
{
this.isAmmeter = isAmmeter;
}
public String getIsAmmeter()
{
return isAmmeter;
}
public void setIsKeyMonitor(Long isKeyMonitor)
{
this.isKeyMonitor = isKeyMonitor;
}
public Long getIsKeyMonitor()
{
return isKeyMonitor;
}
public void setIsCircuit(Long isCircuit)
{
this.isCircuit = isCircuit;
}
public Long getIsCircuit()
{
return isCircuit;
}
public void setPublicShareType(Long publicShareType)
{
this.publicShareType = publicShareType;
}
public Long getPublicShareType()
{
return publicShareType;
}
public void setMonitorHierarchy(Long monitorHierarchy)
{
this.monitorHierarchy = monitorHierarchy;
}
public Long getMonitorHierarchy()
{
return monitorHierarchy;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("monitorName", getMonitorName())
.append("monitorAddr", getMonitorAddr())
.append("monitorType", getMonitorType())
.append("monitorStatus", getMonitorStatus())
.append("collectDeviceId", getCollectDeviceId())
.append("grade", getGrade())
.append("meterTypeId", getMeterTypeId())
.append("correctValue", getCorrectValue())
.append("pt", getPt())
.append("ct", getCt())
.append("isAmmeter", getIsAmmeter())
.append("isKeyMonitor", getIsKeyMonitor())
.append("isCircuit", getIsCircuit())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("publicShareType", getPublicShareType())
.append("monitorHierarchy", getMonitorHierarchy())
.toString();
}
}

@ -0,0 +1,101 @@
package com.hw.ems.base.domain;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.hw.system.api.domain.SysDept;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
/**
* Treeselect
*
* @author ruoyi
*/
public class TreeSelects implements Serializable
{
private static final long serialVersionUID = 1L;
/** 节点ID */
private Long id;
/** 节点名称 */
private String label;
private String code;
/** 子节点 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelects> children;
public TreeSelects()
{
}
public TreeSelects(SysDept dept)
{
this.id = dept.getDeptId();
this.label = dept.getDeptName();
this.children = dept.getChildren().stream().map(TreeSelects::new).collect(Collectors.toList());
}
public TreeSelects(EmsBaseMonitorInfo baseMonitorInfo){
// this.id = baseMonitorInfo.getObjId();
this.label = baseMonitorInfo.getMonitorName();
this.code = baseMonitorInfo.getMonitorCode();
this.children = baseMonitorInfo.getChildren().stream().map(TreeSelects::new).collect(Collectors.toList());
}
// public TreeSelects(EmsBaseWorkUnit baseWorkUnit){
// this.id = baseWorkUnit.getObjId();
// this.label = baseWorkUnit.getWorkUnitName();
// this.code = baseWorkUnit.getWorkUnitCode();
// this.children = baseWorkUnit.getChildren().stream().map(TreeSelects::new).collect(Collectors.toList());
// }
//
// public TreeSelects(SysMenu menu)
// {
// this.id = menu.getMenuId();
// this.label = menu.getMenuName();
// this.children = menu.getChildren().stream().map(TreeSelects::new).collect(Collectors.toList());
// }
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getLabel()
{
return label;
}
public void setLabel(String label)
{
this.label = label;
}
public List<TreeSelects> getChildren()
{
return children;
}
public void setChildren(List<TreeSelects> children)
{
this.children = children;
}
}

@ -0,0 +1,61 @@
package com.hw.ems.base.mapper;
import com.hw.ems.base.domain.EmsBaseCollectDeviceInfo;
import java.util.List;
/**
* Mapper
*
* @author Yinq
* @date 2024-05-20
*/
public interface EmsBaseCollectDeviceInfoMapper {
/**
*
*
* @param objId
* @return
*/
public EmsBaseCollectDeviceInfo selectEmsBaseCollectDeviceInfoByObjId(Long objId);
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
public List<EmsBaseCollectDeviceInfo> selectEmsBaseCollectDeviceInfoList(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo);
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
public int insertEmsBaseCollectDeviceInfo(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo);
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
public int updateEmsBaseCollectDeviceInfo(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsBaseCollectDeviceInfoByObjId(Long objId);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsBaseCollectDeviceInfoByObjIds(Long[] objIds);
}

@ -0,0 +1,69 @@
package com.hw.ems.base.mapper;
import com.hw.ems.base.domain.EmsBaseEnergyType;
import java.util.List;
/**
* Mapper
*
* @author Yinq
* @date 2024-05-08
*/
public interface EmsBaseEnergyTypeMapper
{
/**
*
*
* @param objId
* @return
*/
public EmsBaseEnergyType selectEmsBaseEnergyTypeByObjId(Long objId);
/**
*
*
* @param emsBaseEnergyType
* @return
*/
public List<EmsBaseEnergyType> selectEmsBaseEnergyTypeList(EmsBaseEnergyType emsBaseEnergyType);
/**
*
*
* @param emsBaseEnergyType
* @return
*/
public int insertEmsBaseEnergyType(EmsBaseEnergyType emsBaseEnergyType);
/**
*
*
* @param emsBaseEnergyType
* @return
*/
public int updateEmsBaseEnergyType(EmsBaseEnergyType emsBaseEnergyType);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsBaseEnergyTypeByObjId(Long objId);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsBaseEnergyTypeByObjIds(Long[] objIds);
/**
* id
* @param energyTypeId
* @return
*/
public String selectEmsBaseEnergyNameByEnergyTypeId(int energyTypeId);
}

@ -0,0 +1,70 @@
package com.hw.ems.base.mapper;
import com.hw.ems.base.domain.EmsBaseMonitorInfo;
import java.util.List;
/**
* Mapper
*
* @author Yinq
* @date 2024-05-08
*/
public interface EmsBaseMonitorInfoMapper
{
/**
*
*
* @param objId
* @return
*/
public EmsBaseMonitorInfo selectEmsBaseMonitorInfoByObjId(Long objId);
/**
*
*
* @param emsBaseMonitorInfo
* @return
*/
public List<EmsBaseMonitorInfo> selectEmsBaseMonitorInfoList(EmsBaseMonitorInfo emsBaseMonitorInfo);
/**
*
*
* @param emsBaseMonitorInfo
* @return
*/
public int insertEmsBaseMonitorInfo(EmsBaseMonitorInfo emsBaseMonitorInfo);
/**
*
*
* @param emsBaseMonitorInfo
* @return
*/
public int updateEmsBaseMonitorInfo(EmsBaseMonitorInfo emsBaseMonitorInfo);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsBaseMonitorInfoByObjId(Long objId);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsBaseMonitorInfoByObjIds(Long[] objIds);
/**
*
* @param monitorCode
* @return
*/
public String selectEmsBaseMonitorTypeByMonitorCode(String monitorCode);
}

@ -0,0 +1,62 @@
package com.hw.ems.base.service;
import com.hw.ems.base.domain.EmsBaseCollectDeviceInfo;
import java.util.List;
/**
* Service
*
* @author Yinq
* @date 2024-05-20
*/
public interface IEmsBaseCollectDeviceInfoService {
/**
*
*
* @param objId
* @return
*/
public EmsBaseCollectDeviceInfo selectEmsBaseCollectDeviceInfoByObjId(Long objId);
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
public List<EmsBaseCollectDeviceInfo> selectEmsBaseCollectDeviceInfoList(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo);
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
public int insertEmsBaseCollectDeviceInfo(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo);
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
public int updateEmsBaseCollectDeviceInfo(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsBaseCollectDeviceInfoByObjIds(Long[] objIds);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsBaseCollectDeviceInfoByObjId(Long objId);
}

@ -0,0 +1,69 @@
package com.hw.ems.base.service;
import com.hw.ems.base.domain.EmsBaseEnergyType;
import java.util.List;
/**
* Service
*
* @author Yinq
* @date 2024-05-08
*/
public interface IEmsBaseEnergyTypeService
{
/**
*
*
* @param objId
* @return
*/
public EmsBaseEnergyType selectEmsBaseEnergyTypeByObjId(Long objId);
/**
*
*
* @param emsBaseEnergyType
* @return
*/
public List<EmsBaseEnergyType> selectEmsBaseEnergyTypeList(EmsBaseEnergyType emsBaseEnergyType);
/**
*
*
* @param emsBaseEnergyType
* @return
*/
public int insertEmsBaseEnergyType(EmsBaseEnergyType emsBaseEnergyType);
/**
*
*
* @param emsBaseEnergyType
* @return
*/
public int updateEmsBaseEnergyType(EmsBaseEnergyType emsBaseEnergyType);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsBaseEnergyTypeByObjIds(Long[] objIds);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsBaseEnergyTypeByObjId(Long objId);
/**
* id
* @param energyTypeId
* @return
*/
String queryEnergyNameByEnergyTypeId(int energyTypeId);
}

@ -0,0 +1,92 @@
package com.hw.ems.base.service;
import com.hw.ems.base.domain.EmsBaseMonitorInfo;
import com.hw.ems.base.domain.TreeSelects;
import java.util.List;
/**
* Service
*
* @author Yinq
* @date 2024-05-08
*/
public interface IEmsBaseMonitorInfoService
{
/**
*
*
* @param objId
* @return
*/
public EmsBaseMonitorInfo selectEmsBaseMonitorInfoByObjId(Long objId);
/**
*
* @param emsBaseMonitorInfo
* @return
*/
public List<EmsBaseMonitorInfo> selectEmsBaseMonitorInfoList(EmsBaseMonitorInfo emsBaseMonitorInfo);
/**
*
* @param monitorCode
* @return
*/
public String selectEmsBaseMonitorTypeByMonitorCode(String monitorCode);
/**
*
*
* @param emsBaseMonitorInfo
* @return
*/
public int insertEmsBaseMonitorInfo(EmsBaseMonitorInfo emsBaseMonitorInfo);
/**
*
*
* @param emsBaseMonitorInfo
* @return
*/
public int updateEmsBaseMonitorInfo(EmsBaseMonitorInfo emsBaseMonitorInfo);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsBaseMonitorInfoByObjIds(Long[] objIds);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsBaseMonitorInfoByObjId(Long objId);
/**
*
* */
List<TreeSelects> selectBaseMonitorInfoTreeList(EmsBaseMonitorInfo baseMonitorInfo);
/**
*
*
* @param
* @return
*/
public List<TreeSelects> buildMonitorInfoTreeSelect(List<EmsBaseMonitorInfo> baseMonitorInfos);
/**
*
*
* @param
* @return
*/
public List<EmsBaseMonitorInfo> buildMonitorInfoTree(List<EmsBaseMonitorInfo> baseMonitorInfos);
}

@ -0,0 +1,90 @@
package com.hw.ems.base.service.impl;
import com.hw.common.core.utils.DateUtils;
import com.hw.ems.base.domain.EmsBaseCollectDeviceInfo;
import com.hw.ems.base.mapper.EmsBaseCollectDeviceInfoMapper;
import com.hw.ems.base.service.IEmsBaseCollectDeviceInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author Yinq
* @date 2024-05-20
*/
@Service
public class EmsBaseCollectDeviceInfoServiceImpl implements IEmsBaseCollectDeviceInfoService {
@Autowired
private EmsBaseCollectDeviceInfoMapper emsBaseCollectDeviceInfoMapper;
/**
*
*
* @param objId
* @return
*/
@Override
public EmsBaseCollectDeviceInfo selectEmsBaseCollectDeviceInfoByObjId(Long objId) {
return emsBaseCollectDeviceInfoMapper.selectEmsBaseCollectDeviceInfoByObjId(objId);
}
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
@Override
public List<EmsBaseCollectDeviceInfo> selectEmsBaseCollectDeviceInfoList(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
return emsBaseCollectDeviceInfoMapper.selectEmsBaseCollectDeviceInfoList(emsBaseCollectDeviceInfo);
}
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
@Override
public int insertEmsBaseCollectDeviceInfo(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
emsBaseCollectDeviceInfo.setCreateTime(DateUtils.getNowDate());
return emsBaseCollectDeviceInfoMapper.insertEmsBaseCollectDeviceInfo(emsBaseCollectDeviceInfo);
}
/**
*
*
* @param emsBaseCollectDeviceInfo
* @return
*/
@Override
public int updateEmsBaseCollectDeviceInfo(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
emsBaseCollectDeviceInfo.setUpdateTime(DateUtils.getNowDate());
return emsBaseCollectDeviceInfoMapper.updateEmsBaseCollectDeviceInfo(emsBaseCollectDeviceInfo);
}
/**
*
*
* @param objIds
* @return
*/
@Override
public int deleteEmsBaseCollectDeviceInfoByObjIds(Long[] objIds) {
return emsBaseCollectDeviceInfoMapper.deleteEmsBaseCollectDeviceInfoByObjIds(objIds);
}
/**
*
*
* @param objId
* @return
*/
@Override
public int deleteEmsBaseCollectDeviceInfoByObjId(Long objId) {
return emsBaseCollectDeviceInfoMapper.deleteEmsBaseCollectDeviceInfoByObjId(objId);
}
}

@ -0,0 +1,107 @@
package com.hw.ems.base.service.impl;
import com.hw.common.core.utils.DateUtils;
import com.hw.ems.base.domain.EmsBaseEnergyType;
import com.hw.ems.base.mapper.EmsBaseEnergyTypeMapper;
import com.hw.ems.base.service.IEmsBaseEnergyTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author Yinq
* @date 2024-05-08
*/
@Service
public class EmsBaseEnergyTypeServiceImpl implements IEmsBaseEnergyTypeService
{
@Autowired
private EmsBaseEnergyTypeMapper emsBaseEnergyTypeMapper;
/**
*
*
* @param objId
* @return
*/
@Override
public EmsBaseEnergyType selectEmsBaseEnergyTypeByObjId(Long objId)
{
return emsBaseEnergyTypeMapper.selectEmsBaseEnergyTypeByObjId(objId);
}
/**
*
*
* @param emsBaseEnergyType
* @return
*/
@Override
public List<EmsBaseEnergyType> selectEmsBaseEnergyTypeList(EmsBaseEnergyType emsBaseEnergyType)
{
return emsBaseEnergyTypeMapper.selectEmsBaseEnergyTypeList(emsBaseEnergyType);
}
/**
*
*
* @param emsBaseEnergyType
* @return
*/
@Override
public int insertEmsBaseEnergyType(EmsBaseEnergyType emsBaseEnergyType)
{
emsBaseEnergyType.setCreateTime(DateUtils.getNowDate());
return emsBaseEnergyTypeMapper.insertEmsBaseEnergyType(emsBaseEnergyType);
}
/**
*
*
* @param emsBaseEnergyType
* @return
*/
@Override
public int updateEmsBaseEnergyType(EmsBaseEnergyType emsBaseEnergyType)
{
emsBaseEnergyType.setUpdateTime(DateUtils.getNowDate());
return emsBaseEnergyTypeMapper.updateEmsBaseEnergyType(emsBaseEnergyType);
}
/**
*
*
* @param objIds
* @return
*/
@Override
public int deleteEmsBaseEnergyTypeByObjIds(Long[] objIds)
{
return emsBaseEnergyTypeMapper.deleteEmsBaseEnergyTypeByObjIds(objIds);
}
/**
*
*
* @param objId
* @return
*/
@Override
public int deleteEmsBaseEnergyTypeByObjId(Long objId)
{
return emsBaseEnergyTypeMapper.deleteEmsBaseEnergyTypeByObjId(objId);
}
/**
* id
* @param energyTypeId
* @return
*/
@Override
public String queryEnergyNameByEnergyTypeId(int energyTypeId) {
return emsBaseEnergyTypeMapper.selectEmsBaseEnergyNameByEnergyTypeId(energyTypeId);
}
}

@ -0,0 +1,203 @@
package com.hw.ems.base.service.impl;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.ems.base.domain.EmsBaseMonitorInfo;
import com.hw.ems.base.domain.TreeSelects;
import com.hw.ems.base.mapper.EmsBaseMonitorInfoMapper;
import com.hw.ems.base.service.IEmsBaseMonitorInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
/**
* Service
*
* @author Yinq
* @date 2024-05-08
*/
@Service
public class EmsBaseMonitorInfoServiceImpl implements IEmsBaseMonitorInfoService
{
@Autowired
private EmsBaseMonitorInfoMapper emsBaseMonitorInfoMapper;
/**
*
*
* @param objId
* @return
*/
@Override
public EmsBaseMonitorInfo selectEmsBaseMonitorInfoByObjId(Long objId)
{
return emsBaseMonitorInfoMapper.selectEmsBaseMonitorInfoByObjId(objId);
}
/**
*
*
* @param emsBaseMonitorInfo
* @return
*/
@Override
public List<EmsBaseMonitorInfo> selectEmsBaseMonitorInfoList(EmsBaseMonitorInfo emsBaseMonitorInfo)
{
return emsBaseMonitorInfoMapper.selectEmsBaseMonitorInfoList(emsBaseMonitorInfo);
}
/**
*
* @param monitorCode
* @return
*/
@Override
public String selectEmsBaseMonitorTypeByMonitorCode(String monitorCode) {
return emsBaseMonitorInfoMapper.selectEmsBaseMonitorTypeByMonitorCode(monitorCode);
}
/**
*
*
* @param emsBaseMonitorInfo
* @return
*/
@Override
public int insertEmsBaseMonitorInfo(EmsBaseMonitorInfo emsBaseMonitorInfo)
{
emsBaseMonitorInfo.setCreateTime(DateUtils.getNowDate());
return emsBaseMonitorInfoMapper.insertEmsBaseMonitorInfo(emsBaseMonitorInfo);
}
/**
*
*
* @param emsBaseMonitorInfo
* @return
*/
@Override
public int updateEmsBaseMonitorInfo(EmsBaseMonitorInfo emsBaseMonitorInfo)
{
emsBaseMonitorInfo.setUpdateTime(DateUtils.getNowDate());
return emsBaseMonitorInfoMapper.updateEmsBaseMonitorInfo(emsBaseMonitorInfo);
}
/**
*
*
* @param objIds
* @return
*/
@Override
public int deleteEmsBaseMonitorInfoByObjIds(Long[] objIds)
{
return emsBaseMonitorInfoMapper.deleteEmsBaseMonitorInfoByObjIds(objIds);
}
/**
*
*
* @param objId
* @return
*/
@Override
public int deleteEmsBaseMonitorInfoByObjId(Long objId)
{
return emsBaseMonitorInfoMapper.deleteEmsBaseMonitorInfoByObjId(objId);
}
/**
*
* */
@Override
public List<TreeSelects> selectBaseMonitorInfoTreeList(EmsBaseMonitorInfo baseMonitorInfo) {
List<EmsBaseMonitorInfo> baseMonitorInfos = selectEmsBaseMonitorInfoList(baseMonitorInfo);
return buildMonitorInfoTreeSelect(baseMonitorInfos);
}
/**
*
*
* @param
* @return
*/
@Override
public List<TreeSelects> buildMonitorInfoTreeSelect(List<EmsBaseMonitorInfo> baseMonitorInfos)
{
List<EmsBaseMonitorInfo> deptTrees = buildMonitorInfoTree(baseMonitorInfos);
return deptTrees.stream().map(TreeSelects::new).collect(Collectors.toList());
}
/**
*
*
* @param
* @return
*/
@Override
public List<EmsBaseMonitorInfo> buildMonitorInfoTree(List<EmsBaseMonitorInfo> baseMonitorInfos)
{
List<EmsBaseMonitorInfo> returnList = new ArrayList<EmsBaseMonitorInfo>();
List<Long> tempList = baseMonitorInfos.stream().map(EmsBaseMonitorInfo::getObjId).collect(Collectors.toList());
for (EmsBaseMonitorInfo baseMonitorInfo : baseMonitorInfos)
{
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(baseMonitorInfo.getParentId()))
{
recursionFn(baseMonitorInfos, baseMonitorInfo);
returnList.add(baseMonitorInfo);
}
}
if (returnList.isEmpty())
{
returnList = baseMonitorInfos;
}
return returnList;
}
/**
*
*/
private void recursionFn(List<EmsBaseMonitorInfo> list, EmsBaseMonitorInfo t)
{
// 得到子节点列表
List<EmsBaseMonitorInfo> childList = getChildList(list, t);
t.setChildren(childList);
for (EmsBaseMonitorInfo tChild : childList)
{
if (hasChild(list, tChild))
{
recursionFn(list, tChild);
}
}
}
/**
*
*/
private List<EmsBaseMonitorInfo> getChildList(List<EmsBaseMonitorInfo> list, EmsBaseMonitorInfo t)
{
List<EmsBaseMonitorInfo> tlist = new ArrayList<EmsBaseMonitorInfo>();
Iterator<EmsBaseMonitorInfo> it = list.iterator();
while (it.hasNext())
{
EmsBaseMonitorInfo n = (EmsBaseMonitorInfo) it.next();
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getObjId().longValue())
{
tlist.add(n);
}
}
return tlist;
}
/**
*
*/
private boolean hasChild(List<EmsBaseMonitorInfo> list, EmsBaseMonitorInfo t)
{
return getChildList(list, t).size() > 0;
}
}

@ -0,0 +1,176 @@
package com.hw.ems.record.controller;
import com.alibaba.fastjson2.JSONArray;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.web.page.TableDataInfo;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.ems.base.service.IEmsBaseEnergyTypeService;
import com.hw.ems.base.service.IEmsBaseMonitorInfoService;
import com.hw.ems.record.domain.EmsIOTData;
import com.hw.ems.record.domain.TWTempertureData;
import com.hw.ems.record.service.ITWTempertureDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* Controller
*
* @author Caoql
* @date 2024-08-21
*/
@RestController
@RequestMapping("/record/recordIOTInstant")
public class TWTempertureDataController extends BaseController
{
@Autowired
private ITWTempertureDataService tWTempertureDataService;
@Autowired
private IEmsBaseMonitorInfoService emsBaseMonitorInfoService;
@Autowired
private IEmsBaseEnergyTypeService emsBaseEnergyTypeService;
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
/**
*
*/
// @PreAuthorize("@ss.hasPermi('ems/record:recordIOTInstant:list')")
@GetMapping("/list")
public TableDataInfo list(TWTempertureData tWTempertureData)
{
startPage();
List<TWTempertureData> list = tWTempertureDataService.selectTWTempertureDataList(tWTempertureData);
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);
}
/**
*
* @param monitorCodeList
* @return
*/
@GetMapping("/iotInstantMonitoring")
public AjaxResult iotInstantMonitoring(String monitorCodeList){
List<TWTempertureData> list = new ArrayList<TWTempertureData>();
if(StringUtils.isNotEmpty(monitorCodeList)){
String[] split = monitorCodeList.split(",");
for (String monitorId : split) {
TWTempertureData tWTempertureData = new TWTempertureData();
tWTempertureData.setMonitorId(monitorId);
Map<String,Object> params = new HashMap<>();
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MINUTE,-5);
Calendar startTime = (Calendar) calendar.clone();
params.put("beginRecordTime",sdf.format(startTime.getTime()));
params.put("endRecordTime",sdf.format(new Date()));
tWTempertureData.setParams(params);
List<TWTempertureData> twTempertureData = tWTempertureDataService.selectIotInstantList(tWTempertureData);
if(twTempertureData.size()>0){
Optional<TWTempertureData> first = twTempertureData.stream().sorted(Comparator.comparing(TWTempertureData::getRecodeTime)).findFirst();
list.add(first.get());
}
}
}
System.out.println(JSONArray.toJSONString(list));
return success(list);
}
/**
*
*/
// @PreAuthorize("@ss.hasPermi('ems/record:recordIOTInstant:export')")
@Log(title = "物联网实时数据", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TWTempertureData tWTempertureData)
{
List<TWTempertureData> list = tWTempertureDataService.selectTWTempertureDataList(tWTempertureData);
ExcelUtil<TWTempertureData> util = new ExcelUtil<TWTempertureData>(TWTempertureData.class);
util.exportExcel(response, list, "物联网实时数据数据");
}
/**
*
*/
// @PreAuthorize("@ss.hasPermi('ems/record:recordIOTInstant:query')")
@GetMapping(value = "/{objid}")
public AjaxResult getInfo(@PathVariable("objid") Long objid)
{
return success(tWTempertureDataService.selectTWTempertureDataByObjid(objid));
}
/**
*
*/
// @PreAuthorize("@ss.hasPermi('ems/record:recordIOTInstant:add')")
@Log(title = "物联网实时数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TWTempertureData tWTempertureData)
{
// tWTempertureData.setCreateBy(getUsername());
return toAjax(tWTempertureDataService.insertTWTempertureData(tWTempertureData));
}
/**
*
*/
// @PreAuthorize("@ss.hasPermi('ems/record:recordIOTInstant:edit')")
@Log(title = "物联网实时数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TWTempertureData tWTempertureData)
{
// tWTempertureData.setUpdateBy(getUsername());
return toAjax(tWTempertureDataService.updateTWTempertureData(tWTempertureData));
}
/**
*
*/
// @PreAuthorize("@ss.hasPermi('ems/record:recordIOTInstant:remove')")
@Log(title = "物联网实时数据", businessType = BusinessType.DELETE)
@DeleteMapping("/{objids}")
public AjaxResult remove(@PathVariable Long[] objids)
{
return toAjax(tWTempertureDataService.deleteTWTempertureDataByObjids(objids));
}
}

@ -0,0 +1,98 @@
package com.hw.ems.record.domain;
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;
}
}

@ -0,0 +1,230 @@
package com.hw.ems.record.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.Date;
/**
* T_W_TempertureData
*
* @author Caoql
* @date 2024-08-21
*/
@Data
public class TWTempertureData extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键标识 */
private Long objid;
/** 计量设备编号 */
@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")
private Date collectTime;
/** 温度 */
@Excel(name = "温度")
private BigDecimal tempreture;
/** 湿度 */
@Excel(name = "湿度")
private BigDecimal humidity;
/** 照度 */
@Excel(name = "照度")
private BigDecimal illuminance;
/** 噪声 */
@Excel(name = "噪声")
private BigDecimal noise;
/** 硫化氢浓度 */
@Excel(name = "硫化氢浓度")
private BigDecimal concentration;
/** 记录时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "记录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date recodeTime;
private BigDecimal pm1;
private BigDecimal pm2;
private BigDecimal pm10;
private BigDecimal standby;
/** 报警类型 */
@Excel(name = "报警类型")
private Long alarmType;
/** */
@Excel(name = " ")
private Long confirmPersonID;
/** */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = " ", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date confirmTime;
/** */
@Excel(name = " ")
private Long confirmFlag;
public void setObjid(Long objid)
{
this.objid = objid;
}
public Long getObjid()
{
return objid;
}
public void setMonitorId(String monitorId)
{
this.monitorId = monitorId;
}
public String getMonitorId()
{
return monitorId;
}
public void setCollectTime(Date collectTime)
{
this.collectTime = collectTime;
}
public Date getCollectTime()
{
return collectTime;
}
public void setTempreture(BigDecimal tempreture)
{
this.tempreture = tempreture;
}
public BigDecimal getTempreture()
{
return tempreture;
}
public void setHumidity(BigDecimal humidity)
{
this.humidity = humidity;
}
public BigDecimal getHumidity()
{
return humidity;
}
public void setIlluminance(BigDecimal illuminance)
{
this.illuminance = illuminance;
}
public String getMonitorName() {
return monitorName;
}
public void setMonitorName(String monitorName) {
this.monitorName = monitorName;
}
public BigDecimal getIlluminance()
{
return illuminance;
}
public void setNoise(BigDecimal noise)
{
this.noise = noise;
}
public BigDecimal getNoise()
{
return noise;
}
public void setConcentration(BigDecimal concentration)
{
this.concentration = concentration;
}
public BigDecimal getConcentration()
{
return concentration;
}
public void setRecodeTime(Date recodeTime)
{
this.recodeTime = recodeTime;
}
public Date getRecodeTime()
{
return recodeTime;
}
public void setAlarmType(Long alarmType)
{
this.alarmType = alarmType;
}
public Long getAlarmType()
{
return alarmType;
}
public void setConfirmPersonID(Long confirmPersonID)
{
this.confirmPersonID = confirmPersonID;
}
public Long getConfirmPersonID()
{
return confirmPersonID;
}
public void setConfirmTime(Date confirmTime)
{
this.confirmTime = confirmTime;
}
public Date getConfirmTime()
{
return confirmTime;
}
public void setConfirmFlag(Long confirmFlag)
{
this.confirmFlag = confirmFlag;
}
public Long getConfirmFlag()
{
return confirmFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("objid", getObjid())
.append("monitorId", getMonitorId())
.append("collectTime", getCollectTime())
.append("tempreture", getTempreture())
.append("humidity", getHumidity())
.append("illuminance", getIlluminance())
.append("noise", getNoise())
.append("concentration", getConcentration())
.append("recodeTime", getRecodeTime())
.append("alarmType", getAlarmType())
.append("confirmPersonID", getConfirmPersonID())
.append("confirmTime", getConfirmTime())
.append("confirmFlag", getConfirmFlag())
.toString();
}
}

@ -0,0 +1,78 @@
package com.hw.ems.record.mapper;
import com.hw.ems.record.domain.TWTempertureData;
import java.util.List;
/**
* Mapper
*
* @author Caoql
* @date 2024-08-21
*/
public interface TWTempertureDataMapper
{
/**
*
*
* @param objid
* @return
*/
public TWTempertureData selectTWTempertureDataByObjid(Long objid);
/**
*
*
* @param tWTempertureData
* @return
*/
public List<TWTempertureData> selectTWTempertureDataList(TWTempertureData tWTempertureData);
/**
*
*
* @param tWTempertureData
* @return
*/
public int insertTWTempertureData(TWTempertureData tWTempertureData);
/**
*
*
* @param tWTempertureData
* @return
*/
public int updateTWTempertureData(TWTempertureData tWTempertureData);
/**
*
*
* @param objid
* @return
*/
public int deleteTWTempertureDataByObjid(Long objid);
/**
*
*
* @param objids
* @return
*/
public int deleteTWTempertureDataByObjids(Long[] objids);
/**
*
* @param tWTempertureData
* @return
*/
List<TWTempertureData> selectIotInstantList(TWTempertureData tWTempertureData);
/**
*
* @param monitorId
* @return
*/
TWTempertureData selectIotInstantMinitoringData(String monitorId);
}

@ -0,0 +1,77 @@
package com.hw.ems.record.service;
import com.hw.ems.record.domain.TWTempertureData;
import java.util.List;
/**
* Service
*
* @author Caoql
* @date 2024-08-21
*/
public interface ITWTempertureDataService
{
/**
*
*
* @param objid
* @return
*/
public TWTempertureData selectTWTempertureDataByObjid(Long objid);
/**
*
*
* @param tWTempertureData
* @return
*/
public List<TWTempertureData> selectTWTempertureDataList(TWTempertureData tWTempertureData);
/**
*
*
* @param tWTempertureData
* @return
*/
public int insertTWTempertureData(TWTempertureData tWTempertureData);
/**
*
*
* @param tWTempertureData
* @return
*/
public int updateTWTempertureData(TWTempertureData tWTempertureData);
/**
*
*
* @param objids
* @return
*/
public int deleteTWTempertureDataByObjids(Long[] objids);
/**
*
*
* @param objid
* @return
*/
public int deleteTWTempertureDataByObjid(Long objid);
/**
*
* @param tWTempertureData
* @return
*/
List<TWTempertureData> selectIotInstantList(TWTempertureData tWTempertureData);
/**
*
* @param monitorId
* @return
*/
TWTempertureData selectIotInstantMinitoringData(String monitorId);
}

@ -0,0 +1,114 @@
package com.hw.ems.record.service.impl;
import com.hw.ems.record.domain.TWTempertureData;
import com.hw.ems.record.mapper.TWTempertureDataMapper;
import com.hw.ems.record.service.ITWTempertureDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Service
*
* @author Caoql
* @date 2024-08-21
*/
@Service
public class TWTempertureDataServiceImpl implements ITWTempertureDataService
{
@Autowired
private TWTempertureDataMapper tWTempertureDataMapper;
/**
*
*
* @param objid
* @return
*/
@Override
public TWTempertureData selectTWTempertureDataByObjid(Long objid)
{
return tWTempertureDataMapper.selectTWTempertureDataByObjid(objid);
}
/**
*
*
* @param tWTempertureData
* @return
*/
@Override
public List<TWTempertureData> selectTWTempertureDataList(TWTempertureData tWTempertureData)
{
return tWTempertureDataMapper.selectTWTempertureDataList(tWTempertureData);
}
/**
*
*
* @param tWTempertureData
* @return
*/
@Override
public int insertTWTempertureData(TWTempertureData tWTempertureData)
{
return tWTempertureDataMapper.insertTWTempertureData(tWTempertureData);
}
/**
*
*
* @param tWTempertureData
* @return
*/
@Override
public int updateTWTempertureData(TWTempertureData tWTempertureData)
{
return tWTempertureDataMapper.updateTWTempertureData(tWTempertureData);
}
/**
*
*
* @param objids
* @return
*/
@Override
public int deleteTWTempertureDataByObjids(Long[] objids)
{
return tWTempertureDataMapper.deleteTWTempertureDataByObjids(objids);
}
/**
*
*
* @param objid
* @return
*/
@Override
public int deleteTWTempertureDataByObjid(Long objid)
{
return tWTempertureDataMapper.deleteTWTempertureDataByObjid(objid);
}
/**
*
* @param tWTempertureData
* @return
*/
@Override
public List<TWTempertureData> selectIotInstantList(TWTempertureData tWTempertureData) {
return tWTempertureDataMapper.selectIotInstantList(tWTempertureData);
}
/**
*
* @param monitorId
* @return
*/
@Override
public TWTempertureData selectIotInstantMinitoringData(String monitorId) {
return tWTempertureDataMapper.selectIotInstantMinitoringData(monitorId);
}
}

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.ems.base.mapper.EmsBaseCollectDeviceInfoMapper">
<resultMap type="EmsBaseCollectDeviceInfo" id="EmsBaseCollectDeviceInfoResult">
<result property="objId" column="obj_id"/>
<result property="collectDeviceId" column="collect_device_id"/>
<result property="collectDeviceName" column="collect_device_name"/>
<result property="energyTypeId" column="energy_type_id"/>
<result property="energyTypeName" column="energy_name"/>
<result property="model" column="model"/>
<result property="manufacturer" column="manufacturer"/>
<result property="ipAddress" column="ip_address"/>
<result property="produceDate" column="produce_date"/>
<result property="settingAddress" column="setting_address"/>
<result property="isFlag" column="is_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectEmsBaseCollectDeviceInfoVo">
select ebcdi.collect_device_id,
ebcdi.collect_device_name,
ebcdi.energy_type_id,
ebet.energy_name,
ebcdi.model,
ebcdi.manufacturer,
ebcdi.ip_address,
ebcdi.produce_date,
ebcdi.setting_address,
ebcdi.is_flag,
ebcdi.create_by,
ebcdi.create_time,
ebcdi.update_by,
ebcdi.update_time,
ebcdi.remark
from ems_base_collect_device_info ebcdi
left join ems_base_energy_type ebet on ebcdi.energy_type_id = ebet.energy_type_id
</sql>
<select id="selectEmsBaseCollectDeviceInfoList" parameterType="EmsBaseCollectDeviceInfo"
resultMap="EmsBaseCollectDeviceInfoResult">
<include refid="selectEmsBaseCollectDeviceInfoVo"/>
<where>
<if test="collectDeviceId != null and collectDeviceId != ''">and ebcdi.collect_device_id = #{collectDeviceId}
</if>
<if test="collectDeviceName != null and collectDeviceName != ''">and ebcdi.collect_device_name like concat('%',
#{collectDeviceName}, '%')
</if>
<if test="energyTypeId != null ">and ebcdi.energy_type_id = #{energyTypeId}</if>
<if test="model != null and model != ''">and ebcdi.model = #{model}</if>
<if test="manufacturer != null and manufacturer != ''">and ebcdi.manufacturer = #{manufacturer}</if>
<if test="ipAddress != null and ipAddress != ''">and ebcdi.ip_address = #{ipAddress}</if>
<if test="produceDate != null ">and ebcdi.produce_date = #{produceDate}</if>
<if test="settingAddress != null and settingAddress != ''">and ebcdi.setting_address = #{settingAddress}</if>
<if test="isFlag != null and isFlag != ''">and ebcdi.is_flag = #{isFlag}</if>
</where>
</select>
<select id="selectEmsBaseCollectDeviceInfoByObjId" parameterType="Long" resultMap="EmsBaseCollectDeviceInfoResult">
<include refid="selectEmsBaseCollectDeviceInfoVo"/>
where ebcdi.obj_id = #{objId}
</select>
<insert id="insertEmsBaseCollectDeviceInfo" parameterType="EmsBaseCollectDeviceInfo" useGeneratedKeys="true"
keyProperty="objId">
insert into ems_base_collect_device_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="collectDeviceId != null">collect_device_id,</if>
<if test="collectDeviceName != null">collect_device_name,</if>
<if test="energyTypeId != null">energy_type_id,</if>
<if test="model != null">model,</if>
<if test="manufacturer != null">manufacturer,</if>
<if test="ipAddress != null">ip_address,</if>
<if test="produceDate != null">produce_date,</if>
<if test="settingAddress != null">setting_address,</if>
<if test="isFlag != null">is_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="collectDeviceId != null">#{collectDeviceId},</if>
<if test="collectDeviceName != null">#{collectDeviceName},</if>
<if test="energyTypeId != null">#{energyTypeId},</if>
<if test="model != null">#{model},</if>
<if test="manufacturer != null">#{manufacturer},</if>
<if test="ipAddress != null">#{ipAddress},</if>
<if test="produceDate != null">#{produceDate},</if>
<if test="settingAddress != null">#{settingAddress},</if>
<if test="isFlag != null">#{isFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateEmsBaseCollectDeviceInfo" parameterType="EmsBaseCollectDeviceInfo">
update ems_base_collect_device_info
<trim prefix="SET" suffixOverrides=",">
<if test="collectDeviceId != null">collect_device_id = #{collectDeviceId},</if>
<if test="collectDeviceName != null">collect_device_name = #{collectDeviceName},</if>
<if test="energyTypeId != null">energy_type_id = #{energyTypeId},</if>
<if test="model != null">model = #{model},</if>
<if test="manufacturer != null">manufacturer = #{manufacturer},</if>
<if test="ipAddress != null">ip_address = #{ipAddress},</if>
<if test="produceDate != null">produce_date = #{produceDate},</if>
<if test="settingAddress != null">setting_address = #{settingAddress},</if>
<if test="isFlag != null">is_flag = #{isFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteEmsBaseCollectDeviceInfoByObjId" parameterType="Long">
delete
from ems_base_collect_device_info
where obj_id = #{objId}
</delete>
<delete id="deleteEmsBaseCollectDeviceInfoByObjIds" parameterType="String">
delete from ems_base_collect_device_info where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.ems.base.mapper.EmsBaseEnergyTypeMapper">
<resultMap type="EmsBaseEnergyType" id="EmsBaseEnergyTypeResult">
<result property="objId" column="obj_id"/>
<result property="energyTypeId" column="energy_type_id"/>
<result property="energyName" column="energy_name"/>
<result property="measureUnit" column="measure_unit"/>
<result property="price" column="price"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectEmsBaseEnergyTypeVo">
select energy_type_id,
energy_name,
measure_unit,
price,
create_by,
create_time,
update_by,
update_time
from ems_base_energy_type
</sql>
<select id="selectEmsBaseEnergyTypeList" parameterType="EmsBaseEnergyType" resultMap="EmsBaseEnergyTypeResult">
<include refid="selectEmsBaseEnergyTypeVo"/>
<where>
<if test="energyTypeId != null ">and energy_type_id = #{energyTypeId}</if>
<if test="energyName != null and energyName != ''">and energy_name like concat('%', #{energyName}, '%')
</if>
<if test="measureUnit != null and measureUnit != ''">and measure_unit = #{measureUnit}</if>
<if test="price != null ">and price = #{price}</if>
</where>
</select>
<select id="selectEmsBaseEnergyTypeByObjId" parameterType="Long" resultMap="EmsBaseEnergyTypeResult">
<include refid="selectEmsBaseEnergyTypeVo"/>
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=",">
<if test="energyTypeId != null">energy_type_id,</if>
<if test="energyName != null">energy_name,</if>
<if test="measureUnit != null">measure_unit,</if>
<if test="price != null">price,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="energyTypeId != null">#{energyTypeId},</if>
<if test="energyName != null">#{energyName},</if>
<if test="measureUnit != null">#{measureUnit},</if>
<if test="price != null">#{price},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateEmsBaseEnergyType" parameterType="EmsBaseEnergyType">
update ems_base_energy_type
<trim prefix="SET" suffixOverrides=",">
<if test="energyTypeId != null">energy_type_id = #{energyTypeId},</if>
<if test="energyName != null">energy_name = #{energyName},</if>
<if test="measureUnit != null">measure_unit = #{measureUnit},</if>
<if test="price != null">price = #{price},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteEmsBaseEnergyTypeByObjId" parameterType="Long">
delete
from ems_base_energy_type
where obj_id = #{objId}
</delete>
<delete id="deleteEmsBaseEnergyTypeByObjIds" parameterType="String">
delete from ems_base_energy_type where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,174 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.ems.base.mapper.EmsBaseMonitorInfoMapper">
<resultMap type="EmsBaseMonitorInfo" id="EmsBaseMonitorInfoResult">
<result property="objId" column="obj_id" />
<result property="parentId" column="parent_id" />
<result property="monitorCode" column="monitor_code" />
<result property="monitorName" column="monitor_name" />
<result property="monitorAddr" column="monitor_addr" />
<result property="monitorType" column="monitor_type" />
<result property="monitorStatus" column="monitor_status" />
<result property="collectDeviceId" column="collect_device_id" />
<result property="ancestors" column="ancestors" />
<result property="grade" column="grade" />
<result property="meterTypeId" column="meter_type_id" />
<result property="correctValue" column="correct_value" />
<result property="pt" column="pt" />
<result property="ct" column="ct" />
<result property="isAmmeter" column="is_ammeter" />
<result property="isKeyMonitor" column="is_key_monitor" />
<result property="isCircuit" column="is_circuit" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="publicShareType" column="public_share_type" />
<result property="monitorHierarchy" column="monitor_hierarchy" />
</resultMap>
<sql id="selectEmsBaseMonitorInfoVo">
select obj_id, parent_id, monitor_code, monitor_name, monitor_addr, monitor_type, monitor_status, collect_device_id, ancestors, grade, meter_type_id, correct_value, pt, ct, is_ammeter, is_key_monitor, is_circuit, create_by, create_time, update_by, update_time, public_share_type, monitor_hierarchy from ems_base_monitor_info
</sql>
<select id="selectEmsBaseMonitorInfoList" parameterType="EmsBaseMonitorInfo" resultMap="EmsBaseMonitorInfoResult">
<include refid="selectEmsBaseMonitorInfoVo"/>
<where>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="monitorCode != null and monitorCode != ''"> and monitor_code = #{monitorCode}</if>
<if test="monitorName != null and monitorName != ''"> and monitor_name like concat('%', #{monitorName}, '%')</if>
<if test="monitorTypeList != null and monitorTypeList.size > 0">
and monitor_type IN
<foreach item="monitorId" collection="monitorTypeList" open="(" separator="," close=")">
#{monitorId}
</foreach>
</if>
<if test="monitorAddr != null and monitorAddr != ''"> and monitor_addr = #{monitorAddr}</if>
<if test="monitorType != null "> and monitor_type = #{monitorType}</if>
<if test="monitorStatus != null "> and monitor_status = #{monitorStatus}</if>
<if test="collectDeviceId != null and collectDeviceId != ''"> and collect_device_id = #{collectDeviceId}</if>
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
<if test="grade != null "> and grade = #{grade}</if>
<if test="meterTypeId != null and meterTypeId != ''"> and meter_type_id = #{meterTypeId}</if>
<if test="correctValue != null "> and correct_value = #{correctValue}</if>
<if test="pt != null "> and pt = #{pt}</if>
<if test="ct != null "> and ct = #{ct}</if>
<if test="isAmmeter != null and isAmmeter != ''"> and is_ammeter = #{isAmmeter}</if>
<if test="isKeyMonitor != null "> and is_key_monitor = #{isKeyMonitor}</if>
<if test="isCircuit != null "> and is_circuit = #{isCircuit}</if>
<if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy}</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="publicShareType != null "> and public_share_type = #{publicShareType}</if>
<if test="monitorHierarchy != null "> and monitor_hierarchy = #{monitorHierarchy}</if>
</where>
</select>
<select id="selectEmsBaseMonitorInfoByObjId" parameterType="Long" resultMap="EmsBaseMonitorInfoResult">
<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=",">
<if test="parentId != null">parent_id,</if>
<if test="monitorCode != null and monitorCode != ''">monitor_code,</if>
<if test="monitorName != null">monitor_name,</if>
<if test="monitorAddr != null">monitor_addr,</if>
<if test="monitorType != null">monitor_type,</if>
<if test="monitorStatus != null">monitor_status,</if>
<if test="collectDeviceId != null">collect_device_id,</if>
<if test="ancestors != null">ancestors,</if>
<if test="grade != null">grade,</if>
<if test="meterTypeId != null">meter_type_id,</if>
<if test="correctValue != null">correct_value,</if>
<if test="pt != null">pt,</if>
<if test="ct != null">ct,</if>
<if test="isAmmeter != null">is_ammeter,</if>
<if test="isKeyMonitor != null">is_key_monitor,</if>
<if test="isCircuit != null">is_circuit,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="publicShareType != null">public_share_type,</if>
<if test="monitorHierarchy != null">monitor_hierarchy,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
<if test="monitorCode != null and monitorCode != ''">#{monitorCode},</if>
<if test="monitorName != null">#{monitorName},</if>
<if test="monitorAddr != null">#{monitorAddr},</if>
<if test="monitorType != null">#{monitorType},</if>
<if test="monitorStatus != null">#{monitorStatus},</if>
<if test="collectDeviceId != null">#{collectDeviceId},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="grade != null">#{grade},</if>
<if test="meterTypeId != null">#{meterTypeId},</if>
<if test="correctValue != null">#{correctValue},</if>
<if test="pt != null">#{pt},</if>
<if test="ct != null">#{ct},</if>
<if test="isAmmeter != null">#{isAmmeter},</if>
<if test="isKeyMonitor != null">#{isKeyMonitor},</if>
<if test="isCircuit != null">#{isCircuit},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="publicShareType != null">#{publicShareType},</if>
<if test="monitorHierarchy != null">#{monitorHierarchy},</if>
</trim>
</insert>
<update id="updateEmsBaseMonitorInfo" parameterType="EmsBaseMonitorInfo">
update ems_base_monitor_info
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="monitorCode != null and monitorCode != ''">monitor_code = #{monitorCode},</if>
<if test="monitorName != null">monitor_name = #{monitorName},</if>
<if test="monitorAddr != null">monitor_addr = #{monitorAddr},</if>
<if test="monitorType != null">monitor_type = #{monitorType},</if>
<if test="monitorStatus != null">monitor_status = #{monitorStatus},</if>
<if test="collectDeviceId != null">collect_device_id = #{collectDeviceId},</if>
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="grade != null">grade = #{grade},</if>
<if test="meterTypeId != null">meter_type_id = #{meterTypeId},</if>
<if test="correctValue != null">correct_value = #{correctValue},</if>
<if test="pt != null">pt = #{pt},</if>
<if test="ct != null">ct = #{ct},</if>
<if test="isAmmeter != null">is_ammeter = #{isAmmeter},</if>
<if test="isKeyMonitor != null">is_key_monitor = #{isKeyMonitor},</if>
<if test="isCircuit != null">is_circuit = #{isCircuit},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="publicShareType != null">public_share_type = #{publicShareType},</if>
<if test="monitorHierarchy != null">monitor_hierarchy = #{monitorHierarchy},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteEmsBaseMonitorInfoByObjId" parameterType="Long">
delete from ems_base_monitor_info where obj_id = #{objId}
</delete>
<delete id="deleteEmsBaseMonitorInfoByObjIds" parameterType="String">
delete from ems_base_monitor_info where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.ems.record.mapper.TWTempertureDataMapper">
<resultMap type="TWTempertureData" id="TWTempertureDataResult">
<result property="objid" column="objid" />
<result property="monitorId" column="monitorId" />
<result property="collectTime" column="collectTime" />
<result property="tempreture" column="tempreture" />
<result property="humidity" column="humidity" />
<result property="illuminance" column="illuminance" />
<result property="noise" column="noise" />
<result property="concentration" column="concentration" />
<result property="recodeTime" column="recodeTime" />
<result property="alarmType" column="alarmType" />
<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 twtd.objid,
twtd.monitorId,
twtd.collectTime,
twtd.tempreture,
twtd.humidity,
twtd.illuminance,
twtd.noise,
twtd.concentration,
twtd.recodeTime,
twtd.pm1,
twtd.pm2,
twtd.pm10,
twtd.standBy,
-- twtd.alarmType,
-- twtd.confirmPersonID,
-- twtd.confirmTime,
-- twtd.confirmFlag,
ebmi.monitor_name
from record_iotenv_instant 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 twtd.monitorId = #{monitorId}</if>
<if test="params.beginCollectTime != null and params.beginCollectTime != '' and params.endCollectTime != null and params.endCollectTime != ''">
and twtd.collectTime between #{params.beginCollectTime} and #{params.endCollectTime}
</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="params.beginRecordTime != null and params.beginRecordTime != '' and params.endRecordTime != null and params.endRecordTime != ''">
and twtd.recodeTime between #{params.beginRecordTime} and #{params.endRecordTime}
</if>
<if test="confirmFlag != null "> and twtd.confirmFlag = #{confirmFlag}</if>
</where>
order by twtd.recodeTime desc
</select>
<select id="selectTWTempertureDataByObjid" parameterType="Long" resultMap="TWTempertureDataResult">
<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>
<select id="selectIotInstantMinitoringData" parameterType="TWTempertureData" resultMap="TWTempertureDataResult">
<include refid="selectTWTempertureDataVo"></include>
<where>
<if test="monitorId != null and monitorId != ''"> and twtd.monitorId = #{monitorId}</if>
</where>
order by twtd.recordTime desc
</select>
<insert id="insertTWTempertureData" parameterType="TWTempertureData" useGeneratedKeys="true" keyProperty="objid">
insert into T_W_TempertureData
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="monitorId != null">monitorId,</if>
<if test="collectTime != null">collectTime,</if>
<if test="tempreture != null">tempreture,</if>
<if test="humidity != null">humidity,</if>
<if test="illuminance != null">illuminance,</if>
<if test="noise != null">noise,</if>
<if test="concentration != null">concentration,</if>
<if test="recodeTime != null">recodeTime,</if>
<if test="alarmType != null">alarmType,</if>
<if test="confirmPersonID != null">confirmPersonID,</if>
<if test="confirmTime != null">confirmTime,</if>
<if test="confirmFlag != null">confirmFlag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="monitorId != null">#{monitorId},</if>
<if test="collectTime != null">#{collectTime},</if>
<if test="tempreture != null">#{tempreture},</if>
<if test="humidity != null">#{humidity},</if>
<if test="illuminance != null">#{illuminance},</if>
<if test="noise != null">#{noise},</if>
<if test="concentration != null">#{concentration},</if>
<if test="recodeTime != null">#{recodeTime},</if>
<if test="alarmType != null">#{alarmType},</if>
<if test="confirmPersonID != null">#{confirmPersonID},</if>
<if test="confirmTime != null">#{confirmTime},</if>
<if test="confirmFlag != null">#{confirmFlag},</if>
</trim>
</insert>
<update id="updateTWTempertureData" parameterType="TWTempertureData">
update T_W_TempertureData
<trim prefix="SET" suffixOverrides=",">
<if test="monitorId != null">monitorId = #{monitorId},</if>
<if test="collectTime != null">collectTime = #{collectTime},</if>
<if test="tempreture != null">tempreture = #{tempreture},</if>
<if test="humidity != null">humidity = #{humidity},</if>
<if test="illuminance != null">illuminance = #{illuminance},</if>
<if test="noise != null">noise = #{noise},</if>
<if test="concentration != null">concentration = #{concentration},</if>
<if test="recodeTime != null">recodeTime = #{recodeTime},</if>
<if test="alarmType != null">alarmType = #{alarmType},</if>
<if test="confirmPersonID != null">confirmPersonID = #{confirmPersonID},</if>
<if test="confirmTime != null">confirmTime = #{confirmTime},</if>
<if test="confirmFlag != null">confirmFlag = #{confirmFlag},</if>
</trim>
where objid = #{objid}
</update>
<delete id="deleteTWTempertureDataByObjid" parameterType="Long">
delete from T_W_TempertureData where objid = #{objid}
</delete>
<delete id="deleteTWTempertureDataByObjids" parameterType="String">
delete from T_W_TempertureData where objid in
<foreach item="objid" collection="array" open="(" separator="," close=")">
#{objid}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save