Explorar o código

设备闹钟信息显示

zhengjie hai 1 ano
pai
achega
9c5b2a4dfc

+ 12 - 16
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TDataDisplayController.java

@@ -1,26 +1,18 @@
 package com.ruoyi.web.controller.system;
 
 import com.alibaba.fastjson.JSONObject;
-import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysDictData;
 import com.ruoyi.common.core.page.TableDataInfo;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.LocationUtils;
 import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.system.domain.TShouhuanAlarmList;
-import com.ruoyi.system.domain.TSosSolve;
 import com.ruoyi.system.domain.dto.*;
 import com.ruoyi.system.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
-import javax.servlet.http.HttpServletResponse;
 import java.text.NumberFormat;
-import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -47,6 +39,9 @@ public class TDataDisplayController extends BaseController
     @Autowired
     private ITUserProfileService userProfileService;
 
+    @Autowired
+    private ISysDictDataService sysDictDataService;
+
     @Autowired
     private LocationUtils locationUtils;
 
@@ -300,13 +295,14 @@ public class TDataDisplayController extends BaseController
     }
 
     public String checkDeviceType(Integer device_model){
-        switch (device_model){
-            case 0:
-                return "S8";
-            case 1:
-                return "X5";
-            default:
-                return "无效";
+        SysDictData date = new SysDictData();
+        date.setDictType("sys_device_type");
+        List<SysDictData> selectDictDataList = sysDictDataService.selectDictDataList(date);
+        for (SysDictData sysDictData : selectDictDataList){
+            if (device_model == Integer.parseInt(sysDictData.getDictValue())){
+                return sysDictData.getDictLabel();
+            }
         }
+        return "null";
     }
 }

+ 98 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TDeviceClockController.java

@@ -0,0 +1,98 @@
+package com.ruoyi.web.controller.system;
+
+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.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.domain.TDeviceClock;
+import com.ruoyi.system.service.ITDeviceClockService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 设备设置闹钟Controller
+ * 
+ * @author zhengjie
+ * @date 2023-09-20
+ */
+@RestController
+@RequestMapping("/system/deviceclock")
+public class TDeviceClockController extends BaseController
+{
+    @Autowired
+    private ITDeviceClockService tDeviceClockService;
+
+    /**
+     * 查询设备设置闹钟列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(TDeviceClock tDeviceClock)
+    {
+        startPage();
+        List<TDeviceClock> list = tDeviceClockService.selectTDeviceClockList(tDeviceClock);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出设备设置闹钟列表
+     */
+    @Log(title = "设备设置闹钟", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, TDeviceClock tDeviceClock)
+    {
+        List<TDeviceClock> list = tDeviceClockService.selectTDeviceClockList(tDeviceClock);
+        ExcelUtil<TDeviceClock> util = new ExcelUtil<TDeviceClock>(TDeviceClock.class);
+        util.exportExcel(response, list, "设备设置闹钟数据");
+    }
+
+    /**
+     * 获取设备设置闹钟详细信息
+     */
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Integer id)
+    {
+        return success(tDeviceClockService.selectTDeviceClockById(id));
+    }
+
+    /**
+     * 新增设备设置闹钟
+     */
+    @Log(title = "设备设置闹钟", businessType = BusinessType.INSERT)
+    @RequestMapping("/clockAdd")
+    public AjaxResult add(@RequestBody List<TDeviceClock> tDeviceClock)
+    {
+        return toAjax(tDeviceClockService.insertTDeviceClock(tDeviceClock));
+    }
+
+    /**
+     * 修改设备设置闹钟
+     */
+    @Log(title = "设备设置闹钟", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TDeviceClock tDeviceClock)
+    {
+        return toAjax(tDeviceClockService.updateTDeviceClock(tDeviceClock));
+    }
+
+    /**
+     * 删除设备设置闹钟
+     */
+    @Log(title = "设备设置闹钟", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Integer[] ids)
+    {
+        return toAjax(tDeviceClockService.deleteTDeviceClockByIds(ids));
+    }
+}

