feat:功能完善
This commit is contained in:
parent
fb320c6888
commit
d8e13a803c
|
@ -12,6 +12,10 @@ public class DatabaseDto implements Serializable {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private String dataBaseType;
|
||||||
|
|
||||||
private boolean online;
|
private boolean online;
|
||||||
|
|
||||||
private String ipAddress;
|
private String ipAddress;
|
||||||
|
|
|
@ -16,4 +16,8 @@ public interface SystemClient {
|
||||||
/* 系统用户相关 */
|
/* 系统用户相关 */
|
||||||
@RequestMapping("/sys/user/findUserMap")
|
@RequestMapping("/sys/user/findUserMap")
|
||||||
Map<String, SysUser> findUserMap();
|
Map<String, SysUser> findUserMap();
|
||||||
|
|
||||||
|
/* 数据字典相关 */
|
||||||
|
@GetMapping("/sys/dict/dataBaseType")
|
||||||
|
Map<String,String> dataBaseType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
d.ID,
|
d.ID,
|
||||||
d.NAME,
|
d.NAME,
|
||||||
d.port,
|
d.port,
|
||||||
|
d.type,
|
||||||
d.ip_address,
|
d.ip_address,
|
||||||
COUNT (l.id) AS alarms
|
COUNT (l.id) AS alarms
|
||||||
FROM
|
FROM
|
||||||
|
|
|
@ -17,8 +17,10 @@ import org.jeecg.modules.base.dto.SourceDto;
|
||||||
import org.jeecg.modules.base.vo.SourceVo;
|
import org.jeecg.modules.base.vo.SourceVo;
|
||||||
import org.jeecg.modules.entity.AlarmHistory;
|
import org.jeecg.modules.entity.AlarmHistory;
|
||||||
import org.jeecg.modules.entity.SysDatabase;
|
import org.jeecg.modules.entity.SysDatabase;
|
||||||
|
import org.jeecg.modules.feignclient.SystemClient;
|
||||||
import org.jeecg.modules.mapper.SysDatabaseMapper;
|
import org.jeecg.modules.mapper.SysDatabaseMapper;
|
||||||
import org.jeecg.modules.service.ISysDatabaseService;
|
import org.jeecg.modules.service.ISysDatabaseService;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@ -30,6 +32,9 @@ import java.util.*;
|
||||||
@Service("sysDatabaseService")
|
@Service("sysDatabaseService")
|
||||||
public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDatabase> implements ISysDatabaseService {
|
public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDatabase> implements ISysDatabaseService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SystemClient systemClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result findPage(QueryRequest query) {
|
public Result findPage(QueryRequest query) {
|
||||||
Integer pageNo = query.getPageNo();
|
Integer pageNo = query.getPageNo();
|
||||||
|
@ -46,8 +51,12 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
|
||||||
params.put("startDate",startDate);
|
params.put("startDate",startDate);
|
||||||
params.put("endDate",endDate);
|
params.put("endDate",endDate);
|
||||||
List<DatabaseDto> databaseDtos = baseMapper.findPage(params);
|
List<DatabaseDto> databaseDtos = baseMapper.findPage(params);
|
||||||
|
Map<String, String> dataBaseMap = systemClient.dataBaseType();
|
||||||
for (DatabaseDto databaseDto : databaseDtos) {
|
for (DatabaseDto databaseDto : databaseDtos) {
|
||||||
databaseDto.setOnline(true).setSlowQuery("328/s")
|
String type = databaseDto.getType();
|
||||||
|
String dataBaseType = dataBaseMap.get(type);
|
||||||
|
databaseDto.setDataBaseType(dataBaseType)
|
||||||
|
.setOnline(true).setSlowQuery("328/s")
|
||||||
.setAlarmRed(true).setCpuUutilzation("35.8%")
|
.setAlarmRed(true).setCpuUutilzation("35.8%")
|
||||||
.setMemoryUsage("55.8%").setDiskUsage("35.68%");
|
.setMemoryUsage("55.8%").setDiskUsage("35.68%");
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import static org.jeecg.common.email.EmailServiceManager.getInstance;
|
||||||
public class EmailPushMsgHandle implements ISendMsgHandle {
|
public class EmailPushMsgHandle implements ISendMsgHandle {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AbnormalAlarmClient alarmClient;
|
private AbnormalAlarmClient abnormalAlarmClient;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysMessageService sysMessageService;
|
private ISysMessageService sysMessageService;
|
||||||
|
@ -32,7 +32,7 @@ public class EmailPushMsgHandle implements ISendMsgHandle {
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(MessageDTO messageDTO) {
|
public void sendMessage(MessageDTO messageDTO) {
|
||||||
// 获取邮件发送服务器信息
|
// 获取邮件发送服务器信息
|
||||||
SysEmail sysEmail = alarmClient.getSender().getResult();
|
SysEmail sysEmail = abnormalAlarmClient.getSender().getResult();
|
||||||
|
|
||||||
// 初始化邮件服务
|
// 初始化邮件服务
|
||||||
EmailServiceManager emailService = getInstance();
|
EmailServiceManager emailService = getInstance();
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
package org.jeecg.modules.quartz.job;
|
package org.jeecg.modules.quartz.job;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||||
|
import org.jeecg.common.config.mqtoken.UserTokenContext;
|
||||||
import org.jeecg.common.util.DateUtils;
|
import org.jeecg.common.util.DateUtils;
|
||||||
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
|
import org.jeecg.modules.message.handle.impl.EmailPushMsgHandle;
|
||||||
import org.quartz.*;
|
import org.quartz.*;
|
||||||
|
|
||||||
|
import static org.jeecg.common.util.TokenUtils.getTempToken;
|
||||||
/**
|
/**
|
||||||
* @Description: 同步定时任务测试
|
* @Description: 同步定时任务测试
|
||||||
*
|
*
|
||||||
|
@ -14,22 +19,17 @@ import org.quartz.*;
|
||||||
* @author: taoyan
|
* @author: taoyan
|
||||||
* @date: 2020年06月19日
|
* @date: 2020年06月19日
|
||||||
*/
|
*/
|
||||||
@PersistJobDataAfterExecution
|
|
||||||
@DisallowConcurrentExecution
|
@DisallowConcurrentExecution
|
||||||
@Slf4j
|
@PersistJobDataAfterExecution
|
||||||
public class AsyncJob implements Job {
|
public class AsyncJob implements Job {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
log.info(" --- 同步任务调度开始 --- ");
|
// start:生成临时Token到线程中
|
||||||
try {
|
UserTokenContext.setToken(getTempToken());
|
||||||
//此处模拟任务执行时间 5秒 任务表达式配置为每秒执行一次:0/1 * * * * ? *
|
|
||||||
Thread.sleep(5000);
|
EmailPushMsgHandle emailPushMsgHandle = SpringContextUtils.getBean(EmailPushMsgHandle.class);
|
||||||
} catch (InterruptedException e) {
|
emailPushMsgHandle.sendMessage(new MessageDTO("xiao","nzyone@qq.com","测试邮件","这是一封测试邮件"));
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
//测试发现 每5秒执行一次
|
|
||||||
log.info(" --- 执行完毕,时间:"+DateUtils.now()+"---");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.jeecg.common.system.vo.DictQuery;
|
||||||
import org.jeecg.common.system.vo.LoginUser;
|
import org.jeecg.common.system.vo.LoginUser;
|
||||||
import org.jeecg.common.util.*;
|
import org.jeecg.common.util.*;
|
||||||
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||||
|
import org.jeecg.modules.system.dto.DatabaseTypeDto;
|
||||||
import org.jeecg.modules.system.entity.GardsStations;
|
import org.jeecg.modules.system.entity.GardsStations;
|
||||||
import org.jeecg.modules.system.entity.SysDict;
|
import org.jeecg.modules.system.entity.SysDict;
|
||||||
import org.jeecg.modules.system.entity.SysDictItem;
|
import org.jeecg.modules.system.entity.SysDictItem;
|
||||||
|
@ -48,6 +49,7 @@ import org.springframework.web.servlet.ModelAndView;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -705,4 +707,14 @@ public class SysDictController {
|
||||||
return sysDictService.findStationListByMenuName(menuName);
|
return sysDictService.findStationListByMenuName(menuName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("dataBaseType")
|
||||||
|
public Map<String,String> dataBaseType(){
|
||||||
|
List<DatabaseTypeDto> databaseTypeDtos = sysDictService.dataBaseType();
|
||||||
|
Map<String, String> dataBaseMap = databaseTypeDtos.stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
DatabaseTypeDto::getValue,
|
||||||
|
DatabaseTypeDto::getText,
|
||||||
|
(oldValue, newValue) -> newValue));
|
||||||
|
return dataBaseMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package org.jeecg.modules.system.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DatabaseTypeDto {
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
private String text;
|
||||||
|
}
|
|
@ -4,12 +4,15 @@ import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.apache.ibatis.annotations.MapKey;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
import org.apache.ibatis.annotations.Update;
|
import org.apache.ibatis.annotations.Update;
|
||||||
import org.jeecg.common.system.vo.DictModel;
|
import org.jeecg.common.system.vo.DictModel;
|
||||||
import org.jeecg.common.system.vo.DictModelMany;
|
import org.jeecg.common.system.vo.DictModelMany;
|
||||||
import org.jeecg.common.system.vo.DictQuery;
|
import org.jeecg.common.system.vo.DictQuery;
|
||||||
|
import org.jeecg.modules.base.dto.DatabaseDto;
|
||||||
|
import org.jeecg.modules.system.dto.DatabaseTypeDto;
|
||||||
import org.jeecg.modules.system.entity.SysDict;
|
import org.jeecg.modules.system.entity.SysDict;
|
||||||
import org.jeecg.modules.system.model.DuplicateCheckVo;
|
import org.jeecg.modules.system.model.DuplicateCheckVo;
|
||||||
import org.jeecg.modules.system.model.TreeSelectModel;
|
import org.jeecg.modules.system.model.TreeSelectModel;
|
||||||
|
@ -272,4 +275,6 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
|
||||||
*/
|
*/
|
||||||
@InterceptorIgnore(tenantLine = "true")
|
@InterceptorIgnore(tenantLine = "true")
|
||||||
List<SysDict> getDictListByLowAppId(@Param("lowAppId") String lowAppId, @Param("tenantId") Integer tenantId);
|
List<SysDict> getDictListByLowAppId(@Param("lowAppId") String lowAppId, @Param("tenantId") Integer tenantId);
|
||||||
|
|
||||||
|
List<DatabaseTypeDto> dataBaseType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,5 +230,13 @@
|
||||||
and tenant_id = #{tenantId}
|
and tenant_id = #{tenantId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="dataBaseType" resultType="org.jeecg.modules.system.dto.DatabaseTypeDto">
|
||||||
|
SELECT
|
||||||
|
item_value AS VALUE,
|
||||||
|
item_text AS TEXT
|
||||||
|
FROM
|
||||||
|
sys_dict_item di
|
||||||
|
INNER JOIN sys_dict d ON di.dict_id = d.id
|
||||||
|
WHERE d.dict_code = 'database_type'
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.system.service;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import org.jeecg.common.system.vo.DictModel;
|
import org.jeecg.common.system.vo.DictModel;
|
||||||
import org.jeecg.common.system.vo.DictQuery;
|
import org.jeecg.common.system.vo.DictQuery;
|
||||||
|
import org.jeecg.modules.system.dto.DatabaseTypeDto;
|
||||||
import org.jeecg.modules.system.entity.GardsStations;
|
import org.jeecg.modules.system.entity.GardsStations;
|
||||||
import org.jeecg.modules.system.entity.SysDict;
|
import org.jeecg.modules.system.entity.SysDict;
|
||||||
import org.jeecg.modules.system.entity.SysDictItem;
|
import org.jeecg.modules.system.entity.SysDictItem;
|
||||||
|
@ -278,4 +279,5 @@ public interface ISysDictService extends IService<SysDict> {
|
||||||
|
|
||||||
List<GardsStations> findStationListByMenuName(String menuName);
|
List<GardsStations> findStationListByMenuName(String menuName);
|
||||||
|
|
||||||
|
List<DatabaseTypeDto> dataBaseType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.jeecg.common.util.RedisUtil;
|
||||||
import org.jeecg.common.util.SqlInjectionUtil;
|
import org.jeecg.common.util.SqlInjectionUtil;
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
import org.jeecg.config.mybatis.MybatisPlusSaasConfig;
|
||||||
|
import org.jeecg.modules.system.dto.DatabaseTypeDto;
|
||||||
import org.jeecg.modules.system.entity.GardsStations;
|
import org.jeecg.modules.system.entity.GardsStations;
|
||||||
import org.jeecg.modules.system.entity.SysDict;
|
import org.jeecg.modules.system.entity.SysDict;
|
||||||
import org.jeecg.modules.system.entity.SysDictItem;
|
import org.jeecg.modules.system.entity.SysDictItem;
|
||||||
|
@ -570,6 +571,11 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||||
return gardsStationsList;
|
return gardsStationsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DatabaseTypeDto> dataBaseType() {
|
||||||
|
return baseMapper.dataBaseType();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加字典
|
* 添加字典
|
||||||
* @param dictName
|
* @param dictName
|
||||||
|
|
Loading…
Reference in New Issue
Block a user