新增加热器设备适配,及mina升级!
This commit is contained in:
parent
1ccc3c8998
commit
90de7d7808
36
pom.xml
36
pom.xml
|
|
@ -8,7 +8,7 @@
|
||||||
<name>ifishSocket</name>
|
<name>ifishSocket</name>
|
||||||
<url>http://mvnrepository.com</url>
|
<url>http://mvnrepository.com</url>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.quartz-scheduler</groupId>
|
<groupId>org.quartz-scheduler</groupId>
|
||||||
<artifactId>quartz</artifactId>
|
<artifactId>quartz</artifactId>
|
||||||
|
|
@ -67,29 +67,17 @@
|
||||||
<artifactId>c3p0</artifactId>
|
<artifactId>c3p0</artifactId>
|
||||||
<version>0.9.1.2</version>
|
<version>0.9.1.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
<version>1.7.12</version>
|
<version>1.7.13</version>
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>ch.qos.logback</groupId>
|
|
||||||
<artifactId>logback-core</artifactId>
|
|
||||||
<version>1.1.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>ch.qos.logback</groupId>
|
|
||||||
<artifactId>logback-classic</artifactId>
|
|
||||||
<version>1.1.2</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.mina</groupId>
|
<groupId>org.apache.mina</groupId>
|
||||||
<artifactId>mina-core</artifactId>
|
<artifactId>mina-core</artifactId>
|
||||||
<version>2.0.7</version>
|
<version>2.0.17</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
@ -101,13 +89,13 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.mina</groupId>
|
<groupId>org.apache.mina</groupId>
|
||||||
<artifactId>mina-integration-beans</artifactId>
|
<artifactId>mina-integration-beans</artifactId>
|
||||||
<version>2.0.7</version>
|
<version>2.0.17</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.mina</groupId>
|
<groupId>org.apache.mina</groupId>
|
||||||
<artifactId>mina-filter-compression</artifactId>
|
<artifactId>mina-filter-compression</artifactId>
|
||||||
<version>2.0.7</version>
|
<version>2.0.17</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
@ -156,7 +144,15 @@
|
||||||
<version>2.5.4</version>
|
<version>2.5.4</version>
|
||||||
<extensions>true</extensions>
|
<extensions>true</extensions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>1.6</source>
|
||||||
|
<target>1.6</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>src/main/java</directory>
|
<directory>src/main/java</directory>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.ifish.dao;
|
||||||
|
|
||||||
|
import com.ifish.entity.Device;
|
||||||
|
import com.ifish.entity.DeviceHeater;
|
||||||
|
import org.hibernate.criterion.Criterion;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: yan.y
|
||||||
|
* @Description:
|
||||||
|
* @Date: Created in 20:06 2018/9/15
|
||||||
|
* @Modified by:
|
||||||
|
*/
|
||||||
|
public interface DeviceHeaterDao {
|
||||||
|
|
||||||
|
DeviceHeater findById(Integer id);
|
||||||
|
|
||||||
|
DeviceHeater save(DeviceHeater device);
|
||||||
|
|
||||||
|
DeviceHeater update(DeviceHeater device);
|
||||||
|
|
||||||
|
DeviceHeater getUniqueByProperty(String property,Object value);
|
||||||
|
|
||||||
|
List<DeviceHeater> getByCriterion(Criterion... criterions);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.ifish.daoImpl;
|
||||||
|
|
||||||
|
import com.ifish.dao.DeviceDao;
|
||||||
|
import com.ifish.dao.DeviceHeaterDao;
|
||||||
|
import com.ifish.entity.Device;
|
||||||
|
import com.ifish.entity.DeviceHeater;
|
||||||
|
import com.ifish.hibernate.HibernateBaseDao;
|
||||||
|
import org.hibernate.criterion.Criterion;
|
||||||
|
import org.hibernate.criterion.Restrictions;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: DeviceHerterDaoImpl
|
||||||
|
* @Description: TODO
|
||||||
|
* @author ggw
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class DeviceHeaterDaoImpl extends HibernateBaseDao<DeviceHeater, Integer> implements DeviceHeaterDao {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<DeviceHeater> getEntityClass() {
|
||||||
|
return DeviceHeater.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceHeater findById(Integer id) {
|
||||||
|
return this.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceHeater getUniqueByProperty(String property, Object value) {
|
||||||
|
return this.findUniqueByProperty(Restrictions.eq(property, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceHeater save(DeviceHeater deviceHeater) {
|
||||||
|
this.getSession().save(deviceHeater);
|
||||||
|
return deviceHeater;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceHeater update(DeviceHeater deviceHeater) {
|
||||||
|
this.getSession().update(deviceHeater);
|
||||||
|
return deviceHeater;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceHeater> getByCriterion(Criterion... criterion) {
|
||||||
|
return super.findByProperty(criterion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.ifish.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: yan.y
|
||||||
|
* @Description:
|
||||||
|
* @Date: Created in 21:00 2018/9/17
|
||||||
|
* @Modified by:
|
||||||
|
*/
|
||||||
|
public class DeviceHeater implements Serializable{
|
||||||
|
|
||||||
|
private Integer heaterId;
|
||||||
|
|
||||||
|
private String heaterMacAddress;
|
||||||
|
|
||||||
|
private String heaterWaterTemperature;
|
||||||
|
|
||||||
|
private String heaterPh;
|
||||||
|
|
||||||
|
private String heaterGatheringTime;
|
||||||
|
|
||||||
|
public Integer getHeaterId() {
|
||||||
|
return heaterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaterId(Integer heaterId) {
|
||||||
|
this.heaterId = heaterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHeaterMacAddress() {
|
||||||
|
return heaterMacAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaterMacAddress(String heaterMacAddress) {
|
||||||
|
this.heaterMacAddress = heaterMacAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHeaterWaterTemperature() {
|
||||||
|
return heaterWaterTemperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaterWaterTemperature(String heaterWaterTemperature) {
|
||||||
|
this.heaterWaterTemperature = heaterWaterTemperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHeaterPh() {
|
||||||
|
return heaterPh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaterPh(String heaterPh) {
|
||||||
|
this.heaterPh = heaterPh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHeaterGatheringTime() {
|
||||||
|
return heaterGatheringTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaterGatheringTime(String heaterGatheringTime) {
|
||||||
|
this.heaterGatheringTime = heaterGatheringTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
|
||||||
|
<hibernate-mapping package="com.ifish.entity">
|
||||||
|
<class name="DeviceHeater" table="tbl_device_heater" dynamic-insert="true" dynamic-update="true">
|
||||||
|
<meta attribute="sync-DAO">false</meta>
|
||||||
|
<id name="heaterId" type="java.lang.Integer" column="heater_id">
|
||||||
|
<generator class="identity"/>
|
||||||
|
</id>
|
||||||
|
<property name="heaterMacAddress" column="heater_mac_address" type="string" length="50"/>
|
||||||
|
<property name="heaterWaterTemperature" column="heater_water_temperature" type="string" length="50"/>
|
||||||
|
<property name="heaterPh" column="heater_ph" type="string" length="50"/>
|
||||||
|
<property name="heaterGatheringTime" column="heater_gathering_time" type="string" length="50"/>
|
||||||
|
</class>
|
||||||
|
</hibernate-mapping>
|
||||||
|
|
@ -35,7 +35,7 @@ public class ExecuteJob implements Job {
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceService deviceService;
|
private DeviceService deviceService;
|
||||||
|
|
||||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
//任务传递的参数
|
//任务传递的参数
|
||||||
JobDataMap dataMap = context.getJobDetail().getJobDataMap();
|
JobDataMap dataMap = context.getJobDetail().getJobDataMap();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ifish.quartz;
|
package com.ifish.quartz;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
import org.quartz.JobBuilder;
|
import org.quartz.JobBuilder;
|
||||||
import org.quartz.JobDetail;
|
import org.quartz.JobDetail;
|
||||||
import org.quartz.JobKey;
|
import org.quartz.JobKey;
|
||||||
|
|
@ -10,8 +11,6 @@ import org.quartz.Trigger;
|
||||||
import org.quartz.TriggerBuilder;
|
import org.quartz.TriggerBuilder;
|
||||||
import org.quartz.TriggerKey;
|
import org.quartz.TriggerKey;
|
||||||
import org.quartz.impl.StdSchedulerFactory;
|
import org.quartz.impl.StdSchedulerFactory;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -20,7 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
*/
|
*/
|
||||||
public class ScheduleJob {
|
public class ScheduleJob {
|
||||||
|
|
||||||
private static Logger log = LoggerFactory.getLogger(ScheduleJob.class);
|
private static Logger log = Logger.getLogger(ScheduleJob.class);
|
||||||
//调度
|
//调度
|
||||||
private Scheduler scheduler = null;
|
private Scheduler scheduler = null;
|
||||||
|
|
||||||
|
|
@ -36,7 +35,7 @@ public class ScheduleJob {
|
||||||
scheduler.setJobFactory(jobFactory);
|
scheduler.setJobFactory(jobFactory);
|
||||||
scheduler.start();
|
scheduler.start();
|
||||||
} catch (SchedulerException e) {
|
} catch (SchedulerException e) {
|
||||||
log.error("start scheduler error:{}",e.toString());
|
log.error(String.format("start scheduler error:{%s}",e.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -46,7 +45,8 @@ public class ScheduleJob {
|
||||||
*/
|
*/
|
||||||
public void addJob(JobGroup jobGroup){
|
public void addJob(JobGroup jobGroup){
|
||||||
try {
|
try {
|
||||||
log.info("添加任务:{}.{}",jobGroup.getJobName(),jobGroup.getTriggerName());
|
log.info(String.format("添加任务:%s.%s",jobGroup.getJobName(),jobGroup.getTriggerName()));
|
||||||
|
// log.info("添加任务:{}.{}",jobGroup.getJobName(),jobGroup.getTriggerName());
|
||||||
//任务
|
//任务
|
||||||
JobDetail jobDetail= JobBuilder.newJob(ExecuteJob.class)
|
JobDetail jobDetail= JobBuilder.newJob(ExecuteJob.class)
|
||||||
.usingJobData("macAddress", jobGroup.getMacAddress())
|
.usingJobData("macAddress", jobGroup.getMacAddress())
|
||||||
|
|
@ -60,7 +60,8 @@ public class ScheduleJob {
|
||||||
//添加触发器
|
//添加触发器
|
||||||
scheduler.scheduleJob(jobDetail,trigger);
|
scheduler.scheduleJob(jobDetail,trigger);
|
||||||
} catch (SchedulerException e) {
|
} catch (SchedulerException e) {
|
||||||
log.error("addJob error【macAddress:{},jobGroup:{},triggerGroup:{},errMsg:{}】",jobGroup.getMacAddress(),jobGroup.getJobName(),jobGroup.getTriggerGroup(),e.toString());
|
log.error(String.format("addJob error【macAddress:{%s},jobGroup:{%s},triggerGroup:{%s},errMsg:{%s}】",jobGroup.getMacAddress(),jobGroup.getJobName(),jobGroup.getTriggerGroup(),e.toString()));
|
||||||
|
// log.error("addJob error【macAddress:{},jobGroup:{},triggerGroup:{},errMsg:{}】",jobGroup.getMacAddress(),jobGroup.getJobName(),jobGroup.getTriggerGroup(),e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
@ -70,7 +71,7 @@ public class ScheduleJob {
|
||||||
*/
|
*/
|
||||||
public void deleteJob(JobGroup jobGroup){
|
public void deleteJob(JobGroup jobGroup){
|
||||||
try {
|
try {
|
||||||
log.info("移除任务:{}.{}",jobGroup.getJobName(),jobGroup.getTriggerName());
|
log.info(String.format("移除任务:%s.%s",jobGroup.getJobName(),jobGroup.getTriggerName()));
|
||||||
//触发器
|
//触发器
|
||||||
TriggerKey triggerKey = TriggerKey.triggerKey(jobGroup.getTriggerName(),jobGroup.getTriggerGroup());
|
TriggerKey triggerKey = TriggerKey.triggerKey(jobGroup.getTriggerName(),jobGroup.getTriggerGroup());
|
||||||
//停止触发器
|
//停止触发器
|
||||||
|
|
@ -82,7 +83,7 @@ public class ScheduleJob {
|
||||||
//删除任务
|
//删除任务
|
||||||
scheduler.deleteJob(jobKey);
|
scheduler.deleteJob(jobKey);
|
||||||
} catch (SchedulerException e) {
|
} catch (SchedulerException e) {
|
||||||
log.error("deleteJob error【macAddress:{},jobGroup:{},triggerGroup:{},errMsg:{}】",jobGroup.getMacAddress(),jobGroup.getJobName(),jobGroup.getTriggerGroup(),e.toString());
|
log.error(String.format("deleteJob error【macAddress:{%s},jobGroup:{%s},triggerGroup:{%s},errMsg:{%s}】",jobGroup.getMacAddress(),jobGroup.getJobName(),jobGroup.getTriggerGroup(),e.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,7 +95,7 @@ public class ScheduleJob {
|
||||||
//关闭任务
|
//关闭任务
|
||||||
scheduler.shutdown();
|
scheduler.shutdown();
|
||||||
} catch (SchedulerException e) {
|
} catch (SchedulerException e) {
|
||||||
log.error("shutdown scheduler error:{}",e.toString());
|
log.error(String.format("shutdown scheduler error:{%s}",e.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,8 @@ package com.ifish.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ifish.entity.Device;
|
import com.ifish.entity.*;
|
||||||
import com.ifish.entity.DeviceUser;
|
import com.ifish.socketNew.model.receive.BackFunctionCodeHeater;
|
||||||
import com.ifish.entity.FactoryList;
|
|
||||||
import com.ifish.entity.HardwareType;
|
|
||||||
import com.ifish.entity.LoginRecord;
|
|
||||||
import com.ifish.socketNew.model.send.OrderFunctionCode1;
|
import com.ifish.socketNew.model.send.OrderFunctionCode1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -17,23 +14,28 @@ import com.ifish.socketNew.model.send.OrderFunctionCode1;
|
||||||
*/
|
*/
|
||||||
public interface DeviceService {
|
public interface DeviceService {
|
||||||
|
|
||||||
public Device update(Device device);
|
Device update(Device device);
|
||||||
|
|
||||||
public Device update(OrderFunctionCode1 model);
|
Device update(OrderFunctionCode1 model);
|
||||||
|
|
||||||
|
DeviceHeater save(BackFunctionCodeHeater model);
|
||||||
|
DeviceHeater update(DeviceHeater deviceHeater);
|
||||||
|
|
||||||
|
void updateWarnOnoff(String macAddress,String onOff);
|
||||||
|
|
||||||
public void updateWarnOnoff(String macAddress,String onOff);
|
Device getUniqueByProperty(String property,Object value);
|
||||||
|
|
||||||
|
List<Device> getByProperty(String property,Object value);
|
||||||
|
|
||||||
|
List<DeviceHeater> getDeviceHeaterByProperty(String hour,String macAddress);
|
||||||
|
|
||||||
|
DeviceUser getUniqueByProperty(String macAddress);
|
||||||
|
|
||||||
public Device getUniqueByProperty(String property,Object value);
|
List<DeviceUser> getListByProperty(Integer deviceId);
|
||||||
|
|
||||||
public List<Device> getByProperty(String property,Object value);
|
LoginRecord save(LoginRecord loginRecord);
|
||||||
|
|
||||||
public DeviceUser getUniqueByProperty(String macAddress);
|
FactoryList getFactoryListById(String factoryCode);
|
||||||
|
|
||||||
public List<DeviceUser> getListByProperty(Integer deviceId);
|
HardwareType getHardwareTypeById(String typeCode);
|
||||||
|
|
||||||
public LoginRecord save(LoginRecord loginRecord);
|
|
||||||
|
|
||||||
public FactoryList getFactoryListById(String factoryCode);
|
|
||||||
|
|
||||||
public HardwareType getHardwareTypeById(String typeCode);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,14 @@
|
||||||
package com.ifish.serviceImpl;
|
package com.ifish.serviceImpl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ifish.dao.*;
|
||||||
|
import com.ifish.entity.*;
|
||||||
|
import com.ifish.socketNew.model.receive.BackFunctionCodeHeater;
|
||||||
|
import org.hibernate.criterion.Criterion;
|
||||||
import org.hibernate.criterion.Restrictions;
|
import org.hibernate.criterion.Restrictions;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
@ -10,16 +16,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import com.ifish.dao.DeviceDao;
|
|
||||||
import com.ifish.dao.DeviceUserDao;
|
|
||||||
import com.ifish.dao.FactoryListDao;
|
|
||||||
import com.ifish.dao.HardwareTypeDao;
|
|
||||||
import com.ifish.dao.LoginRecordDao;
|
|
||||||
import com.ifish.entity.Device;
|
|
||||||
import com.ifish.entity.DeviceUser;
|
|
||||||
import com.ifish.entity.FactoryList;
|
|
||||||
import com.ifish.entity.HardwareType;
|
|
||||||
import com.ifish.entity.LoginRecord;
|
|
||||||
import com.ifish.enums.BooleanEnum;
|
import com.ifish.enums.BooleanEnum;
|
||||||
import com.ifish.service.DeviceService;
|
import com.ifish.service.DeviceService;
|
||||||
import com.ifish.socketNew.model.send.OrderFunctionCode1;
|
import com.ifish.socketNew.model.send.OrderFunctionCode1;
|
||||||
|
|
@ -41,6 +37,8 @@ public class DeviceServiceImpl implements DeviceService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceDao deviceDao;
|
private DeviceDao deviceDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private DeviceHeaterDao deviceHeaterDao;
|
||||||
|
@Autowired
|
||||||
private LoginRecordDao loginRecordDao;
|
private LoginRecordDao loginRecordDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceUserDao deviceUserDao;
|
private DeviceUserDao deviceUserDao;
|
||||||
|
|
@ -168,4 +166,28 @@ public class DeviceServiceImpl implements DeviceService {
|
||||||
return this.hardwareTypeDao.findById(typeCode);
|
return this.hardwareTypeDao.findById(typeCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceHeater save(BackFunctionCodeHeater model) {
|
||||||
|
//保存加热棒数据 按天
|
||||||
|
DeviceHeater deviceHeater = new DeviceHeater();
|
||||||
|
deviceHeater.setHeaterGatheringTime(Calendar.getInstance().get(Calendar.HOUR_OF_DAY) + "");
|
||||||
|
deviceHeater.setHeaterMacAddress(ByteUtil.bytesToHexString(model.getSrc()));
|
||||||
|
deviceHeater.setHeaterPh(String.valueOf(model.getPh()));
|
||||||
|
deviceHeater.setHeaterWaterTemperature(String.valueOf(model.getWaterTemperature()));
|
||||||
|
return this.deviceHeaterDao.save(deviceHeater);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceHeater update(DeviceHeater deviceHeater) {
|
||||||
|
return this.deviceHeaterDao.update(deviceHeater);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceHeater> getDeviceHeaterByProperty(String hour,String macAddress) {
|
||||||
|
List<Criterion> queryList = new ArrayList<Criterion>();
|
||||||
|
queryList.add(Restrictions.eq("heaterMacAddress",macAddress));
|
||||||
|
queryList.add(Restrictions.eq("heaterGatheringTime",hour));
|
||||||
|
List<DeviceHeater> list = this.deviceHeaterDao.getByCriterion(queryList.toArray(new Criterion[queryList.size()]));
|
||||||
|
return list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ public class MinaServerHandler extends IoHandlerAdapter {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void sessionClosed(IoSession session) throws Exception {
|
public void sessionClosed(IoSession session) throws Exception {
|
||||||
log.warn("{}:会话关闭,连接数:{}", session.getRemoteAddress(), atomicInt.decrementAndGet());
|
log.info("{}:会话关闭,连接数:{}", session.getRemoteAddress(), atomicInt.decrementAndGet());
|
||||||
//旧连接关闭,获取设备mac地址
|
//旧连接关闭,获取设备mac地址
|
||||||
String oldConnect = session.getRemoteAddress().toString();
|
String oldConnect = session.getRemoteAddress().toString();
|
||||||
String macAddress = SomeServer.remoteAddress.get(oldConnect);
|
String macAddress = SomeServer.remoteAddress.get(oldConnect);
|
||||||
|
|
@ -92,7 +92,7 @@ public class MinaServerHandler extends IoHandlerAdapter {
|
||||||
//离线时间
|
//离线时间
|
||||||
jobGroup.setTimestamp(IfishUtil.format(new Date()));
|
jobGroup.setTimestamp(IfishUtil.format(new Date()));
|
||||||
//10分钟后推送
|
//10分钟后推送
|
||||||
jobGroup.setStartTime(new Date(new Date().getTime() + 600000L));
|
jobGroup.setStartTime(new Date(System.currentTimeMillis() + 600000L));
|
||||||
scheduleJob.addJob(jobGroup);
|
scheduleJob.addJob(jobGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ public class MinaServerHandler extends IoHandlerAdapter {
|
||||||
@Override
|
@Override
|
||||||
public void sessionIdle(IoSession session, IdleStatus status)
|
public void sessionIdle(IoSession session, IdleStatus status)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
log.warn("空闲超时,服务器主动关闭连接{}", session.getRemoteAddress());
|
log.info("空闲超时,服务器主动关闭连接{}", session.getRemoteAddress());
|
||||||
session.close(true);
|
session.close(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,16 @@
|
||||||
package com.ifish.socketNew;
|
package com.ifish.socketNew;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArraySet;
|
import java.util.concurrent.CopyOnWriteArraySet;
|
||||||
|
|
||||||
|
import com.ifish.entity.*;
|
||||||
|
import com.ifish.socketNew.model.receive.*;
|
||||||
import org.apache.mina.core.session.IoSession;
|
import org.apache.mina.core.session.IoSession;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import com.ifish.entity.Device;
|
|
||||||
import com.ifish.entity.DeviceUser;
|
|
||||||
import com.ifish.entity.LoginRecord;
|
|
||||||
import com.ifish.entity.PushList;
|
|
||||||
import com.ifish.entity.User;
|
|
||||||
import com.ifish.enums.BooleanEnum;
|
import com.ifish.enums.BooleanEnum;
|
||||||
import com.ifish.enums.NeteaseEnum;
|
import com.ifish.enums.NeteaseEnum;
|
||||||
import com.ifish.enums.PushTypeEnum;
|
import com.ifish.enums.PushTypeEnum;
|
||||||
|
|
@ -25,9 +19,6 @@ import com.ifish.quartz.JobGroup;
|
||||||
import com.ifish.quartz.ScheduleJob;
|
import com.ifish.quartz.ScheduleJob;
|
||||||
import com.ifish.service.DeviceService;
|
import com.ifish.service.DeviceService;
|
||||||
import com.ifish.service.UserService;
|
import com.ifish.service.UserService;
|
||||||
import com.ifish.socketNew.model.receive.BackFunctionCode0;
|
|
||||||
import com.ifish.socketNew.model.receive.BackFunctionCode1;
|
|
||||||
import com.ifish.socketNew.model.receive.BackFunctionCode8;
|
|
||||||
import com.ifish.socketNew.model.send.OrderFunctionCode0;
|
import com.ifish.socketNew.model.send.OrderFunctionCode0;
|
||||||
import com.ifish.socketNew.model.send.OrderFunctionCode1;
|
import com.ifish.socketNew.model.send.OrderFunctionCode1;
|
||||||
import com.ifish.socketNew.model.send.OrderFunctionCode15;
|
import com.ifish.socketNew.model.send.OrderFunctionCode15;
|
||||||
|
|
@ -58,8 +49,8 @@ public class SomeServer {
|
||||||
public static boolean isReplay = true;
|
public static boolean isReplay = true;
|
||||||
|
|
||||||
private static Logger log = LoggerFactory.getLogger(SomeServer.class);
|
private static Logger log = LoggerFactory.getLogger(SomeServer.class);
|
||||||
public static ConcurrentHashMap<String, String> remoteAddress = new ConcurrentHashMap<String, String>();
|
public static final ConcurrentHashMap<String, String> remoteAddress = new ConcurrentHashMap<String, String>();
|
||||||
public static ConcurrentHashMap<String, IoSession> sessions_cz = new ConcurrentHashMap<String, IoSession>();
|
public static final ConcurrentHashMap<String, IoSession> sessions_cz = new ConcurrentHashMap<String, IoSession>();
|
||||||
private ConcurrentHashMap<String, CopyOnWriteArraySet<IoSession>> sessions_sjs = new ConcurrentHashMap<String, CopyOnWriteArraySet<IoSession>>();
|
private ConcurrentHashMap<String, CopyOnWriteArraySet<IoSession>> sessions_sjs = new ConcurrentHashMap<String, CopyOnWriteArraySet<IoSession>>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -70,6 +61,7 @@ public class SomeServer {
|
||||||
public void doSome(IoSession session, Object message) {
|
public void doSome(IoSession session, Object message) {
|
||||||
//通配字符串
|
//通配字符串
|
||||||
if(message instanceof byte[]){
|
if(message instanceof byte[]){
|
||||||
|
|
||||||
byte[] bytes = (byte[]) message;
|
byte[] bytes = (byte[]) message;
|
||||||
//长度
|
//长度
|
||||||
int length = bytes[14] & 0xff;
|
int length = bytes[14] & 0xff;
|
||||||
|
|
@ -86,6 +78,21 @@ public class SomeServer {
|
||||||
else{
|
else{
|
||||||
sendToDevice(session,strSrc, message);
|
sendToDevice(session,strSrc, message);
|
||||||
}
|
}
|
||||||
|
} else if (message instanceof BackFunctionCodeHeater) {
|
||||||
|
//智能加热棒 获取服务器响应数据 以小时分开 mac地址唯一 最多24条数据
|
||||||
|
BackFunctionCodeHeater heater = (BackFunctionCodeHeater) message;
|
||||||
|
String macAddress = ByteUtil.bytesToHexString(heater.getSrc());
|
||||||
|
String hour = String.valueOf(Calendar.getInstance().get(Calendar.HOUR_OF_DAY));
|
||||||
|
List<DeviceHeater> deviceHeaters = deviceService.getDeviceHeaterByProperty(hour, macAddress);
|
||||||
|
if (deviceHeaters.size() > 0) {
|
||||||
|
DeviceHeater deviceHeater = deviceHeaters.get(0);
|
||||||
|
deviceHeater.setHeaterWaterTemperature(String.valueOf(heater.getWaterTemperature()));
|
||||||
|
deviceHeater.setHeaterPh(String.valueOf(heater.getPh()));
|
||||||
|
deviceService.update(deviceHeater);
|
||||||
|
} else {
|
||||||
|
deviceService.save(heater);
|
||||||
|
}
|
||||||
|
sendToApp(session,macAddress,heater.getByteMessage());
|
||||||
}
|
}
|
||||||
//设置设备温度报警
|
//设置设备温度报警
|
||||||
else if(message instanceof OrderFunctionCode5) {
|
else if(message instanceof OrderFunctionCode5) {
|
||||||
|
|
@ -101,7 +108,7 @@ public class SomeServer {
|
||||||
log.error("error Onoff:{},macAddress:{}",Onoff,strDest);
|
log.error("error Onoff:{},macAddress:{}",Onoff,strDest);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("set OrderSetWarnModel error:macAddress:{},error msg:{}",strDest,e.toString());
|
log.error("set OrderSetWarnModel error:macAddress:{},error msg:{}",strDest,e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//设备温度报警
|
//设备温度报警
|
||||||
|
|
@ -154,7 +161,7 @@ public class SomeServer {
|
||||||
deviceService.save(loginRecord);
|
deviceService.save(loginRecord);
|
||||||
// }
|
// }
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("save device login error:macAddress:{},error msg:{}",strSrc,e.toString());
|
log.error("save device login error:macAddress:{},error msg:{}",strSrc,e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//APP登录服务器
|
//APP登录服务器
|
||||||
|
|
@ -216,7 +223,7 @@ public class SomeServer {
|
||||||
this.deviceService.update(device);
|
this.deviceService.update(device);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("save device sdk version16 error:macAddress:{},error msg:{}",strSrc,e.toString());
|
log.error("save device sdk version16 error:macAddress:{},error msg:{}",strSrc,e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//模块版本号
|
//模块版本号
|
||||||
|
|
@ -248,14 +255,13 @@ public class SomeServer {
|
||||||
this.deviceService.update(device);
|
this.deviceService.update(device);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("save device sdk version17 error:macAddress:{},error msg:{}",strSrc,e.toString());
|
log.error("save device sdk version17 error:macAddress:{},error msg:{}",strSrc,e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送数据APP
|
* 发送数据APP
|
||||||
* @param dest 目的地
|
|
||||||
* @param message 发送对象
|
* @param message 发送对象
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -280,7 +286,6 @@ public class SomeServer {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 发送数据给设备
|
* 发送数据给设备
|
||||||
* @param dest 目的地
|
|
||||||
* @param message 发送对象
|
* @param message 发送对象
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -363,7 +368,7 @@ public class SomeServer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("pushNotifcation error:macAddress:{},error msg:{}",strSrc,e.toString());
|
log.error("pushNotifcation error:macAddress:{},error msg:{}",strSrc,e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@ package com.ifish.socketNew.codeFactory;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
|
import com.ifish.socketNew.model.receive.BackFunctionCodeHeater;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.mina.core.buffer.IoBuffer;
|
import org.apache.mina.core.buffer.IoBuffer;
|
||||||
import org.apache.mina.core.session.AttributeKey;
|
import org.apache.mina.core.session.AttributeKey;
|
||||||
import org.apache.mina.core.session.IoSession;
|
import org.apache.mina.core.session.IoSession;
|
||||||
import org.apache.mina.filter.codec.ProtocolDecoder;
|
import org.apache.mina.filter.codec.ProtocolDecoder;
|
||||||
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
|
import org.apache.mina.filter.codec.ProtocolDecoderOutput;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import com.ifish.socketNew.model.send.OrderFunctionCode0;
|
import com.ifish.socketNew.model.send.OrderFunctionCode0;
|
||||||
import com.ifish.socketNew.model.send.OrderFunctionCode1;
|
import com.ifish.socketNew.model.send.OrderFunctionCode1;
|
||||||
|
|
@ -28,7 +28,7 @@ public class ServerDecode implements ProtocolDecoder {
|
||||||
|
|
||||||
private final AttributeKey CONTEXT = new AttributeKey(getClass(), "context");
|
private final AttributeKey CONTEXT = new AttributeKey(getClass(), "context");
|
||||||
private final Charset charset;
|
private final Charset charset;
|
||||||
private static Logger log = LoggerFactory.getLogger(ServerDecode.class);
|
private static Logger log = Logger.getLogger(ServerDecode.class);
|
||||||
|
|
||||||
public ServerDecode() {
|
public ServerDecode() {
|
||||||
this(Charset.defaultCharset());
|
this(Charset.defaultCharset());
|
||||||
|
|
@ -79,7 +79,8 @@ public class ServerDecode implements ProtocolDecoder {
|
||||||
doDecode(buf, out, length ,check_code);
|
doDecode(buf, out, length ,check_code);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
log.info("length error:length:【{}】,limit:【{}】,HexDump:【{}】",length,limit,buf.getHexDump());
|
// log.info(String.format("length error:length:【%s】,limit:【%s】,HexDump:【%s】",length,limit,buf.getHexDump()));
|
||||||
|
// log.info("length error:length:【{}】,limit:【{}】,HexDump:【{}】",length,limit,buf.getHexDump());
|
||||||
}
|
}
|
||||||
buf.position(0);
|
buf.position(0);
|
||||||
buf.clear();
|
buf.clear();
|
||||||
|
|
@ -96,11 +97,15 @@ public class ServerDecode implements ProtocolDecoder {
|
||||||
byte[] bytes = new byte[length];
|
byte[] bytes = new byte[length];
|
||||||
buf.get(bytes);
|
buf.get(bytes);
|
||||||
buf.flip();
|
buf.flip();
|
||||||
//log.info("length:【{}】;limit:【{}】,HexDump:【{}】",length,buf.limit(),buf.getHexDump());
|
// log.info("lengthth:【{}】;limit:【{}】,HexDump:【{}】",length,buf.limit(),buf.getHexDump());
|
||||||
//crc16校验
|
//crc16校验
|
||||||
//boolean bln = CRC16.calcCrc16(ByteUtil.hexStringToBytes(hexDump));
|
//boolean bln = CRC16.calcCrc16(ByteUtil.hexStringToBytes(hexDump));
|
||||||
switch (length) {
|
switch (length) {
|
||||||
//长度为22
|
//长度为22
|
||||||
|
case 31: {
|
||||||
|
functionBackHeater(bytes,buf, out);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 22:{
|
case 22:{
|
||||||
//设置报警温度
|
//设置报警温度
|
||||||
if(check_code==5){
|
if(check_code==5){
|
||||||
|
|
@ -360,6 +365,42 @@ public class ServerDecode implements ProtocolDecoder {
|
||||||
out.write(model);
|
out.write(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void functionBackHeater(byte[] bytes,IoBuffer buf, ProtocolDecoderOutput out){
|
||||||
|
BackFunctionCodeHeater model = new BackFunctionCodeHeater();
|
||||||
|
model.setByteMessage(bytes);
|
||||||
|
|
||||||
|
buf.getHexDump();
|
||||||
|
|
||||||
|
//15字节头
|
||||||
|
model.setType(buf.get());
|
||||||
|
model.setCheck_code(buf.get());
|
||||||
|
byte[] src = model.getSrc();
|
||||||
|
for (int i = 0; i < src.length; i++) {
|
||||||
|
src[i] = buf.get();
|
||||||
|
}
|
||||||
|
model.setSrc(src);
|
||||||
|
byte[] dest = model.getDest();
|
||||||
|
for (int i = 0; i < dest.length; i++) {
|
||||||
|
dest[i] = buf.get();
|
||||||
|
}
|
||||||
|
model.setDest(dest);
|
||||||
|
model.setRemote_len(buf.get());
|
||||||
|
|
||||||
|
model.setMainNumber(buf.get());
|
||||||
|
model.setMainSwitch(buf.get());
|
||||||
|
model.setControlState(buf.get());
|
||||||
|
model.setWaterTemperature(buf.getShort());
|
||||||
|
model.setHeatingTemperature(buf.getShort());
|
||||||
|
model.setAlarmSwitch(buf.get());
|
||||||
|
model.setPh(buf.getShort());
|
||||||
|
model.setLowTemperature(buf.getShort());
|
||||||
|
model.setHighTemperature(buf.getShort());
|
||||||
|
byte[] crc16_code = model.getCrc16_code();
|
||||||
|
for (int i = 0; i < crc16_code.length; i++) {
|
||||||
|
crc16_code[i] = buf.get();
|
||||||
|
}
|
||||||
|
out.write(model);
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void dispose(IoSession session) throws Exception {
|
public void dispose(IoSession session) throws Exception {
|
||||||
Context ctx = (Context) session.getAttribute(CONTEXT);
|
Context ctx = (Context) session.getAttribute(CONTEXT);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,131 @@
|
||||||
|
package com.ifish.socketNew.model.receive;
|
||||||
|
|
||||||
|
import com.ifish.socketNew.model.HeadModel;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 智能加热棒心跳返回30字节 15数据包头+13内容+2校验码
|
||||||
|
* @author guogw
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class BackFunctionCodeHeater extends HeadModel implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 5899193914651159511L;
|
||||||
|
|
||||||
|
private byte[] byteMessage;
|
||||||
|
|
||||||
|
private byte mainNumber;
|
||||||
|
|
||||||
|
private byte mainSwitch;
|
||||||
|
|
||||||
|
private byte controlState;
|
||||||
|
|
||||||
|
private short waterTemperature;
|
||||||
|
|
||||||
|
private short heatingTemperature;
|
||||||
|
|
||||||
|
private byte alarmSwitch;
|
||||||
|
|
||||||
|
private short ph;
|
||||||
|
|
||||||
|
private short lowTemperature;
|
||||||
|
|
||||||
|
private short highTemperature;
|
||||||
|
|
||||||
|
public byte[] getByteMessage() {
|
||||||
|
return byteMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setByteMessage(byte[] byteMessage) {
|
||||||
|
this.byteMessage = byteMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getMainNumber() {
|
||||||
|
return mainNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMainNumber(byte mainNumber) {
|
||||||
|
this.mainNumber = mainNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getMainSwitch() {
|
||||||
|
return mainSwitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMainSwitch(byte mainSwitch) {
|
||||||
|
this.mainSwitch = mainSwitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getControlState() {
|
||||||
|
return controlState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setControlState(byte controlState) {
|
||||||
|
this.controlState = controlState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getWaterTemperature() {
|
||||||
|
return waterTemperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWaterTemperature(short waterTemperature) {
|
||||||
|
this.waterTemperature = waterTemperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getHeatingTemperature() {
|
||||||
|
return heatingTemperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeatingTemperature(short heatingTemperature) {
|
||||||
|
this.heatingTemperature = heatingTemperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte getAlarmSwitch() {
|
||||||
|
return alarmSwitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlarmSwitch(byte alarmSwitch) {
|
||||||
|
this.alarmSwitch = alarmSwitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getPh() {
|
||||||
|
return ph;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPh(short ph) {
|
||||||
|
this.ph = ph;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getLowTemperature() {
|
||||||
|
return lowTemperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLowTemperature(short lowTemperature) {
|
||||||
|
this.lowTemperature = lowTemperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getHighTemperature() {
|
||||||
|
return highTemperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHighTemperature(short highTemperature) {
|
||||||
|
this.highTemperature = highTemperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
final StringBuffer sb = new StringBuffer("BackFunctionCodeHeater{");
|
||||||
|
sb.append("mainNumber=").append(mainNumber);
|
||||||
|
sb.append(", mainSwitch=").append(mainSwitch);
|
||||||
|
sb.append(", controlState=").append(controlState);
|
||||||
|
sb.append(", waterTemperature=").append(waterTemperature);
|
||||||
|
sb.append(", heatingTemperature=").append(heatingTemperature);
|
||||||
|
sb.append(", alarmSwitch=").append(alarmSwitch);
|
||||||
|
sb.append(", ph=").append(ph);
|
||||||
|
sb.append(", lowTemperature=").append(lowTemperature);
|
||||||
|
sb.append(", highTemperature=").append(highTemperature);
|
||||||
|
sb.append('}');
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,18 +1,15 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
|
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||||
xmlns:aop="http://www.springframework.org/schema/aop"
|
xmlns:context="http://www.springframework.org/schema/context"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
|
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
|
||||||
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
|
|
||||||
http://www.springframework.org/schema/context
|
http://www.springframework.org/schema/context
|
||||||
http://www.springframework.org/schema/context/spring-context-4.0.xsd
|
http://www.springframework.org/schema/context/spring-context-4.0.xsd"
|
||||||
http://www.springframework.org/schema/aop
|
|
||||||
http://www.springframework.org/schema/aop/spring-aop.xsd"
|
|
||||||
default-lazy-init="true">
|
default-lazy-init="true">
|
||||||
|
|
||||||
<!-- 注册识别注解 -->
|
<!-- 注册识别注解 -->
|
||||||
<context:component-scan base-package="com.ifish.daoImpl,com.ifish.serviceImpl"/>
|
<context:component-scan base-package="com.ifish.daoImpl,com.ifish.serviceImpl"/>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
c3p0.driverClassName=com.mysql.jdbc.Driver
|
c3p0.driverClassName=com.mysql.jdbc.Driver
|
||||||
c3p0.url=jdbc\:mysql\://localhost\:3306/myfishdb?characterEncoding\=UTF-8
|
c3p0.url=jdbc\:mysql\://localhost\:3306/myfishdb?characterEncoding\=UTF-8
|
||||||
|
#c3p0.url=jdbc\:mysql\://139.196.24.156\:3306/myfishdb?characterEncoding\=UTF-8
|
||||||
c3p0.username=ifish
|
c3p0.username=ifish
|
||||||
c3p0.password=ifish7pwd
|
c3p0.password=ifish7pwd
|
||||||
#c3p0.username=root
|
#c3p0.username=root
|
||||||
|
#c3p0.password=ifish7mysql
|
||||||
|
#c3p0.username=root
|
||||||
#c3p0.password=123456
|
#c3p0.password=123456
|
||||||
|
|
||||||
c3p0.autoCommitOnClose=true
|
c3p0.autoCommitOnClose=true
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
log4j.rootLogger=INFO,CONSOLE,FILE,ROLLING_FILE
|
||||||
|
###################
|
||||||
|
# Console Appender
|
||||||
|
###################
|
||||||
|
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
|
||||||
|
log4j.appender.Threshold=INFO
|
||||||
|
log4j.appender.CONSOLE.Target=System.out
|
||||||
|
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.CONSOLE.layout.ConversionPattern=[ifish7Socket][%-5p]%d - (%F:%L) - %m%n
|
||||||
|
########################
|
||||||
|
# [INFO]Daily Rolling File
|
||||||
|
########################
|
||||||
|
log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
|
||||||
|
log4j.appender.FILE.Threshold=INFO
|
||||||
|
log4j.appender.FILE.File=/logs/ifishSocket/ifish7Socket_ALL.log
|
||||||
|
log4j.appender.FILE.Append=true
|
||||||
|
log4j.appender.FILE.ImmediateFlush = true
|
||||||
|
log4j.appender.FILE.DatePattern='.'yyyy-MM-dd
|
||||||
|
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.FILE.layout.ConversionPattern=[Ifish7][%-5p]%d - %c.%t(%F:%L) - %m%n
|
||||||
|
|
||||||
|
########################
|
||||||
|
# [ERROR]Rolling File
|
||||||
|
########################
|
||||||
|
log4j.appender.ROLLING_FILE=org.apache.log4j.DailyRollingFileAppender
|
||||||
|
log4j.appender.ROLLING_FILE.Threshold=ERROR
|
||||||
|
log4j.appender.ROLLING_FILE.File=/logs/ifishSocket/Ifish7_ERROR.log
|
||||||
|
log4j.appender.ROLLING_FILE.Append=true
|
||||||
|
log4j.appender.ROLLING_FILE.ImmediateFlush = true
|
||||||
|
log4j.appender.ROLLING_FILE.DatePattern='.'yyyy-MM-dd
|
||||||
|
log4j.appender.ROLLING_FILE.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.ROLLING_FILE.layout.ConversionPattern=[Ifish7][%-5p]%d - %c.%t(%F:%L) - %m%n
|
||||||
|
|
||||||
|
log4j.logger.org.springframework=INFO
|
||||||
|
log4j.logger.com.hibernate=INFO
|
||||||
|
log4j.logger.java.sql=INFO
|
||||||
|
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
<bean id="sessionConfig" factory-bean="ioAcceptor" factory-method="getSessionConfig">
|
<bean id="sessionConfig" factory-bean="ioAcceptor" factory-method="getSessionConfig">
|
||||||
<property name="bothIdleTime" value="60" />
|
<property name="bothIdleTime" value="60" />
|
||||||
<property name="minReadBufferSize" value="512" />
|
<property name="minReadBufferSize" value="512" />
|
||||||
<property name="maxReadBufferSize" value="1024" />
|
<property name="maxReadBufferSize" value="3072" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- 开始运行socket服务 -->
|
<!-- 开始运行socket服务 -->
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
#\u672c\u5730
|
#\u672c\u5730
|
||||||
ifish.ip=192.168.61.128
|
#ifish.ip=192.168.31.83
|
||||||
#\u6d4b\u8bd5\u4e91
|
#\u6d4b\u8bd5\u4e91
|
||||||
#ifish.ip=139.196.24.156
|
#ifish.ip=139.196.24.156
|
||||||
#\u6b63\u5f0f\u4e91
|
#\u6b63\u5f0f\u4e91
|
||||||
#ifish.ip=120.55.190.56
|
ifish.ip=120.55.190.56
|
||||||
#\u670d\u52a1\u5668\u7aef\u53e3
|
#\u670d\u52a1\u5668\u7aef\u53e3
|
||||||
ifish.port=9955
|
ifish.port=9955
|
||||||
Loading…
Reference in New Issue