From ef741541362c56a44629634cc90fdc2538f6d1cb Mon Sep 17 00:00:00 2001 From: "yan.y" Date: Thu, 19 Jun 2025 17:15:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=9F=E8=83=BD=E5=8F=8A?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ifish/action/AdminAction.java | 92 +++++------ .../com/ifish/entity/DeviceUserAttriName.java | 152 ++++++++++++++++-- .../com/ifish/entity/HardwareTypeAttri.java | 78 ++++++--- .../ifish/serviceImpl/AdminServiceImpl.java | 104 ++++++++++-- 4 files changed, 334 insertions(+), 92 deletions(-) diff --git a/src/main/java/com/ifish/action/AdminAction.java b/src/main/java/com/ifish/action/AdminAction.java index a267b35..139fff4 100644 --- a/src/main/java/com/ifish/action/AdminAction.java +++ b/src/main/java/com/ifish/action/AdminAction.java @@ -1,16 +1,21 @@ package com.ifish.action; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - +import com.alibaba.fastjson.JSONObject; +import com.ifish.domain.JsonResult; import com.ifish.entity.*; +import com.ifish.enums.*; +import com.ifish.excel.DownloadExcel; +import com.ifish.hibernate.Pagination; +import com.ifish.search.CheckNames; +import com.ifish.search.SearchFilter; +import com.ifish.service.AdminService; +import com.ifish.service.GradeService; import com.ifish.util.IfishFileDirectory; import com.ifish.util.IfishFileUtils; +import com.ifish.util.IfishUtil; +import com.ifish.util.ResultUtil; +import com.ifish.webService.MyService; +import com.ifish.webService.MyServiceService; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -24,23 +29,9 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; -import com.alibaba.fastjson.JSONObject; -import com.ifish.domain.JsonResult; -import com.ifish.enums.BooleanEnum; -import com.ifish.enums.MenuTypeEnum; -import com.ifish.enums.RoleEnum; -import com.ifish.enums.SysUserEnum; -import com.ifish.enums.UeditorTypeEnum; -import com.ifish.excel.DownloadExcel; -import com.ifish.hibernate.Pagination; -import com.ifish.search.CheckNames; -import com.ifish.search.SearchFilter; -import com.ifish.service.AdminService; -import com.ifish.service.GradeService; -import com.ifish.util.IfishUtil; -import com.ifish.util.ResultUtil; -import com.ifish.webService.MyService; -import com.ifish.webService.MyServiceService; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.*; /** * @author ggw @@ -931,10 +922,14 @@ public class AdminAction { deviceAttr3List.add(new CheckNames("25", "加热模式温度设置", false)); deviceAttr3List.add(new CheckNames("26", "制冷模式温度设置", false)); deviceAttr3List.add(new CheckNames("27", "喂鱼设置", false)); - deviceAttr3List.add(new CheckNames("28", "温度矫正设置-两个", false)); + deviceAttr3List.add(new CheckNames("28", "温度矫正设置-1", false)); deviceAttr3List.add(new CheckNames("29", "延时启动时间设置", false)); deviceAttr3List.add(new CheckNames("30", "电量显示", false)); deviceAttr3List.add(new CheckNames("31", "一键喂鱼按键", false)); + deviceAttr3List.add(new CheckNames("32", "温度矫正设置-2", false)); + deviceAttr3List.add(new CheckNames("33", "护理灯", false)); + deviceAttr3List.add(new CheckNames("34", "温度显示1", false)); + deviceAttr3List.add(new CheckNames("35", "温度显示2", false)); Map modelData = new HashMap<>(); modelData.put("list1", deviceAttr1List); modelData.put("list3", deviceAttr3List); @@ -971,28 +966,33 @@ public class AdminAction { public ModelAndView editHardwareType(String hardwareType) { if (hardwareType != null) { HardwareType hardware = this.adminService.getHardwareTypeById(hardwareType); + HardwareTypeAttri hardwareTypeAttri = this.adminService.getHardwareTypeAttri(hardwareType); + boolean hasAttr = hardwareTypeAttri != null; List deviceAttr1List = new ArrayList<>(); - deviceAttr1List.add(new CheckNames("1", "S1开关", false)); - deviceAttr1List.add(new CheckNames("2", "S2开关", false)); - deviceAttr1List.add(new CheckNames("3", "S3开关", false)); - deviceAttr1List.add(new CheckNames("4", "S4开关", false)); - deviceAttr1List.add(new CheckNames("5", "S5开关", false)); - deviceAttr1List.add(new CheckNames("6", "S6开关", false)); - deviceAttr1List.add(new CheckNames("7", "S7开关", false)); - deviceAttr1List.add(new CheckNames("8", "S8开关", false)); - deviceAttr1List.add(new CheckNames("9", "S9开关", false)); - deviceAttr1List.add(new CheckNames("10", "S10开关", false)); - deviceAttr1List.add(new CheckNames("11", "S11开关", false)); - deviceAttr1List.add(new CheckNames("12", "S12开关", false)); - + deviceAttr1List.add(new CheckNames("1", "S1开关", hasAttr && hardwareTypeAttri.getSwitchS1() == 1)); + deviceAttr1List.add(new CheckNames("2", "S2开关", hasAttr && hardwareTypeAttri.getSwitchS2() == 1)); + deviceAttr1List.add(new CheckNames("3", "S3开关", hasAttr && hardwareTypeAttri.getSwitchS3() == 1)); + deviceAttr1List.add(new CheckNames("4", "S4开关", hasAttr && hardwareTypeAttri.getSwitchS4() == 1)); + deviceAttr1List.add(new CheckNames("5", "S5开关", hasAttr && hardwareTypeAttri.getSwitchS5() == 1)); + deviceAttr1List.add(new CheckNames("6", "S6开关", hasAttr && hardwareTypeAttri.getSwitchS6() == 1)); + deviceAttr1List.add(new CheckNames("7", "S7开关", hasAttr && hardwareTypeAttri.getSwitchS7() == 1)); + deviceAttr1List.add(new CheckNames("8", "S8开关", hasAttr && hardwareTypeAttri.getSwitchS8() == 1)); + deviceAttr1List.add(new CheckNames("9", "S9开关", hasAttr && hardwareTypeAttri.getSwitchS9() == 1)); + deviceAttr1List.add(new CheckNames("10", "S10开关", hasAttr && hardwareTypeAttri.getSwitchS10() == 1)); + deviceAttr1List.add(new CheckNames("11", "S11开关", hasAttr && hardwareTypeAttri.getSwitchS11() == 1)); + deviceAttr1List.add(new CheckNames("12", "S12开关", hasAttr && hardwareTypeAttri.getSwitchS12() == 1)); List deviceAttr3List = new ArrayList<>(); - deviceAttr3List.add(new CheckNames("25", "加热模式温度设置", false)); - deviceAttr3List.add(new CheckNames("26", "制冷模式温度设置", false)); - deviceAttr3List.add(new CheckNames("27", "喂鱼设置", false)); - deviceAttr3List.add(new CheckNames("28", "温度矫正设置-两个", false)); - deviceAttr3List.add(new CheckNames("29", "延时启动时间设置", false)); - deviceAttr3List.add(new CheckNames("30", "电量显示", false)); - deviceAttr3List.add(new CheckNames("31", "一键喂鱼按键", false)); + deviceAttr3List.add(new CheckNames("25", "加热模式温度设置", hasAttr && hardwareTypeAttri.getTemperature1() == 1)); + deviceAttr3List.add(new CheckNames("26", "制冷模式温度设置", hasAttr && hardwareTypeAttri.getTemperature2() == 1)); + deviceAttr3List.add(new CheckNames("27", "喂鱼设置", hasAttr && hardwareTypeAttri.getFeedfishSet() == 1)); + deviceAttr3List.add(new CheckNames("28", "温度矫正设置-1", hasAttr && hardwareTypeAttri.getChangeTemperSet1() == 1)); + deviceAttr3List.add(new CheckNames("32", "温度矫正设置-2", hasAttr && hardwareTypeAttri.getChangeTemperSet2() == 1)); + deviceAttr3List.add(new CheckNames("29", "延时启动时间设置", hasAttr && hardwareTypeAttri.getDelayedSet() == 1)); + deviceAttr3List.add(new CheckNames("30", "电量显示", hasAttr && hardwareTypeAttri.getElectricityShow() == 1)); + deviceAttr3List.add(new CheckNames("31", "一键喂鱼按键", hasAttr && hardwareTypeAttri.getOnceFeedfishSet() == 1)); + deviceAttr3List.add(new CheckNames("33", "护理灯", hasAttr && hardwareTypeAttri.getNursingLight() == 1)); + deviceAttr3List.add(new CheckNames("34", "温度显示1", hasAttr && hardwareTypeAttri.getTemperatureShow1() == 1)); + deviceAttr3List.add(new CheckNames("35", "温度显示2", hasAttr && hardwareTypeAttri.getTemperatureShow2() == 1)); Map map = new HashMap(); map.put("list1", deviceAttr1List); map.put("list3", deviceAttr3List); diff --git a/src/main/java/com/ifish/entity/DeviceUserAttriName.java b/src/main/java/com/ifish/entity/DeviceUserAttriName.java index 3ff9935..2992cc8 100644 --- a/src/main/java/com/ifish/entity/DeviceUserAttriName.java +++ b/src/main/java/com/ifish/entity/DeviceUserAttriName.java @@ -27,31 +27,157 @@ public class DeviceUserAttriName implements Serializable{ private Integer deviceId; @Column(name="switch_s1") - private Integer switchS1; + private String switchS1; @Column(name="switch_s2") - private Integer switchS2; + private String switchS2; @Column(name="switch_s3") - private Integer switchS3; + private String switchS3; @Column(name="switch_s4") - private Integer switchS4; + private String switchS4; @Column(name="switch_s5") - private Integer switchS5; + private String switchS5; @Column(name="switch_s6") - private Integer switchS6; + private String switchS6; @Column(name="switch_s7") - private Integer switchS7; + private String switchS7; @Column(name="switch_s8") - private Integer switchS8; + private String switchS8; @Column(name="switch_s9") - private Integer switchS9; + private String switchS9; @Column(name="switch_s10") - private Integer switchS10; + private String switchS10; @Column(name="switch_s11") - private Integer switchS11; + private String switchS11; @Column(name="switch_s12") - private Integer switchS12; + private String switchS12; @Column(name="create_time") private Date createTime; - + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public Integer getDeviceId() { + return deviceId; + } + + public void setDeviceId(Integer deviceId) { + this.deviceId = deviceId; + } + + public String getSwitchS1() { + return switchS1; + } + + public void setSwitchS1(String switchS1) { + this.switchS1 = switchS1; + } + + public String getSwitchS2() { + return switchS2; + } + + public void setSwitchS2(String switchS2) { + this.switchS2 = switchS2; + } + + public String getSwitchS3() { + return switchS3; + } + + public void setSwitchS3(String switchS3) { + this.switchS3 = switchS3; + } + + public String getSwitchS4() { + return switchS4; + } + + public void setSwitchS4(String switchS4) { + this.switchS4 = switchS4; + } + + public String getSwitchS5() { + return switchS5; + } + + public void setSwitchS5(String switchS5) { + this.switchS5 = switchS5; + } + + public String getSwitchS6() { + return switchS6; + } + + public void setSwitchS6(String switchS6) { + this.switchS6 = switchS6; + } + + public String getSwitchS7() { + return switchS7; + } + + public void setSwitchS7(String switchS7) { + this.switchS7 = switchS7; + } + + public String getSwitchS8() { + return switchS8; + } + + public void setSwitchS8(String switchS8) { + this.switchS8 = switchS8; + } + + public String getSwitchS9() { + return switchS9; + } + + public void setSwitchS9(String switchS9) { + this.switchS9 = switchS9; + } + + public String getSwitchS10() { + return switchS10; + } + + public void setSwitchS10(String switchS10) { + this.switchS10 = switchS10; + } + + public String getSwitchS11() { + return switchS11; + } + + public void setSwitchS11(String switchS11) { + this.switchS11 = switchS11; + } + + public String getSwitchS12() { + return switchS12; + } + + public void setSwitchS12(String switchS12) { + this.switchS12 = switchS12; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } } diff --git a/src/main/java/com/ifish/entity/HardwareTypeAttri.java b/src/main/java/com/ifish/entity/HardwareTypeAttri.java index 4baa494..2e878ba 100644 --- a/src/main/java/com/ifish/entity/HardwareTypeAttri.java +++ b/src/main/java/com/ifish/entity/HardwareTypeAttri.java @@ -23,51 +23,59 @@ public class HardwareTypeAttri implements Serializable{ private String hardwareType; @Column(name="switch_s1") - private Integer switchS1; + private Integer switchS1 = 0; @Column(name="switch_s2") - private Integer switchS2; + private Integer switchS2 = 0; @Column(name="switch_s3") - private Integer switchS3; + private Integer switchS3 = 0; @Column(name="switch_s4") - private Integer switchS4; + private Integer switchS4 = 0; @Column(name="switch_s5") - private Integer switchS5; + private Integer switchS5 = 0; @Column(name="switch_s6") - private Integer switchS6; + private Integer switchS6 = 0; @Column(name="switch_s7") - private Integer switchS7; + private Integer switchS7 = 0; @Column(name="switch_s8") - private Integer switchS8; + private Integer switchS8 = 0; @Column(name="switch_s9") - private Integer switchS9; + private Integer switchS9 = 0; @Column(name="switch_s10") - private Integer switchS10; + private Integer switchS10 = 0; @Column(name="switch_s11") - private Integer switchS11; + private Integer switchS11 = 0; @Column(name="switch_s12") - private Integer switchS12; + private Integer switchS12 = 0; @Column(name="temperature1") - private Integer temperature1; + private Integer temperature1 = 0; @Column(name="temperature2") - private Integer temperature2; + private Integer temperature2 = 0; @Column(name="heating_set") - private Integer heatingSet; + private Integer heatingSet = 0; @Column(name="refrigeration_set") - private Integer refrigerationSet; + private Integer refrigerationSet = 0; @Column(name="feedfish_set") - private Integer feedfishSet; + private Integer feedfishSet = 0; @Column(name="change_temper_set1") - private Integer changeTemperSet1; + private Integer changeTemperSet1 = 0; @Column(name="change_temper_set2") - private Integer changeTemperSet2; + private Integer changeTemperSet2 = 0; @Column(name="delayed_set") - private Integer delayedSet; + private Integer delayedSet = 0; @Column(name="electricity_show") - private Integer electricityShow; + private Integer electricityShow = 0; @Column(name="once_feedfish_set") - private Integer onceFeedfishSet; + private Integer onceFeedfishSet = 0; + + @Column(name="nursing_light") + private Integer nursingLight = 0; + + @Column(name="temperature_show1") + private Integer temperatureShow1 = 0; + @Column(name="temperature_show2") + private Integer temperatureShow2 = 0; @Column(name="create_time") - private Date createTime; + private Date createTime = new Date(); public Integer getId() { return id; @@ -261,6 +269,30 @@ public class HardwareTypeAttri implements Serializable{ this.onceFeedfishSet = onceFeedfishSet; } + public Integer getNursingLight() { + return nursingLight; + } + + public void setNursingLight(Integer nursingLight) { + this.nursingLight = nursingLight; + } + + public Integer getTemperatureShow1() { + return temperatureShow1; + } + + public void setTemperatureShow1(Integer temperatureShow1) { + this.temperatureShow1 = temperatureShow1; + } + + public Integer getTemperatureShow2() { + return temperatureShow2; + } + + public void setTemperatureShow2(Integer temperatureShow2) { + this.temperatureShow2 = temperatureShow2; + } + public Date getCreateTime() { return createTime; } diff --git a/src/main/java/com/ifish/serviceImpl/AdminServiceImpl.java b/src/main/java/com/ifish/serviceImpl/AdminServiceImpl.java index 3335d1c..768edbc 100644 --- a/src/main/java/com/ifish/serviceImpl/AdminServiceImpl.java +++ b/src/main/java/com/ifish/serviceImpl/AdminServiceImpl.java @@ -4,14 +4,7 @@ import java.io.File; import java.text.Format; import java.text.NumberFormat; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import com.ifish.dao.*; import com.ifish.entity.*; @@ -1315,7 +1308,6 @@ public class AdminServiceImpl implements AdminService { } if (id.equals("28")) { hardwareTypeAttri.setChangeTemperSet1(1); - hardwareTypeAttri.setChangeTemperSet2(1); } if (id.equals("29")) { hardwareTypeAttri.setDelayedSet(1); @@ -1326,6 +1318,12 @@ public class AdminServiceImpl implements AdminService { if (id.equals("31")) { hardwareTypeAttri.setOnceFeedfishSet(1); } + if (id.equals("32")) { + hardwareTypeAttri.setChangeTemperSet2(1); + } + if (id.equals("33")) { + hardwareTypeAttri.setNursingLight(1); + } } hardwareTypeAttriDao.save(hardwareTypeAttri); this.hardwareTypeDao.save(hardwareType); @@ -1351,6 +1349,44 @@ public class AdminServiceImpl implements AdminService { } hardwareTypeAttri.setHardwareType(hardwareType.getHardwareType()); String[] attr1List = attr1.split(","); + List attr1Arr = Arrays.asList(attr1List); + if (!attr1Arr.contains("1")) { + hardwareTypeAttri.setSwitchS1(0); + } + if (!attr1Arr.contains("2")) { + hardwareTypeAttri.setSwitchS2(0); + } + if (!attr1Arr.contains("3")) { + hardwareTypeAttri.setSwitchS3(0); + } + if (!attr1Arr.contains("4")) { + hardwareTypeAttri.setSwitchS4(0); + } + if (!attr1Arr.contains("5")) { + hardwareTypeAttri.setSwitchS5(0); + } + if (!attr1Arr.contains("6")) { + hardwareTypeAttri.setSwitchS6(0); + } + if (!attr1Arr.contains("7")) { + hardwareTypeAttri.setSwitchS7(0); + } + if (!attr1Arr.contains("8")) { + hardwareTypeAttri.setSwitchS8(0); + } + if (!attr1Arr.contains("9")) { + hardwareTypeAttri.setSwitchS9(0); + } + if (!attr1Arr.contains("10")) { + hardwareTypeAttri.setSwitchS10(0); + } + if (!attr1Arr.contains("11")) { + hardwareTypeAttri.setSwitchS11(0); + } + if (!attr1Arr.contains("12")) { + hardwareTypeAttri.setSwitchS12(0); + } + for (String id : attr1List) { if (id.equals("1")) { hardwareTypeAttri.setSwitchS1(1); @@ -1390,6 +1426,42 @@ public class AdminServiceImpl implements AdminService { } } String[] attr3List = attr3.split(","); + List attr3Arr = Arrays.asList(attr3List); + if (!attr3Arr.contains("25")) { + hardwareTypeAttri.setTemperature1(0); + hardwareTypeAttri.setHeatingSet(0); + } + if (!attr3Arr.contains("26")) { + hardwareTypeAttri.setTemperature2(0); + hardwareTypeAttri.setRefrigerationSet(0); + } + if (!attr3Arr.contains("27")) { + hardwareTypeAttri.setFeedfishSet(0); + } + if (!attr3Arr.contains("28")) { + hardwareTypeAttri.setChangeTemperSet1(0); + } + if (!attr3Arr.contains("29")) { + hardwareTypeAttri.setDelayedSet(0); + } + if (!attr3Arr.contains("30")) { + hardwareTypeAttri.setElectricityShow(0); + } + if (!attr3Arr.contains("31")) { + hardwareTypeAttri.setOnceFeedfishSet(0); + } + if (!attr3Arr.contains("32")) { + hardwareTypeAttri.setChangeTemperSet2(0); + } + if (!attr3Arr.contains("33")) { + hardwareTypeAttri.setNursingLight(0); + } + if (!attr3Arr.contains("34")) { + hardwareTypeAttri.setTemperatureShow1(0); + } + if (!attr3Arr.contains("35")) { + hardwareTypeAttri.setTemperatureShow2(0); + } for (String id : attr3List) { if (id.equals("25")) { hardwareTypeAttri.setTemperature1(1); @@ -1404,7 +1476,7 @@ public class AdminServiceImpl implements AdminService { } if (id.equals("28")) { hardwareTypeAttri.setChangeTemperSet1(1); - hardwareTypeAttri.setChangeTemperSet2(1); + } if (id.equals("29")) { hardwareTypeAttri.setDelayedSet(1); @@ -1415,6 +1487,18 @@ public class AdminServiceImpl implements AdminService { if (id.equals("31")) { hardwareTypeAttri.setOnceFeedfishSet(1); } + if (id.equals("32")) { + hardwareTypeAttri.setChangeTemperSet2(1); + } + if (id.equals("33")) { + hardwareTypeAttri.setNursingLight(1); + } + if (id.contains("34")) { + hardwareTypeAttri.setTemperatureShow1(1); + } + if (id.contains("35")) { + hardwareTypeAttri.setTemperatureShow2(1); + } } hardwareTypeAttriDao.save(hardwareTypeAttri); return this.hardwareTypeDao.update(hardwareType);