新增接口

This commit is contained in:
yan.y 2025-06-19 17:10:59 +08:00
parent 6f879f19cf
commit 40b07fdfad
20 changed files with 1333 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -378,6 +379,37 @@ public class UserAction {
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), ""); return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
} }
/**
* 获取设备对应默认开关背景开关默认名称
*
* @return
*/
@RequestMapping("/getDeviceBaseInfo.do")
@ResponseBody
public Object getDeviceBaseInfo(String hardwareType, Integer userId, Integer deviceId) {
try {
return baseService.getDeviceBaseInfo(hardwareType, userId, deviceId);
} catch (Exception e) {
e.printStackTrace();
log.error("get getDeviceBaseInfo Information:hardwareType:{}, userId : {},error message:{}", userId, hardwareType, e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 设置设备对应名称
* @return
*/
@RequestMapping("/setDeviceNameInfo.do")
public Object setDeviceNameInfo(UserDeviceAttriName deviceAttriName) {
try {
return baseService.setDeviceNameInfo(deviceAttriName);
} catch (Exception e) {
e.printStackTrace();
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/** /**
* 修改设备信息 * 修改设备信息
* *

View File

@ -0,0 +1,22 @@
package com.ifish.bean;
import lombok.Builder;
import lombok.Data;
/**
* @author: yan.y
* @Description:
* @Date: Created in 10:43 2025/6/19
* @Modified by:
*/
@Data
@Builder
public class DeviceBaseInfo {
private String key;
private String displayName;
private boolean isEnable;
private int functionCode;
private String icon;
}

View File

@ -0,0 +1,10 @@
package com.ifish.dao;
import com.ifish.entity.FactoryHardware;
/**
*
*/
public interface FactoryHardwareDao extends BaseDao<FactoryHardware, String>{
}

View File

@ -0,0 +1,13 @@
package com.ifish.dao;
import com.ifish.entity.FactoryVenderHardwareTypeAttri;
/**
* @ClassName: HardwareTypeDao
* @Description: TODO
* @author ggw
*
*/
public interface FactoryHardwareTypeAttrDao extends BaseDao<FactoryVenderHardwareTypeAttri, Integer>{
}

View File

@ -0,0 +1,10 @@
package com.ifish.dao;
import com.ifish.entity.FactoryList;
/**
*
*/
public interface FactoryListDao extends BaseDao<FactoryList, String>{
}

View File

@ -0,0 +1,13 @@
package com.ifish.dao;
import com.ifish.entity.HardwareTypeAttri;
/**
* @ClassName: HardwareTypeDao
* @Description: TODO
* @author ggw
*
*/
public interface HardwareTypeAttriDao extends BaseDao<HardwareTypeAttri, Integer>{
}

View File

@ -0,0 +1,10 @@
package com.ifish.dao;
import com.ifish.entity.UserDeviceAttriName;
/**
*
*/
public interface UserDeviceAttrNameDao extends BaseDao<UserDeviceAttriName, Integer>{
}

View File

@ -0,0 +1,18 @@
package com.ifish.daoImpl;
import com.ifish.dao.FactoryHardwareDao;
import com.ifish.entity.FactoryHardware;
import com.ifish.hibernate.HibernateBaseDao;
import org.springframework.stereotype.Repository;
/**
*/
@Repository("factoryHardwareDao")
public class FactoryHardwareImpl extends HibernateBaseDao<FactoryHardware, String> implements FactoryHardwareDao {
@Override
protected Class<FactoryHardware> getEntityClass() {
return FactoryHardware.class;
}
}

View File

@ -0,0 +1,24 @@
package com.ifish.daoImpl;
import com.ifish.dao.FactoryHardwareTypeAttrDao;
import com.ifish.entity.FactoryVenderHardwareTypeAttri;
import com.ifish.hibernate.HibernateBaseDao;
import org.springframework.stereotype.Repository;
/**
* @ClassName: HardwareTypeDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository("factoryHardwareTypeAttrDao")
public class FactoryHardwareTypeAttrDaoImpl extends HibernateBaseDao<FactoryVenderHardwareTypeAttri, Integer> implements FactoryHardwareTypeAttrDao {
@Override
protected Class<FactoryVenderHardwareTypeAttri> getEntityClass() {
return FactoryVenderHardwareTypeAttri.class;
}
}

View File

@ -0,0 +1,18 @@
package com.ifish.daoImpl;
import com.ifish.dao.FactoryListDao;
import com.ifish.entity.FactoryList;
import com.ifish.hibernate.HibernateBaseDao;
import org.springframework.stereotype.Repository;
/**
*/
@Repository("factoryListDao")
public class FactoryListImpl extends HibernateBaseDao<FactoryList, String> implements FactoryListDao {
@Override
protected Class<FactoryList> getEntityClass() {
return FactoryList.class;
}
}

View File

@ -0,0 +1,24 @@
package com.ifish.daoImpl;
import com.ifish.dao.HardwareTypeAttriDao;
import com.ifish.entity.HardwareTypeAttri;
import com.ifish.hibernate.HibernateBaseDao;
import org.springframework.stereotype.Repository;
/**
* @ClassName: HardwareTypeDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository("hardwareTypeAttriDao")
public class HardwareTypeDaoAttriImpl extends HibernateBaseDao<HardwareTypeAttri, Integer> implements HardwareTypeAttriDao {
@Override
protected Class<HardwareTypeAttri> getEntityClass() {
return HardwareTypeAttri.class;
}
}

View File

@ -0,0 +1,19 @@
package com.ifish.daoImpl;
import com.ifish.dao.UserDeviceAttrNameDao;
import com.ifish.entity.UserDeviceAttriName;
import com.ifish.hibernate.HibernateBaseDao;
import org.springframework.stereotype.Repository;
/**
*
*/
@Repository("userDeviceAttrNameDao")
public class UserDeviceAttrNameDaoImpl extends HibernateBaseDao<UserDeviceAttriName, Integer> implements UserDeviceAttrNameDao {
@Override
protected Class<UserDeviceAttriName> getEntityClass() {
return UserDeviceAttriName.class;
}
}

View File

@ -0,0 +1,40 @@
package com.ifish.entity;
import javax.persistence.*;
import java.io.Serializable;
/**
* @ClassName: tbl_factory_list
* @date 2015年7月2日 下午16:40:00
*
*/
@Entity
@Table(name="tbl_factory_hardware")
public class FactoryHardware implements Serializable{
private static final long serialVersionUID = 8124293561934933084L;
@Id
@Column(name="factory_code")
@GeneratedValue(strategy=GenerationType.IDENTITY)
private String factoryCode;
@Column(name="hardware_type")
private String hardwareType;
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getHardwareType() {
return hardwareType;
}
public void setHardwareType(String hardwareType) {
this.hardwareType = hardwareType;
}
}

View File

@ -0,0 +1,50 @@
package com.ifish.entity;
import javax.persistence.*;
import java.io.Serializable;
/**
* @ClassName: tbl_factory_list
* @date 2015年7月2日 下午16:40:00
*
*/
@Entity
@Table(name="tbl_factory_list")
public class FactoryList implements Serializable{
private static final long serialVersionUID = 8124293561934933084L;
//电子厂编号
@Id
@Column(name="factory_code")
@GeneratedValue(strategy=GenerationType.IDENTITY)
private String factoryCode;
//电子厂名称
@Column(name="factory_name")
private String factoryName;
@Column(name="background")
private String background;
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryName() {
return factoryName;
}
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
public String getBackground() {
return background;
}
public void setBackground(String background) {
this.background = background;
}
}

View File

@ -0,0 +1,296 @@
package com.ifish.entity;
import com.ifish.enums.SubDirectoryEnum;
import com.ifish.util.IfishFilePath;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
*
*/
@Entity
@Table(name="tbl_factory_vender_hardware_type_attri")
public class FactoryVenderHardwareTypeAttri implements Serializable{
private static final long serialVersionUID = -5155435715428041950L;
/**
* ID
*/
@Id
@Column(name="id")
@GeneratedValue(strategy=GenerationType.AUTO)
private Integer id;
@Column(name="hardware_type")
private String hardwareType;
@Column(name="switch_s1")
private String switchS1;
@Column(name="switch_s2")
private String switchS2;
@Column(name="switch_s3")
private String switchS3;
@Column(name="switch_s4")
private String switchS4;
@Column(name="switch_s5")
private String switchS5;
@Column(name="switch_s6")
private String switchS6;
@Column(name="switch_s7")
private String switchS7;
@Column(name="switch_s8")
private String switchS8;
@Column(name="switch_s9")
private String switchS9;
@Column(name="switch_s10")
private String switchS10;
@Column(name="switch_s11")
private String switchS11;
@Column(name="switch_s12")
private String switchS12;
@Column(name="switch_s1_ico1")
private String switchS1Ico1;
@Column(name="switch_s2_ico2")
private String switchS2Ico2;
@Column(name="switch_s3_ico3")
private String switchS3Ico3;
@Column(name="switch_s4_ico4")
private String switchS4Ico4;
@Column(name="switch_s5_ico5")
private String switchS5Ico5;
@Column(name="switch_s6_ico6")
private String switchS6Ico6;
@Column(name="switch_s7_ico7")
private String switchS7Ico7;
@Column(name="switch_s8_ico8")
private String switchS8Ico8;
@Column(name="switch_s9_ico9")
private String switchS9Ico9;
@Column(name="switch_s10_ico10")
private String switchS10Ico10;
@Column(name="switch_s11_ico11")
private String switchS11Ico11;
@Column(name="switch_s12_ico12")
private String switchS12Ico12;
@Column(name="create_time")
private Date createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getHardwareType() {
return hardwareType;
}
public void setHardwareType(String hardwareType) {
this.hardwareType = hardwareType;
}
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 String getSwitchS1Ico1() {
return IfishFilePath.getPath(SubDirectoryEnum.ifishGoods, switchS1Ico1);
}
public void setSwitchS1Ico1(String switchS1Ico1) {
this.switchS1Ico1 = switchS1Ico1;
}
public String getSwitchS2Ico2() {
return IfishFilePath.getPath(SubDirectoryEnum.ifishGoods, switchS2Ico2);
}
public void setSwitchS2Ico2(String switchS2Ico2) {
this.switchS2Ico2 = switchS2Ico2;
}
public String getSwitchS3Ico3() {
return IfishFilePath.getPath(SubDirectoryEnum.ifishGoods, switchS3Ico3);
}
public void setSwitchS3Ico3(String switchS3Ico3) {
this.switchS3Ico3 = switchS3Ico3;
}
public String getSwitchS4Ico4() {
return IfishFilePath.getPath(SubDirectoryEnum.ifishGoods, switchS4Ico4);
}
public void setSwitchS4Ico4(String switchS4Ico4) {
this.switchS4Ico4 = switchS4Ico4;
}
public String getSwitchS5Ico5() {
return IfishFilePath.getPath(SubDirectoryEnum.ifishGoods, switchS5Ico5);
}
public void setSwitchS5Ico5(String switchS5Ico5) {
this.switchS5Ico5 = switchS5Ico5;
}
public String getSwitchS6Ico6() {
return IfishFilePath.getPath(SubDirectoryEnum.ifishGoods, switchS6Ico6);
}
public void setSwitchS6Ico6(String switchS6Ico6) {
this.switchS6Ico6 = switchS6Ico6;
}
public String getSwitchS7Ico7() {
return IfishFilePath.getPath(SubDirectoryEnum.ifishGoods, switchS7Ico7);
}
public void setSwitchS7Ico7(String switchS7Ico7) {
this.switchS7Ico7 = switchS7Ico7;
}
public String getSwitchS8Ico8() {
return IfishFilePath.getPath(SubDirectoryEnum.ifishGoods, switchS8Ico8);
}
public void setSwitchS8Ico8(String switchS8Ico8) {
this.switchS8Ico8 = switchS8Ico8;
}
public String getSwitchS9Ico9() {
return IfishFilePath.getPath(SubDirectoryEnum.ifishGoods, switchS9Ico9);
}
public void setSwitchS9Ico9(String switchS9Ico9) {
this.switchS9Ico9 = switchS9Ico9;
}
public String getSwitchS10Ico10() {
return IfishFilePath.getPath(SubDirectoryEnum.ifishGoods, switchS10Ico10);
}
public void setSwitchS10Ico10(String switchS10Ico10) {
this.switchS10Ico10 = switchS10Ico10;
}
public String getSwitchS11Ico11() {
return IfishFilePath.getPath(SubDirectoryEnum.ifishGoods, switchS11Ico11);
}
public void setSwitchS11Ico11(String switchS11Ico11) {
this.switchS11Ico11 = switchS11Ico11;
}
public String getSwitchS12Ico12() {
return IfishFilePath.getPath(SubDirectoryEnum.ifishGoods, switchS12Ico12);
}
public void setSwitchS12Ico12(String switchS12Ico12) {
this.switchS12Ico12 = switchS12Ico12;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -0,0 +1,301 @@
package com.ifish.entity;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
*
*/
@Entity
@Table(name="tbl_hardware_type_attri")
public class HardwareTypeAttri implements Serializable{
private static final long serialVersionUID = -5155435715428041950L;
/**
* ID
*/
@Id
@Column(name="id")
@GeneratedValue(strategy=GenerationType.AUTO)
private Integer id;
@Column(name="hardware_type")
private String hardwareType;
@Column(name="switch_s1")
private Integer switchS1 = 0;
@Column(name="switch_s2")
private Integer switchS2 = 0;
@Column(name="switch_s3")
private Integer switchS3 = 0;
@Column(name="switch_s4")
private Integer switchS4 = 0;
@Column(name="switch_s5")
private Integer switchS5 = 0;
@Column(name="switch_s6")
private Integer switchS6 = 0;
@Column(name="switch_s7")
private Integer switchS7 = 0;
@Column(name="switch_s8")
private Integer switchS8 = 0;
@Column(name="switch_s9")
private Integer switchS9 = 0;
@Column(name="switch_s10")
private Integer switchS10 = 0;
@Column(name="switch_s11")
private Integer switchS11 = 0;
@Column(name="switch_s12")
private Integer switchS12 = 0;
@Column(name="temperature1")
private Integer temperature1 = 0;
@Column(name="temperature2")
private Integer temperature2 = 0;
@Column(name="heating_set")
private Integer heatingSet = 0;
@Column(name="refrigeration_set")
private Integer refrigerationSet = 0;
@Column(name="feedfish_set")
private Integer feedfishSet = 0;
@Column(name="change_temper_set1")
private Integer changeTemperSet1 = 0;
@Column(name="change_temper_set2")
private Integer changeTemperSet2 = 0;
@Column(name="delayed_set")
private Integer delayedSet = 0;
@Column(name="electricity_show")
private Integer electricityShow = 0;
@Column(name="once_feedfish_set")
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 = new Date();
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getHardwareType() {
return hardwareType;
}
public void setHardwareType(String hardwareType) {
this.hardwareType = hardwareType;
}
public Integer getSwitchS1() {
return switchS1;
}
public void setSwitchS1(Integer switchS1) {
this.switchS1 = switchS1;
}
public Integer getSwitchS2() {
return switchS2;
}
public void setSwitchS2(Integer switchS2) {
this.switchS2 = switchS2;
}
public Integer getSwitchS3() {
return switchS3;
}
public void setSwitchS3(Integer switchS3) {
this.switchS3 = switchS3;
}
public Integer getSwitchS4() {
return switchS4;
}
public void setSwitchS4(Integer switchS4) {
this.switchS4 = switchS4;
}
public Integer getSwitchS5() {
return switchS5;
}
public void setSwitchS5(Integer switchS5) {
this.switchS5 = switchS5;
}
public Integer getSwitchS6() {
return switchS6;
}
public void setSwitchS6(Integer switchS6) {
this.switchS6 = switchS6;
}
public Integer getSwitchS7() {
return switchS7;
}
public void setSwitchS7(Integer switchS7) {
this.switchS7 = switchS7;
}
public Integer getSwitchS8() {
return switchS8;
}
public void setSwitchS8(Integer switchS8) {
this.switchS8 = switchS8;
}
public Integer getSwitchS9() {
return switchS9;
}
public void setSwitchS9(Integer switchS9) {
this.switchS9 = switchS9;
}
public Integer getSwitchS10() {
return switchS10;
}
public void setSwitchS10(Integer switchS10) {
this.switchS10 = switchS10;
}
public Integer getSwitchS11() {
return switchS11;
}
public void setSwitchS11(Integer switchS11) {
this.switchS11 = switchS11;
}
public Integer getSwitchS12() {
return switchS12;
}
public void setSwitchS12(Integer switchS12) {
this.switchS12 = switchS12;
}
public Integer getTemperature1() {
return temperature1;
}
public void setTemperature1(Integer temperature1) {
this.temperature1 = temperature1;
}
public Integer getTemperature2() {
return temperature2;
}
public void setTemperature2(Integer temperature2) {
this.temperature2 = temperature2;
}
public Integer getHeatingSet() {
return heatingSet;
}
public void setHeatingSet(Integer heatingSet) {
this.heatingSet = heatingSet;
}
public Integer getRefrigerationSet() {
return refrigerationSet;
}
public void setRefrigerationSet(Integer refrigerationSet) {
this.refrigerationSet = refrigerationSet;
}
public Integer getFeedfishSet() {
return feedfishSet;
}
public void setFeedfishSet(Integer feedfishSet) {
this.feedfishSet = feedfishSet;
}
public Integer getChangeTemperSet1() {
return changeTemperSet1;
}
public void setChangeTemperSet1(Integer changeTemperSet1) {
this.changeTemperSet1 = changeTemperSet1;
}
public Integer getChangeTemperSet2() {
return changeTemperSet2;
}
public void setChangeTemperSet2(Integer changeTemperSet2) {
this.changeTemperSet2 = changeTemperSet2;
}
public Integer getDelayedSet() {
return delayedSet;
}
public void setDelayedSet(Integer delayedSet) {
this.delayedSet = delayedSet;
}
public Integer getElectricityShow() {
return electricityShow;
}
public void setElectricityShow(Integer electricityShow) {
this.electricityShow = electricityShow;
}
public Integer getOnceFeedfishSet() {
return onceFeedfishSet;
}
public void setOnceFeedfishSet(Integer 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() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@ -0,0 +1,181 @@
package com.ifish.entity;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
*
*/
@Entity
@Table(name="tbl_device_user_attriname")
public class UserDeviceAttriName implements Serializable{
private static final long serialVersionUID = -5155435715428041950L;
/**
* ID
*/
@Id
@Column(name="id")
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@Column(name="user_id")
private Integer userId;
@Column(name="device_id")
private Integer deviceId;
@Column(name="switch_s1")
private String switchS1;
@Column(name="switch_s2")
private String switchS2;
@Column(name="switch_s3")
private String switchS3;
@Column(name="switch_s4")
private String switchS4;
@Column(name="switch_s5")
private String switchS5;
@Column(name="switch_s6")
private String switchS6;
@Column(name="switch_s7")
private String switchS7;
@Column(name="switch_s8")
private String switchS8;
@Column(name="switch_s9")
private String switchS9;
@Column(name="switch_s10")
private String switchS10;
@Column(name="switch_s11")
private String switchS11;
@Column(name="switch_s12")
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;
}
}

View File

@ -198,4 +198,7 @@ public interface BaseService {
*/ */
Object userMessageNoReadCount(Integer userId); Object userMessageNoReadCount(Integer userId);
Object getDeviceBaseInfo(String hardwareType, Integer userId, Integer deviceId);
Object setDeviceNameInfo(UserDeviceAttriName deviceAttriName);
} }

View File

@ -1,6 +1,9 @@
package com.ifish.serviceImpl; package com.ifish.serviceImpl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ifish.bean.DeviceBaseInfo;
import com.ifish.dao.*; import com.ifish.dao.*;
import com.ifish.entity.*; import com.ifish.entity.*;
import com.ifish.enums.*; import com.ifish.enums.*;
@ -22,6 +25,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
@ -2079,4 +2083,229 @@ public class BaseServiceImpl implements BaseService {
map.put("messageNoReadCount",this.pushListDao.pushNoReadCount(userId)); map.put("messageNoReadCount",this.pushListDao.pushNoReadCount(userId));
return IfishUtil.returnJson(ResultEnum.success.getKey(), map); return IfishUtil.returnJson(ResultEnum.success.getKey(), map);
} }
@Resource
private FactoryListDao factoryListDao;
@Resource
private UserDeviceAttrNameDao userDeviceAttrNameDao;
@Resource
private FactoryHardwareTypeAttrDao factoryHardwareTypeAttrDao;
@Resource
private HardwareTypeAttriDao hardwareTypeAttriDao;
@Resource
private FactoryHardwareDao factoryHardwareDao;
@Override
public Object getDeviceBaseInfo(String hardwareType, Integer userId, Integer deviceId) {
FactoryHardware factoryHardware = this.factoryHardwareDao.findUniqueByProperty(Restrictions.eq("hardwareType", hardwareType));
if (factoryHardware == null) {
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "当前设备类型未找到");
}
FactoryList factoryList = factoryListDao.findUniqueByProperty(Restrictions.eq("factoryCode", factoryHardware.getFactoryCode()));
JSONObject data = new JSONObject();
if (factoryList != null) {
data.put("background", IfishFilePath.getPath(SubDirectoryEnum.ifishGoods,factoryList.getBackground()));
}
HardwareTypeAttri hardwareTypeAttri = hardwareTypeAttriDao.findUniqueByProperty(Restrictions.eq("hardwareType", hardwareType));
List<DeviceBaseInfo> deviceBaseInfos = new ArrayList<>();
deviceBaseInfos.add(DeviceBaseInfo.builder().key("switchS1").displayName("开关1").functionCode(1).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getSwitchS1() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("switchS2").displayName("开关2").functionCode(2).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getSwitchS2() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("switchS3").displayName("开关3").functionCode(3).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getSwitchS3() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("switchS4").displayName("开关4").functionCode(4).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getSwitchS4() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("switchS5").displayName("开关5").functionCode(5).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getSwitchS5() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("switchS6").displayName("开关6").functionCode(6).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getSwitchS6() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("switchS7").displayName("开关7").functionCode(7).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getSwitchS7() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("switchS8").displayName("开关8").functionCode(8).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getSwitchS8() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("switchS9").displayName("开关9").functionCode(9).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getSwitchS9() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("switchS10").displayName("开关10").functionCode(10).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getSwitchS10() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("switchS11").displayName("开关11").functionCode(11).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getSwitchS11() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("switchS12").displayName("开关12").functionCode(12).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getSwitchS12() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("temperature1").displayName("加热温度").functionCode(13).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getTemperature1() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("heatingSet").displayName("加热模式").functionCode(14).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getHeatingSet() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("temperature2").displayName("制冷温度").functionCode(15).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getTemperature2() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("refrigerationSet").displayName("制冷模式").functionCode(16).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getRefrigerationSet() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("feedfishSet").displayName("喂鱼设置").functionCode(17).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getFeedfishSet() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("changeTemperSet1").displayName("温度矫正设置-1").functionCode(18).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getChangeTemperSet1() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("changeTemperSet2").displayName("温度矫正设置-2").functionCode(18).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getChangeTemperSet2() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("delayedSet").displayName("延时启动时间设置").functionCode(19).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getDelayedSet() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("electricityShow").displayName("电量显示").functionCode(20).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getElectricityShow() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("onceFeedfishSet").displayName("一键喂鱼按键").functionCode(21).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getOnceFeedfishSet() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("nursingLight").displayName("护理灯").functionCode(22).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getNursingLight() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("temperatureShow1").displayName("显示温度1").functionCode(23).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getTemperatureShow1() == 1).build());
deviceBaseInfos.add(DeviceBaseInfo.builder().key("temperatureShow2").displayName("显示温度2").functionCode(24).isEnable(hardwareTypeAttri != null && hardwareTypeAttri.getTemperatureShow2() == 1).build());
FactoryVenderHardwareTypeAttri hardwareTypeNameAttr = factoryHardwareTypeAttrDao.findUniqueByProperty(Restrictions.eq("hardwareType", hardwareType));
if (hardwareTypeNameAttr != null) {
for (DeviceBaseInfo deviceBaseInfo : deviceBaseInfos) {
if (StringUtils.isNotBlank(hardwareTypeNameAttr.getSwitchS1()) &&
deviceBaseInfo.getKey().equals("switchS1")) {
deviceBaseInfo.setKey(hardwareTypeNameAttr.getSwitchS1());
deviceBaseInfo.setIcon(hardwareTypeNameAttr.getSwitchS1Ico1());
}
if (StringUtils.isNotBlank(hardwareTypeNameAttr.getSwitchS2()) &&
deviceBaseInfo.getKey().equals("switchS2")) {
deviceBaseInfo.setKey(hardwareTypeNameAttr.getSwitchS2());
deviceBaseInfo.setIcon(hardwareTypeNameAttr.getSwitchS2Ico2());
}
if (StringUtils.isNotBlank(hardwareTypeNameAttr.getSwitchS3()) &&
deviceBaseInfo.getKey().equals("switchS3")) {
deviceBaseInfo.setKey(hardwareTypeNameAttr.getSwitchS3());
deviceBaseInfo.setIcon(hardwareTypeNameAttr.getSwitchS3Ico3());
}
if (StringUtils.isNotBlank(hardwareTypeNameAttr.getSwitchS4()) &&
deviceBaseInfo.getKey().equals("switchS4")) {
deviceBaseInfo.setKey(hardwareTypeNameAttr.getSwitchS4());
deviceBaseInfo.setIcon(hardwareTypeNameAttr.getSwitchS4Ico4());
}
if (StringUtils.isNotBlank(hardwareTypeNameAttr.getSwitchS5()) &&
deviceBaseInfo.getKey().equals("switchS5")) {
deviceBaseInfo.setKey(hardwareTypeNameAttr.getSwitchS5());
deviceBaseInfo.setIcon(hardwareTypeNameAttr.getSwitchS5Ico5());
}
if (StringUtils.isNotBlank(hardwareTypeNameAttr.getSwitchS6()) &&
deviceBaseInfo.getKey().equals("switchS6")) {
deviceBaseInfo.setKey(hardwareTypeNameAttr.getSwitchS6());
deviceBaseInfo.setIcon(hardwareTypeNameAttr.getSwitchS6Ico6());
}
if (StringUtils.isNotBlank(hardwareTypeNameAttr.getSwitchS7()) &&
deviceBaseInfo.getKey().equals("switchS7")) {
deviceBaseInfo.setKey(hardwareTypeNameAttr.getSwitchS7());
deviceBaseInfo.setIcon(hardwareTypeNameAttr.getSwitchS7Ico7());
}
if (StringUtils.isNotBlank(hardwareTypeNameAttr.getSwitchS8()) &&
deviceBaseInfo.getKey().equals("switchS8")) {
deviceBaseInfo.setKey(hardwareTypeNameAttr.getSwitchS8());
deviceBaseInfo.setIcon(hardwareTypeNameAttr.getSwitchS8Ico8());
}
if (StringUtils.isNotBlank(hardwareTypeNameAttr.getSwitchS9()) &&
deviceBaseInfo.getKey().equals("switchS9")) {
deviceBaseInfo.setKey(hardwareTypeNameAttr.getSwitchS9());
deviceBaseInfo.setIcon(hardwareTypeNameAttr.getSwitchS9Ico9());
}
if (StringUtils.isNotBlank(hardwareTypeNameAttr.getSwitchS10()) &&
deviceBaseInfo.getKey().equals("switchS10")) {
deviceBaseInfo.setKey(hardwareTypeNameAttr.getSwitchS10());
deviceBaseInfo.setIcon(hardwareTypeNameAttr.getSwitchS10Ico10());
}
if (StringUtils.isNotBlank(hardwareTypeNameAttr.getSwitchS11()) &&
deviceBaseInfo.getKey().equals("switchS11")) {
deviceBaseInfo.setKey(hardwareTypeNameAttr.getSwitchS11());
deviceBaseInfo.setIcon(hardwareTypeNameAttr.getSwitchS11Ico11());
}
if (StringUtils.isNotBlank(hardwareTypeNameAttr.getSwitchS12()) &&
deviceBaseInfo.getKey().equals("switchS12")) {
deviceBaseInfo.setKey(hardwareTypeNameAttr.getSwitchS12());
deviceBaseInfo.setIcon(hardwareTypeNameAttr.getSwitchS12Ico12());
}
}
}
if (deviceId != null && deviceId > 0) {
UserDeviceAttriName userDeviceAttriName = userDeviceAttrNameDao.findUniqueByProperty(Restrictions.eq("userId", userId), Restrictions.eq("deviceId", deviceId));
if (userDeviceAttriName != null) {
for (DeviceBaseInfo deviceBaseInfo : deviceBaseInfos) {
if (StringUtils.isNotBlank(userDeviceAttriName.getSwitchS1()) &&
deviceBaseInfo.getKey().equals("switchS1")) {
deviceBaseInfo.setKey(userDeviceAttriName.getSwitchS1());
}
if (StringUtils.isNotBlank(userDeviceAttriName.getSwitchS2()) &&
deviceBaseInfo.getKey().equals("switchS2")) {
deviceBaseInfo.setKey(userDeviceAttriName.getSwitchS2());
}
if (StringUtils.isNotBlank(userDeviceAttriName.getSwitchS3()) &&
deviceBaseInfo.getKey().equals("switchS3")) {
deviceBaseInfo.setKey(userDeviceAttriName.getSwitchS3());
}
if (StringUtils.isNotBlank(userDeviceAttriName.getSwitchS4()) &&
deviceBaseInfo.getKey().equals("switchS4")) {
deviceBaseInfo.setKey(userDeviceAttriName.getSwitchS4());
}
if (StringUtils.isNotBlank(userDeviceAttriName.getSwitchS5()) &&
deviceBaseInfo.getKey().equals("switchS5")) {
deviceBaseInfo.setKey(userDeviceAttriName.getSwitchS5());
}
if (StringUtils.isNotBlank(userDeviceAttriName.getSwitchS6()) &&
deviceBaseInfo.getKey().equals("switchS6")) {
deviceBaseInfo.setKey(userDeviceAttriName.getSwitchS6());
}
if (StringUtils.isNotBlank(userDeviceAttriName.getSwitchS7()) &&
deviceBaseInfo.getKey().equals("switchS7")) {
deviceBaseInfo.setKey(userDeviceAttriName.getSwitchS7());
}
if (StringUtils.isNotBlank(userDeviceAttriName.getSwitchS8()) &&
deviceBaseInfo.getKey().equals("switchS8")) {
deviceBaseInfo.setKey(userDeviceAttriName.getSwitchS8());
}
if (StringUtils.isNotBlank(userDeviceAttriName.getSwitchS9()) &&
deviceBaseInfo.getKey().equals("switchS9")) {
deviceBaseInfo.setKey(userDeviceAttriName.getSwitchS9());
}
if (StringUtils.isNotBlank(userDeviceAttriName.getSwitchS10()) &&
deviceBaseInfo.getKey().equals("switchS10")) {
deviceBaseInfo.setKey(userDeviceAttriName.getSwitchS10());
}
if (StringUtils.isNotBlank(userDeviceAttriName.getSwitchS11()) &&
deviceBaseInfo.getKey().equals("switchS11")) {
deviceBaseInfo.setKey(userDeviceAttriName.getSwitchS11());
}
if (StringUtils.isNotBlank(userDeviceAttriName.getSwitchS12()) &&
deviceBaseInfo.getKey().equals("switchS12")) {
deviceBaseInfo.setKey(userDeviceAttriName.getSwitchS12());
}
}
}
}
data.put("deviceBaseInfos", JSONArray.parseArray(JSONObject.toJSONString(deviceBaseInfos)));
return IfishUtil.returnJson(ResultEnum.success.getKey(), data);
}
@Override
public Object setDeviceNameInfo(UserDeviceAttriName deviceAttriName) {
if (deviceAttriName.getUserId() == null || deviceAttriName.getDeviceId() == null) {
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "用户ID或设备ID为空", "");
}
UserDeviceAttriName userDeviceAttriName = userDeviceAttrNameDao.findUniqueByProperty(Restrictions.eq("userId", deviceAttriName.getUserId()), Restrictions.eq("deviceId", deviceAttriName.getDeviceId()));
if (userDeviceAttriName == null) {
userDeviceAttriName = new UserDeviceAttriName();
userDeviceAttriName.setUserId(deviceAttriName.getUserId());
userDeviceAttriName.setDeviceId(deviceAttriName.getDeviceId());
}
if (deviceAttriName.getSwitchS1() != null) {
userDeviceAttriName.setSwitchS1(deviceAttriName.getSwitchS1());
}
if (deviceAttriName.getSwitchS2() != null) {
userDeviceAttriName.setSwitchS2(deviceAttriName.getSwitchS2());
}
if (deviceAttriName.getSwitchS3() != null) {
userDeviceAttriName.setSwitchS3(deviceAttriName.getSwitchS3());
}
if (deviceAttriName.getSwitchS4() != null) {
userDeviceAttriName.setSwitchS4(deviceAttriName.getSwitchS4());
}
if (deviceAttriName.getSwitchS5() != null) {
userDeviceAttriName.setSwitchS5(deviceAttriName.getSwitchS5());
}
if (deviceAttriName.getSwitchS6() != null) {
userDeviceAttriName.setSwitchS6(deviceAttriName.getSwitchS6());
}
if (deviceAttriName.getSwitchS7() != null) {
userDeviceAttriName.setSwitchS7(deviceAttriName.getSwitchS7());
}
if (deviceAttriName.getSwitchS8() != null) {
userDeviceAttriName.setSwitchS8(deviceAttriName.getSwitchS8());
}
if (deviceAttriName.getSwitchS9() != null) {
userDeviceAttriName.setSwitchS9(deviceAttriName.getSwitchS9());
}
if (deviceAttriName.getSwitchS10() != null) {
userDeviceAttriName.setSwitchS10(deviceAttriName.getSwitchS10());
}
if (deviceAttriName.getSwitchS11() != null) {
userDeviceAttriName.setSwitchS11(deviceAttriName.getSwitchS11());
}
if (deviceAttriName.getSwitchS12() != null) {
userDeviceAttriName.setSwitchS12(deviceAttriName.getSwitchS12());
}
userDeviceAttrNameDao.saveOrUpdate(userDeviceAttriName);
return IfishUtil.returnJson(ResultEnum.success.getKey(), ResultEnum.success.getValue(), JSONObject.parseObject(JSONObject.toJSONString(userDeviceAttriName)));
}
} }

View File

@ -226,7 +226,26 @@ public class IfishUtil {
} else { } else {
map.put("data", value); map.put("data", value);
} }
System.out.println("响应 : " + map.toString()); System.out.println("响应 : " + map);
return map;
}
/**
* 返回json数据
*
* @param str
* @return
*/
public static Map<String, Object> returnJson(String key, String msg, Object value) {
Map<String, Object> map = new HashMap<>();
map.put("result", key);
map.put("msg", msg);
if (value.equals("")) {
map.put("data", null);
} else {
map.put("data", value);
}
System.out.println("响应 : " + map);
return map; return map;
} }