diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed8368a --- /dev/null +++ b/.gitignore @@ -0,0 +1,47 @@ +###################################################################### +# Build Tools + +.gradle +/build/ +!gradle/wrapper/gradle-wrapper.jar + +target/ +!.mvn/wrapper/maven-wrapper.jar + +###################################################################### +# IDE + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### JRebel ### +rebel.xml + +### NetBeans ### +nbproject/private/ +build/* +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ + +###################################################################### +# Others +*.log +*.xml.versionsBackup +*.swp + +!*/build/*.java +!*/build/*.html +!*/build/*.xml diff --git a/agri-system/src/main/java/com/agri/system/controller/SysDtuDataController.java b/agri-system/src/main/java/com/agri/system/controller/SysDtuDataController.java new file mode 100644 index 0000000..13fbd91 --- /dev/null +++ b/agri-system/src/main/java/com/agri/system/controller/SysDtuDataController.java @@ -0,0 +1,104 @@ +package com.agri.system.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.agri.common.annotation.Log; +import com.agri.common.core.controller.BaseController; +import com.agri.common.core.domain.AjaxResult; +import com.agri.common.enums.BusinessType; +import com.agri.system.domain.SysDtuData; +import com.agri.system.service.ISysDtuDataService; +import com.agri.common.utils.poi.ExcelUtil; +import com.agri.common.core.page.TableDataInfo; + +/** + * DTU温湿度上报数据Controller + * + * @author agri + * @date 2025-12-23 + */ +@RestController +@RequestMapping("/system/data") +public class SysDtuDataController extends BaseController +{ + @Autowired + private ISysDtuDataService sysDtuDataService; + + /** + * 查询DTU温湿度上报数据列表 + */ + @PreAuthorize("@ss.hasPermi('system:data:list')") + @GetMapping("/list") + public TableDataInfo list(SysDtuData sysDtuData) + { + startPage(); + List list = sysDtuDataService.selectSysDtuDataList(sysDtuData); + return getDataTable(list); + } + + /** + * 导出DTU温湿度上报数据列表 + */ + @PreAuthorize("@ss.hasPermi('system:data:export')") + @Log(title = "DTU温湿度上报数据", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysDtuData sysDtuData) + { + List list = sysDtuDataService.selectSysDtuDataList(sysDtuData); + ExcelUtil util = new ExcelUtil(SysDtuData.class); + util.exportExcel(response, list, "DTU温湿度上报数据数据"); + } + + /** + * 获取DTU温湿度上报数据详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:data:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(sysDtuDataService.selectSysDtuDataById(id)); + } + + /** + * 新增DTU温湿度上报数据 + */ + @PreAuthorize("@ss.hasPermi('system:data:add')") + @Log(title = "DTU温湿度上报数据", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysDtuData sysDtuData) + { + return toAjax(sysDtuDataService.insertSysDtuData(sysDtuData)); + } + + /** + * 修改DTU温湿度上报数据 + */ + @PreAuthorize("@ss.hasPermi('system:data:edit')") + @Log(title = "DTU温湿度上报数据", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysDtuData sysDtuData) + { + return toAjax(sysDtuDataService.updateSysDtuData(sysDtuData)); + } + + /** + * 删除DTU温湿度上报数据 + */ + @PreAuthorize("@ss.hasPermi('system:data:remove')") + @Log(title = "DTU温湿度上报数据", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(sysDtuDataService.deleteSysDtuDataByIds(ids)); + } +} diff --git a/agri-system/src/main/java/com/agri/system/domain/SysDtuData.java b/agri-system/src/main/java/com/agri/system/domain/SysDtuData.java new file mode 100644 index 0000000..8d3dd79 --- /dev/null +++ b/agri-system/src/main/java/com/agri/system/domain/SysDtuData.java @@ -0,0 +1,223 @@ +package com.agri.system.domain; + +import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.agri.common.annotation.Excel; +import com.agri.common.core.domain.BaseEntity; + +/** + * DTU温湿度上报数据对象 sys_dtu_data + * + * @author agri + * @date 2025-12-23 + */ +public class SysDtuData extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键ID */ + private Long id; + + /** 设备唯一标识(IMEI/DeviceId) */ + @Excel(name = "设备唯一标识(IMEI/DeviceId)") + private String imei; + + /** 设备上报时间戳(ms或s,建议统一ms) */ + @Excel(name = "设备上报时间戳(ms或s,建议统一ms)") + private Long ts; + + /** ts转换后的正常时间(由服务端转换入库) */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "ts转换后的正常时间(由服务端转换入库)", width = 30, dateFormat = "yyyy-MM-dd") + private Date time; + + /** 温度1(℃) */ + @Excel(name = "温度1(℃)") + private BigDecimal temp1; + + /** 湿度1(%RH) */ + @Excel(name = "湿度1(%RH)") + private BigDecimal humi1; + + /** 温度2(℃) */ + @Excel(name = "温度2(℃)") + private BigDecimal temp2; + + /** 湿度2(%RH) */ + @Excel(name = "湿度2(%RH)") + private BigDecimal humi2; + + /** 温度3(℃) */ + @Excel(name = "温度3(℃)") + private BigDecimal temp3; + + /** 湿度3(%RH) */ + @Excel(name = "湿度3(%RH)") + private BigDecimal humi3; + + /** 温度4(℃) */ + @Excel(name = "温度4(℃)") + private BigDecimal temp4; + + /** 湿度4(%RH) */ + @Excel(name = "湿度4(%RH)") + private BigDecimal humi4; + + /** 原始JSON元信息(原始上报码/额外字段) */ + @Excel(name = "原始JSON元信息(原始上报码/额外字段)") + private String raw; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setImei(String imei) + { + this.imei = imei; + } + + public String getImei() + { + return imei; + } + + public void setTs(Long ts) + { + this.ts = ts; + } + + public Long getTs() + { + return ts; + } + + public void setTime(Date time) + { + this.time = time; + } + + public Date getTime() + { + return time; + } + + public void setTemp1(BigDecimal temp1) + { + this.temp1 = temp1; + } + + public BigDecimal getTemp1() + { + return temp1; + } + + public void setHumi1(BigDecimal humi1) + { + this.humi1 = humi1; + } + + public BigDecimal getHumi1() + { + return humi1; + } + + public void setTemp2(BigDecimal temp2) + { + this.temp2 = temp2; + } + + public BigDecimal getTemp2() + { + return temp2; + } + + public void setHumi2(BigDecimal humi2) + { + this.humi2 = humi2; + } + + public BigDecimal getHumi2() + { + return humi2; + } + + public void setTemp3(BigDecimal temp3) + { + this.temp3 = temp3; + } + + public BigDecimal getTemp3() + { + return temp3; + } + + public void setHumi3(BigDecimal humi3) + { + this.humi3 = humi3; + } + + public BigDecimal getHumi3() + { + return humi3; + } + + public void setTemp4(BigDecimal temp4) + { + this.temp4 = temp4; + } + + public BigDecimal getTemp4() + { + return temp4; + } + + public void setHumi4(BigDecimal humi4) + { + this.humi4 = humi4; + } + + public BigDecimal getHumi4() + { + return humi4; + } + + public void setRaw(String raw) + { + this.raw = raw; + } + + public String getRaw() + { + return raw; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("imei", getImei()) + .append("ts", getTs()) + .append("time", getTime()) + .append("temp1", getTemp1()) + .append("humi1", getHumi1()) + .append("temp2", getTemp2()) + .append("humi2", getHumi2()) + .append("temp3", getTemp3()) + .append("humi3", getHumi3()) + .append("temp4", getTemp4()) + .append("humi4", getHumi4()) + .append("raw", getRaw()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .toString(); + } +} diff --git a/agri-system/src/main/java/com/agri/system/mapper/SysDtuDataMapper.java b/agri-system/src/main/java/com/agri/system/mapper/SysDtuDataMapper.java new file mode 100644 index 0000000..4d8afd3 --- /dev/null +++ b/agri-system/src/main/java/com/agri/system/mapper/SysDtuDataMapper.java @@ -0,0 +1,61 @@ +package com.agri.system.mapper; + +import java.util.List; +import com.agri.system.domain.SysDtuData; + +/** + * DTU温湿度上报数据Mapper接口 + * + * @author agri + * @date 2025-12-23 + */ +public interface SysDtuDataMapper +{ + /** + * 查询DTU温湿度上报数据 + * + * @param id DTU温湿度上报数据主键 + * @return DTU温湿度上报数据 + */ + public SysDtuData selectSysDtuDataById(Long id); + + /** + * 查询DTU温湿度上报数据列表 + * + * @param sysDtuData DTU温湿度上报数据 + * @return DTU温湿度上报数据集合 + */ + public List selectSysDtuDataList(SysDtuData sysDtuData); + + /** + * 新增DTU温湿度上报数据 + * + * @param sysDtuData DTU温湿度上报数据 + * @return 结果 + */ + public int insertSysDtuData(SysDtuData sysDtuData); + + /** + * 修改DTU温湿度上报数据 + * + * @param sysDtuData DTU温湿度上报数据 + * @return 结果 + */ + public int updateSysDtuData(SysDtuData sysDtuData); + + /** + * 删除DTU温湿度上报数据 + * + * @param id DTU温湿度上报数据主键 + * @return 结果 + */ + public int deleteSysDtuDataById(Long id); + + /** + * 批量删除DTU温湿度上报数据 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSysDtuDataByIds(Long[] ids); +} diff --git a/agri-system/src/main/java/com/agri/system/service/ISysDtuDataService.java b/agri-system/src/main/java/com/agri/system/service/ISysDtuDataService.java new file mode 100644 index 0000000..ca5992f --- /dev/null +++ b/agri-system/src/main/java/com/agri/system/service/ISysDtuDataService.java @@ -0,0 +1,61 @@ +package com.agri.system.service; + +import java.util.List; +import com.agri.system.domain.SysDtuData; + +/** + * DTU温湿度上报数据Service接口 + * + * @author agri + * @date 2025-12-23 + */ +public interface ISysDtuDataService +{ + /** + * 查询DTU温湿度上报数据 + * + * @param id DTU温湿度上报数据主键 + * @return DTU温湿度上报数据 + */ + public SysDtuData selectSysDtuDataById(Long id); + + /** + * 查询DTU温湿度上报数据列表 + * + * @param sysDtuData DTU温湿度上报数据 + * @return DTU温湿度上报数据集合 + */ + public List selectSysDtuDataList(SysDtuData sysDtuData); + + /** + * 新增DTU温湿度上报数据 + * + * @param sysDtuData DTU温湿度上报数据 + * @return 结果 + */ + public int insertSysDtuData(SysDtuData sysDtuData); + + /** + * 修改DTU温湿度上报数据 + * + * @param sysDtuData DTU温湿度上报数据 + * @return 结果 + */ + public int updateSysDtuData(SysDtuData sysDtuData); + + /** + * 批量删除DTU温湿度上报数据 + * + * @param ids 需要删除的DTU温湿度上报数据主键集合 + * @return 结果 + */ + public int deleteSysDtuDataByIds(Long[] ids); + + /** + * 删除DTU温湿度上报数据信息 + * + * @param id DTU温湿度上报数据主键 + * @return 结果 + */ + public int deleteSysDtuDataById(Long id); +} diff --git a/agri-system/src/main/java/com/agri/system/service/impl/SysDtuDataServiceImpl.java b/agri-system/src/main/java/com/agri/system/service/impl/SysDtuDataServiceImpl.java new file mode 100644 index 0000000..7bd0d83 --- /dev/null +++ b/agri-system/src/main/java/com/agri/system/service/impl/SysDtuDataServiceImpl.java @@ -0,0 +1,95 @@ +package com.agri.system.service.impl; + +import java.util.List; +import com.agri.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.agri.system.mapper.SysDtuDataMapper; +import com.agri.system.domain.SysDtuData; +import com.agri.system.service.ISysDtuDataService; + +/** + * DTU温湿度上报数据Service业务层处理 + * + * @author agri + * @date 2025-12-23 + */ +@Service +public class SysDtuDataServiceImpl implements ISysDtuDataService +{ + @Autowired + private SysDtuDataMapper sysDtuDataMapper; + + /** + * 查询DTU温湿度上报数据 + * + * @param id DTU温湿度上报数据主键 + * @return DTU温湿度上报数据 + */ + @Override + public SysDtuData selectSysDtuDataById(Long id) + { + return sysDtuDataMapper.selectSysDtuDataById(id); + } + + /** + * 查询DTU温湿度上报数据列表 + * + * @param sysDtuData DTU温湿度上报数据 + * @return DTU温湿度上报数据 + */ + @Override + public List selectSysDtuDataList(SysDtuData sysDtuData) + { + return sysDtuDataMapper.selectSysDtuDataList(sysDtuData); + } + + /** + * 新增DTU温湿度上报数据 + * + * @param sysDtuData DTU温湿度上报数据 + * @return 结果 + */ + @Override + public int insertSysDtuData(SysDtuData sysDtuData) + { + sysDtuData.setCreateTime(DateUtils.getNowDate()); + return sysDtuDataMapper.insertSysDtuData(sysDtuData); + } + + /** + * 修改DTU温湿度上报数据 + * + * @param sysDtuData DTU温湿度上报数据 + * @return 结果 + */ + @Override + public int updateSysDtuData(SysDtuData sysDtuData) + { + return sysDtuDataMapper.updateSysDtuData(sysDtuData); + } + + /** + * 批量删除DTU温湿度上报数据 + * + * @param ids 需要删除的DTU温湿度上报数据主键 + * @return 结果 + */ + @Override + public int deleteSysDtuDataByIds(Long[] ids) + { + return sysDtuDataMapper.deleteSysDtuDataByIds(ids); + } + + /** + * 删除DTU温湿度上报数据信息 + * + * @param id DTU温湿度上报数据主键 + * @return 结果 + */ + @Override + public int deleteSysDtuDataById(Long id) + { + return sysDtuDataMapper.deleteSysDtuDataById(id); + } +} diff --git a/agri-system/src/main/resources/mapper/system/SysDtuDataMapper.xml b/agri-system/src/main/resources/mapper/system/SysDtuDataMapper.xml new file mode 100644 index 0000000..5da14aa --- /dev/null +++ b/agri-system/src/main/resources/mapper/system/SysDtuDataMapper.xml @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + select id, imei, ts, time, temp1, humi1, temp2, humi2, temp3, humi3, temp4, humi4, raw, create_by, create_time from sys_dtu_data + + + + + + + + insert into sys_dtu_data + + imei, + ts, + time, + temp1, + humi1, + temp2, + humi2, + temp3, + humi3, + temp4, + humi4, + raw, + create_by, + create_time, + + + #{imei}, + #{ts}, + #{time}, + #{temp1}, + #{humi1}, + #{temp2}, + #{humi2}, + #{temp3}, + #{humi3}, + #{temp4}, + #{humi4}, + #{raw}, + #{createBy}, + #{createTime}, + + + + + update sys_dtu_data + + imei = #{imei}, + ts = #{ts}, + time = #{time}, + temp1 = #{temp1}, + humi1 = #{humi1}, + temp2 = #{temp2}, + humi2 = #{humi2}, + temp3 = #{temp3}, + humi3 = #{humi3}, + temp4 = #{temp4}, + humi4 = #{humi4}, + raw = #{raw}, + create_by = #{createBy}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from sys_dtu_data where id = #{id} + + + + delete from sys_dtu_data where id in + + #{id} + + + \ No newline at end of file