diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/mybatisplus/CodeGenerator.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/mybatisplus/CodeGenerator.java index b3d63f6..50f2d36 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/mybatisplus/CodeGenerator.java +++ b/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); diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java new file mode 100644 index 0000000..006d3aa --- /dev/null +++ b/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); + } + +} diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/StatisticsController.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/StatisticsController.java new file mode 100644 index 0000000..7e5a59b --- /dev/null +++ b/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; + +/** + *

+ * 操作日志统计数据 前端控制器 + *

+ * + * @author dfy + * @since 2023-04-08 + */ +@RestController +@RequestMapping("/systemlog/statistics") +public class StatisticsController { + +} + diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java new file mode 100644 index 0000000..09bde87 --- /dev/null +++ b/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; + +/** + *

+ * 操作日志统计数据 + *

+ * + * @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; + + +} diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java index 484f955..210acca 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java +++ b/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; + } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.java new file mode 100644 index 0000000..53166f0 --- /dev/null +++ b/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; + +/** + *

+ * 操作日志统计数据 Mapper 接口 + *

+ * + * @author dfy + * @since 2023-04-08 + */ +public interface StatisticsMapper extends BaseMapper { + +} diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/xml/StatisticsMapper.xml b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/xml/StatisticsMapper.xml new file mode 100644 index 0000000..093a8d3 --- /dev/null +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/xml/StatisticsMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/StatisticsService.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/StatisticsService.java new file mode 100644 index 0000000..a04f72c --- /dev/null +++ b/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; + +/** + *

+ * 操作日志统计数据 服务类 + *

+ * + * @author dfy + * @since 2023-04-08 + */ +public interface StatisticsService extends IService { + + /** + * 保存统计的数据 + */ + void saveCountStatistics(); +} diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java new file mode 100644 index 0000000..b1f5c97 --- /dev/null +++ b/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; + +/** + *

+ * 操作日志统计数据 服务实现类 + *

+ * + * @author dfy + * @since 2023-04-08 + */ +@Service +public class StatisticsServiceImpl extends ServiceImpl implements StatisticsService { + + @Autowired + private SysLogService sysLogService; + + + /** + * 保存统计的数据 + */ + @Override + public void saveCountStatistics() { + //1. 保存操作模块的数据 + + } +} diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/task/SyslogTimerTask.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/task/SyslogTimerTask.java new file mode 100644 index 0000000..99a09d0 --- /dev/null +++ b/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(); + } +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/controller/ProcessTypeController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/controller/ProcessTypeController.java index ade2805..07f176a 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/controller/ProcessTypeController.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/controller/ProcessTypeController.java @@ -43,15 +43,13 @@ public class ProcessTypeController { private final TicketProperties ticketProperties; - private final ProcessTypeService processTypeService; - private final List ticketServiceList; - private final RedisTemplate redisTemplate; + private final RedisTemplate redisTemplate; private final IFlowClient flowClient; @@ -59,8 +57,6 @@ public class ProcessTypeController { private final QueueProduceService queueProduceService; - - @GetMapping("/add") public void add() { List 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 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); } + + } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/WorkTicketInfoMapper.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/WorkTicketInfoMapper.java deleted file mode 100644 index 5185416..0000000 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/WorkTicketInfoMapper.java +++ /dev/null @@ -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 { - -} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/WorkTicketInfoService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/WorkTicketInfoService.java deleted file mode 100644 index bfd29d3..0000000 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/WorkTicketInfoService.java +++ /dev/null @@ -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 { - -} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java index 995459f..78d5b21 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java +++ b/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 variables = new HashMap<>(); + // variables.put("task_id", taskId); + // variables.put("signUserIds", formData); + + flowClient.startProcessInstanceContainNameByKey(processDefinitionKey,"workTicket:task:"+1,) } } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketInfoServiceImpl.java deleted file mode 100644 index 276a347..0000000 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/WorkTicketInfoServiceImpl.java +++ /dev/null @@ -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 implements WorkTicketInfoService { -}