新增功能及名称控制

This commit is contained in:
yan.y 2025-06-19 17:15:47 +08:00
parent 00a3e75e93
commit ef74154136
4 changed files with 334 additions and 92 deletions

View File

@ -1,16 +1,21 @@
package com.ifish.action; package com.ifish.action;
import java.io.IOException; import com.alibaba.fastjson.JSONObject;
import java.io.UnsupportedEncodingException; import com.ifish.domain.JsonResult;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.ifish.entity.*; 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.IfishFileDirectory;
import com.ifish.util.IfishFileUtils; 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.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; 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.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSONObject; import java.io.IOException;
import com.ifish.domain.JsonResult; import java.io.UnsupportedEncodingException;
import com.ifish.enums.BooleanEnum; import java.util.*;
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;
/** /**
* @author ggw * @author ggw
@ -931,10 +922,14 @@ public class AdminAction {
deviceAttr3List.add(new CheckNames("25", "加热模式温度设置", false)); deviceAttr3List.add(new CheckNames("25", "加热模式温度设置", false));
deviceAttr3List.add(new CheckNames("26", "制冷模式温度设置", false)); deviceAttr3List.add(new CheckNames("26", "制冷模式温度设置", false));
deviceAttr3List.add(new CheckNames("27", "喂鱼设置", 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("29", "延时启动时间设置", false));
deviceAttr3List.add(new CheckNames("30", "电量显示", false)); deviceAttr3List.add(new CheckNames("30", "电量显示", false));
deviceAttr3List.add(new CheckNames("31", "一键喂鱼按键", 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<String, Object> modelData = new HashMap<>(); Map<String, Object> modelData = new HashMap<>();
modelData.put("list1", deviceAttr1List); modelData.put("list1", deviceAttr1List);
modelData.put("list3", deviceAttr3List); modelData.put("list3", deviceAttr3List);
@ -971,28 +966,33 @@ public class AdminAction {
public ModelAndView editHardwareType(String hardwareType) { public ModelAndView editHardwareType(String hardwareType) {
if (hardwareType != null) { if (hardwareType != null) {
HardwareType hardware = this.adminService.getHardwareTypeById(hardwareType); HardwareType hardware = this.adminService.getHardwareTypeById(hardwareType);
HardwareTypeAttri hardwareTypeAttri = this.adminService.getHardwareTypeAttri(hardwareType);
boolean hasAttr = hardwareTypeAttri != null;
List<CheckNames> deviceAttr1List = new ArrayList<>(); List<CheckNames> deviceAttr1List = new ArrayList<>();
deviceAttr1List.add(new CheckNames("1", "S1开关", false)); deviceAttr1List.add(new CheckNames("1", "S1开关", hasAttr && hardwareTypeAttri.getSwitchS1() == 1));
deviceAttr1List.add(new CheckNames("2", "S2开关", false)); deviceAttr1List.add(new CheckNames("2", "S2开关", hasAttr && hardwareTypeAttri.getSwitchS2() == 1));
deviceAttr1List.add(new CheckNames("3", "S3开关", false)); deviceAttr1List.add(new CheckNames("3", "S3开关", hasAttr && hardwareTypeAttri.getSwitchS3() == 1));
deviceAttr1List.add(new CheckNames("4", "S4开关", false)); deviceAttr1List.add(new CheckNames("4", "S4开关", hasAttr && hardwareTypeAttri.getSwitchS4() == 1));
deviceAttr1List.add(new CheckNames("5", "S5开关", false)); deviceAttr1List.add(new CheckNames("5", "S5开关", hasAttr && hardwareTypeAttri.getSwitchS5() == 1));
deviceAttr1List.add(new CheckNames("6", "S6开关", false)); deviceAttr1List.add(new CheckNames("6", "S6开关", hasAttr && hardwareTypeAttri.getSwitchS6() == 1));
deviceAttr1List.add(new CheckNames("7", "S7开关", false)); deviceAttr1List.add(new CheckNames("7", "S7开关", hasAttr && hardwareTypeAttri.getSwitchS7() == 1));
deviceAttr1List.add(new CheckNames("8", "S8开关", false)); deviceAttr1List.add(new CheckNames("8", "S8开关", hasAttr && hardwareTypeAttri.getSwitchS8() == 1));
deviceAttr1List.add(new CheckNames("9", "S9开关", false)); deviceAttr1List.add(new CheckNames("9", "S9开关", hasAttr && hardwareTypeAttri.getSwitchS9() == 1));
deviceAttr1List.add(new CheckNames("10", "S10开关", false)); deviceAttr1List.add(new CheckNames("10", "S10开关", hasAttr && hardwareTypeAttri.getSwitchS10() == 1));
deviceAttr1List.add(new CheckNames("11", "S11开关", false)); deviceAttr1List.add(new CheckNames("11", "S11开关", hasAttr && hardwareTypeAttri.getSwitchS11() == 1));
deviceAttr1List.add(new CheckNames("12", "S12开关", false)); deviceAttr1List.add(new CheckNames("12", "S12开关", hasAttr && hardwareTypeAttri.getSwitchS12() == 1));
List<CheckNames> deviceAttr3List = new ArrayList<>(); List<CheckNames> deviceAttr3List = new ArrayList<>();
deviceAttr3List.add(new CheckNames("25", "加热模式温度设置", false)); deviceAttr3List.add(new CheckNames("25", "加热模式温度设置", hasAttr && hardwareTypeAttri.getTemperature1() == 1));
deviceAttr3List.add(new CheckNames("26", "制冷模式温度设置", false)); deviceAttr3List.add(new CheckNames("26", "制冷模式温度设置", hasAttr && hardwareTypeAttri.getTemperature2() == 1));
deviceAttr3List.add(new CheckNames("27", "喂鱼设置", false)); deviceAttr3List.add(new CheckNames("27", "喂鱼设置", hasAttr && hardwareTypeAttri.getFeedfishSet() == 1));
deviceAttr3List.add(new CheckNames("28", "温度矫正设置-两个", false)); deviceAttr3List.add(new CheckNames("28", "温度矫正设置-1", hasAttr && hardwareTypeAttri.getChangeTemperSet1() == 1));
deviceAttr3List.add(new CheckNames("29", "延时启动时间设置", false)); deviceAttr3List.add(new CheckNames("32", "温度矫正设置-2", hasAttr && hardwareTypeAttri.getChangeTemperSet2() == 1));
deviceAttr3List.add(new CheckNames("30", "电量显示", false)); deviceAttr3List.add(new CheckNames("29", "延时启动时间设置", hasAttr && hardwareTypeAttri.getDelayedSet() == 1));
deviceAttr3List.add(new CheckNames("31", "一键喂鱼按键", false)); 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<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put("list1", deviceAttr1List); map.put("list1", deviceAttr1List);
map.put("list3", deviceAttr3List); map.put("list3", deviceAttr3List);

View File

@ -27,31 +27,157 @@ public class DeviceUserAttriName implements Serializable{
private Integer deviceId; private Integer deviceId;
@Column(name="switch_s1") @Column(name="switch_s1")
private Integer switchS1; private String switchS1;
@Column(name="switch_s2") @Column(name="switch_s2")
private Integer switchS2; private String switchS2;
@Column(name="switch_s3") @Column(name="switch_s3")
private Integer switchS3; private String switchS3;
@Column(name="switch_s4") @Column(name="switch_s4")
private Integer switchS4; private String switchS4;
@Column(name="switch_s5") @Column(name="switch_s5")
private Integer switchS5; private String switchS5;
@Column(name="switch_s6") @Column(name="switch_s6")
private Integer switchS6; private String switchS6;
@Column(name="switch_s7") @Column(name="switch_s7")
private Integer switchS7; private String switchS7;
@Column(name="switch_s8") @Column(name="switch_s8")
private Integer switchS8; private String switchS8;
@Column(name="switch_s9") @Column(name="switch_s9")
private Integer switchS9; private String switchS9;
@Column(name="switch_s10") @Column(name="switch_s10")
private Integer switchS10; private String switchS10;
@Column(name="switch_s11") @Column(name="switch_s11")
private Integer switchS11; private String switchS11;
@Column(name="switch_s12") @Column(name="switch_s12")
private Integer switchS12; private String switchS12;
@Column(name="create_time") @Column(name="create_time")
private Date createTime; 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;
}
} }

View File

@ -23,51 +23,59 @@ public class HardwareTypeAttri implements Serializable{
private String hardwareType; private String hardwareType;
@Column(name="switch_s1") @Column(name="switch_s1")
private Integer switchS1; private Integer switchS1 = 0;
@Column(name="switch_s2") @Column(name="switch_s2")
private Integer switchS2; private Integer switchS2 = 0;
@Column(name="switch_s3") @Column(name="switch_s3")
private Integer switchS3; private Integer switchS3 = 0;
@Column(name="switch_s4") @Column(name="switch_s4")
private Integer switchS4; private Integer switchS4 = 0;
@Column(name="switch_s5") @Column(name="switch_s5")
private Integer switchS5; private Integer switchS5 = 0;
@Column(name="switch_s6") @Column(name="switch_s6")
private Integer switchS6; private Integer switchS6 = 0;
@Column(name="switch_s7") @Column(name="switch_s7")
private Integer switchS7; private Integer switchS7 = 0;
@Column(name="switch_s8") @Column(name="switch_s8")
private Integer switchS8; private Integer switchS8 = 0;
@Column(name="switch_s9") @Column(name="switch_s9")
private Integer switchS9; private Integer switchS9 = 0;
@Column(name="switch_s10") @Column(name="switch_s10")
private Integer switchS10; private Integer switchS10 = 0;
@Column(name="switch_s11") @Column(name="switch_s11")
private Integer switchS11; private Integer switchS11 = 0;
@Column(name="switch_s12") @Column(name="switch_s12")
private Integer switchS12; private Integer switchS12 = 0;
@Column(name="temperature1") @Column(name="temperature1")
private Integer temperature1; private Integer temperature1 = 0;
@Column(name="temperature2") @Column(name="temperature2")
private Integer temperature2; private Integer temperature2 = 0;
@Column(name="heating_set") @Column(name="heating_set")
private Integer heatingSet; private Integer heatingSet = 0;
@Column(name="refrigeration_set") @Column(name="refrigeration_set")
private Integer refrigerationSet; private Integer refrigerationSet = 0;
@Column(name="feedfish_set") @Column(name="feedfish_set")
private Integer feedfishSet; private Integer feedfishSet = 0;
@Column(name="change_temper_set1") @Column(name="change_temper_set1")
private Integer changeTemperSet1; private Integer changeTemperSet1 = 0;
@Column(name="change_temper_set2") @Column(name="change_temper_set2")
private Integer changeTemperSet2; private Integer changeTemperSet2 = 0;
@Column(name="delayed_set") @Column(name="delayed_set")
private Integer delayedSet; private Integer delayedSet = 0;
@Column(name="electricity_show") @Column(name="electricity_show")
private Integer electricityShow; private Integer electricityShow = 0;
@Column(name="once_feedfish_set") @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") @Column(name="create_time")
private Date createTime; private Date createTime = new Date();
public Integer getId() { public Integer getId() {
return id; return id;
@ -261,6 +269,30 @@ public class HardwareTypeAttri implements Serializable{
this.onceFeedfishSet = onceFeedfishSet; 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() { public Date getCreateTime() {
return createTime; return createTime;
} }

View File

@ -4,14 +4,7 @@ import java.io.File;
import java.text.Format; import java.text.Format;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
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 com.ifish.dao.*; import com.ifish.dao.*;
import com.ifish.entity.*; import com.ifish.entity.*;
@ -1315,7 +1308,6 @@ public class AdminServiceImpl implements AdminService {
} }
if (id.equals("28")) { if (id.equals("28")) {
hardwareTypeAttri.setChangeTemperSet1(1); hardwareTypeAttri.setChangeTemperSet1(1);
hardwareTypeAttri.setChangeTemperSet2(1);
} }
if (id.equals("29")) { if (id.equals("29")) {
hardwareTypeAttri.setDelayedSet(1); hardwareTypeAttri.setDelayedSet(1);
@ -1326,6 +1318,12 @@ public class AdminServiceImpl implements AdminService {
if (id.equals("31")) { if (id.equals("31")) {
hardwareTypeAttri.setOnceFeedfishSet(1); hardwareTypeAttri.setOnceFeedfishSet(1);
} }
if (id.equals("32")) {
hardwareTypeAttri.setChangeTemperSet2(1);
}
if (id.equals("33")) {
hardwareTypeAttri.setNursingLight(1);
}
} }
hardwareTypeAttriDao.save(hardwareTypeAttri); hardwareTypeAttriDao.save(hardwareTypeAttri);
this.hardwareTypeDao.save(hardwareType); this.hardwareTypeDao.save(hardwareType);
@ -1351,6 +1349,44 @@ public class AdminServiceImpl implements AdminService {
} }
hardwareTypeAttri.setHardwareType(hardwareType.getHardwareType()); hardwareTypeAttri.setHardwareType(hardwareType.getHardwareType());
String[] attr1List = attr1.split(","); String[] attr1List = attr1.split(",");
List<String> 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) { for (String id : attr1List) {
if (id.equals("1")) { if (id.equals("1")) {
hardwareTypeAttri.setSwitchS1(1); hardwareTypeAttri.setSwitchS1(1);
@ -1390,6 +1426,42 @@ public class AdminServiceImpl implements AdminService {
} }
} }
String[] attr3List = attr3.split(","); String[] attr3List = attr3.split(",");
List<String> 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) { for (String id : attr3List) {
if (id.equals("25")) { if (id.equals("25")) {
hardwareTypeAttri.setTemperature1(1); hardwareTypeAttri.setTemperature1(1);
@ -1404,7 +1476,7 @@ public class AdminServiceImpl implements AdminService {
} }
if (id.equals("28")) { if (id.equals("28")) {
hardwareTypeAttri.setChangeTemperSet1(1); hardwareTypeAttri.setChangeTemperSet1(1);
hardwareTypeAttri.setChangeTemperSet2(1);
} }
if (id.equals("29")) { if (id.equals("29")) {
hardwareTypeAttri.setDelayedSet(1); hardwareTypeAttri.setDelayedSet(1);
@ -1415,6 +1487,18 @@ public class AdminServiceImpl implements AdminService {
if (id.equals("31")) { if (id.equals("31")) {
hardwareTypeAttri.setOnceFeedfishSet(1); 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); hardwareTypeAttriDao.save(hardwareTypeAttri);
return this.hardwareTypeDao.update(hardwareType); return this.hardwareTypeDao.update(hardwareType);