前端主页页面实现
This commit is contained in:
parent
0a527e83a9
commit
fe8f41044a
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ruoyi.system.api;
|
package com.ruoyi.system.api;
|
||||||
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestHeader;
|
import org.springframework.web.bind.annotation.RequestHeader;
|
||||||
|
|
@ -11,6 +12,8 @@ import com.ruoyi.system.api.domain.SysLogininfor;
|
||||||
import com.ruoyi.system.api.domain.SysOperLog;
|
import com.ruoyi.system.api.domain.SysOperLog;
|
||||||
import com.ruoyi.system.api.factory.RemoteLogFallbackFactory;
|
import com.ruoyi.system.api.factory.RemoteLogFallbackFactory;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日志服务
|
* 日志服务
|
||||||
*
|
*
|
||||||
|
|
@ -38,4 +41,7 @@ public interface RemoteLogService
|
||||||
*/
|
*/
|
||||||
@PostMapping("/logininfor")
|
@PostMapping("/logininfor")
|
||||||
public R<Boolean> saveLogininfor(@RequestBody SysLogininfor sysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
public R<Boolean> saveLogininfor(@RequestBody SysLogininfor sysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
|
|
||||||
|
@GetMapping("/operlog/selectNewOperLog")
|
||||||
|
R<List<SysOperLog>> selectNewOperLog(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ import com.ruoyi.system.api.RemoteLogService;
|
||||||
import com.ruoyi.system.api.domain.SysLogininfor;
|
import com.ruoyi.system.api.domain.SysLogininfor;
|
||||||
import com.ruoyi.system.api.domain.SysOperLog;
|
import com.ruoyi.system.api.domain.SysOperLog;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日志服务降级处理
|
* 日志服务降级处理
|
||||||
*
|
*
|
||||||
|
|
@ -36,6 +38,11 @@ public class RemoteLogFallbackFactory implements FallbackFactory<RemoteLogServic
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<List<SysOperLog>> selectNewOperLog(String source) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.xjs.business.english;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.xjs.business.english.domain.EnglishWordDTO;
|
||||||
|
import com.xjs.business.english.factory.RemoteEnglishFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用openapi服务AreaController feign
|
||||||
|
*
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-03-23
|
||||||
|
*/
|
||||||
|
@FeignClient(contextId = "remoteEnglishFeign",
|
||||||
|
value = ServiceNameConstants.BUSINESS_ENGLISH_SERVICE,
|
||||||
|
fallbackFactory = RemoteEnglishFactory.class)
|
||||||
|
public interface RemoteEnglishFeign {
|
||||||
|
|
||||||
|
@GetMapping("/word/getEnglishWordForRpc")
|
||||||
|
R<List<EnglishWordDTO>> getEnglishWordByRandom();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.xjs.business.english.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.annotation.Excel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 英语单词对象 english_word
|
||||||
|
*
|
||||||
|
* @author xjs
|
||||||
|
* @since 2021-12-29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EnglishWordDTO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 英语单词
|
||||||
|
*/
|
||||||
|
private String englishWord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对应的中文
|
||||||
|
*/
|
||||||
|
private String chineseWord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看次数
|
||||||
|
*/
|
||||||
|
private Long lookCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.xjs.business.english.factory;
|
||||||
|
|
||||||
|
import com.xjs.business.english.RemoteEnglishFeign;
|
||||||
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*英语服务降级处理
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-06-15
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class RemoteEnglishFactory implements FallbackFactory<RemoteEnglishFeign> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RemoteEnglishFeign create(Throwable cause) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -41,4 +41,7 @@ public interface RemoteLogFeign {
|
||||||
|
|
||||||
@PostMapping("maillog/saveForRPC")
|
@PostMapping("maillog/saveForRPC")
|
||||||
R<Object> saveMailLog(@RequestBody MailLog mailLog);
|
R<Object> saveMailLog(@RequestBody MailLog mailLog);
|
||||||
|
|
||||||
|
@GetMapping("log/groupLogNumberForRPC")
|
||||||
|
R<Map<Object, Object>> groupLogNumber();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,12 @@ public class RemoteLogFactory implements FallbackFactory<RemoteLogFeign> {
|
||||||
log.error("日志模块邮件日志服务添加调用失败");
|
log.error("日志模块邮件日志服务添加调用失败");
|
||||||
return R.fail("日志模块邮件日志服务添加调用失败" + cause.getMessage());
|
return R.fail("日志模块邮件日志服务添加调用失败" + cause.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<Map<Object, Object>> groupLogNumber() {
|
||||||
|
log.error("日志模块获取日志次数调用失败");
|
||||||
|
return R.fail("日志模块获取日志次数调用失败" + cause.getMessage());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import com.xjs.business.webmagic.factory.RemoteWebmagicSinaFactory;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 内部 调用 新浪 爬虫定时任务
|
* 内部 调用 新浪 爬虫定时任务
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
|
|
@ -18,4 +20,7 @@ public interface RemoteWebmagicSinaFeign {
|
||||||
|
|
||||||
@GetMapping("/sinaNews/taskForPRC")
|
@GetMapping("/sinaNews/taskForPRC")
|
||||||
R sinaTaskForPRC();
|
R sinaTaskForPRC();
|
||||||
|
|
||||||
|
@GetMapping("/sinaNews/getNewsForRpc")
|
||||||
|
R<Map<Object, Object>> getNews();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 内部 调用 新浪 爬虫定时任务 降级
|
* 内部 调用 新浪 爬虫定时任务 降级
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
|
|
@ -23,6 +25,12 @@ public class RemoteWebmagicSinaFactory implements FallbackFactory<RemoteWebmagic
|
||||||
log.error("新浪 爬虫定时任务 降级------服务可能正在运行");
|
log.error("新浪 爬虫定时任务 降级------服务可能正在运行");
|
||||||
return R.fail("降级处理------服务可能正在运行");
|
return R.fail("降级处理------服务可能正在运行");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<Map<Object, Object>> getNews() {
|
||||||
|
log.error("新浪 获取最新新闻 降级------服务可能正在运行");
|
||||||
|
return R.fail("降级处理------服务可能正在运行");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,11 @@ public class ServiceNameConstants {
|
||||||
*/
|
*/
|
||||||
public static final String BUSINESS_WEBMAGIC_SERVICE = "xjs-webmagic";
|
public static final String BUSINESS_WEBMAGIC_SERVICE = "xjs-webmagic";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 英语服务的serviceid
|
||||||
|
*/
|
||||||
|
public static final String BUSINESS_ENGLISH_SERVICE = "xjs-english";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 优惠服务的serviceid
|
* 优惠服务的serviceid
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,9 @@ import org.springframework.data.redis.serializer.RedisSerializer;
|
||||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* redis配置
|
* redis配置
|
||||||
|
|
@ -93,8 +96,21 @@ public class RedisConfig extends CachingConfigurerSupport {
|
||||||
config = config.disableCachingNullValues();
|
config = config.disableCachingNullValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
RedisCacheManager cacheManager = RedisCacheManager.builder(redisConnectionFactory).cacheDefaults(config).build();
|
//单独给某个定义过期时间
|
||||||
return cacheManager;
|
Set<String> cacheNames = new HashSet<>();
|
||||||
|
cacheNames.add("bussiness:index:wb_search");
|
||||||
|
cacheNames.add("bussiness:index:log_count");
|
||||||
|
cacheNames.add("bussiness:index:oper_log");
|
||||||
|
ConcurrentHashMap<String, RedisCacheConfiguration> configMap = new ConcurrentHashMap<>();
|
||||||
|
configMap.put("bussiness:index:wb_search", config.entryTtl(Duration.ofMinutes(10L)));
|
||||||
|
configMap.put("bussiness:index:log_count", config.entryTtl(Duration.ofMinutes(10L)));
|
||||||
|
configMap.put("bussiness:index:oper_log", config.entryTtl(Duration.ofSeconds(10L)));
|
||||||
|
|
||||||
|
return RedisCacheManager.builder(redisConnectionFactory)
|
||||||
|
.cacheDefaults(config)
|
||||||
|
.initialCacheNames(cacheNames)
|
||||||
|
.withInitialCacheConfigurations(configMap)
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,6 @@
|
||||||
package com.ruoyi.system.controller;
|
package com.ruoyi.system.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.common.core.web.controller.BaseController;
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
|
@ -20,6 +11,11 @@ import com.ruoyi.common.security.annotation.InnerAuth;
|
||||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||||
import com.ruoyi.system.api.domain.SysOperLog;
|
import com.ruoyi.system.api.domain.SysOperLog;
|
||||||
import com.ruoyi.system.service.ISysOperLogService;
|
import com.ruoyi.system.service.ISysOperLogService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志记录
|
* 操作日志记录
|
||||||
|
|
@ -75,4 +71,12 @@ public class SysOperlogController extends BaseController
|
||||||
{
|
{
|
||||||
return toAjax(operLogService.insertOperlog(operLog));
|
return toAjax(operLogService.insertOperlog(operLog));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------内部调用rpc----------------------------------------
|
||||||
|
@GetMapping("selectNewOperLog")
|
||||||
|
@InnerAuth
|
||||||
|
public R<List<SysOperLog>> selectNewOperLog() {
|
||||||
|
List<SysOperLog> sysOperLogs = operLogService.selectNewOperLog();
|
||||||
|
return R.ok(sysOperLogs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
package com.ruoyi.system.mapper;
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.system.api.domain.SysOperLog;
|
import com.ruoyi.system.api.domain.SysOperLog;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志 数据层
|
* 操作日志 数据层
|
||||||
*
|
*
|
||||||
|
|
@ -45,4 +46,10 @@ public interface SysOperLogMapper
|
||||||
* 清空操作日志
|
* 清空操作日志
|
||||||
*/
|
*/
|
||||||
public void cleanOperLog();
|
public void cleanOperLog();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询最新的5条操作记录
|
||||||
|
* @return list
|
||||||
|
*/
|
||||||
|
List<SysOperLog> selectNewOperLog();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
package com.ruoyi.system.service;
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.ruoyi.system.api.domain.SysOperLog;
|
import com.ruoyi.system.api.domain.SysOperLog;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志 服务层
|
* 操作日志 服务层
|
||||||
*
|
*
|
||||||
|
|
@ -46,4 +47,10 @@ public interface ISysOperLogService
|
||||||
* 清空操作日志
|
* 清空操作日志
|
||||||
*/
|
*/
|
||||||
public void cleanOperLog();
|
public void cleanOperLog();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询最新的5条操作记录
|
||||||
|
* @return list
|
||||||
|
*/
|
||||||
|
List<SysOperLog> selectNewOperLog();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
package com.ruoyi.system.service.impl;
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.ruoyi.system.api.domain.SysOperLog;
|
import com.ruoyi.system.api.domain.SysOperLog;
|
||||||
import com.ruoyi.system.mapper.SysOperLogMapper;
|
import com.ruoyi.system.mapper.SysOperLogMapper;
|
||||||
import com.ruoyi.system.service.ISysOperLogService;
|
import com.ruoyi.system.service.ISysOperLogService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志 服务层处理
|
* 操作日志 服务层处理
|
||||||
|
|
@ -13,8 +14,7 @@ import com.ruoyi.system.service.ISysOperLogService;
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysOperLogServiceImpl implements ISysOperLogService
|
public class SysOperLogServiceImpl implements ISysOperLogService {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysOperLogMapper operLogMapper;
|
private SysOperLogMapper operLogMapper;
|
||||||
|
|
||||||
|
|
@ -25,8 +25,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertOperlog(SysOperLog operLog)
|
public int insertOperlog(SysOperLog operLog) {
|
||||||
{
|
|
||||||
return operLogMapper.insertOperlog(operLog);
|
return operLogMapper.insertOperlog(operLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -37,8 +36,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService
|
||||||
* @return 操作日志集合
|
* @return 操作日志集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysOperLog> selectOperLogList(SysOperLog operLog)
|
public List<SysOperLog> selectOperLogList(SysOperLog operLog) {
|
||||||
{
|
|
||||||
return operLogMapper.selectOperLogList(operLog);
|
return operLogMapper.selectOperLogList(operLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -49,8 +47,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteOperLogByIds(Long[] operIds)
|
public int deleteOperLogByIds(Long[] operIds) {
|
||||||
{
|
|
||||||
return operLogMapper.deleteOperLogByIds(operIds);
|
return operLogMapper.deleteOperLogByIds(operIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,8 +58,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService
|
||||||
* @return 操作日志对象
|
* @return 操作日志对象
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysOperLog selectOperLogById(Long operId)
|
public SysOperLog selectOperLogById(Long operId) {
|
||||||
{
|
|
||||||
return operLogMapper.selectOperLogById(operId);
|
return operLogMapper.selectOperLogById(operId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,8 +66,12 @@ public class SysOperLogServiceImpl implements ISysOperLogService
|
||||||
* 清空操作日志
|
* 清空操作日志
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void cleanOperLog()
|
public void cleanOperLog() {
|
||||||
{
|
|
||||||
operLogMapper.cleanOperLog();
|
operLogMapper.cleanOperLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysOperLog> selectNewOperLog() {
|
||||||
|
return operLogMapper.selectNewOperLog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectOperLogVo">
|
<sql id="selectOperLogVo">
|
||||||
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, oper_time
|
select oper_id,
|
||||||
|
title,
|
||||||
|
business_type,
|
||||||
|
method,
|
||||||
|
request_method,
|
||||||
|
operator_type,
|
||||||
|
oper_name,
|
||||||
|
dept_name,
|
||||||
|
oper_url,
|
||||||
|
oper_ip,
|
||||||
|
oper_param,
|
||||||
|
json_result,
|
||||||
|
status,
|
||||||
|
error_msg,
|
||||||
|
oper_time
|
||||||
from sys_oper_log
|
from sys_oper_log
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<insert id="insertOperlog" parameterType="SysOperLog">
|
<insert id="insertOperlog" parameterType="SysOperLog">
|
||||||
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_param, json_result, status, error_msg, oper_time)
|
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name,
|
||||||
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, sysdate())
|
oper_url, oper_ip, oper_param, json_result, status, error_msg, oper_time)
|
||||||
|
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName},
|
||||||
|
#{operUrl}, #{operIp}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, sysdate())
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
|
<select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
|
||||||
|
|
@ -75,6 +91,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where oper_id = #{operId}
|
where oper_id = #{operId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectNewOperLog" resultMap="SysOperLogResult">
|
||||||
|
select oper_id, title, business_type, request_method, oper_name,oper_ip
|
||||||
|
from sys_oper_log
|
||||||
|
order by oper_time desc limit 5
|
||||||
|
</select>
|
||||||
|
|
||||||
<update id="cleanOperLog">
|
<update id="cleanOperLog">
|
||||||
truncate table sys_oper_log
|
truncate table sys_oper_log
|
||||||
</update>
|
</update>
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,12 @@
|
||||||
|
|
||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
export function showWbSearch() {
|
export function showData() {
|
||||||
return request({
|
return request({
|
||||||
url: '/openapi/index/showWbSearch',
|
url: '/openapi/index/showData',
|
||||||
method: 'get'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function showCopyWriting() {
|
|
||||||
return request({
|
|
||||||
url: '/openapi/index/showCopyWriting',
|
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,111 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container" style="padding-top: 0">
|
||||||
<el-row :gutter="5">
|
<el-row :gutter="5">
|
||||||
<el-col :span="8">
|
<el-col :span="4">
|
||||||
<div class="grid-content bg-purple">
|
<div>
|
||||||
|
<el-card shadow="hover" :body-style="{padding:'3px'}">
|
||||||
|
<router-link :to="'/business/logs/apilog/'">
|
||||||
|
<div class="board">
|
||||||
|
<div class="top_board">API数</div>
|
||||||
|
<div class="content_board">今日:<span class="num_class">{{ logCount.apiLog.todayNumber }}</span></div>
|
||||||
|
<div class="content_board">总计:<span class="num_class">{{ logCount.apiLog.total }}</span></div>
|
||||||
|
</div>
|
||||||
|
</router-link>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="4">
|
||||||
|
<div>
|
||||||
|
<el-card shadow="hover" :body-style="{padding:'3px'}">
|
||||||
|
<router-link :to="'/business/logs/reptileLog/'">
|
||||||
|
<div class="board">
|
||||||
|
<div class="top_board">爬虫数</div>
|
||||||
|
<div class="content_board">今日:<span class="num_class">{{ logCount.webmagicLog.todayNumber }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="content_board">总计:<span class="num_class">{{ logCount.webmagicLog.total }}</span></div>
|
||||||
|
</div>
|
||||||
|
</router-link>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="4">
|
||||||
|
<div>
|
||||||
|
<el-card shadow="hover" :body-style="{padding:'3px'}">
|
||||||
|
<router-link :to="'/business/logs/taskLog/'">
|
||||||
|
<div class="board">
|
||||||
|
<div class="top_board">任务数</div>
|
||||||
|
<div class="content_board">今日:<span class="num_class">{{ logCount.taskLog.todayNumber }}</span></div>
|
||||||
|
<div class="content_board">总计:<span class="num_class">{{ logCount.taskLog.total }}</span></div>
|
||||||
|
</div>
|
||||||
|
</router-link>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="4">
|
||||||
|
<div>
|
||||||
|
<el-card shadow="hover" :body-style="{padding:'3px'}">
|
||||||
|
<router-link :to="'/business/logs/maillog/'">
|
||||||
|
<div class="board">
|
||||||
|
<div class="top_board">邮件数</div>
|
||||||
|
<div class="content_board">今日:<span class="num_class">{{ logCount.mailLog.todayNumber }}</span></div>
|
||||||
|
<div class="content_board">总计:<span class="num_class">{{ logCount.mailLog.total }}</span></div>
|
||||||
|
</div>
|
||||||
|
</router-link>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="4">
|
||||||
|
<div>
|
||||||
|
<el-card shadow="hover" :body-style="{padding:'3px'}">
|
||||||
|
<router-link :to="'/user/profile/'">
|
||||||
|
<div class="board">
|
||||||
|
<div class="top_board">登录数</div>
|
||||||
|
<div class="content_board"><span v-html="' '"></span></div>
|
||||||
|
<div class="content_board">总计:<span class="num_class">{{ loginCount }}</span></div>
|
||||||
|
</div>
|
||||||
|
</router-link>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="4">
|
||||||
|
<div>
|
||||||
|
<el-card shadow="hover" :body-style="{padding:'3px'}">
|
||||||
|
<div class="board">
|
||||||
|
<div class="top_board">IP信息</div>
|
||||||
|
<div class="content_board">IP:<span class="num_class">{{ ipInfo.ip }}</span></div>
|
||||||
|
<div class="content_board">归属地:<span class="num_class">{{ ipInfo.desc }}</span></div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="5">
|
||||||
|
<el-col :span="6">
|
||||||
|
<div>
|
||||||
<el-card class="box-card" :body-style="{padding:'3px'}" shadow="hover">
|
<el-card class="box-card" :body-style="{padding:'3px'}" shadow="hover">
|
||||||
<div slot="header" style="font-size: 18px;color: #3A71A8;font-weight: 800;padding: 0">
|
<div slot="header" style="font-size: 18px;color: #3A71A8;font-weight: 800;padding: 0">
|
||||||
<span>最新微博热搜</span>
|
<span>最新微博热搜</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-for="wb in WbDataList" :key="wb.id" style="color: #8492a6;">
|
<div v-for="wb in WbDataList" :key="wb.id" style="color: #8492a6;" class="top_content">
|
||||||
{{ wb.hotword }}
|
{{ wb.hotword }}
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="16">
|
<el-col :span="18">
|
||||||
<div class="grid-content bg-purple">
|
<div>
|
||||||
<el-card class="box-card" :body-style="{padding:'3px'}" shadow="hover">
|
<el-card class="box-card" :body-style="{padding:'3px'}" shadow="hover">
|
||||||
<div slot="header" style="font-size: 18px;color: #00BCD4;font-weight: 800;padding: 0">
|
<div slot="header" style="font-size: 18px;color: #00BCD4;font-weight: 800;padding: 0">
|
||||||
<span>文案</span>
|
<span>文案</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-for="copyWriting in copyWritingList" :key="copyWriting.id" class="top_content"
|
<div v-for="copyWriting in copyWritingList" :key="copyWriting.id" class="top_content"
|
||||||
style="color: #bfcbd9;">
|
style="color: #bfcbd9;">
|
||||||
<el-tooltip effect="light" :content="copyWriting.content+' ——— '+copyWriting.type" placement="top">
|
<el-tooltip effect="light" :content="copyWriting.content+' ——— '+copyWriting.type" placement="top"
|
||||||
|
:enterable="false">
|
||||||
<span>{{ copyWriting.content }} ——— <span style="color: #bfcbc5">{{ copyWriting.type }}</span></span>
|
<span>{{ copyWriting.content }} ——— <span style="color: #bfcbc5">{{ copyWriting.type }}</span></span>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -31,17 +115,159 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="5">
|
<el-row :gutter="5">
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<div class="grid-content bg-purple"></div>
|
<div>
|
||||||
|
<el-card class="box-card" :body-style="{padding:'3px'}" shadow="hover">
|
||||||
|
<div slot="header" style="font-size: 18px;color: #7a6df0;font-weight: 800;padding: 0">
|
||||||
|
<span>网易云热评</span>
|
||||||
|
</div>
|
||||||
|
<div v-for="yun in yunList" :key="yun.id" class="top_content" style="color: #999999;">
|
||||||
|
<el-tooltip effect="light" :content="yun.content+' ——— '+yun.source" placement="top" :enterable="false">
|
||||||
|
<span>{{ yun.content }} ——— <span style="color: #bfcbc5">{{ yun.source }}</span></span>
|
||||||
|
</el-tooltip>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="5">
|
<el-row :gutter="5">
|
||||||
<el-col :span="24">
|
<el-col :span="13">
|
||||||
<div class="grid-content bg-purple"></div>
|
<div>
|
||||||
|
<el-card class="box-card" :body-style="{padding:'3px'}" shadow="hover">
|
||||||
|
<div slot="header" style="font-size: 18px;color: #ffba00;font-weight: 800;padding: 0">
|
||||||
|
<span>最新操作日志</span>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
:data="operLogTableData"
|
||||||
|
style="width: 100%"
|
||||||
|
:row-style="{height: '0'}"
|
||||||
|
:cell-style="{padding: '0'}"
|
||||||
|
border
|
||||||
|
>
|
||||||
|
<el-table-column prop="title" label="系统模块" align="center" :show-overflow-tooltip="true"/>
|
||||||
|
<el-table-column prop="businessType" label="操作类型" align="center" :show-overflow-tooltip="true">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_oper_type" :value="scope.row.businessType"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="requestMethod" label="请求方式" align="center" :show-overflow-tooltip="true"/>
|
||||||
|
<el-table-column prop="operName" label="操作人员" align="center" :show-overflow-tooltip="true"/>
|
||||||
|
<el-table-column label="主机" align="center" prop="operIp" :show-overflow-tooltip="true"/>
|
||||||
|
</el-table>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="11">
|
||||||
|
<el-card class="box-card" :body-style="{padding:'3px'}" shadow="hover">
|
||||||
|
<div slot="header" style="font-size: 18px;color: #ff4949;font-weight: 800;padding: 0">
|
||||||
|
<span>英语单词</span>
|
||||||
|
</div>
|
||||||
|
<el-table
|
||||||
|
:data="englishWordTableData"
|
||||||
|
style="width: 100%"
|
||||||
|
:row-style="{height: '0'}"
|
||||||
|
:cell-style="{padding: '0'}"
|
||||||
|
border
|
||||||
|
>
|
||||||
|
<el-table-column prop="englishWord" label="英语单词" align="center" :show-overflow-tooltip="true"/>
|
||||||
|
<el-table-column prop="chineseWord" label="中文翻译" align="center" :show-overflow-tooltip="true">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag type="success">{{ scope.row.chineseWord }}</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="lookCount" label="查看次数" align="center" :show-overflow-tooltip="true"/>
|
||||||
|
<el-table-column prop="createTime" label="创建时间" align="center" :show-overflow-tooltip="true"/>
|
||||||
|
</el-table>
|
||||||
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="5">
|
<el-row :gutter="5">
|
||||||
<el-col :span="24">
|
<el-col :span="12">
|
||||||
<div class="grid-content bg-purple"></div>
|
<div>
|
||||||
|
<el-card class="box-card" :body-style="{padding:'3px'}" shadow="hover">
|
||||||
|
<div slot="header" style="font-size: 18px;color: #BD2828;font-weight: 800;padding: 0">
|
||||||
|
<span>最新国内新闻</span>
|
||||||
|
</div>
|
||||||
|
<div v-for="internalNews in internalNewsList" :key="internalNews.title" class="top_content"
|
||||||
|
style="color: #666666;">
|
||||||
|
<span @click="toLookNews(internalNews.url)" style="cursor: pointer">{{ internalNews.title }}</span>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<div>
|
||||||
|
<el-card class="box-card" :body-style="{padding:'3px'}" shadow="hover">
|
||||||
|
<div slot="header" style="font-size: 18px;color: #3d8610;font-weight: 800;padding: 0">
|
||||||
|
<span>最新国际新闻</span>
|
||||||
|
</div>
|
||||||
|
<div v-for="internationalNews in internationalNewsList" :key="internationalNews.title" class="top_content"
|
||||||
|
style="color: #324157;">
|
||||||
|
<span @click="toLookNews(internationalNews.url)" style="cursor: pointer">{{
|
||||||
|
internationalNews.title
|
||||||
|
}}</span>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row :gutter="5">
|
||||||
|
<el-col :span="8">
|
||||||
|
<div>
|
||||||
|
<el-card class="box-card" :body-style="{padding:'3px'}" shadow="hover">
|
||||||
|
<div slot="header" style="font-size: 18px;color: #1482f0;font-weight: 800;padding: 0">
|
||||||
|
<span>美图鉴赏-1</span>
|
||||||
|
</div>
|
||||||
|
<el-carousel :interval="1500" type="card" height="132px">
|
||||||
|
<el-carousel-item v-for="pic in beautyPictureList1" :key="pic">
|
||||||
|
<el-image
|
||||||
|
style="width: 234px; height: 132px"
|
||||||
|
:src="pic"
|
||||||
|
:preview-src-list="beautyPictureList1">
|
||||||
|
</el-image>
|
||||||
|
</el-carousel-item>
|
||||||
|
</el-carousel>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="8">
|
||||||
|
<div>
|
||||||
|
<el-card class="box-card" :body-style="{padding:'3px'}" shadow="hover">
|
||||||
|
<div slot="header" style="font-size: 18px;color: #1482f0;font-weight: 800;padding: 0">
|
||||||
|
<span>美图鉴赏-2</span>
|
||||||
|
</div>
|
||||||
|
<el-carousel :interval="1500" type="card" height="132px">
|
||||||
|
<el-carousel-item v-for="pic in beautyPictureList2" :key="pic">
|
||||||
|
<el-image
|
||||||
|
style="width: 234px; height: 132px"
|
||||||
|
:src="pic"
|
||||||
|
:preview-src-list="beautyPictureList2">
|
||||||
|
</el-image>
|
||||||
|
</el-carousel-item>
|
||||||
|
</el-carousel>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="8">
|
||||||
|
<div>
|
||||||
|
<el-card class="box-card" :body-style="{padding:'3px'}" shadow="hover">
|
||||||
|
<div slot="header" style="font-size: 18px;color: #1482f0;font-weight: 800;padding: 0">
|
||||||
|
<span>美图鉴赏-3</span>
|
||||||
|
</div>
|
||||||
|
<el-carousel :interval="1500" type="card" height="132px">
|
||||||
|
<el-carousel-item v-for="pic in beautyPictureList3" :key="pic">
|
||||||
|
<el-image
|
||||||
|
style="width: 234px; height: 132px"
|
||||||
|
:src="pic"
|
||||||
|
:preview-src-list="beautyPictureList3">
|
||||||
|
</el-image>
|
||||||
|
</el-carousel-item>
|
||||||
|
</el-carousel>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -49,21 +275,53 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
import {showData} from "@/api";
|
||||||
import {showCopyWriting, showWbSearch} from "@/api";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Index",
|
name: "Index",
|
||||||
|
dicts: ['sys_oper_type'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
WbDataList: {},
|
WbDataList: [],
|
||||||
copyWritingList: {},
|
copyWritingList: [],
|
||||||
|
yunList: [],
|
||||||
|
logCount: {
|
||||||
|
apiLog: {
|
||||||
|
todayNumber: 0,
|
||||||
|
total: 0
|
||||||
|
},
|
||||||
|
webmagicLog: {
|
||||||
|
todayNumber: 0,
|
||||||
|
total: 0
|
||||||
|
},
|
||||||
|
taskLog: {
|
||||||
|
todayNumber: 0,
|
||||||
|
total: 0
|
||||||
|
},
|
||||||
|
mailLog: {
|
||||||
|
todayNumber: 0,
|
||||||
|
total: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
loginCount: 0,
|
||||||
|
|
||||||
|
operLogTableData: [],
|
||||||
|
englishWordTableData: [],
|
||||||
|
|
||||||
|
internalNewsList: [],
|
||||||
|
internationalNewsList: [],
|
||||||
|
beautyPictureList1: [],
|
||||||
|
beautyPictureList2: [],
|
||||||
|
beautyPictureList3: [],
|
||||||
|
|
||||||
|
ipInfo:{},
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.showWbSearch()
|
this.showData()
|
||||||
this.showCopyWriting()
|
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
@ -72,17 +330,32 @@ export default {
|
||||||
|
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
showWbSearch() {
|
toLookNews(url) {
|
||||||
showWbSearch().then(res => {
|
window.open(url)
|
||||||
this.WbDataList = res.data
|
},
|
||||||
|
|
||||||
|
showData() {
|
||||||
|
this.$modal.loading("请稍后...")
|
||||||
|
showData().then(res => {
|
||||||
|
this.WbDataList = res.data.weiboList
|
||||||
|
this.copyWritingList = res.data.networkDTOList
|
||||||
|
this.yunList = res.data.yunList
|
||||||
|
this.logCount = res.data.logCount
|
||||||
|
this.loginCount = res.data.loginCount
|
||||||
|
this.operLogTableData = res.data.sysOperLog
|
||||||
|
this.englishWordTableData = res.data.englishWord
|
||||||
|
this.internalNewsList = res.data.news.internal
|
||||||
|
this.internationalNewsList = res.data.news.international
|
||||||
|
this.beautyPictureList1 = res.data.beautyPicture.one
|
||||||
|
this.beautyPictureList2 = res.data.beautyPicture.two
|
||||||
|
this.beautyPictureList3 = res.data.beautyPicture.three
|
||||||
|
this.ipInfo = res.data.ipInfo
|
||||||
|
|
||||||
|
this.$modal.closeLoading()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
showCopyWriting() {
|
|
||||||
showCopyWriting().then(res => {
|
|
||||||
this.copyWritingList = res.data
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -97,34 +370,30 @@ export default {
|
||||||
text-overflow: ellipsis; /*超出显示省略号*/
|
text-overflow: ellipsis; /*超出显示省略号*/
|
||||||
|
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 700;
|
font-weight: 600;
|
||||||
|
padding-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.top_board {
|
||||||
.el-col {
|
font-weight: 800;
|
||||||
border-radius: 4px;
|
font-size: 20px;
|
||||||
|
color: #0072c6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bg-purple-dark {
|
.board {
|
||||||
background: #99a9bf;
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bg-purple {
|
.content_board {
|
||||||
background: #d3dce6;
|
color: #999093;
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bg-purple-light {
|
.num_class {
|
||||||
background: #e5e9f2;
|
color: #7171C6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-content {
|
|
||||||
border-radius: 4px;
|
|
||||||
min-height: 36px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.row-bg {
|
|
||||||
padding: 10px 0;
|
|
||||||
background-color: #f9fafc;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.xjs.consts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用常量
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-06-15
|
||||||
|
*/
|
||||||
|
public class CommonConst {
|
||||||
|
|
||||||
|
public static final String TODAY_START = "00:00:00";
|
||||||
|
public static final String TODAY_END = "23:59:59";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.xjs.word.controller;
|
package com.xjs.word.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
import com.ruoyi.common.log.annotation.Log;
|
import com.ruoyi.common.log.annotation.Log;
|
||||||
|
|
@ -80,6 +81,15 @@ public class EnglishWordController extends MyBaseController<EnglishWord> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------内部调用rpc-----------------------------------
|
||||||
|
@GetMapping("getEnglishWordForRpc")
|
||||||
|
@ApiOperation("随机获取5条英语单词数据")
|
||||||
|
public R<List<EnglishWord>> getEnglishWordByRandom() {
|
||||||
|
List<EnglishWord> englishWordList=englishWordService.getEnglishWordByRandom();
|
||||||
|
return R.ok(englishWordList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------代码自动生成-----------------------------------
|
//------------------------代码自动生成-----------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,4 +46,11 @@ public interface EnglishWordMapper extends BaseMapper<EnglishWord> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteEnglishWordByIds(Long[] ids);
|
int deleteEnglishWordByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机获取5条英语单词数据
|
||||||
|
* @return list
|
||||||
|
*/
|
||||||
|
List<EnglishWord> getEnglishWordByRandom();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,12 @@ public interface IEnglishWordService extends IService<EnglishWord> {
|
||||||
*/
|
*/
|
||||||
public int deleteEnglishWordByIds(Long[] ids);
|
public int deleteEnglishWordByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机获取5条英语单词数据
|
||||||
|
* @return list
|
||||||
|
*/
|
||||||
|
List<EnglishWord> getEnglishWordByRandom();
|
||||||
|
|
||||||
|
|
||||||
//------------------------代码自动生成-----------------------------------
|
//------------------------代码自动生成-----------------------------------
|
||||||
|
|
||||||
|
|
@ -84,4 +90,7 @@ public interface IEnglishWordService extends IService<EnglishWord> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteEnglishWordById(Long id);
|
public int deleteEnglishWordById(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -175,6 +175,11 @@ public class EnglishWordServiceImpl extends ServiceImpl<EnglishWordMapper, Engli
|
||||||
return englishWordMapper.deleteEnglishWordByIds(ids);
|
return englishWordMapper.deleteEnglishWordByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EnglishWord> getEnglishWordByRandom() {
|
||||||
|
return englishWordMapper.getEnglishWordByRandom();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询英语单词列表
|
* 查询英语单词列表
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,9 @@
|
||||||
<include refid="selectEnglishWordVo"/>
|
<include refid="selectEnglishWordVo"/>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getEnglishWordByRandom" resultType="com.xjs.word.domain.EnglishWord">
|
||||||
|
select english_word,chinese_word,look_count,create_time from english_word ORDER BY RAND() LIMIT 5
|
||||||
|
</select>
|
||||||
|
|
||||||
<delete id="deleteEnglishWordById" parameterType="Long">
|
<delete id="deleteEnglishWordById" parameterType="Long">
|
||||||
delete
|
delete
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.xjs;
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.xjs.apilog.service.IApiLogService;
|
||||||
|
import com.xjs.maillog.service.MailLogService;
|
||||||
|
import com.xjs.other.LogNumberVo;
|
||||||
|
import com.xjs.reptileLog.service.WebmagicLogService;
|
||||||
|
import com.xjs.tasklog.service.TaskLogService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用日志控制器
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-06-15
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("log")
|
||||||
|
@Api(tags = "业务模块-通用日志")
|
||||||
|
public class CommonLogController {
|
||||||
|
private final ExecutorService executor = Executors.newFixedThreadPool(5);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IApiLogService apiLogService;
|
||||||
|
@Autowired
|
||||||
|
private MailLogService mailLogService;
|
||||||
|
@Autowired
|
||||||
|
private WebmagicLogService webmagicLogService;
|
||||||
|
@Autowired
|
||||||
|
private TaskLogService taskLogService;
|
||||||
|
|
||||||
|
//---------------------------内部调用----------------------------------------------
|
||||||
|
|
||||||
|
@GetMapping("groupLogNumberForRPC")
|
||||||
|
@ApiOperation("聚合日志次数")
|
||||||
|
public R<Map<Object, Object>> groupLogNumber() throws ExecutionException, InterruptedException {
|
||||||
|
CompletableFuture<LogNumberVo> apiLogFuture = CompletableFuture.supplyAsync(() ->
|
||||||
|
apiLogService.getCount(), executor);
|
||||||
|
|
||||||
|
CompletableFuture<LogNumberVo> mailLogFuture = CompletableFuture.supplyAsync(() ->
|
||||||
|
mailLogService.getCount(), executor);
|
||||||
|
|
||||||
|
CompletableFuture<LogNumberVo> webmagicLogFuture = CompletableFuture.supplyAsync(() ->
|
||||||
|
webmagicLogService.getCount(), executor);
|
||||||
|
|
||||||
|
CompletableFuture<LogNumberVo> taskLogFuture = CompletableFuture.supplyAsync(() ->
|
||||||
|
taskLogService.getCount(), executor);
|
||||||
|
|
||||||
|
CompletableFuture.allOf(apiLogFuture,mailLogFuture,webmagicLogFuture,taskLogFuture).get();
|
||||||
|
|
||||||
|
Map<Object, Object> map = MapUtil.builder()
|
||||||
|
.put("apiLog",apiLogFuture.get())
|
||||||
|
.put("mailLog",mailLogFuture.get())
|
||||||
|
.put("webmagicLog",webmagicLogFuture.get())
|
||||||
|
.put("taskLog",taskLogFuture.get())
|
||||||
|
.build();
|
||||||
|
return R.ok(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,7 @@ package com.xjs.apilog.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.xjs.apilog.domain.ApiLog;
|
import com.xjs.apilog.domain.ApiLog;
|
||||||
|
import com.xjs.other.LogNumberVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -14,6 +15,27 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public interface IApiLogService extends IService<ApiLog> {
|
public interface IApiLogService extends IService<ApiLog> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有api名称
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> getApiName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据时间查询API记录统计
|
||||||
|
* @param startDate 开始时间
|
||||||
|
* @param endDate 结束时间
|
||||||
|
* @return map
|
||||||
|
*/
|
||||||
|
Map<String, List> statisticsByDate(String startDate, String endDate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取次数
|
||||||
|
* @return LogNumberVo
|
||||||
|
*/
|
||||||
|
LogNumberVo getCount();
|
||||||
|
|
||||||
|
|
||||||
//------------------------代码自动生成-----------------------------------
|
//------------------------代码自动生成-----------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -48,17 +70,6 @@ public interface IApiLogService extends IService<ApiLog> {
|
||||||
*/
|
*/
|
||||||
int deleteApiLogById(Long id);
|
int deleteApiLogById(Long id);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取所有api名称
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<String> getApiName();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据时间查询API记录统计
|
|
||||||
* @param startDate 开始时间
|
|
||||||
* @param endDate 结束时间
|
|
||||||
* @return map
|
|
||||||
*/
|
|
||||||
Map<String, List> statisticsByDate(String startDate, String endDate);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.xjs.apilog.service.impl;
|
package com.xjs.apilog.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ruoyi.common.core.constant.HttpStatus;
|
import com.ruoyi.common.core.constant.HttpStatus;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
|
@ -8,14 +10,15 @@ import com.xjs.apilog.mapper.ApiLogMapper;
|
||||||
import com.xjs.apilog.service.IApiLogService;
|
import com.xjs.apilog.service.IApiLogService;
|
||||||
import com.xjs.apilog.vo.ApiLogVo;
|
import com.xjs.apilog.vo.ApiLogVo;
|
||||||
import com.xjs.business.warning.RemoteWarningCRUDFeign;
|
import com.xjs.business.warning.RemoteWarningCRUDFeign;
|
||||||
|
import com.xjs.other.LogNumberVo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import static com.xjs.consts.CommonConst.TODAY_END;
|
||||||
import java.util.Map;
|
import static com.xjs.consts.CommonConst.TODAY_START;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日志Service业务层处理
|
* 日志Service业务层处理
|
||||||
|
|
@ -30,6 +33,49 @@ public class ApiLogServiceImpl extends ServiceImpl<ApiLogMapper,ApiLog> implemen
|
||||||
@Autowired
|
@Autowired
|
||||||
private RemoteWarningCRUDFeign remoteWarningCRUDFeign;
|
private RemoteWarningCRUDFeign remoteWarningCRUDFeign;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getApiName() {
|
||||||
|
R<List<String>> apiName = remoteWarningCRUDFeign.getApiNameForRPC();
|
||||||
|
if (apiName.getCode() == HttpStatus.SUCCESS) {
|
||||||
|
return apiName.getData();
|
||||||
|
}
|
||||||
|
return new ArrayList<String>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List> statisticsByDate(String startDate, String endDate) {
|
||||||
|
List<ApiLogVo> recordList =apiLogMapper.statisticsByDate(startDate, endDate);
|
||||||
|
Map<String, List> map = new HashMap<>();
|
||||||
|
List<String> apiNames = new ArrayList<>();
|
||||||
|
List<Long> count = new ArrayList<>();
|
||||||
|
recordList.forEach(record ->{
|
||||||
|
apiNames.add(record.getApiName());
|
||||||
|
count.add(record.getCount());
|
||||||
|
});
|
||||||
|
map.put("apiNames", apiNames);
|
||||||
|
map.put("count", count);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LogNumberVo getCount() {
|
||||||
|
LogNumberVo logNumberVo = new LogNumberVo();
|
||||||
|
|
||||||
|
long total = super.count();
|
||||||
|
logNumberVo.setTotal(total);
|
||||||
|
|
||||||
|
LambdaQueryWrapper<ApiLog> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
String startDate = DateUtil.today() + " "+TODAY_START;
|
||||||
|
String endDate = DateUtil.today() + " "+TODAY_END;
|
||||||
|
wrapper.between(ApiLog::getCreateTime, startDate, endDate);
|
||||||
|
long todayCount = super.count(wrapper);
|
||||||
|
logNumberVo.setTodayNumber(todayCount);
|
||||||
|
|
||||||
|
return logNumberVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------代码自动生成-----------------------------------
|
//------------------------代码自动生成-----------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -76,27 +122,5 @@ public class ApiLogServiceImpl extends ServiceImpl<ApiLogMapper,ApiLog> implemen
|
||||||
return apiLogMapper.deleteApiLogById(id);
|
return apiLogMapper.deleteApiLogById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getApiName() {
|
|
||||||
R<List<String>> apiName = remoteWarningCRUDFeign.getApiNameForRPC();
|
|
||||||
if (apiName.getCode() == HttpStatus.SUCCESS) {
|
|
||||||
return apiName.getData();
|
|
||||||
}
|
|
||||||
return new ArrayList<String>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, List> statisticsByDate(String startDate, String endDate) {
|
|
||||||
List<ApiLogVo> recordList =apiLogMapper.statisticsByDate(startDate, endDate);
|
|
||||||
Map<String, List> map = new HashMap<>();
|
|
||||||
List<String> apiNames = new ArrayList<>();
|
|
||||||
List<Long> count = new ArrayList<>();
|
|
||||||
recordList.forEach(record ->{
|
|
||||||
apiNames.add(record.getApiName());
|
|
||||||
count.add(record.getCount());
|
|
||||||
});
|
|
||||||
map.put("apiNames", apiNames);
|
|
||||||
map.put("count", count);
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.xjs.maillog.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.xjs.maillog.domain.MailLog;
|
import com.xjs.maillog.domain.MailLog;
|
||||||
|
import com.xjs.other.LogNumberVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -12,6 +13,11 @@ import java.util.List;
|
||||||
* @since 2022-04-14
|
* @since 2022-04-14
|
||||||
*/
|
*/
|
||||||
public interface MailLogService extends IService<MailLog> {
|
public interface MailLogService extends IService<MailLog> {
|
||||||
|
/**
|
||||||
|
* 获取次数
|
||||||
|
* @return LogNumberVo
|
||||||
|
*/
|
||||||
|
LogNumberVo getCount();
|
||||||
|
|
||||||
|
|
||||||
//---------------------------代码生成-----------------------------------
|
//---------------------------代码生成-----------------------------------
|
||||||
|
|
@ -47,4 +53,6 @@ public interface MailLogService extends IService<MailLog> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteMailLogById(Long id);
|
int deleteMailLogById(Long id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,20 @@
|
||||||
package com.xjs.maillog.service.impl;
|
package com.xjs.maillog.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.xjs.maillog.domain.MailLog;
|
import com.xjs.maillog.domain.MailLog;
|
||||||
import com.xjs.maillog.mapper.MailLogMapper;
|
import com.xjs.maillog.mapper.MailLogMapper;
|
||||||
import com.xjs.maillog.service.MailLogService;
|
import com.xjs.maillog.service.MailLogService;
|
||||||
|
import com.xjs.other.LogNumberVo;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.xjs.consts.CommonConst.TODAY_END;
|
||||||
|
import static com.xjs.consts.CommonConst.TODAY_START;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 邮件日志Service业务层处理
|
* 邮件日志Service业务层处理
|
||||||
*
|
*
|
||||||
|
|
@ -20,8 +26,28 @@ public class MailLogServiceImpl extends ServiceImpl<MailLogMapper,MailLog> imple
|
||||||
@Resource
|
@Resource
|
||||||
private MailLogMapper mailLogMapper;
|
private MailLogMapper mailLogMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LogNumberVo getCount() {
|
||||||
|
LogNumberVo logNumberVo = new LogNumberVo();
|
||||||
|
|
||||||
|
long total = super.count();
|
||||||
|
logNumberVo.setTotal(total);
|
||||||
|
|
||||||
|
LambdaQueryWrapper<MailLog> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
String startDate = DateUtil.today() + " "+TODAY_START;
|
||||||
|
String endDate = DateUtil.today() + " "+TODAY_END;
|
||||||
|
wrapper.between(MailLog::getCreateTime, startDate, endDate);
|
||||||
|
long todayCount = super.count(wrapper);
|
||||||
|
logNumberVo.setTodayNumber(todayCount);
|
||||||
|
|
||||||
|
return logNumberVo;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------代码生成-----------------------------------
|
//---------------------------代码生成-----------------------------------
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询邮件日志
|
* 查询邮件日志
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.xjs.other;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志次数vo
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-06-15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LogNumberVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 今日次数
|
||||||
|
*/
|
||||||
|
private Long todayNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总次数
|
||||||
|
*/
|
||||||
|
private Long total;
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.xjs.reptileLog.service;
|
package com.xjs.reptileLog.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xjs.other.LogNumberVo;
|
||||||
import com.xjs.reptileLog.domain.WebmagicLog;
|
import com.xjs.reptileLog.domain.WebmagicLog;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -12,6 +13,12 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface WebmagicLogService extends IService<WebmagicLog> {
|
public interface WebmagicLogService extends IService<WebmagicLog> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取次数
|
||||||
|
* @return LogNumberVo
|
||||||
|
*/
|
||||||
|
LogNumberVo getCount();
|
||||||
|
|
||||||
//------------------------代码生成-------------------------
|
//------------------------代码生成-------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package com.xjs.reptileLog.service.impl;
|
package com.xjs.reptileLog.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.xjs.other.LogNumberVo;
|
||||||
import com.xjs.reptileLog.domain.WebmagicLog;
|
import com.xjs.reptileLog.domain.WebmagicLog;
|
||||||
import com.xjs.reptileLog.mapper.WebmagicLogMapper;
|
import com.xjs.reptileLog.mapper.WebmagicLogMapper;
|
||||||
import com.xjs.reptileLog.service.WebmagicLogService;
|
import com.xjs.reptileLog.service.WebmagicLogService;
|
||||||
|
|
@ -9,6 +12,9 @@ import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.xjs.consts.CommonConst.TODAY_END;
|
||||||
|
import static com.xjs.consts.CommonConst.TODAY_START;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @since 2022-02-17
|
* @since 2022-02-17
|
||||||
|
|
@ -19,6 +25,24 @@ public class WebmagicLogServiceImpl extends ServiceImpl<WebmagicLogMapper, Webma
|
||||||
@Resource
|
@Resource
|
||||||
private WebmagicLogMapper webmagicLogMapper;
|
private WebmagicLogMapper webmagicLogMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LogNumberVo getCount() {
|
||||||
|
LogNumberVo logNumberVo = new LogNumberVo();
|
||||||
|
|
||||||
|
long total = super.count();
|
||||||
|
logNumberVo.setTotal(total);
|
||||||
|
|
||||||
|
LambdaQueryWrapper<WebmagicLog> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
String startDate = DateUtil.today() + " "+TODAY_START;
|
||||||
|
String endDate = DateUtil.today() + " "+TODAY_END;
|
||||||
|
wrapper.between(WebmagicLog::getCreateTime, startDate, endDate);
|
||||||
|
long todayCount = super.count(wrapper);
|
||||||
|
logNumberVo.setTodayNumber(todayCount);
|
||||||
|
|
||||||
|
return logNumberVo;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------代码生成-----------------------------
|
//------------------------代码生成-----------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.xjs.tasklog.service;
|
package com.xjs.tasklog.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xjs.other.LogNumberVo;
|
||||||
import com.xjs.tasklog.domain.TaskLog;
|
import com.xjs.tasklog.domain.TaskLog;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -12,6 +13,13 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface TaskLogService extends IService<TaskLog> {
|
public interface TaskLogService extends IService<TaskLog> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取次数
|
||||||
|
* @return LogNumberVo
|
||||||
|
*/
|
||||||
|
LogNumberVo getCount();
|
||||||
|
|
||||||
//-----------------------代码生成------------------------------
|
//-----------------------代码生成------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
package com.xjs.tasklog.service.impl;
|
package com.xjs.tasklog.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.xjs.apilog.domain.ApiLog;
|
||||||
|
import com.xjs.other.LogNumberVo;
|
||||||
import com.xjs.tasklog.domain.TaskLog;
|
import com.xjs.tasklog.domain.TaskLog;
|
||||||
import com.xjs.tasklog.mapper.TaskLogMapper;
|
import com.xjs.tasklog.mapper.TaskLogMapper;
|
||||||
import com.xjs.tasklog.service.TaskLogService;
|
import com.xjs.tasklog.service.TaskLogService;
|
||||||
|
|
@ -9,6 +13,9 @@ import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.xjs.consts.CommonConst.TODAY_END;
|
||||||
|
import static com.xjs.consts.CommonConst.TODAY_START;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 任务日志service实现
|
* 任务日志service实现
|
||||||
*
|
*
|
||||||
|
|
@ -20,6 +27,23 @@ public class TaskLogServiceImpl extends ServiceImpl<TaskLogMapper, TaskLog> impl
|
||||||
@Resource
|
@Resource
|
||||||
private TaskLogMapper taskLogMapper;
|
private TaskLogMapper taskLogMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LogNumberVo getCount() {
|
||||||
|
LogNumberVo logNumberVo = new LogNumberVo();
|
||||||
|
|
||||||
|
long total = super.count();
|
||||||
|
logNumberVo.setTotal(total);
|
||||||
|
|
||||||
|
LambdaQueryWrapper<TaskLog> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
String startDate = DateUtil.today() + " "+TODAY_START;
|
||||||
|
String endDate = DateUtil.today() + " "+TODAY_END;
|
||||||
|
wrapper.between(TaskLog::getCreateTime, startDate, endDate);
|
||||||
|
long todayCount = super.count(wrapper);
|
||||||
|
logNumberVo.setTodayNumber(todayCount);
|
||||||
|
|
||||||
|
return logNumberVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------代码生成------------------------------------
|
//----------------------------------代码生成------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@ public class ApiAWordController extends BaseController {
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@ApiOperation("每日一句接口")
|
@ApiOperation("每日一句接口")
|
||||||
@Log(title = "获取每日一句")
|
|
||||||
@RequiresLogin
|
@RequiresLogin
|
||||||
public AjaxResult getApiAWord(@Validated RequestBody requestBody) {
|
public AjaxResult getApiAWord(@Validated RequestBody requestBody) {
|
||||||
requestBody = Optional.ofNullable(requestBody).orElseGet(RequestBody::new);
|
requestBody = Optional.ofNullable(requestBody).orElseGet(RequestBody::new);
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,50 @@
|
||||||
package com.xjs.common.controller;
|
package com.xjs.common.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import com.ruoyi.system.api.RemoteLogService;
|
||||||
|
import com.ruoyi.system.api.RemoteUserService;
|
||||||
|
import com.ruoyi.system.api.domain.SysOperLog;
|
||||||
|
import com.ruoyi.system.api.model.LoginUser;
|
||||||
|
import com.xjs.apitools.domain.ApiBeautyPicture;
|
||||||
|
import com.xjs.apitools.service.ApiToolsService;
|
||||||
|
import com.xjs.business.english.RemoteEnglishFeign;
|
||||||
|
import com.xjs.business.english.domain.EnglishWordDTO;
|
||||||
|
import com.xjs.business.log.RemoteLogFeign;
|
||||||
import com.xjs.business.webmagic.RemoteWebmagicCopyWritingNetworkFeign;
|
import com.xjs.business.webmagic.RemoteWebmagicCopyWritingNetworkFeign;
|
||||||
|
import com.xjs.business.webmagic.RemoteWebmagicSinaFeign;
|
||||||
import com.xjs.business.webmagic.domain.CopyWritingNetworkDTO;
|
import com.xjs.business.webmagic.domain.CopyWritingNetworkDTO;
|
||||||
|
import com.xjs.copywriting.domain.CopyWriting;
|
||||||
|
import com.xjs.copywriting.service.CopyWritingService;
|
||||||
import com.xjs.topsearch.domain.ApiTopsearchWeibo;
|
import com.xjs.topsearch.domain.ApiTopsearchWeibo;
|
||||||
import com.xjs.topsearch.service.ApiTopsearchWeiboService;
|
import com.xjs.topsearch.service.ApiTopsearchWeiboService;
|
||||||
|
import com.xjs.weather.domain.IPInfoVo;
|
||||||
|
import com.xjs.weather.service.IPService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主页控制器
|
* 主页控制器
|
||||||
|
*
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @since 2022-06-14
|
* @since 2022-06-14
|
||||||
*/
|
*/
|
||||||
|
|
@ -28,23 +54,148 @@ import java.util.List;
|
||||||
@Log4j2
|
@Log4j2
|
||||||
public class IndexController {
|
public class IndexController {
|
||||||
|
|
||||||
|
private final ExecutorService executor = Executors.newFixedThreadPool(5);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApiTopsearchWeiboService apiTopsearchWeiboService;
|
private ApiTopsearchWeiboService apiTopsearchWeiboService;
|
||||||
|
@Autowired
|
||||||
|
private CopyWritingService copyWritingService;
|
||||||
|
@Autowired //解决aop 调用this不代理问题
|
||||||
|
private IndexController indexController;
|
||||||
@Resource
|
@Resource
|
||||||
private RemoteWebmagicCopyWritingNetworkFeign remoteWebmagicCopyWritingNetworkFeign;
|
private RemoteWebmagicCopyWritingNetworkFeign remoteWebmagicCopyWritingNetworkFeign;
|
||||||
|
@Resource
|
||||||
|
private RemoteLogFeign remoteLogFeign;
|
||||||
|
@Resource
|
||||||
|
private RemoteUserService remoteUserService;
|
||||||
|
@Resource
|
||||||
|
private RemoteLogService remoteLogService;
|
||||||
|
@Resource
|
||||||
|
private RemoteEnglishFeign remoteEnglishFeign;
|
||||||
|
@Resource
|
||||||
|
private RemoteWebmagicSinaFeign remoteWebmagicSinaFeign;
|
||||||
|
@Autowired
|
||||||
|
private ApiToolsService apiToolsService;
|
||||||
|
@Autowired
|
||||||
|
private IPService ipService;
|
||||||
|
|
||||||
@GetMapping("showWbSearch")
|
@GetMapping("showData")
|
||||||
@ApiOperation("展示微博热搜")
|
@ApiOperation("展示数据")
|
||||||
public AjaxResult showWbSearch() {
|
public AjaxResult showWbSearch() throws ExecutionException, InterruptedException {
|
||||||
List<ApiTopsearchWeibo> weiboList = apiTopsearchWeiboService.showWbSearch();
|
CompletableFuture<List<ApiTopsearchWeibo>> weiboListFuture = CompletableFuture.supplyAsync(() ->
|
||||||
return AjaxResult.success(weiboList);
|
apiTopsearchWeiboService.showWbSearch(), executor);
|
||||||
|
|
||||||
|
CompletableFuture<List<CopyWritingNetworkDTO>> networkDTOListFuture = CompletableFuture.supplyAsync(indexController::getCopyWritingNetworkList, executor);
|
||||||
|
|
||||||
|
CompletableFuture<List<CopyWriting>> yunListFuture = CompletableFuture.supplyAsync(() ->
|
||||||
|
copyWritingService.NeteaseHotWord(), executor);
|
||||||
|
|
||||||
|
CompletableFuture<Map<Object, Object>> logCountFuture = CompletableFuture.supplyAsync(indexController::getLogCount, executor);
|
||||||
|
|
||||||
|
CompletableFuture<Integer> loginCountFuture = CompletableFuture.supplyAsync(indexController::getLoginCount, executor);
|
||||||
|
|
||||||
|
CompletableFuture<List<SysOperLog>> sysOperLogFuture = CompletableFuture.supplyAsync(indexController::getSysOperLog, executor);
|
||||||
|
|
||||||
|
CompletableFuture<List<EnglishWordDTO>> englishFuture = CompletableFuture.supplyAsync(indexController::getEnglish, executor);
|
||||||
|
|
||||||
|
CompletableFuture<Map<String, List<String>>> beautyPictureFuture = CompletableFuture.supplyAsync(indexController::getBeautyPictureList, executor);
|
||||||
|
|
||||||
|
CompletableFuture<Map<Object, Object>> newsFuture = CompletableFuture.supplyAsync(indexController::getNews, executor);
|
||||||
|
|
||||||
|
CompletableFuture<IPInfoVo> ipInfoFuture = CompletableFuture.supplyAsync(indexController::getIpInfo, executor);
|
||||||
|
|
||||||
|
CompletableFuture.allOf(
|
||||||
|
weiboListFuture,
|
||||||
|
networkDTOListFuture,
|
||||||
|
yunListFuture,
|
||||||
|
logCountFuture,
|
||||||
|
sysOperLogFuture,
|
||||||
|
englishFuture,
|
||||||
|
newsFuture,
|
||||||
|
beautyPictureFuture,
|
||||||
|
ipInfoFuture
|
||||||
|
).get();
|
||||||
|
|
||||||
|
Map<Object, Object> map = MapUtil.builder()
|
||||||
|
.put("weiboList", weiboListFuture.get())
|
||||||
|
.put("networkDTOList", networkDTOListFuture.get())
|
||||||
|
.put("yunList", yunListFuture.get())
|
||||||
|
.put("logCount", logCountFuture.get())
|
||||||
|
.put("loginCount", loginCountFuture.get())
|
||||||
|
.put("sysOperLog", sysOperLogFuture.get())
|
||||||
|
.put("englishWord", englishFuture.get())
|
||||||
|
.put("news", newsFuture.get())
|
||||||
|
.put("beautyPicture", beautyPictureFuture.get())
|
||||||
|
.put("ipInfo", ipInfoFuture.get())
|
||||||
|
.build();
|
||||||
|
return AjaxResult.success(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("showCopyWriting")
|
@Cacheable(cacheNames = "bussiness:index:copy_writing", key = "#root.method.name")
|
||||||
@ApiOperation("首页展示文案")
|
public List<CopyWritingNetworkDTO> getCopyWritingNetworkList() {
|
||||||
public AjaxResult showCopyWriting() {
|
return remoteWebmagicCopyWritingNetworkFeign.showCopyWriting().getData();
|
||||||
R<List<CopyWritingNetworkDTO>> data = remoteWebmagicCopyWritingNetworkFeign.showCopyWriting();
|
}
|
||||||
return AjaxResult.success(data.getData());
|
|
||||||
|
@Cacheable(cacheNames = "bussiness:index:log_count", key = "#root.method.name")
|
||||||
|
public Map<Object, Object> getLogCount() {
|
||||||
|
return remoteLogFeign.groupLogNumber().getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Cacheable(cacheNames = "bussiness:index:login_count", key = "#root.method.name")
|
||||||
|
public Integer getLoginCount() {
|
||||||
|
R<LoginUser> r = remoteUserService.getUserInfo("admin", SecurityConstants.INNER);
|
||||||
|
return r.getData().getSysUser().getLoginCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Cacheable(cacheNames = "bussiness:index:oper_log", key = "#root.method.name")
|
||||||
|
public List<SysOperLog> getSysOperLog() {
|
||||||
|
R<List<SysOperLog>> listR = remoteLogService.selectNewOperLog(SecurityConstants.INNER);
|
||||||
|
return listR.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Cacheable(cacheNames = "bussiness:index:english", key = "#root.method.name")
|
||||||
|
public List<EnglishWordDTO> getEnglish() {
|
||||||
|
R<List<EnglishWordDTO>> r = remoteEnglishFeign.getEnglishWordByRandom();
|
||||||
|
return r.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Cacheable(cacheNames = "bussiness:index:news", key = "#root.method.name")
|
||||||
|
public Map<Object, Object> getNews() {
|
||||||
|
R<Map<Object, Object>> r = remoteWebmagicSinaFeign.getNews();
|
||||||
|
return r.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
@Cacheable(cacheNames = "bussiness:index:beauty_picture", key = "#root.method.name")
|
||||||
|
public Map<String, List<String>> getBeautyPictureList() {
|
||||||
|
|
||||||
|
CompletableFuture<List<String>> oneFuture = CompletableFuture.supplyAsync(() ->
|
||||||
|
apiToolsService.getBeautyPictureList().stream()
|
||||||
|
.map(ApiBeautyPicture::getImageUrl).collect(Collectors.toList()), executor);
|
||||||
|
|
||||||
|
CompletableFuture<List<String>> twoFuture = CompletableFuture.supplyAsync(() ->
|
||||||
|
apiToolsService.getBeautyPictureList().stream()
|
||||||
|
.map(ApiBeautyPicture::getImageUrl).collect(Collectors.toList()), executor);
|
||||||
|
|
||||||
|
CompletableFuture<List<String>> threeFuture = CompletableFuture.supplyAsync(() ->
|
||||||
|
apiToolsService.getBeautyPictureList().stream()
|
||||||
|
.map(ApiBeautyPicture::getImageUrl).collect(Collectors.toList()), executor);
|
||||||
|
|
||||||
|
|
||||||
|
CompletableFuture.allOf(oneFuture, twoFuture, threeFuture).get();
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, List<String>> map = new HashMap<>();
|
||||||
|
map.put("one", oneFuture.get());
|
||||||
|
map.put("two", twoFuture.get());
|
||||||
|
map.put("three", threeFuture.get());
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Cacheable(cacheNames = "bussiness:index:ip_info", key = "#root.method.name")
|
||||||
|
public IPInfoVo getIpInfo() {
|
||||||
|
return ipService.getIPApiData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,6 @@ public class CopyWritingController extends BaseController {
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@ApiOperation("文案接口")
|
@ApiOperation("文案接口")
|
||||||
@Log(title = "获取文案")
|
|
||||||
@RequiresLogin
|
@RequiresLogin
|
||||||
public AjaxResult copyWriting(@Validated RequestBody requestBody) {
|
public AjaxResult copyWriting(@Validated RequestBody requestBody) {
|
||||||
requestBody = Optional.ofNullable(requestBody).orElseGet(RequestBody::new);
|
requestBody = Optional.ofNullable(requestBody).orElseGet(RequestBody::new);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.xjs.copywriting.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.xjs.copywriting.domain.CopyWriting;
|
import com.xjs.copywriting.domain.CopyWriting;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -64,4 +65,10 @@ public interface CopyWritingMapper extends BaseMapper<CopyWriting> {
|
||||||
*/
|
*/
|
||||||
int deleteCopyWritingByIds(Long[] ids);
|
int deleteCopyWritingByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机获取5条网易云热评
|
||||||
|
* @param wyy 类型
|
||||||
|
* @return list
|
||||||
|
*/
|
||||||
|
List<CopyWriting> NeteaseHotWord(@Param("wyy") Integer wyy);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,12 @@ public interface CopyWritingService extends IService<CopyWriting> {
|
||||||
*/
|
*/
|
||||||
int deleteRepeatData();
|
int deleteRepeatData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取网易云热评
|
||||||
|
* @return list
|
||||||
|
*/
|
||||||
|
List<CopyWriting> NeteaseHotWord();
|
||||||
|
|
||||||
|
|
||||||
//-------------------------代码自动生成----------------------------------
|
//-------------------------代码自动生成----------------------------------
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.xjs.copywriting.service.impl;
|
package com.xjs.copywriting.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.xjs.consts.CopyWritingConst;
|
||||||
import com.xjs.copywriting.domain.CopyWriting;
|
import com.xjs.copywriting.domain.CopyWriting;
|
||||||
import com.xjs.copywriting.mapper.CopyWritingMapper;
|
import com.xjs.copywriting.mapper.CopyWritingMapper;
|
||||||
import com.xjs.copywriting.service.CopyWritingService;
|
import com.xjs.copywriting.service.CopyWritingService;
|
||||||
|
|
@ -36,6 +37,12 @@ public class CopyWritingServiceImpl extends ServiceImpl<CopyWritingMapper, CopyW
|
||||||
return copyWritingMapper.deleteRepeatData();
|
return copyWritingMapper.deleteRepeatData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Cacheable(cacheNames = "bussiness:index:yun_hot_word",key = "#root.method.name")
|
||||||
|
public List<CopyWriting> NeteaseHotWord() {
|
||||||
|
return copyWritingMapper.NeteaseHotWord(CopyWritingConst.WYY);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------代码自动生成------------------------------------
|
//----------------------代码自动生成------------------------------------
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.xjs.topsearch.domain.ApiTopsearchWeibo;
|
import com.xjs.topsearch.domain.ApiTopsearchWeibo;
|
||||||
import com.xjs.topsearch.mapper.ApiTopsearchWeiboMapper;
|
import com.xjs.topsearch.mapper.ApiTopsearchWeiboMapper;
|
||||||
import com.xjs.topsearch.service.ApiTopsearchWeiboService;
|
import com.xjs.topsearch.service.ApiTopsearchWeiboService;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
@ -25,6 +26,7 @@ public class ApiTopsearchWeiboServiceImpl extends ServiceImpl<ApiTopsearchWeiboM
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Cacheable(cacheNames = "bussiness:index:wb_search",key = "#root.method.name")
|
||||||
public List<ApiTopsearchWeibo> showWbSearch() {
|
public List<ApiTopsearchWeibo> showWbSearch() {
|
||||||
LambdaQueryWrapper<ApiTopsearchWeibo> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ApiTopsearchWeibo> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.select(ApiTopsearchWeibo::getHotword,ApiTopsearchWeibo::getId);
|
wrapper.select(ApiTopsearchWeibo::getHotword,ApiTopsearchWeibo::getId);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package com.xjs.weather.controller;
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
import com.ruoyi.common.log.annotation.Log;
|
|
||||||
import com.ruoyi.common.security.annotation.RequiresLogin;
|
import com.ruoyi.common.security.annotation.RequiresLogin;
|
||||||
import com.xjs.utils.WeekUtils;
|
import com.xjs.utils.WeekUtils;
|
||||||
import com.xjs.weather.domain.Casts;
|
import com.xjs.weather.domain.Casts;
|
||||||
|
|
@ -40,7 +39,6 @@ public class WeatherController {
|
||||||
|
|
||||||
@GetMapping("now")
|
@GetMapping("now")
|
||||||
@ApiOperation("获取实时天气信息")
|
@ApiOperation("获取实时天气信息")
|
||||||
@Log(title = "获取实时天气")
|
|
||||||
@RequiresLogin
|
@RequiresLogin
|
||||||
public AjaxResult getNowWeatherApiData() {
|
public AjaxResult getNowWeatherApiData() {
|
||||||
return AjaxResult.success(weatherService.saveNowWeather());
|
return AjaxResult.success(weatherService.saveNowWeather());
|
||||||
|
|
@ -48,7 +46,6 @@ public class WeatherController {
|
||||||
|
|
||||||
@GetMapping("forecast")
|
@GetMapping("forecast")
|
||||||
@ApiOperation("获取预报天气信息")
|
@ApiOperation("获取预报天气信息")
|
||||||
@Log(title = "获取预报天气")
|
|
||||||
@RequiresLogin
|
@RequiresLogin
|
||||||
public AjaxResult getForecastWeatherApiData() {
|
public AjaxResult getForecastWeatherApiData() {
|
||||||
ForecastWeather forecastWeather = weatherService.cacheForecastWeather();
|
ForecastWeather forecastWeather = weatherService.cacheForecastWeather();
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,9 @@
|
||||||
<include refid="selectCopyWritingVo"/>
|
<include refid="selectCopyWritingVo"/>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="NeteaseHotWord" resultType="com.xjs.copywriting.domain.CopyWriting">
|
||||||
|
SELECT id,source,content FROM api_copywriting WHERE type=#{wyy} ORDER BY RAND() LIMIT 5
|
||||||
|
</select>
|
||||||
|
|
||||||
<delete id="deleteCopyWritingById" parameterType="Long">
|
<delete id="deleteCopyWritingById" parameterType="Long">
|
||||||
delete
|
delete
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,10 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.xjs.consts.CommonConst.TODAY_END;
|
||||||
|
import static com.xjs.consts.CommonConst.TODAY_START;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 天气统计service接口实现
|
* 天气统计service接口实现
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
|
|
@ -28,8 +32,8 @@ public class WeatherStatisticsServiceImpl implements WeatherStatisticsService {
|
||||||
@Override
|
@Override
|
||||||
public Map<String, List> historyWeather(String startDate, String endDate) {
|
public Map<String, List> historyWeather(String startDate, String endDate) {
|
||||||
if (StringUtils.isEmpty(startDate) || StringUtils.isEmpty(endDate)) {
|
if (StringUtils.isEmpty(startDate) || StringUtils.isEmpty(endDate)) {
|
||||||
startDate = DateUtil.today() + " 00:00:00";
|
startDate = DateUtil.today() + " "+TODAY_START;
|
||||||
endDate = DateUtil.today() + " 23:59:59";
|
endDate = DateUtil.today() + " "+TODAY_END;
|
||||||
}
|
}
|
||||||
return remoteWeatherFeign.getHistoryWeatherForRPC(startDate, endDate).getData();
|
return remoteWeatherFeign.getHistoryWeatherForRPC(startDate, endDate).getData();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.xjs.copywritingNetwork.mapper.CopyWritingNetworkMapper;
|
import com.xjs.copywritingNetwork.mapper.CopyWritingNetworkMapper;
|
||||||
import com.xjs.copywritingNetwork.pojo.CopyWritingNetwork;
|
import com.xjs.copywritingNetwork.pojo.CopyWritingNetwork;
|
||||||
import com.xjs.copywritingNetwork.service.CopyWritingNetworkService;
|
import com.xjs.copywritingNetwork.service.CopyWritingNetworkService;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新浪爬虫数据controller
|
* 新浪爬虫数据controller
|
||||||
|
|
@ -28,7 +29,7 @@ import java.util.List;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("sinaNews")
|
@RequestMapping("sinaNews")
|
||||||
@Api(tags = "爬虫模块-新浪新闻")
|
@Api(tags = "爬虫模块-新浪新闻")
|
||||||
public class SinaNewsController extends MyBaseController {
|
public class SinaNewsController extends MyBaseController<SinaNews> {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SinaNewsTask sinaNewsTask;
|
private SinaNewsTask sinaNewsTask;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -52,6 +53,14 @@ public class SinaNewsController extends MyBaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("getNewsForRpc")
|
||||||
|
@ApiOperation("获取最新新闻")
|
||||||
|
public R<Map<Object, Object>> getNews() {
|
||||||
|
Map<Object, Object> map=sinaNewsService.getNews();
|
||||||
|
return R.ok(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------代码生成----------------------------
|
//----------------------代码生成----------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.xjs.sina.pojo.SinaNews;
|
import com.xjs.sina.pojo.SinaNews;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新浪新闻爬虫Service接口
|
* 新浪新闻爬虫Service接口
|
||||||
|
|
@ -50,4 +51,10 @@ public interface SinaNewsService extends IService<SinaNews> {
|
||||||
public int deleteSinaNewsById(Long id);
|
public int deleteSinaNewsById(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取最新国内、国际新闻
|
||||||
|
* @return map
|
||||||
|
*/
|
||||||
|
Map<Object, Object> getNews();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.xjs.sina.service.impl;
|
package com.xjs.sina.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.xjs.sina.mapper.SinaNewsMapper;
|
import com.xjs.sina.mapper.SinaNewsMapper;
|
||||||
|
|
@ -9,6 +11,7 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新浪新闻爬虫Service接口实现
|
* 新浪新闻爬虫Service接口实现
|
||||||
|
|
@ -70,5 +73,27 @@ public class SinaNewsServiceImpl extends ServiceImpl<SinaNewsMapper, SinaNews> i
|
||||||
return sinaNewsMapper.deleteSinaNewsById(id);
|
return sinaNewsMapper.deleteSinaNewsById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Object, Object> getNews() {
|
||||||
|
LambdaQueryWrapper<SinaNews> internalWrapper = new LambdaQueryWrapper<>();
|
||||||
|
internalWrapper.select(SinaNews::getTitle, SinaNews::getUrl);
|
||||||
|
internalWrapper.eq(SinaNews::getCategory, "国内");
|
||||||
|
internalWrapper.orderByDesc(SinaNews::getCreateTime);
|
||||||
|
internalWrapper.last("limit 5");
|
||||||
|
List<SinaNews> internalList = super.list(internalWrapper);
|
||||||
|
|
||||||
|
LambdaQueryWrapper<SinaNews> internationalWrapper = new LambdaQueryWrapper<>();
|
||||||
|
internationalWrapper.select(SinaNews::getTitle, SinaNews::getUrl);
|
||||||
|
internationalWrapper.eq(SinaNews::getCategory, "国际");
|
||||||
|
internationalWrapper.orderByDesc(SinaNews::getCreateTime);
|
||||||
|
internationalWrapper.last("limit 5");
|
||||||
|
List<SinaNews> internationalList = super.list(internationalWrapper);
|
||||||
|
|
||||||
|
return MapUtil.builder()
|
||||||
|
.put("internal", internalList)
|
||||||
|
.put("international", internationalList)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue