V13
This commit is contained in:
@@ -1,26 +1,33 @@
|
||||
package com.ruoyi.job;
|
||||
|
||||
import com.ruoyi.cai.service.AnchorImCountDayService;
|
||||
import com.ruoyi.job.op.BusOp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class EveryDaysJob {
|
||||
@Autowired
|
||||
private BusOp busOp;
|
||||
@Autowired
|
||||
private AnchorImCountDayService anchorImCountDayService;
|
||||
// 凌晨0点3分执行一次
|
||||
@Scheduled(cron = "0 3 0 * * ? ")
|
||||
public void run() {
|
||||
try {
|
||||
log.info("执行用户VIP状态码回转-开始");
|
||||
log.info("执行IM统计入库-开始");
|
||||
// busOp.refreshUserVipStatus();
|
||||
anchorImCountDayService.refreshCount(LocalDate.now().plusDays(-1));
|
||||
anchorImCountDayService.totalUserCount();
|
||||
}catch (Exception e){
|
||||
log.error("执行用户VIP状态码回转-失败!",e);
|
||||
log.error("执行IM统计入库-失败!",e);
|
||||
}finally {
|
||||
log.info("执行用户VIP状态码回转-结束");
|
||||
log.info("执行IM统计入库-结束");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.ruoyi.web.controller.cai.admin;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.cai.domain.AnchorImCountDay;
|
||||
import com.ruoyi.cai.dto.admin.vo.AnchorImCountDayAdminVO;
|
||||
import com.ruoyi.cai.dto.admin.vo.UserCountAdminVo;
|
||||
import com.ruoyi.cai.mapper.UserCountMapper;
|
||||
import com.ruoyi.cai.service.AnchorImCountDayService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 每日发言统计
|
||||
*
|
||||
* @author 777
|
||||
* @date 2025-08-19
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/cai/anchorImCountDay")
|
||||
public class AnchorImCountDayController extends BaseController {
|
||||
|
||||
private final AnchorImCountDayService anchorImCountDayService;
|
||||
private final UserCountMapper userCountMapper;
|
||||
|
||||
/**
|
||||
* 查询每日发言统计列表
|
||||
*/
|
||||
@SaCheckPermission("cai:anchorImCountDay:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<AnchorImCountDayAdminVO> list(AnchorImCountDayAdminVO bo, PageQuery pageQuery) {
|
||||
IPage<AnchorImCountDayAdminVO> page = anchorImCountDayService.pageAdmin(bo, pageQuery);
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
@SaCheckPermission("cai:anchorImCountDay:list")
|
||||
@GetMapping("/imCountAll/list")
|
||||
public TableDataInfo<UserCountAdminVo> imCountAllList(UserCountAdminVo bo, PageQuery pageQuery) {
|
||||
Page<UserCountAdminVo> page = userCountMapper.pageAdmin(pageQuery.build(), bo);
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 刷新今日统计
|
||||
*/
|
||||
@Log(title = "刷新每日发言统计", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/refreshCount")
|
||||
public R<Void> refreshCount(@RequestBody AnchorImCountDay bo) {
|
||||
anchorImCountDayService.refreshCount(bo.getCountDate());
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "刷新用户所有发言统计", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/totalUserCount")
|
||||
public R<Void> totalUserCount() {
|
||||
anchorImCountDayService.totalUserCount();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,7 @@ spring:
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
|
||||
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
|
||||
url: jdbc:mysql://124.222.254.188:5306/cai-v5?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
|
||||
url: jdbc:mysql://124.222.254.188:5306/cai-v6?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
|
||||
username: root
|
||||
password: 383200134
|
||||
# 从库数据源
|
||||
|
||||
Reference in New Issue
Block a user