段飞宇
2 years ago
15 changed files with 256 additions and 66 deletions
@ -0,0 +1,29 @@
|
||||
package com.hnac.hzims.middle.systemlog.config; |
||||
|
||||
import com.hnac.hzims.middle.systemlog.task.SyslogTimerTask; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
|
||||
import java.util.Timer; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/4/8 14:15 |
||||
*/ |
||||
@Configuration |
||||
public class SysLogConfig { |
||||
|
||||
@Bean |
||||
public void syslogTimer() { |
||||
//1.创建一个timer实例
|
||||
Timer timer = new Timer(); |
||||
//2.创建一个SyslogTimerTask实例
|
||||
SyslogTimerTask myTimeTask = new SyslogTimerTask(); |
||||
//3.通过timer定时定频率调用SyslogTimerTask的业务逻辑
|
||||
// 即 第一次执行是在当前时间的两秒之后,之后每隔30秒钟执行一次
|
||||
timer.schedule(myTimeTask,2000L,30000L); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.hnac.hzims.middle.systemlog.controller; |
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
/** |
||||
* <p> |
||||
* 操作日志统计数据 前端控制器 |
||||
* </p> |
||||
* |
||||
* @author dfy |
||||
* @since 2023-04-08 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/systemlog/statistics") |
||||
public class StatisticsController { |
||||
|
||||
} |
||||
|
@ -0,0 +1,70 @@
|
||||
package com.hnac.hzims.middle.systemlog.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import java.time.LocalDateTime; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import java.io.Serializable; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
/** |
||||
* <p> |
||||
* 操作日志统计数据 |
||||
* </p> |
||||
* |
||||
* @author dfy |
||||
* @since 2023-04-08 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@Accessors(chain = true) |
||||
@TableName("hzims_statistics") |
||||
public class Statistics implements Serializable { |
||||
|
||||
private static final long serialVersionUID=1L; |
||||
|
||||
/** |
||||
* 编号 |
||||
*/ |
||||
@TableField("id") |
||||
private Long id; |
||||
|
||||
/** |
||||
* 统计日期 |
||||
*/ |
||||
@TableField("date_calculated") |
||||
private String dateCalculated; |
||||
|
||||
/** |
||||
* 操作模块统计 |
||||
*/ |
||||
@TableField("title_num") |
||||
private Integer titleNum; |
||||
|
||||
/** |
||||
* 功能模块统计 |
||||
*/ |
||||
@TableField("module_name_num") |
||||
private Integer moduleNameNum; |
||||
|
||||
/** |
||||
* 请求路径统计 |
||||
*/ |
||||
@TableField("path_num") |
||||
private Integer pathNum; |
||||
|
||||
/** |
||||
* 创建时间 |
||||
*/ |
||||
@TableField("create_time") |
||||
private LocalDateTime createTime; |
||||
|
||||
/** |
||||
* 更新时间 |
||||
*/ |
||||
@TableField("update_time") |
||||
private LocalDateTime updateTime; |
||||
|
||||
|
||||
} |
@ -0,0 +1,16 @@
|
||||
package com.hnac.hzims.middle.systemlog.mapper; |
||||
|
||||
import com.hnac.hzims.middle.systemlog.entity.Statistics; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* <p> |
||||
* 操作日志统计数据 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author dfy |
||||
* @since 2023-04-08 |
||||
*/ |
||||
public interface StatisticsMapper extends BaseMapper<Statistics> { |
||||
|
||||
} |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.hnac.hzims.middle.systemlog.mapper.StatisticsMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,20 @@
|
||||
package com.hnac.hzims.middle.systemlog.service; |
||||
|
||||
import com.hnac.hzims.middle.systemlog.entity.Statistics; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* <p> |
||||
* 操作日志统计数据 服务类 |
||||
* </p> |
||||
* |
||||
* @author dfy |
||||
* @since 2023-04-08 |
||||
*/ |
||||
public interface StatisticsService extends IService<Statistics> { |
||||
|
||||
/** |
||||
* 保存统计的数据 |
||||
*/ |
||||
void saveCountStatistics(); |
||||
} |
@ -0,0 +1,34 @@
|
||||
package com.hnac.hzims.middle.systemlog.service.impl; |
||||
|
||||
import com.hnac.hzims.middle.systemlog.entity.Statistics; |
||||
import com.hnac.hzims.middle.systemlog.mapper.StatisticsMapper; |
||||
import com.hnac.hzims.middle.systemlog.service.StatisticsService; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.hnac.hzims.middle.systemlog.service.SysLogService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* <p> |
||||
* 操作日志统计数据 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author dfy |
||||
* @since 2023-04-08 |
||||
*/ |
||||
@Service |
||||
public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statistics> implements StatisticsService { |
||||
|
||||
@Autowired |
||||
private SysLogService sysLogService; |
||||
|
||||
|
||||
/** |
||||
* 保存统计的数据 |
||||
*/ |
||||
@Override |
||||
public void saveCountStatistics() { |
||||
//1. 保存操作模块的数据
|
||||
|
||||
} |
||||
} |
@ -0,0 +1,31 @@
|
||||
package com.hnac.hzims.middle.systemlog.task; |
||||
|
||||
import com.hnac.hzims.middle.systemlog.service.StatisticsService; |
||||
import com.hnac.hzims.middle.systemlog.service.SysLogService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.util.TimerTask; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/4/8 14:13 |
||||
*/ |
||||
@Component |
||||
public class SyslogTimerTask extends TimerTask { |
||||
|
||||
|
||||
@Autowired |
||||
private StatisticsService statisticsService; |
||||
|
||||
/** |
||||
* The action to be performed by this timer task. |
||||
*/ |
||||
@Override |
||||
public void run() { |
||||
//保存统计的数据
|
||||
statisticsService.saveCountStatistics(); |
||||
} |
||||
} |
@ -1,17 +0,0 @@
|
||||
package com.hnac.hzims.ticket.twoTicket.mapper; |
||||
|
||||
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; |
||||
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; |
||||
import org.springframework.stereotype.Repository; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/4/8 11:29 |
||||
*/ |
||||
@Repository |
||||
public interface WorkTicketInfoMapper extends UserDataScopeBaseMapper<WorkTicketInfoEntity> { |
||||
|
||||
} |
@ -1,14 +0,0 @@
|
||||
package com.hnac.hzims.ticket.twoTicket.service; |
||||
|
||||
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/4/8 11:31 |
||||
*/ |
||||
public interface WorkTicketInfoService extends BaseService<WorkTicketInfoEntity> { |
||||
|
||||
} |
@ -1,17 +0,0 @@
|
||||
package com.hnac.hzims.ticket.twoTicket.service.impl; |
||||
|
||||
import com.hnac.hzims.ticket.twoTicket.mapper.WorkTicketInfoMapper; |
||||
import com.hnac.hzims.ticket.twoTicket.service.WorkTicketInfoService; |
||||
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* @Author WL |
||||
* @Version v1.0 |
||||
* @Serial 1.0 |
||||
* @Date 2023/4/8 11:32 |
||||
*/ |
||||
@Service |
||||
public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMapper,WorkTicketInfoEntity> implements WorkTicketInfoService { |
||||
} |
Loading…
Reference in new issue