+ 0 - 7
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TDeviceSetController.java

@@ -2,7 +2,6 @@ package com.ruoyi.web.controller.system;
 
 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;
@@ -37,7 +36,6 @@ public class TDeviceSetController extends BaseController
     /**
      * 查询设备设置列表
      */
-    @PreAuthorize("@ss.hasPermi('system:deviceset:list')")
     @GetMapping("/list")
     public TableDataInfo list(TDeviceSet tDeviceSet)
     {
@@ -49,7 +47,6 @@ public class TDeviceSetController extends BaseController
     /**
      * 导出设备设置列表
      */
-    @PreAuthorize("@ss.hasPermi('system:deviceset:export')")
     @Log(title = "设备设置", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     public void export(HttpServletResponse response, TDeviceSet tDeviceSet)
@@ -62,7 +59,6 @@ public class TDeviceSetController extends BaseController
     /**
      * 获取设备设置详细信息
      */
-    @PreAuthorize("@ss.hasPermi('system:deviceset:query')")
     @GetMapping(value = "/{id}")
     public AjaxResult getInfo(@PathVariable("id") Integer id)
     {
@@ -72,7 +68,6 @@ public class TDeviceSetController extends BaseController
     /**
      * 新增设备设置
      */
-    @PreAuthorize("@ss.hasPermi('system:deviceset:add')")
     @Log(title = "设备设置", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody TDeviceSet tDeviceSet)
@@ -83,7 +78,6 @@ public class TDeviceSetController extends BaseController
     /**
      * 修改设备设置
      */
-    @PreAuthorize("@ss.hasPermi('system:deviceset:edit')")
     @Log(title = "设备设置", businessType = BusinessType.UPDATE)
     @PutMapping
     public AjaxResult edit(@RequestBody TDeviceSet tDeviceSet)
@@ -94,7 +88,6 @@ public class TDeviceSetController extends BaseController
     /**
      * 删除设备设置
      */
-    @PreAuthorize("@ss.hasPermi('system:deviceset:remove')")
     @Log(title = "设备设置", businessType = BusinessType.DELETE)
 	@DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable Integer[] ids)

+ 107 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/TDeviceClock.java

@@ -0,0 +1,107 @@
+package com.ruoyi.system.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 设备设置闹钟对象 t_device_clock
+ * 
+ * @author zhengjie
+ * @date 2023-09-20
+ */
+public class TDeviceClock extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private Integer id;
+
+    /** 设置id编码 */
+    @Excel(name = "设置id编码")
+    private String deviceIdCode;
+
+    /** 闹钟名称 */
+    @Excel(name = "闹钟名称")
+    private String alarmClock;
+
+    /** 闹钟时间 */
+    @Excel(name = "闹钟时间")
+    private String clockTime;
+
+    /** 闹钟使用 1使用 0未使用 */
+    @Excel(name = "闹钟使用 1使用 0未使用")
+    private Integer clockUse;
+
+    /** 闹钟星期 */
+    @Excel(name = "闹钟星期")
+    private String clockWeek;
+
+    public void setId(Integer id) 
+    {
+        this.id = id;
+    }
+
+    public Integer getId() 
+    {
+        return id;
+    }
+    public void setDeviceIdCode(String deviceIdCode) 
+    {
+        this.deviceIdCode = deviceIdCode;
+    }
+
+    public String getDeviceIdCode() 
+    {
+        return deviceIdCode;
+    }
+    public void setAlarmClock(String alarmClock) 
+    {
+        this.alarmClock = alarmClock;
+    }
+
+    public String getAlarmClock() 
+    {
+        return alarmClock;
+    }
+    public void setClockTime(String clockTime) 
+    {
+        this.clockTime = clockTime;
+    }
+
+    public String getClockTime() 
+    {
+        return clockTime;
+    }
+    public void setClockUse(Integer clockUse) 
+    {
+        this.clockUse = clockUse;
+    }
+
+    public Integer getClockUse() 
+    {
+        return clockUse;
+    }
+    public void setClockWeek(String clockWeek) 
+    {
+        this.clockWeek = clockWeek;
+    }
+
+    public String getClockWeek() 
+    {
+        return clockWeek;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("deviceIdCode", getDeviceIdCode())
+            .append("alarmClock", getAlarmClock())
+            .append("clockTime", getClockTime())
+            .append("clockUse", getClockUse())
+            .append("clockWeek", getClockWeek())
+            .toString();
+    }
+}

+ 69 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TDeviceClockMapper.java

@@ -0,0 +1,69 @@
+package com.ruoyi.system.mapper;
+
+import java.util.List;
+import com.ruoyi.system.domain.TDeviceClock;
+
+/**
+ * 设备设置闹钟Mapper接口
+ * 
+ * @author zhengjie
+ * @date 2023-09-20
+ */
+public interface TDeviceClockMapper 
+{
+    /**
+     * 查询设备设置闹钟
+     * 
+     * @param id 设备设置闹钟主键
+     * @return 设备设置闹钟
+     */
+    public TDeviceClock selectTDeviceClockById(Integer id);
+
+    /**
+     * 查询设备设置闹钟
+     *
+     * @param deviceIdCode 设备设置号
+     * @return 设备设置闹钟
+     */
+    public TDeviceClock selectTDeviceClockByCode(String deviceIdCode);
+
+    /**
+     * 查询设备设置闹钟列表
+     * 
+     * @param tDeviceClock 设备设置闹钟
+     * @return 设备设置闹钟集合
+     */
+    public List<TDeviceClock> selectTDeviceClockList(TDeviceClock tDeviceClock);
+
+    /**
+     * 新增设备设置闹钟
+     * 
+     * @param tDeviceClock 设备设置闹钟
+     * @return 结果
+     */
+    public int insertTDeviceClock(TDeviceClock tDeviceClock);
+
+    /**
+     * 修改设备设置闹钟
+     * 
+     * @param tDeviceClock 设备设置闹钟
+     * @return 结果
+     */
+    public int updateTDeviceClock(TDeviceClock tDeviceClock);
+
+    /**
+     * 删除设备设置闹钟
+     * 
+     * @param id 设备设置闹钟主键
+     * @return 结果
+     */
+    public int deleteTDeviceClockById(Integer id);
+
+    /**
+     * 批量删除设备设置闹钟
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteTDeviceClockByIds(Integer[] ids);
+}

+ 69 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ITDeviceClockService.java

@@ -0,0 +1,69 @@
+package com.ruoyi.system.service;
+
+import java.util.List;
+import com.ruoyi.system.domain.TDeviceClock;
+
+/**
+ * 设备设置闹钟Service接口
+ * 
+ * @author zhengjie
+ * @date 2023-09-20
+ */
+public interface ITDeviceClockService 
+{
+    /**
+     * 查询设备设置闹钟
+     * 
+     * @param id 设备设置闹钟主键
+     * @return 设备设置闹钟
+     */
+    public TDeviceClock selectTDeviceClockById(Integer id);
+
+    /**
+     * 查询设备设置闹钟
+     *
+     * @param deviceIdCode 设备设置号
+     * @return 设备设置闹钟
+     */
+    public TDeviceClock selectTDeviceClockByCode(String deviceIdCode);
+
+    /**
+     * 查询设备设置闹钟列表
+     * 
+     * @param tDeviceClock 设备设置闹钟
+     * @return 设备设置闹钟集合
+     */
+    public List<TDeviceClock> selectTDeviceClockList(TDeviceClock tDeviceClock);
+
+    /**
+     * 新增设备设置闹钟
+     * 
+     * @param tDeviceClock 设备设置闹钟
+     * @return 结果
+     */
+    public int insertTDeviceClock(List<TDeviceClock> tDeviceClock);
+
+    /**
+     * 修改设备设置闹钟
+     * 
+     * @param tDeviceClock 设备设置闹钟
+     * @return 结果
+     */
+    public int updateTDeviceClock(TDeviceClock tDeviceClock);
+
+    /**
+     * 批量删除设备设置闹钟
+     * 
+     * @param ids 需要删除的设备设置闹钟主键集合
+     * @return 结果
+     */
+    public int deleteTDeviceClockByIds(Integer[] ids);
+
+    /**
+     * 删除设备设置闹钟信息
+     * 
+     * @param id 设备设置闹钟主键
+     * @return 结果
+     */
+    public int deleteTDeviceClockById(Integer id);
+}

+ 111 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TDeviceClockServiceImpl.java

@@ -0,0 +1,111 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.common.utils.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.system.mapper.TDeviceClockMapper;
+import com.ruoyi.system.domain.TDeviceClock;
+import com.ruoyi.system.service.ITDeviceClockService;
+
+/**
+ * 设备设置闹钟Service业务层处理
+ * 
+ * @author zhengjie
+ * @date 2023-09-20
+ */
+@Service
+public class TDeviceClockServiceImpl implements ITDeviceClockService 
+{
+    @Autowired
+    private TDeviceClockMapper tDeviceClockMapper;
+
+    /**
+     * 查询设备设置闹钟
+     * 
+     * @param id 设备设置闹钟主键
+     * @return 设备设置闹钟
+     */
+    @Override
+    public TDeviceClock selectTDeviceClockById(Integer id)
+    {
+        return tDeviceClockMapper.selectTDeviceClockById(id);
+    }
+
+    /**
+     * 查询设备设置闹钟
+     *
+     * @param deviceIdCode 设备设置号
+     * @return 设备设置闹钟
+     */
+    @Override
+    public TDeviceClock selectTDeviceClockByCode(String deviceIdCode) {
+        return tDeviceClockMapper.selectTDeviceClockByCode(deviceIdCode);
+    }
+
+    /**
+     * 查询设备设置闹钟列表
+     * 
+     * @param tDeviceClock 设备设置闹钟
+     * @return 设备设置闹钟
+     */
+    @Override
+    public List<TDeviceClock> selectTDeviceClockList(TDeviceClock tDeviceClock)
+    {
+        return tDeviceClockMapper.selectTDeviceClockList(tDeviceClock);
+    }
+
+    /**
+     * 新增设备设置闹钟
+     * 
+     * @param tDeviceClock 设备设置闹钟
+     * @return 结果
+     */
+    @Override
+    public int insertTDeviceClock(List<TDeviceClock> tDeviceClock)
+    {
+        if (StringUtils.isNotNull(tDeviceClock)) {
+            for (TDeviceClock clock : tDeviceClock) {
+                tDeviceClockMapper.insertTDeviceClock(clock);
+            }
+        }
+        return 1;
+    }
+
+    /**
+     * 修改设备设置闹钟
+     * 
+     * @param tDeviceClock 设备设置闹钟
+     * @return 结果
+     */
+    @Override
+    public int updateTDeviceClock(TDeviceClock tDeviceClock)
+    {
+        return tDeviceClockMapper.updateTDeviceClock(tDeviceClock);
+    }
+
+    /**
+     * 批量删除设备设置闹钟
+     * 
+     * @param ids 需要删除的设备设置闹钟主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTDeviceClockByIds(Integer[] ids)
+    {
+        return tDeviceClockMapper.deleteTDeviceClockByIds(ids);
+    }
+
+    /**
+     * 删除设备设置闹钟信息
+     * 
+     * @param id 设备设置闹钟主键
+     * @return 结果
+     */
+    @Override
+    public int deleteTDeviceClockById(Integer id)
+    {
+        return tDeviceClockMapper.deleteTDeviceClockById(id);
+    }
+}

+ 80 - 0
ruoyi-system/src/main/resources/mapper/system/TDeviceClockMapper.xml

@@ -0,0 +1,80 @@
+<?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.ruoyi.system.mapper.TDeviceClockMapper">
+    
+    <resultMap type="TDeviceClock" id="TDeviceClockResult">
+        <result property="id"    column="id"    />
+        <result property="deviceIdCode"    column="device_id_code"    />
+        <result property="alarmClock"    column="alarm_clock"    />
+        <result property="clockTime"    column="clock_time"    />
+        <result property="clockUse"    column="clock_use"    />
+        <result property="clockWeek"    column="clock_week"    />
+    </resultMap>
+
+    <sql id="selectTDeviceClockVo">
+        select id, device_id_code, alarm_clock, clock_time, clock_use, clock_week from t_device_clock
+    </sql>
+
+    <select id="selectTDeviceClockList" parameterType="TDeviceClock" resultMap="TDeviceClockResult">
+        <include refid="selectTDeviceClockVo"/>
+        <where>  
+            <if test="deviceIdCode != null  and deviceIdCode != ''"> and device_id_code = #{deviceIdCode}</if>
+            <if test="alarmClock != null  and alarmClock != ''"> and alarm_clock = #{alarmClock}</if>
+            <if test="clockTime != null  and clockTime != ''"> and clock_time = #{clockTime}</if>
+            <if test="clockUse != null "> and clock_use = #{clockUse}</if>
+            <if test="clockWeek != null  and clockWeek != ''"> and clock_week = #{clockWeek}</if>
+        </where>
+    </select>
+    
+    <select id="selectTDeviceClockById" parameterType="Integer" resultMap="TDeviceClockResult">
+        <include refid="selectTDeviceClockVo"/>
+        where id = #{id}
+    </select>
+    <select id="selectTDeviceClockByCode" resultMap="TDeviceClockResult">
+        <include refid="selectTDeviceClockVo"/>
+        where device_id_code = #{deviceIdCode}
+    </select>
+
+    <insert id="insertTDeviceClock" parameterType="TDeviceClock" useGeneratedKeys="true" keyProperty="id">
+        insert into t_device_clock
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="deviceIdCode != null">device_id_code,</if>
+            <if test="alarmClock != null">alarm_clock,</if>
+            <if test="clockTime != null">clock_time,</if>
+            <if test="clockUse != null">clock_use,</if>
+            <if test="clockWeek != null">clock_week,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="deviceIdCode != null">#{deviceIdCode},</if>
+            <if test="alarmClock != null">#{alarmClock},</if>
+            <if test="clockTime != null">#{clockTime},</if>
+            <if test="clockUse != null">#{clockUse},</if>
+            <if test="clockWeek != null">#{clockWeek},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTDeviceClock" parameterType="TDeviceClock">
+        update t_device_clock
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="deviceIdCode != null">device_id_code = #{deviceIdCode},</if>
+            <if test="alarmClock != null">alarm_clock = #{alarmClock},</if>
+            <if test="clockTime != null">clock_time = #{clockTime},</if>
+            <if test="clockUse != null">clock_use = #{clockUse},</if>
+            <if test="clockWeek != null">clock_week = #{clockWeek},</if>
+        </trim>
+        where device_id_code = #{deviceIdCode}
+    </update>
+
+    <delete id="deleteTDeviceClockById" parameterType="Integer">
+        delete from t_device_clock where id = #{id}
+    </delete>
+
+    <delete id="deleteTDeviceClockByIds" parameterType="String">
+        delete from t_device_clock where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 1 - 1
ruoyi-system/src/main/resources/mapper/system/TDeviceSetMapper.xml

@@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
     <select id="selectTDeviceSetByCode" resultMap="TDeviceSetResult">
         <include refid="selectTDeviceSetVo"/>
-        where device_id_code = #{device_id_code}
+        where device_id_code = #{deviceIdCode}
     </select>
 
     <insert id="insertTDeviceSet" parameterType="TDeviceSet" useGeneratedKeys="true" keyProperty="id">