From 4e4f8179ba11d5ad3f3346ff688fc57a8674a996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Fri, 21 Apr 2023 11:11:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=A8=A1=E5=9D=97=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzims/common/logs/aop/SysLogAspect.java | 1 + .../com/hnac/hzims/common/logs/to/SysLogTo.java | 25 +++++ hzims-service/hzims-middle/pom.xml | 8 ++ .../middle/systemlog/config/Swagger2Config.java | 59 +++++++++++ .../systemlog/controller/StatisticsController.java | 62 ++++++++++- .../systemlog/controller/SysLogController.java | 59 ++++++++++- .../hzims/middle/systemlog/entity/Statistics.java | 11 ++ .../systemlog/service/StatisticsService.java | 14 +++ .../middle/systemlog/service/SysLogService.java | 12 +++ .../service/impl/StatisticsServiceImpl.java | 18 ++++ .../systemlog/service/impl/SysLogServiceImpl.java | 41 ++++++++ .../hzims/middle/systemlog/vo/StatisticsVo.java | 34 ++++++ .../hnac/hzims/middle/systemlog/vo/SysLogVo.java | 33 ++++++ .../constant/TicketProcessConstant.java | 2 +- .../controller/ProcessTypeController.java | 4 +- .../service/impl/TicketProcessServiceImpl.java | 114 +++++++++++++++++---- 16 files changed, 469 insertions(+), 28 deletions(-) create mode 100644 hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/Swagger2Config.java create mode 100644 hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/vo/StatisticsVo.java create mode 100644 hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/vo/SysLogVo.java diff --git a/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/aop/SysLogAspect.java b/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/aop/SysLogAspect.java index 75e217c..c2935fe 100644 --- a/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/aop/SysLogAspect.java +++ b/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/aop/SysLogAspect.java @@ -56,6 +56,7 @@ public class SysLogAspect { //private StopWatch stopWatch = new StopWatch(); + private static final ThreadLocal TIME_THREADLOCAL = new NamedThreadLocal<>("Cost Time"); diff --git a/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/to/SysLogTo.java b/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/to/SysLogTo.java index 4b311ba..3816057 100644 --- a/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/to/SysLogTo.java +++ b/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/to/SysLogTo.java @@ -1,5 +1,6 @@ package com.hnac.hzims.common.logs.to; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.time.LocalDateTime; @@ -21,97 +22,115 @@ public class SysLogTo { /** * 租户ID */ + @ApiModelProperty("租户ID") private String tenantId; /** * 服务器ip */ + @ApiModelProperty("服务器ip") protected String serverIp; /** * 服务器地址 */ + @ApiModelProperty("服务器地址") protected String serverHost; /** * 服务名称 */ + @ApiModelProperty("服务名称") protected String serverName; /** * 环境 */ + @ApiModelProperty("环境") protected String env; /** * 操作人 id */ + @ApiModelProperty("操作人id") private Long operationUserId; /** * 操作人 */ + @ApiModelProperty("操作人") private String operationUserName; /** * 请求路径 (操作地址) */ + @ApiModelProperty(" 请求路径 (操作地址)") private String path; /** * 用户代理 */ + @ApiModelProperty("用户代理") protected String userAgent; /** * 操作方式 */ + @ApiModelProperty("操作方式") protected String method; /** * 方法类 */ + @ApiModelProperty("方法类") protected String methodClass; /** * 方法名 */ + @ApiModelProperty("方法名") protected String methodName; /** * 方法执行时间 消耗时间 毫秒 */ + @ApiModelProperty("法执行时间 消耗时间 毫秒") private String costTime; /** * 方法入参 */ + @ApiModelProperty("方法入参") private String parameter; /** * 操作方法 */ + @ApiModelProperty("操作方法") private String title; /** * 方法描述 */ + @ApiModelProperty("方法描述") private String action; /** * 系统类型 */ + @ApiModelProperty("系统类型") private String operatorType; /** * 操作人类别 */ + @ApiModelProperty("操作人类别") private String businessType; @@ -120,32 +139,38 @@ public class SysLogTo { * * @param jsonResult */ + @ApiModelProperty("返回结果") public String jsonResult; /** * 请求的Ip */ + @ApiModelProperty("请求的Ip") private String localIp; /** * 错误消息 */ + @ApiModelProperty("错误消息") private String errorMsg; /** * 操作时间 */ + @ApiModelProperty("操作时间") private LocalDateTime operationTime; /** * 操作状态(0 正常 1 异常) */ + @ApiModelProperty("操作状态") private Integer status; /** * 功能模块 */ + @ApiModelProperty("功能模块") private String moduleName; } diff --git a/hzims-service/hzims-middle/pom.xml b/hzims-service/hzims-middle/pom.xml index 606c141..38e1819 100644 --- a/hzims-service/hzims-middle/pom.xml +++ b/hzims-service/hzims-middle/pom.xml @@ -17,6 +17,7 @@ UTF-8 UTF-8 2.6.13 + 1.9.6 @@ -59,6 +60,13 @@ + + + com.github.xiaoymin + swagger-bootstrap-ui + ${swagger-bootstrap-ui.version} + + diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/Swagger2Config.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/Swagger2Config.java new file mode 100644 index 0000000..b7c5e2a --- /dev/null +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/Swagger2Config.java @@ -0,0 +1,59 @@ +package com.hnac.hzims.middle.systemlog.config; + +import com.google.common.base.Predicates; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +/** + * @Author WL + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/4/13 13:40 + */ +@Configuration +@EnableSwagger2 +public class Swagger2Config implements WebMvcConfigurer { + + + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry.addResourceHandler("/**") + .addResourceLocations("classpath:/static/"); + registry.addResourceHandler("doc.html") + .addResourceLocations("classpath:/META-INF/resources/"); + registry.addResourceHandler("/webjars/**") + .addResourceLocations("classpath:/META-INF/resources/webjars/"); + } + + + + @Bean + public Docket webApiConfig(){ + return new Docket(DocumentationType.SWAGGER_2) + .groupName("日志模块") + .apiInfo(webApiInfo()) + .select() + //只显示api路径下的页面 + .paths(Predicates.and(PathSelectors.regex("/systemlog/.*"))) + .build(); + + } + + private ApiInfo webApiInfo() { + return new ApiInfoBuilder() + .title("网站-API文档") + .description("本文档描述了网站微服务接口定义") + .version("1.0") + .contact(new Contact("WL", "http://localhost:8501/", "55317332@qq.com")) + .build(); + } +} 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 index 7e5a59b..71563bd 100644 --- 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 @@ -1,9 +1,21 @@ package com.hnac.hzims.middle.systemlog.controller; -import org.springframework.web.bind.annotation.RequestMapping; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.common.logs.annotation.OperationAnnotation; +import com.hnac.hzims.common.logs.enums.BusinessType; +import com.hnac.hzims.common.logs.enums.OperatorType; +import com.hnac.hzims.middle.systemlog.entity.Statistics; +import com.hnac.hzims.middle.systemlog.service.StatisticsService; +import com.hnac.hzims.middle.systemlog.vo.StatisticsVo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springblade.core.tool.api.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; -import org.springframework.web.bind.annotation.RestController; +import java.util.List; /** *

@@ -13,9 +25,55 @@ import org.springframework.web.bind.annotation.RestController; * @author dfy * @since 2023-04-08 */ +@Api(tags = "操作日志统计数据") @RestController @RequestMapping("/systemlog/statistics") public class StatisticsController { + + @Autowired + private StatisticsService statisticsService; + + + /** + * 查询 + * + * @param statistics + * @return + */ + @ApiOperation("操作日志统计数据分页查询") + @OperationAnnotation(moduleName = "操作日志", + operatorType = OperatorType.MANAGE, + businessType = BusinessType.INSERT + , title = "操作日志统计数据", action = "操作日志统计数据分页查询") + @GetMapping("/selectPage/{page}/{size}") + public R selectPage( + @PathVariable Long page, + @PathVariable Long size, + StatisticsVo statistics) { + Page page1 = new Page(page, size); + IPage pageSize = statisticsService.selectPage(page1, statistics); + return R.data(pageSize); + } + + + /** + * 根据Id查询日志 + * + * @param id + * @return + */ + @ApiOperation("根据Id查询日志") + @OperationAnnotation(moduleName = "操作日志", + operatorType = OperatorType.MANAGE, + businessType = BusinessType.INSERT + , title = "操作日志统计数据", action = "根据Id查询日志") + @GetMapping("/get/{id}") + public R list(@PathVariable Long id) { + Statistics statistics = statisticsService.getById(id); + return R.data(statistics); + } + + } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/SysLogController.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/SysLogController.java index b40b640..3bca2a1 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/SysLogController.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/SysLogController.java @@ -2,17 +2,24 @@ package com.hnac.hzims.middle.systemlog.controller; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.common.logs.annotation.OperationAnnotation; +import com.hnac.hzims.common.logs.enums.BusinessType; +import com.hnac.hzims.common.logs.enums.OperatorType; import com.hnac.hzims.common.logs.to.SysLogTo; +import com.hnac.hzims.middle.systemlog.entity.Statistics; import com.hnac.hzims.middle.systemlog.entity.SysLog; import com.hnac.hzims.middle.systemlog.service.SysLogService; +import com.hnac.hzims.middle.systemlog.vo.StatisticsVo; +import com.hnac.hzims.middle.systemlog.vo.SysLogVo; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.api.R; import org.springframework.beans.BeanUtils; -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 org.springframework.web.bind.annotation.*; import java.util.List; import java.util.stream.Collectors; @@ -39,6 +46,11 @@ public class SysLogController { * 保存操作日志 * @param sysLogToList */ + @OperationAnnotation(moduleName = "操作日志", + operatorType = OperatorType.MANAGE, + businessType = BusinessType.INSERT + ,title = "系统日志",action = "保存操作日志") + @ApiOperation("保存操作日志") @PostMapping("/batchSave") public void saveBatch(@RequestBody List sysLogToList) { //数据转换 @@ -56,5 +68,44 @@ public class SysLogController { log.info("操作日志新增失败 ~~~"); throw new IllegalArgumentException("操作日志新增失败"); } + + + /** + * 日志分页查询 + * @param page + * @param size + * @return + */ + @OperationAnnotation(moduleName = "操作日志", + operatorType = OperatorType.MANAGE, + businessType = BusinessType.INSERT + ,title = "系统日志",action = "日志分页查询") + @ApiOperation("日志分页查询") + @GetMapping("/selectPage/{page}/{size}") + public R selectPage( + @PathVariable Long page, + @PathVariable Long size, + SysLogVo sysLog) { + Page page1 = new Page(page, size); + IPage pageSize = sysLogService.selectPage(page1, sysLog); + return R.data(pageSize); + } + + + /** + * 根据Id获取日志数据 + * @return + */ + @OperationAnnotation(moduleName = "操作日志", + operatorType = OperatorType.MANAGE, + businessType = BusinessType.INSERT + ,title = "系统日志",action = "根据Id获取日志数据") + @ApiOperation("根据Id获取日志数据") + @GetMapping("/get/{id}") + public R getById(@PathVariable Long id) { + SysLog sysLog = sysLogService.getById(id); + return R.data(sysLog); + } + } 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 index 9d8f338..221004c 100644 --- 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 @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import java.io.Serializable; import java.time.YearMonth; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -29,12 +30,14 @@ public class Statistics implements Serializable { /** * 编号 */ + @ApiModelProperty("编号") @TableField("id") private Long id; /** * 统计日期 */ + @ApiModelProperty("统计日期") @TableField("date_calculated") private String dateCalculated; @@ -42,6 +45,7 @@ public class Statistics implements Serializable { /** * 操作模块 */ + @ApiModelProperty("操作模块") @TableField("title") private String title; @@ -49,6 +53,7 @@ public class Statistics implements Serializable { /** * 操作模块统计 */ + @ApiModelProperty("操作模块统计") @TableField("title_num") private Integer titleNum; @@ -56,6 +61,7 @@ public class Statistics implements Serializable { /** * 功能模块统计 */ + @ApiModelProperty("功能模块统计") @TableField("module_name") private String moduleName; @@ -63,6 +69,7 @@ public class Statistics implements Serializable { /** * 功能模块统计 */ + @ApiModelProperty("功能模块统计") @TableField("module_name_num") private Integer moduleNameNum; @@ -70,24 +77,28 @@ public class Statistics implements Serializable { /** * 请求路径统计 */ + @ApiModelProperty("请求路径统计") @TableField("path") private String path; /** * 请求路径统计 */ + @ApiModelProperty("请求路径统计") @TableField("path_num") private Integer pathNum; /** * 创建时间 */ + @ApiModelProperty("创建时间") @TableField("create_time") private LocalDateTime createTime; /** * 更新时间 */ + @ApiModelProperty("更新时间") @TableField("update_time") private LocalDateTime updateTime; 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 index 32abe97..39a9e5f 100644 --- 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 @@ -1,9 +1,13 @@ package com.hnac.hzims.middle.systemlog.service; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hnac.hzims.middle.systemlog.entity.Statistics; import com.baomidou.mybatisplus.extension.service.IService; +import com.hnac.hzims.middle.systemlog.vo.StatisticsVo; import java.time.YearMonth; +import java.util.List; /** *

@@ -26,4 +30,14 @@ public interface StatisticsService extends IService { * @return */ Statistics getStatisticsBydateCalculated(String operationTime); + + + /** + * 分页查询 + * @param page1 + * @param statistics + * @return + */ + IPage selectPage(Page page1, StatisticsVo statistics); + } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java index 224eceb..a8ad76d 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java @@ -1,8 +1,11 @@ package com.hnac.hzims.middle.systemlog.service; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hnac.hzims.middle.systemlog.entity.SysLog; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzims.middle.systemlog.vo.SysLogStatisticsVo; +import com.hnac.hzims.middle.systemlog.vo.SysLogVo; import java.util.List; @@ -21,4 +24,13 @@ public interface SysLogService extends IService { * @return */ List countStatistics(); + + + /** + * 分页查询 + * @param page1 + * @param sysLog + * @return + */ + IPage selectPage(Page page1, SysLogVo sysLog); } 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 index 78c135e..b6aac7a 100644 --- 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 @@ -1,11 +1,14 @@ package com.hnac.hzims.middle.systemlog.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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 com.hnac.hzims.middle.systemlog.vo.StatisticsVo; import com.hnac.hzims.middle.systemlog.vo.SysLogStatisticsVo; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -84,4 +87,19 @@ public class StatisticsServiceImpl extends ServiceImpl selectPage(Page page1, StatisticsVo statistics) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + IPage statisticsPage = baseMapper.selectPage(page1, queryWrapper); + return statisticsPage; + } } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/SysLogServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/SysLogServiceImpl.java index e1b242b..d6896e1 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/SysLogServiceImpl.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/SysLogServiceImpl.java @@ -1,12 +1,20 @@ package com.hnac.hzims.middle.systemlog.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.hnac.hzims.middle.systemlog.entity.Statistics; import com.hnac.hzims.middle.systemlog.entity.SysLog; import com.hnac.hzims.middle.systemlog.mapper.SysLogMapper; import com.hnac.hzims.middle.systemlog.service.SysLogService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.middle.systemlog.vo.SysLogStatisticsVo; +import com.hnac.hzims.middle.systemlog.vo.SysLogVo; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; +import java.time.LocalDate; import java.util.List; /** @@ -29,4 +37,37 @@ public class SysLogServiceImpl extends ServiceImpl impleme public List countStatistics() { return baseMapper.countStatistics(); } + + /** + * 分页查询 + * + * @param page1 + * @param sysLog + * @return + */ + @Override + public IPage selectPage(Page page1, SysLogVo sysLog) { + String keyword = sysLog.getKeyword(); + LocalDate createTime = sysLog.getCreateTime(); + LocalDate endTime = sysLog.getEndTime(); + + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (StringUtils.isNotEmpty(sysLog.getKeyword())) { + queryWrapper.lambda().like(SysLog::getModuleName, keyword); + queryWrapper.lambda().or().like(SysLog::getTitle, keyword); + queryWrapper.lambda().or().like(SysLog::getAction, keyword); + } + + + if (ObjectUtils.isNotEmpty(createTime)){ + queryWrapper.lambda().ge(SysLog::getOperationTime,createTime); + } + + if (ObjectUtils.isNotEmpty(endTime)){ + queryWrapper.lambda().le(SysLog::getOperationTime,endTime); + } + + IPage statisticsPage = baseMapper.selectPage(page1, queryWrapper); + return statisticsPage; + } } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/vo/StatisticsVo.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/vo/StatisticsVo.java new file mode 100644 index 0000000..deb7d7b --- /dev/null +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/vo/StatisticsVo.java @@ -0,0 +1,34 @@ +package com.hnac.hzims.middle.systemlog.vo; + +import lombok.Data; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +/** + * @Author WL + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/4/21 9:21 + */ +@Data +public class StatisticsVo { + + + /** + * key + */ + public String keyword; + + + /** + * 开始时间 + */ + private LocalDate createTime; + + /** + * 结束时间 + */ + private LocalDate endTime; + +} diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/vo/SysLogVo.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/vo/SysLogVo.java new file mode 100644 index 0000000..c711d4c --- /dev/null +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/vo/SysLogVo.java @@ -0,0 +1,33 @@ +package com.hnac.hzims.middle.systemlog.vo; + +import lombok.Data; + +import java.time.LocalDate; + +/** + * @Author WL + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/4/21 9:53 + */ +@Data +public class SysLogVo { + + + /** + * key + */ + public String keyword; + + + /** + * 开始时间 + */ + private LocalDate createTime; + + /** + * 结束时间 + */ + private LocalDate endTime; + +} diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/constant/TicketProcessConstant.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/constant/TicketProcessConstant.java index 7b9706f..d161a4f 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/constant/TicketProcessConstant.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/constant/TicketProcessConstant.java @@ -11,5 +11,5 @@ package com.hnac.hzims.ticket.processflow.constant; public class TicketProcessConstant { // public final static String STARTEVENT = "startEvent1"; - public final static String STARTEVENT = "newFirstWorkTicket"; + public final static String STARTEVENT = "newFirstWorkTicket"; } 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 07f176a..80d39e0 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 @@ -105,8 +105,8 @@ public class ProcessTypeController { public void addList() { ProcessWorkFlowResponse workTicketMessageResponse = new ProcessWorkFlowResponse(); workTicketMessageResponse.setTaskId("1"); - workTicketMessageResponse.setProcessDefinitionKey("1"); - workTicketMessageResponse.setTaskName("1"); + workTicketMessageResponse.setProcessDefinitionKey("newFirstWorkTicket"); + workTicketMessageResponse.setTaskName("签发人签发"); workTicketMessageResponse.setFormData("1"); String qqqq = JsonUtil.toJson(workTicketMessageResponse); queueProduceService.sendMessage("blade:queue:flow", qqqq); 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 164a40c..4d592af 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 @@ -5,18 +5,25 @@ import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService; import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.aspectj.apache.bcel.generic.TABLESWITCH; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; +import org.springblade.flow.core.entity.BladeFlow; +import org.springblade.flow.core.entity.FlowAttachment; import org.springblade.flow.core.feign.IFlowClient; +import org.springblade.flow.core.vo.ComleteTask; import org.springblade.flow.core.vo.TaskList; import org.springframework.stereotype.Service; +import javax.crypto.Mac; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 开票处理流程实现类 + * * @Author WL * @Version v1.0 * @Serial 1.0 @@ -28,11 +35,16 @@ import java.util.Map; public class TicketProcessServiceImpl implements TicketProcessService { - private final IFlowClient flowClient; + private final IFlowClient flowClient; private final IWorkTicketInfoService workTicketInfoService; + + private Map map = new HashMap(){{ + put("key",true); + }}; + /** * 启动开票流程 * @@ -40,6 +52,9 @@ public class TicketProcessServiceImpl implements TicketProcessService { */ @Override public void startUp(ProcessWorkFlowResponse response) { + + Boolean key = map.get("key"); + //当前环节Id String processDefinitionKey = response.getProcessDefinitionKey(); //当前任务Id @@ -54,25 +69,86 @@ public class TicketProcessServiceImpl implements TicketProcessService { // variables.put("signUserIds", formData); - Map params = new HashMap(2) {{ - put("taskId", "1644624168666353665"); - put("signUserIds", "1377143375838359553"); + if (key) { + Map params = new HashMap(2) {{ + put("taskId", "4066d774-df2c-11ed-b33e-fa163ee12c20"); + put("signUserIds", "1377143375838359553"); + }}; + + + R processInstanceContainNameByKey = flowClient.startProcessInstanceContainNameByKey( + processDefinitionKey, "workTicket:task:" + 1377143375838359553L, + "开启工作的任务", + params); + + if (processInstanceContainNameByKey.getCode() != 200) { + log.error("启动开票流程失败: {}", processInstanceContainNameByKey); + return; + } + + BladeFlow bladeFlow = processInstanceContainNameByKey.getData(); + log.info("bladeFlow: {}", bladeFlow); + map.put("key",false); + return; + } + + + // R tasks = flowClient.getTaskByProcessInstanceIdAndUserId(response.getProcessInstanceId(), + // "1377143375838359553"); + // + // + // flowClient.getTaskByProcessInstanceIdAndUserId(response.getProcessInstanceId(), + // "1377143375838359553"); + // + // if (tasks.getCode() != 200){ + // return; + // } + // + // BladeFlow bladeFlow1 = tasks.getData(); + // + // String curStep = bladeFlow1.getCurStep(); + // System.out.println("curStep = " + curStep); + // + // String status = bladeFlow1.getStatus(); + // System.out.println("status = " + status); + // + // // R> listR = flowClient.todoList(processDefinitionKey); + // // listR.getData().forEach(taskList -> { + // // System.out.println("任务名称:"+taskList); + // // System.out.println(taskList.getTaskName()); + // // System.out.println(taskList.getStatus()); + // // }); + // + // R> taskedVariables = flowClient.taskVariables(response.getTaskId()); + // + // System.out.println(taskedVariables); + + + // R> listR = flowClient.todoList(response.getProcessDefinitionKey()); + // for (TaskList datum : listR.getData()) { + // System.out.println(datum); + // } + + + ComleteTask comleteTask = new ComleteTask(); + comleteTask.setPass(true); + comleteTask.setProcessInstanceId(response.getProcessInstanceId()); + comleteTask.setTaksUserId(1377143375838359553L); + comleteTask.setTaskId(response.getTaskId()); + comleteTask.setComment("同意"); + FlowAttachment flowAttachment= new FlowAttachment(); + flowAttachment.setProcessInstanceId(response.getProcessInstanceId()); + flowAttachment.setTaskId(taskId); + flowAttachment.setAttachmentType(""); + List list = new ArrayList<>(); + list.add(flowAttachment); + comleteTask.setAttachments(list); + Map params = new HashMap(2) {{ + put("taskId",taskId); + put("principalUserIds", "1377143375838359553"); }}; - - flowClient.startProcessInstanceContainNameByKey( - processDefinitionKey,"workTicket:task:"+1, - "开启工作的任务", - params); - - // R> listR = flowClient.todoList(processDefinitionKey); - // listR.getData().forEach(taskList -> { - // System.out.println("任务名称:"+taskList); - // System.out.println(taskList.getTaskName()); - // System.out.println(taskList.getStatus()); - // }); - - - // flowClient.completeTask() + comleteTask.setVariables(params); + flowClient.completeTask(comleteTask); }