fix:取消add/update时状态更新,提高线程状态更新频率

This commit is contained in:
nieziyan 2023-12-12 19:31:24 +08:00
parent 79d7981789
commit 99dd30f639
12 changed files with 11 additions and 88 deletions

View File

@ -1,28 +0,0 @@
package org.jeecg.modules.base.dto;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.jeecg.common.system.base.entity.JeecgEntity;
import java.time.LocalDateTime;
@Data
@TableName("database_status_conn")
public class DatabaseStatusConn extends JeecgEntity {
// private Double memory;
//
// private Integer loginNum;
private Integer connNum;
// private Double respTime; // 单位: (S)
//
// private Double logResidue; // 单位 MB
//
// private Double dataSize; // 单位 MB
private String databaseId;
private LocalDateTime collectTime;
}

View File

@ -51,7 +51,7 @@ public class DatabaseStatusManager {
} }
private void init(){ private void init(){
sleepTime = 30 * 60 * 1000; // 睡眠时间30min sleepTime = 5 * 1000; // 睡眠时间5s
databaseService = SpringContextUtils.getBean(ISysDatabaseService.class); databaseService = SpringContextUtils.getBean(ISysDatabaseService.class);
} }
} }

View File

@ -54,7 +54,7 @@ public class EmailStatusManager {
} }
private void init(){ private void init(){
sleepTime = 30 * 60 * 1000; // 睡眠时间30min sleepTime = 5 * 1000; // 睡眠时间5s
emailService = SpringContextUtils.getBean(ISysEmailService.class); emailService = SpringContextUtils.getBean(ISysEmailService.class);
} }
} }

View File

@ -45,7 +45,7 @@ public class ServerStatusManager {
} }
private void init(){ private void init(){
sleepTime = 30 * 60 * 1000; // 睡眠时间30min sleepTime = 5 * 1000; // 睡眠时间5s
serverService = SpringContextUtils.getBean(ISysServerService.class); serverService = SpringContextUtils.getBean(ISysServerService.class);
} }
} }

View File

@ -1,17 +0,0 @@
package org.jeecg.modules.controller;
import io.swagger.annotations.Api;
import org.jeecg.modules.service.IDatabaseStatusConnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("sysDatabaseStatus")
@Api(value = "数据库状态信息管理", tags = "数据库状态信息管理")
public class SysDatabaseStatusController {
@Autowired
private IDatabaseStatusConnService databaseStatusService;
}

View File

@ -1,8 +0,0 @@
package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.base.dto.DatabaseStatusConn;
public interface DatabaseStatusConnMapper extends BaseMapper<DatabaseStatusConn> {
}

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.mapper.DatabaseStatusConnMapper">
</mapper>

View File

@ -1,9 +0,0 @@
package org.jeecg.modules.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.base.dto.DatabaseStatusConn;
public interface IDatabaseStatusConnService extends IService<DatabaseStatusConn> {
}

View File

@ -1,12 +0,0 @@
package org.jeecg.modules.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.base.dto.*;
import org.jeecg.modules.mapper.DatabaseStatusConnMapper;
import org.jeecg.modules.service.IDatabaseStatusConnService;
import org.springframework.stereotype.Service;
@Service("databaseStatusConnService")
public class DatabaseStatusConnServiceImpl extends ServiceImpl<DatabaseStatusConnMapper, DatabaseStatusConn> implements IDatabaseStatusConnService {
}

View File

@ -130,7 +130,7 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
} }
boolean success = save(sysDatabase); boolean success = save(sysDatabase);
if (success){ if (success){
saveOrUpdateStatus(sysDatabase); // saveOrUpdateStatus(sysDatabase);
return Result.OK(Prompt.ADD_SUCC); return Result.OK(Prompt.ADD_SUCC);
} }
return Result.error(Prompt.ADD_ERR); return Result.error(Prompt.ADD_ERR);
@ -173,7 +173,7 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
} }
boolean success = updateById(sysDatabase); boolean success = updateById(sysDatabase);
if (success) { if (success) {
saveOrUpdateStatus(sysDatabase); // saveOrUpdateStatus(sysDatabase);
return Result.OK(Prompt.UPDATE_SUCC); return Result.OK(Prompt.UPDATE_SUCC);
} }
return Result.error(Prompt.UPDATE_ERR); return Result.error(Prompt.UPDATE_ERR);

View File

@ -144,7 +144,7 @@ public class SysEmailServiceImpl extends ServiceImpl<SysEmailMapper, SysEmail> i
sysEmail.setIsQiye(isQiye(username)); sysEmail.setIsQiye(isQiye(username));
boolean success = save(sysEmail); boolean success = save(sysEmail);
if (success) { if (success) {
saveOrUpdateStatus(sysEmail); // saveOrUpdateStatus(sysEmail);
return Result.OK(Prompt.ADD_SUCC); return Result.OK(Prompt.ADD_SUCC);
} }
return Result.error(Prompt.ADD_ERR); return Result.error(Prompt.ADD_ERR);
@ -167,7 +167,7 @@ public class SysEmailServiceImpl extends ServiceImpl<SysEmailMapper, SysEmail> i
sysEmail.setIsQiye(isQiye(username)); sysEmail.setIsQiye(isQiye(username));
boolean success = updateById(sysEmail); boolean success = updateById(sysEmail);
if (success) { if (success) {
saveOrUpdateStatus(sysEmail); // saveOrUpdateStatus(sysEmail);
// 更新邮箱发件服务器到Redis // 更新邮箱发件服务器到Redis
// updateSender(); // updateSender();
return Result.OK(Prompt.UPDATE_SUCC); return Result.OK(Prompt.UPDATE_SUCC);

View File

@ -146,7 +146,8 @@ public class SysServerServiceImpl extends ServiceImpl<SysServerMapper, SysServer
if (CollUtil.isNotEmpty(list(wrapper))) if (CollUtil.isNotEmpty(list(wrapper)))
return Result.error("IP Address" + Prompt.NOT_REPEAT); return Result.error("IP Address" + Prompt.NOT_REPEAT);
boolean success = saveOrUpatedStatus(sysServer); // boolean success = saveOrUpatedStatus(sysServer);
boolean success = this.saveOrUpdate(sysServer);
if (success) if (success)
return Result.OK(Prompt.ADD_SUCC); return Result.OK(Prompt.ADD_SUCC);
return Result.error(Prompt.ADD_ERR); return Result.error(Prompt.ADD_ERR);
@ -172,7 +173,8 @@ public class SysServerServiceImpl extends ServiceImpl<SysServerMapper, SysServer
if (CollUtil.isNotEmpty(list(wrapper))) if (CollUtil.isNotEmpty(list(wrapper)))
return Result.error("IP Address" + Prompt.NOT_REPEAT); return Result.error("IP Address" + Prompt.NOT_REPEAT);
} }
boolean success = saveOrUpatedStatus(sysServer); // boolean success = saveOrUpatedStatus(sysServer);
boolean success = this.saveOrUpdate(sysServer);
if (success) if (success)
return Result.OK(Prompt.UPDATE_SUCC); return Result.OK(Prompt.UPDATE_SUCC);
return Result.error(Prompt.UPDATE_ERR); return Result.error(Prompt.UPDATE_ERR);