4670101279
2 years ago
12 changed files with 276 additions and 22 deletions
@ -0,0 +1,57 @@
@@ -0,0 +1,57 @@
|
||||
# 数据源配置 |
||||
spring: |
||||
datasource: |
||||
type: com.alibaba.druid.pool.DruidDataSource |
||||
driverClassName: com.mysql.cj.jdbc.Driver |
||||
druid: |
||||
# 主库数据源 |
||||
master: |
||||
url: jdbc:mysql://121.40.203.197:3306/znsc_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai&allowMultiQueries=true&allowPublicKeyRetrieval=true |
||||
username: znsc_test |
||||
password: znSC_1q2w#E$R |
||||
# 从库数据源 |
||||
slave: |
||||
# 从数据源开关/默认关闭 |
||||
enabled: false |
||||
url: |
||||
username: |
||||
password: |
||||
# 初始连接数 |
||||
initialSize: 5 |
||||
# 最小连接池数量 |
||||
minIdle: 10 |
||||
# 最大连接池数量 |
||||
maxActive: 20 |
||||
# 配置获取连接等待超时的时间 |
||||
maxWait: 60000 |
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 |
||||
timeBetweenEvictionRunsMillis: 60000 |
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒 |
||||
minEvictableIdleTimeMillis: 300000 |
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒 |
||||
maxEvictableIdleTimeMillis: 900000 |
||||
# 配置检测连接是否有效 |
||||
validationQuery: SELECT 1 FROM DUAL |
||||
testWhileIdle: true |
||||
testOnBorrow: false |
||||
testOnReturn: false |
||||
webStatFilter: |
||||
enabled: true |
||||
statViewServlet: |
||||
enabled: true |
||||
# 设置白名单,不填则允许所有访问 |
||||
allow: |
||||
url-pattern: /druid/* |
||||
# 控制台管理用户名和密码 |
||||
login-username: ruoyi |
||||
login-password: 123456 |
||||
filter: |
||||
stat: |
||||
enabled: true |
||||
# 慢SQL记录 |
||||
log-slow-sql: true |
||||
slow-sql-millis: 1000 |
||||
merge-sql: true |
||||
wall: |
||||
config: |
||||
multi-statement-allow: true |
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
package com.ruoyi.code.camera.domain; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
|
||||
/** |
||||
* 系统配置表 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-06-21 |
||||
*/ |
||||
@Data |
||||
@TableName("sc_config") |
||||
public class ScConfig implements Serializable |
||||
{ |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@TableId(type = IdType.INPUT) |
||||
private Long id; |
||||
|
||||
private String name; |
||||
|
||||
private String value; |
||||
|
||||
} |
@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.code.camera.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.ruoyi.code.camera.domain.ScConfig; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* 系统配置mapper |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-06-21 |
||||
*/ |
||||
@Mapper |
||||
public interface ScConfigMapper extends BaseMapper<ScConfig> |
||||
{ |
||||
|
||||
} |
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
package com.ruoyi.code.camera.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.ruoyi.code.camera.domain.ScConfig; |
||||
|
||||
/** |
||||
* Service接口 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-06-21 |
||||
*/ |
||||
public interface IScConfigService extends IService<ScConfig> |
||||
{ |
||||
} |
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
package com.ruoyi.code.camera.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.ruoyi.code.camera.domain.ScConfig; |
||||
import com.ruoyi.code.camera.mapper.ScConfigMapper; |
||||
import com.ruoyi.code.camera.service.IScConfigService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* Service业务层处理 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2022-06-21 |
||||
*/ |
||||
@Service("scConfigService") |
||||
public class ScConfigServiceImpl extends ServiceImpl<ScConfigMapper, ScConfig> implements IScConfigService |
||||
{ |
||||
} |
@ -0,0 +1,61 @@
@@ -0,0 +1,61 @@
|
||||
package utils; |
||||
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor; |
||||
import java.util.concurrent.ThreadFactory; |
||||
import java.util.concurrent.TimeUnit; |
||||
|
||||
public class LoginListenThreadController { |
||||
|
||||
private RegisterUtil m_runDevAutoReg; |
||||
|
||||
public LoginListenThreadController(RegisterUtil m_runDevAutoReg){ |
||||
this.m_runDevAutoReg = m_runDevAutoReg; |
||||
} |
||||
|
||||
ScheduledThreadPoolExecutor threadPoolExecutor = new ScheduledThreadPoolExecutor(1); |
||||
|
||||
boolean bExit = true; |
||||
|
||||
public void startLoginListenThread() { |
||||
System.err.println("startLoginListenThread"); |
||||
if (threadPoolExecutor == null) { |
||||
threadPoolExecutor = new ScheduledThreadPoolExecutor(1); |
||||
} |
||||
|
||||
bExit = true; |
||||
|
||||
threadPoolExecutor.schedule(() -> { |
||||
while(bExit) { |
||||
doSomeThing(); |
||||
try { |
||||
Thread.sleep(1000); |
||||
} catch (InterruptedException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
}, 0, TimeUnit.SECONDS); |
||||
} |
||||
|
||||
public void stopLoginListenThread() { |
||||
System.err.println("stopLoginListenThread"); |
||||
bExit = false; |
||||
threadPoolExecutor.shutdownNow(); |
||||
threadPoolExecutor.shutdown(); |
||||
threadPoolExecutor = null; |
||||
} |
||||
|
||||
public void doSomeThing(){ |
||||
if(m_runDevAutoReg.m_listLoginInfos.size() > 0) |
||||
{ |
||||
RegisterUtil.STU_LOGIN_INFO loginInfo = m_runDevAutoReg.m_listLoginInfos.get(0); |
||||
System.out.println(loginInfo.strIP); |
||||
System.out.println(loginInfo.nPort); |
||||
System.out.println(loginInfo.strDevSN); |
||||
// 登陆
|
||||
m_runDevAutoReg.login(loginInfo.strIP, loginInfo.nPort, loginInfo.strDevSN); |
||||
|
||||
m_runDevAutoReg.m_listLoginInfos.removeElementAt(0); |
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue