Browse Source

新增日志统计表

zhongwei
段飞宇 2 years ago
parent
commit
76ee4bd441
  1. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/mybatisplus/CodeGenerator.java
  2. 29
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java
  3. 21
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/StatisticsController.java
  4. 70
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java
  5. 1
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java
  6. 16
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.java
  7. 5
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/xml/StatisticsMapper.xml
  8. 20
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/StatisticsService.java
  9. 34
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java
  10. 31
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/task/SyslogTimerTask.java
  11. 22
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/controller/ProcessTypeController.java
  12. 17
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/WorkTicketInfoMapper.java
  13. 14
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/WorkTicketInfoService.java
  14. 21
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java
  15. 17
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketInfoServiceImpl.java

2
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/mybatisplus/CodeGenerator.java

@ -92,7 +92,7 @@ public class CodeGenerator {
// strategy.setSuperControllerClass("你自己的父类控制器,没有就不用设置!");
// 写于父类中的公共字段
// strategy.setSuperEntityColumns("id");
strategy.setInclude("hzims_sys_log");
strategy.setInclude("hzims_statistics");
strategy.setControllerMappingHyphenStyle(true);
strategy.setTablePrefix("hzims_");
mpg.setStrategy(strategy);

29
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java

@ -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);
}
}

21
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/StatisticsController.java

@ -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 {
}

70
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java

@ -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;
}

1
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java

@ -195,4 +195,5 @@ public class SysLog implements Serializable {
private Integer isDeleted;
}

16
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.java

@ -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> {
}

5
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/xml/StatisticsMapper.xml

@ -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>

20
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/StatisticsService.java

@ -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();
}

34
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java

@ -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. 保存操作模块的数据
}
}

31
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/task/SyslogTimerTask.java

@ -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();
}
}

22
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/controller/ProcessTypeController.java

@ -43,11 +43,9 @@ public class ProcessTypeController {
private final TicketProperties ticketProperties;
private final ProcessTypeService processTypeService;
private final List<ProcessService> ticketServiceList;
@ -59,8 +57,6 @@ public class ProcessTypeController {
private final QueueProduceService queueProduceService;
@GetMapping("/add")
public void add() {
List<WorkTicketProperties> workTickets = ticketProperties.getWorkTickets();
@ -81,15 +77,13 @@ public class ProcessTypeController {
//判断执行具体的实现类
WorkflowQueue workflowQueue = new WorkflowQueue();
workflowQueue.setProcessDefinitionKey(key);
ProcessService ticketService =
ticketServiceList.stream().filter(item -> item.isWorkflowProcess(workflowQueue))
.findFirst().orElse(null);
ProcessService ticketService = ticketServiceList.stream().filter(item -> item.isWorkflowProcess(workflowQueue)).findFirst().orElse(null);
ticketService.calculate(null);
return "key";
}
@OperationAnnotation(title = "操作模块", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE,action ="获取redis数据")
@OperationAnnotation(title = "操作模块", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE, action = "获取redis数据")
@GetMapping("/redis/{value}")
public int opens(@PathVariable String value) {
redisTemplate.convertAndSend("blade:queue:flow", JSON.toJSONString(value));
@ -97,18 +91,16 @@ public class ProcessTypeController {
}
@OperationAnnotation(title = "工作流审批类型", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE,
action ="查询")
@OperationAnnotation(title = "工作流审批类型", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE, action = "查询")
@GetMapping("/list")
public R list() {
List<ProcessType> list = processTypeService.list();
System.out.println(1/0);
System.out.println(1 / 0);
return R.data(list);
}
@OperationAnnotation(title = "工作流审批类型", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE,
action ="审批流处理")
@OperationAnnotation(title = "工作流审批类型", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE, action = "审批流处理")
@GetMapping("/build")
public void addList() {
ProcessWorkFlowResponse workTicketMessageResponse = new ProcessWorkFlowResponse();
@ -117,7 +109,9 @@ public class ProcessTypeController {
workTicketMessageResponse.setTaskName("1");
workTicketMessageResponse.setFormData("1");
String qqqq = JsonUtil.toJson(workTicketMessageResponse);
queueProduceService.sendMessage("blade:queue:flow",qqqq);
queueProduceService.sendMessage("blade:queue:flow", qqqq);
}
}

17
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/WorkTicketInfoMapper.java

@ -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> {
}

14
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/WorkTicketInfoService.java

@ -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> {
}

21
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java

@ -2,12 +2,15 @@ package com.hnac.hzims.ticket.twoTicket.service.impl;
import com.hnac.hzims.ticket.response.ProcessWorkFlowResponse;
import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService;
import com.hnac.hzims.ticket.twoTicket.service.WorkTicketInfoService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.flow.core.feign.IFlowClient;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
* 开票处理流程实现类
* @Author WL
@ -24,7 +27,7 @@ public class TicketProcessServiceImpl implements TicketProcessService {
private final IFlowClient flowClient;
private final WorkTicketInfoService workTicketInfoService;
private final IWorkTicketInfoService workTicketInfoService;
/**
* 启动开票流程
@ -33,6 +36,20 @@ public class TicketProcessServiceImpl implements TicketProcessService {
*/
@Override
public void startUp(ProcessWorkFlowResponse response) {
//当前环节Id
String processDefinitionKey = response.getProcessDefinitionKey();
//当前任务Id
String taskId = response.getTaskId();
//表单数据
String formData = response.getFormData();
log.info("当前任务ID:{},当前流程定义ID:{},启动开票流程", taskId, processDefinitionKey);
System.out.println(formData);
// Map<String, Object> variables = new HashMap<>();
// variables.put("task_id", taskId);
// variables.put("signUserIds", formData);
flowClient.startProcessInstanceContainNameByKey(processDefinitionKey,"workTicket:task:"+1,)
}
}

17
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketInfoServiceImpl.java

@ -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…
Cancel
Save