Browse Source

水电生产运行数据 操作票分页列表详情

zhongwei
段飞宇 2 years ago
parent
commit
f59a0ee86c
  1. 32
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/feign/TicketFeignClient.java
  2. 30
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/feign/fallback/StandardTicketInfoFeignClient.java
  3. 28
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/AreaMonthlyVo.java
  4. 71
      hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketVo.java
  5. 208
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/mybatisplus/CodeGenerator.java
  6. 11
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/config/SysLogConfig.java
  7. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java
  8. 0
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.xml
  9. 10
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.java
  10. 13
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml
  11. 9
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/StatisticsService.java
  12. 8
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java
  13. 47
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java
  14. 12
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/SysLogServiceImpl.java
  15. 5
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/task/SyslogTimerTask.java
  16. 36
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/vo/SysLogStatisticsVo.java
  17. 4
      hzims-service/hzims-middle/src/main/resources/application.yml
  18. 5
      hzims-service/hzims-middle/src/main/resources/mapper/SysLogMapper.xml
  19. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/OperationApplication.java
  20. 33
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/config/IPageDeserializer.java
  21. 52
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/config/WebDataConvertConfig.java
  22. 52
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java
  23. 24
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaMonthlyDetailsService.java
  24. 48
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthlyDetailsServiceImpl.java
  25. 2
      hzims-service/operational/src/main/resources/application-dev.yml
  26. 4
      hzims-service/ticket/pom.xml
  27. 208
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/CodeGenerator.java
  28. 3
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/constant/TicketProcessConstant.java
  29. 14
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/consumer/StandardWorkTicketConsumer.java
  30. 10
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/entity/WorkflowOperationLog.java
  31. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/MakeProcessServiceImpl.java
  32. 140
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java
  33. 16
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java
  34. 965
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java
  35. 22
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java
  36. 365
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClient.java

32
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/feign/TicketFeignClient.java

@ -0,0 +1,32 @@
package com.hnac.hzims.ticket.areamonthly.feign;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.ticket.areamonthly.StandardTicketVo;
import com.hnac.hzims.ticket.areamonthly.feign.fallback.StandardTicketInfoFeignClient;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/10 13:39
*/
@FeignClient(value = "hzims-ticket", fallback = StandardTicketInfoFeignClient.class)
public interface TicketFeignClient {
/**
* 根据月份区域 获取操作详情数据
*
* @return
*/
@GetMapping("/standard/ticket/areaMonthlyWithOperation/{page}/{size}")
R<IPage<StandardTicketVo>> areaMonthlyWithOperation(@PathVariable("page") Long page,
@PathVariable("size") Long size,
@SpringQueryMap AreaMonthlyVo areaMonthlyV);
}

30
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/feign/fallback/StandardTicketInfoFeignClient.java

@ -0,0 +1,30 @@
package com.hnac.hzims.ticket.areamonthly.feign.fallback;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.ticket.areamonthly.StandardTicketVo;
import com.hnac.hzims.ticket.areamonthly.feign.TicketFeignClient;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/10 17:24
*/
@Service
public class StandardTicketInfoFeignClient implements TicketFeignClient {
/**
* 根据月份区域 获取操作详情数据
*
* @param page
* @param size
* @return
*/
@Override
public R<IPage<StandardTicketVo>> areaMonthlyWithOperation(Long page, Long size, AreaMonthlyVo areaMonthlyV) {
return R.fail("远程调用失败");
}
}

28
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/AreaMonthlyVo.java

@ -0,0 +1,28 @@
package com.hnac.hzims.ticket.areamonthly.vo;
import lombok.Data;
import java.time.YearMonth;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/10 11:28
*/
@Data
public class AreaMonthlyVo {
/**
* 区域编号
*/
private String areaId;
/**
* 月份
*/
private YearMonth YearMonth;
}

71
hzims-service-api/ticket-api/src/main/java/com/hnac/hzims/ticket/areamonthly/vo/StandardTicketVo.java

@ -0,0 +1,71 @@
package com.hnac.hzims.ticket.areamonthly;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.mp.support.SqlCondition;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/10 17:06
*/
@EqualsAndHashCode
@Data
public class StandardTicketVo implements Serializable {
private static final long serialVersionUID = -8870464581684939369L;
/**
* 开票种类
*/
private String ticketType;
/**
* 单位
*/
private String company;
/**
* 编号
*/
private String code;
/**
* 开票来源
*/
private String taskType;
/**
* 开票任务来源
*/
private String taskName;
/**
* 发令人
*/
private Long issueOrderPerson;
/**
* 受令人
*/
private Long accessOrderPerson;
/**
* 监护人
*/
private String guardian;
/**
* 值班负责人
*/
private Long principal;
/**
* 开票时间
*/
private Date createTime;
}

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

@ -1,104 +1,104 @@
package com.hnac.hzims.middle.mybatisplus; // package com.hnac.hzims.middle.mybatisplus;
//
import com.baomidou.mybatisplus.generator.AutoGenerator; // import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig; // import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.*; // import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
//
import java.util.ArrayList; // import java.util.ArrayList;
import java.util.List; // import java.util.List;
//
/** // /**
* @Author WL // * @Author WL
* @Version v1.0 // * @Version v1.0
* @Serial 1.0 // * @Serial 1.0
* @Date 2023/4/4 9:07 // * @Date 2023/4/4 9:07
*/ // */
public class CodeGenerator { // public class CodeGenerator {
//
//
public static void main(String[] args) { // public static void main(String[] args) {
// 代码生成器 // // 代码生成器
AutoGenerator mpg = new AutoGenerator(); // AutoGenerator mpg = new AutoGenerator();
//
// 全局配置 // // 全局配置
GlobalConfig gc = new GlobalConfig(); // GlobalConfig gc = new GlobalConfig();
String projectPath = System.getProperty("user.dir") + "/hzims-service/hzims-middle"; // String projectPath = System.getProperty("user.dir") + "/hzims-service/hzims-middle";
gc.setOutputDir(projectPath + "/src/main/java"); // gc.setOutputDir(projectPath + "/src/main/java");
gc.setAuthor("dfy"); // gc.setAuthor("dfy");
gc.setOpen(false); // gc.setOpen(false);
// gc.setSwagger2(true); 实体属性 Swagger2 注解 // // gc.setSwagger2(true); 实体属性 Swagger2 注解
mpg.setGlobalConfig(gc); // mpg.setGlobalConfig(gc);
//
// 数据源配置 // // 数据源配置
DataSourceConfig dsc = new DataSourceConfig(); // DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://192.168.1.20:3576/dev_hzims_middle?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true"); // dsc.setUrl("jdbc:mysql://192.168.1.20:3576/dev_hzims_middle?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true");
// dsc.setSchemaName("public"); // // dsc.setSchemaName("public");
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // dsc.setDriverName("com.mysql.cj.jdbc.Driver");
dsc.setUsername("root"); // dsc.setUsername("root");
dsc.setPassword("123"); // dsc.setPassword("123");
mpg.setDataSource(dsc); // mpg.setDataSource(dsc);
//
// 包配置 // // 包配置
PackageConfig pc = new PackageConfig(); // PackageConfig pc = new PackageConfig();
pc.setModuleName("systemlog"); // pc.setModuleName("systemlog");
pc.setParent("com.hnac.hzims.middle"); // pc.setParent("com.hnac.hzims.middle");
mpg.setPackageInfo(pc); // mpg.setPackageInfo(pc);
//
// 自定义配置 // // 自定义配置
InjectionConfig cfg = new InjectionConfig() { // InjectionConfig cfg = new InjectionConfig() {
@Override // @Override
public void initMap() { // public void initMap() {
// to do nothing // // to do nothing
} // }
}; // };
//
// 如果模板引擎是 freemarker // // 如果模板引擎是 freemarker
String templatePath = "/templates/mapper.xml.ftl"; // String templatePath = "/templates/mapper.xml.ftl";
// 如果模板引擎是 velocity // // 如果模板引擎是 velocity
// String templatePath = "/templates/mapper.xml.vm"; // // String templatePath = "/templates/mapper.xml.vm";
//
// 自定义输出配置 // // 自定义输出配置
List<FileOutConfig> focList = new ArrayList<>(); // List<FileOutConfig> focList = new ArrayList<>();
cfg.setFileOutConfigList(focList); // cfg.setFileOutConfigList(focList);
mpg.setCfg(cfg); // mpg.setCfg(cfg);
//
// 配置模板 // // 配置模板
TemplateConfig templateConfig = new TemplateConfig(); // TemplateConfig templateConfig = new TemplateConfig();
//
// 配置自定义输出模板 // // 配置自定义输出模板
//指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别 // //指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别
// templateConfig.setEntity("templates/entity2.java"); // // templateConfig.setEntity("templates/entity2.java");
// templateConfig.setService(); // // templateConfig.setService();
// templateConfig.setController(); // // templateConfig.setController();
//
// templateConfig.setXml(null); // // templateConfig.setXml(null);
mpg.setTemplate(templateConfig); // mpg.setTemplate(templateConfig);
//
// 策略配置 // // 策略配置
StrategyConfig strategy = new StrategyConfig(); // StrategyConfig strategy = new StrategyConfig();
strategy.setNaming(NamingStrategy.underline_to_camel); // strategy.setNaming(NamingStrategy.underline_to_camel);
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // strategy.setColumnNaming(NamingStrategy.underline_to_camel);
// strategy.setSuperEntityClass("你自己的父类实体,没有就不用设置!"); // // strategy.setSuperEntityClass("你自己的父类实体,没有就不用设置!");
strategy.setEntityLombokModel(true); // strategy.setEntityLombokModel(true);
strategy.setRestControllerStyle(true); // strategy.setRestControllerStyle(true);
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // strategy.setEntityBooleanColumnRemoveIsPrefix(true);
strategy.setEntityLombokModel(true); // strategy.setEntityLombokModel(true);
strategy.setEntitySerialVersionUID(true); // strategy.setEntitySerialVersionUID(true);
strategy.setChainModel(true); // strategy.setChainModel(true);
strategy.setEntityTableFieldAnnotationEnable(true); // strategy.setEntityTableFieldAnnotationEnable(true);
// strategy.setFieldPrefix("hzims_"); // // strategy.setFieldPrefix("hzims_");
// 公共父类 // // 公共父类
// strategy.setSuperControllerClass("你自己的父类控制器,没有就不用设置!"); // // strategy.setSuperControllerClass("你自己的父类控制器,没有就不用设置!");
// 写于父类中的公共字段 // // 写于父类中的公共字段
// strategy.setSuperEntityColumns("id"); // // strategy.setSuperEntityColumns("id");
strategy.setInclude("hzims_statistics"); // strategy.setInclude("hzims_statistics");
strategy.setControllerMappingHyphenStyle(true); // strategy.setControllerMappingHyphenStyle(true);
strategy.setTablePrefix("hzims_"); // strategy.setTablePrefix("hzims_");
mpg.setStrategy(strategy); // mpg.setStrategy(strategy);
// mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // // mpg.setTemplateEngine(new FreemarkerTemplateEngine());
mpg.execute(); // mpg.execute();
} // }
//
} // }
//

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

@ -1,6 +1,8 @@
package com.hnac.hzims.middle.systemlog.config; package com.hnac.hzims.middle.systemlog.config;
import com.hnac.hzims.middle.systemlog.service.StatisticsService;
import com.hnac.hzims.middle.systemlog.task.SyslogTimerTask; import com.hnac.hzims.middle.systemlog.task.SyslogTimerTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@ -15,15 +17,18 @@ import java.util.Timer;
@Configuration @Configuration
public class SysLogConfig { public class SysLogConfig {
@Autowired
private StatisticsService statisticsService;
@Bean @Bean
public void syslogTimer() { public void syslogTimer() {
//1.创建一个timer实例 //1.创建一个timer实例
Timer timer = new Timer(); Timer timer = new Timer();
//2.创建一个SyslogTimerTask实例 //2.创建一个SyslogTimerTask实例
SyslogTimerTask myTimeTask = new SyslogTimerTask(); SyslogTimerTask myTimeTask = new SyslogTimerTask(statisticsService);
//3.通过timer定时定频率调用SyslogTimerTask的业务逻辑 //3.通过timer定时定频率调用SyslogTimerTask的业务逻辑
// 即 第一次执行是在当前时间的两秒之后,之后每隔30秒钟执行一次 // 即 第一次执行是在当前时间的两秒之后,之后每隔3秒钟执行一次
timer.schedule(myTimeTask,2000L,30000L); timer.schedule(myTimeTask,2000L,10000L);
} }
} }

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

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable; import java.io.Serializable;
import java.time.YearMonth;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;

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

10
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.java

@ -2,6 +2,9 @@ package com.hnac.hzims.middle.systemlog.mapper;
import com.hnac.hzims.middle.systemlog.entity.SysLog; import com.hnac.hzims.middle.systemlog.entity.SysLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.middle.systemlog.vo.SysLogStatisticsVo;
import java.util.List;
/** /**
* <p> * <p>
@ -13,4 +16,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface SysLogMapper extends BaseMapper<SysLog> { public interface SysLogMapper extends BaseMapper<SysLog> {
/**
* 查询统计的数据
* @return
*/
List<SysLogStatisticsVo> countStatistics();
} }

13
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml

@ -0,0 +1,13 @@
<?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.SysLogMapper">
<select id="countStatistics" resultType="com.hnac.hzims.middle.systemlog.vo.SysLogStatisticsVo">
select date_format(operation_time, '%Y-%m-%d') operationTime,
count(title) titleCount,
count(module_name) moduleNameCount,
count(path) pathCount
from hzims_sys_log
group by operationTime;
</select>
</mapper>

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

@ -3,6 +3,8 @@ package com.hnac.hzims.middle.systemlog.service;
import com.hnac.hzims.middle.systemlog.entity.Statistics; import com.hnac.hzims.middle.systemlog.entity.Statistics;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.time.YearMonth;
/** /**
* <p> * <p>
* 操作日志统计数据 服务类 * 操作日志统计数据 服务类
@ -17,4 +19,11 @@ public interface StatisticsService extends IService<Statistics> {
* 保存统计的数据 * 保存统计的数据
*/ */
void saveCountStatistics(); void saveCountStatistics();
/**
* 根据时间查询数据
* @param operationTime
* @return
*/
Statistics getStatisticsBydateCalculated(String operationTime);
} }

8
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java

@ -2,6 +2,9 @@ package com.hnac.hzims.middle.systemlog.service;
import com.hnac.hzims.middle.systemlog.entity.SysLog; import com.hnac.hzims.middle.systemlog.entity.SysLog;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.middle.systemlog.vo.SysLogStatisticsVo;
import java.util.List;
/** /**
* <p> * <p>
@ -13,4 +16,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/ */
public interface SysLogService extends IService<SysLog> { public interface SysLogService extends IService<SysLog> {
/**
* 查询统计的数据
* @return
*/
List<SysLogStatisticsVo> countStatistics();
} }

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

@ -1,13 +1,18 @@
package com.hnac.hzims.middle.systemlog.service.impl; package com.hnac.hzims.middle.systemlog.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hnac.hzims.middle.systemlog.entity.Statistics; import com.hnac.hzims.middle.systemlog.entity.Statistics;
import com.hnac.hzims.middle.systemlog.mapper.StatisticsMapper; import com.hnac.hzims.middle.systemlog.mapper.StatisticsMapper;
import com.hnac.hzims.middle.systemlog.service.StatisticsService; import com.hnac.hzims.middle.systemlog.service.StatisticsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.middle.systemlog.service.SysLogService; import com.hnac.hzims.middle.systemlog.service.SysLogService;
import com.hnac.hzims.middle.systemlog.vo.SysLogStatisticsVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.YearMonth;
import java.util.List;
/** /**
* <p> * <p>
* 操作日志统计数据 服务实现类 * 操作日志统计数据 服务实现类
@ -22,13 +27,53 @@ public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statist
@Autowired @Autowired
private SysLogService sysLogService; private SysLogService sysLogService;
@Autowired
private StatisticsService statisticsService;
/** /**
* 保存统计的数据 * 保存统计的数据
*/ */
@Override @Override
public void saveCountStatistics() { public void saveCountStatistics() {
//1. 保存操作模块的数据 //1. 查询统计的数据
List<SysLogStatisticsVo> sysLogStatisticsVoList = sysLogService.countStatistics();
System.out.println(sysLogStatisticsVoList);
//2. 保存数据
if (sysLogStatisticsVoList == null) {
return;
}
for (SysLogStatisticsVo sysLogStatisticsVo : sysLogStatisticsVoList) {
//查询数据
Statistics statistics = statisticsService.getStatisticsBydateCalculated(sysLogStatisticsVo.getOperationTime());
//如果为空保存数据,如果不为空更新数据
if (statistics == null) {
statistics = new Statistics();
statistics.setDateCalculated(sysLogStatisticsVo.getOperationTime());
statistics.setModuleNameNum(sysLogStatisticsVo.getModuleNameCount());
statistics.setTitleNum(sysLogStatisticsVo.getTitleCount());
statistics.setPathNum(sysLogStatisticsVo.getPathCount());
statisticsService.save(statistics);
}else {
statistics.setModuleNameNum(sysLogStatisticsVo.getModuleNameCount());
statistics.setTitleNum(sysLogStatisticsVo.getTitleCount());
statistics.setPathNum(sysLogStatisticsVo.getPathCount());
statisticsService.updateById(statistics);
}
}
}
/**
* 根据时间查询数据
*
* @param operationTime
* @return
*/
@Override
public Statistics getStatisticsBydateCalculated(String operationTime) {
QueryWrapper<Statistics> statisticsQueryWrapper = new QueryWrapper<>();
statisticsQueryWrapper.eq("date_calculated", operationTime);
return baseMapper.selectOne(statisticsQueryWrapper);
} }
} }

12
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/SysLogServiceImpl.java

@ -4,8 +4,11 @@ import com.hnac.hzims.middle.systemlog.entity.SysLog;
import com.hnac.hzims.middle.systemlog.mapper.SysLogMapper; import com.hnac.hzims.middle.systemlog.mapper.SysLogMapper;
import com.hnac.hzims.middle.systemlog.service.SysLogService; import com.hnac.hzims.middle.systemlog.service.SysLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.middle.systemlog.vo.SysLogStatisticsVo;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* <p> * <p>
* 服务实现类 * 服务实现类
@ -17,4 +20,13 @@ import org.springframework.stereotype.Service;
@Service @Service
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements SysLogService { public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements SysLogService {
/**
* 查询统计的数据
*
* @return
*/
@Override
public List<SysLogStatisticsVo> countStatistics() {
return baseMapper.countStatistics();
}
} }

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

@ -2,6 +2,7 @@ package com.hnac.hzims.middle.systemlog.task;
import com.hnac.hzims.middle.systemlog.service.StatisticsService; import com.hnac.hzims.middle.systemlog.service.StatisticsService;
import com.hnac.hzims.middle.systemlog.service.SysLogService; import com.hnac.hzims.middle.systemlog.service.SysLogService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -13,11 +14,10 @@ import java.util.TimerTask;
* @Serial 1.0 * @Serial 1.0
* @Date 2023/4/8 14:13 * @Date 2023/4/8 14:13
*/ */
@Component @AllArgsConstructor
public class SyslogTimerTask extends TimerTask { public class SyslogTimerTask extends TimerTask {
@Autowired
private StatisticsService statisticsService; private StatisticsService statisticsService;
/** /**
@ -26,6 +26,7 @@ public class SyslogTimerTask extends TimerTask {
@Override @Override
public void run() { public void run() {
//保存统计的数据 //保存统计的数据
System.out.println("保存统计的数据");
statisticsService.saveCountStatistics(); statisticsService.saveCountStatistics();
} }
} }

36
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/vo/SysLogStatisticsVo.java

@ -0,0 +1,36 @@
package com.hnac.hzims.middle.systemlog.vo;
import lombok.Data;
import java.time.YearMonth;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/10 9:03
*/
@Data
public class SysLogStatisticsVo {
/**
* 操作时间
*/
private String operationTime;
/**
* 操作模块统计
*/
private Integer titleCount;
/**
* 操作类型统计
*/
private Integer moduleNameCount;
/**
* 根据路径统计
*/
private Integer pathCount;
}

4
hzims-service/hzims-middle/src/main/resources/application.yml

@ -15,9 +15,7 @@ spring:
#mybatis-plus配置 #mybatis-plus配置
mybatis-plus: mybatis-plus:
mapper-locations: mapper-locations: classpath:com/hnac/hzims/**/mapper/*Mapper.xml
- classpath:com/hnac/hzims/**/mapper/*Mapper.xml
- classpath:/mapper/*Mapper.xml
#实体扫描,多个package用逗号或者分号分隔 #实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: com.hnac.hzims.**.entity typeAliasesPackage: com.hnac.hzims.**.entity

5
hzims-service/hzims-middle/src/main/resources/mapper/SysLogMapper.xml

@ -1,5 +0,0 @@
<?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.SysLogMapper">
</mapper>

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/OperationApplication.java

@ -22,6 +22,7 @@ import org.springblade.core.launch.BladeApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.SpringCloudApplication; import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;

33
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/config/IPageDeserializer.java

@ -0,0 +1,33 @@
package com.hnac.hzims.operational.main.config;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.JacksonException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import java.io.IOException;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/10 16:12
*/
public class IPageDeserializer extends StdDeserializer<IPage> {
protected IPageDeserializer(Class<?> vc) {
super(vc);
}
@Override
public IPage deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JacksonException {
JsonNode node = jsonParser.getCodec().readTree(jsonParser);
String s = node.toString();
ObjectMapper om = new ObjectMapper();
Page page = om.readValue(s,Page.class);
return page;
}
}

52
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/config/WebDataConvertConfig.java

@ -0,0 +1,52 @@
package com.hnac.hzims.operational.main.config;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import java.util.Arrays;
import java.util.List;
/**
*
* @Author dfy
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/10 16:11
*/
@Configuration
public class WebDataConvertConfig extends WebMvcConfigurationSupport {
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
converters.add(mappingJackson2HttpMessageConverter());
super.configureMessageConverters(converters);
}
@Bean
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
SimpleModule module = new SimpleModule();
module.addDeserializer(IPage.class, new IPageDeserializer(IPage.class));
mapper.registerModule(module);
converter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON,MediaType.APPLICATION_JSON_UTF8,MediaType.APPLICATION_OCTET_STREAM));
converter.setObjectMapper(mapper);
return converter;
}
}

52
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java

@ -0,0 +1,52 @@
package com.hnac.hzims.operational.main.controller.web;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.main.service.AreaMonthlyDetailsService;
import com.hnac.hzims.ticket.areamonthly.StandardTicketVo;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 水电生成报告详情数据
*
* @Author dfy
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/10 11:21
*/
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/areaMonthlyDetails")
public class AreaMonthlyDetailsController {
private final AreaMonthlyDetailsService areaMonthlyDetailsService;
/**
* 操作票 根据月份区域 获取操作详情数据
*
* @return
*/
@GetMapping("/areaMonthlyWithOperation/{page}/{size}")
public R areaMonthlyWithOperation(@PathVariable("page") Long page,
@PathVariable("size") Long size,
AreaMonthlyVo areaMonthly) {
IPage<StandardTicketVo> standardTicketInfoVoIPage =
areaMonthlyDetailsService.areaMonthlyWithOperation(page,size, areaMonthly);
return R.data(standardTicketInfoVoIPage);
}
}

24
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaMonthlyDetailsService.java

@ -0,0 +1,24 @@
package com.hnac.hzims.operational.main.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.ticket.areamonthly.StandardTicketVo;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
/**
*
* 水电生产运行数据
* @Author dfy
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/10 13:46
*/
public interface AreaMonthlyDetailsService {
/**
* 根据月份区域 获取操作详情数据
* @param page
* @param size
* @param areaMonthly
* @return
*/
IPage<StandardTicketVo> areaMonthlyWithOperation(Long page, Long size, AreaMonthlyVo areaMonthly);
}

48
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthlyDetailsServiceImpl.java

@ -0,0 +1,48 @@
package com.hnac.hzims.operational.main.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.ticket.areamonthly.StandardTicketVo;
import com.hnac.hzims.ticket.areamonthly.feign.TicketFeignClient;
import com.hnac.hzims.operational.main.service.AreaMonthlyDetailsService;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springframework.stereotype.Service;
/**
* 水电生产运行数据
*
* @Author dfy
* @Version v1.0
* @Serial 1.0
* @Date 2023/4/10 13:46
*/
@Slf4j
@RequiredArgsConstructor
@Service
public class AreaMonthlyDetailsServiceImpl implements AreaMonthlyDetailsService {
private final TicketFeignClient ticketFeignClient;
/**
* 根据月份区域 获取操作详情数据
*
* @param page
* @param size
* @param areaMonthly
* @return
*/
@Override
public IPage<StandardTicketVo> areaMonthlyWithOperation(Long page, Long size, AreaMonthlyVo areaMonthly) {
R<IPage<StandardTicketVo>> pageR =
ticketFeignClient.areaMonthlyWithOperation(page, size,areaMonthly);
if (pageR.isSuccess()) {
log.info("获取操作详情数据成功");
return pageR.getData();
}
System.out.println(pageR.getMsg());
return null;
}
}

2
hzims-service/operational/src/main/resources/application-dev.yml

@ -4,6 +4,8 @@ server:
#数据源配置 #数据源配置
spring: spring:
main:
allow-bean-definition-overriding: true
profiles: profiles:
active: dev active: dev
#排除DruidDataSourceAutoConfigure #排除DruidDataSourceAutoConfigure

4
hzims-service/ticket/pom.xml

@ -168,10 +168,6 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
<dependency>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-dict-api</artifactId> <artifactId>blade-dict-api</artifactId>
</dependency> </dependency>

208
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/CodeGenerator.java

@ -1,104 +1,104 @@
package com.hnac.hzims.ticket.processflow; // package com.hnac.hzims.ticket.processflow;
//
import com.baomidou.mybatisplus.generator.AutoGenerator; // import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig; // import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.*; // import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; // import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
//
import java.util.ArrayList; // import java.util.ArrayList;
import java.util.List; // import java.util.List;
//
/** // /**
* 代码生成器 // * 代码生成器
* @Author dfy // * @Author dfy
* @Version v1.0 // * @Version v1.0
* @Serial 1.0 // * @Serial 1.0
* @Date 2023/3/29 8:59 // * @Date 2023/3/29 8:59
*/ // */
public class CodeGenerator { // public class CodeGenerator {
//
//
public static void main(String[] args) { // public static void main(String[] args) {
// 代码生成器 // // 代码生成器
AutoGenerator mpg = new AutoGenerator(); // AutoGenerator mpg = new AutoGenerator();
//
// 全局配置 // // 全局配置
GlobalConfig gc = new GlobalConfig(); // GlobalConfig gc = new GlobalConfig();
String projectPath = System.getProperty("user.dir") + "/hzims-service/ticket"; // String projectPath = System.getProperty("user.dir") + "/hzims-service/ticket";
gc.setOutputDir(projectPath + "/src/main/java"); // gc.setOutputDir(projectPath + "/src/main/java");
gc.setAuthor("dfy"); // gc.setAuthor("dfy");
gc.setOpen(false); // gc.setOpen(false);
// gc.setSwagger2(true); 实体属性 Swagger2 注解 // // gc.setSwagger2(true); 实体属性 Swagger2 注解
mpg.setGlobalConfig(gc); // mpg.setGlobalConfig(gc);
//
// 数据源配置 // // 数据源配置
DataSourceConfig dsc = new DataSourceConfig(); // DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://192.168.1.20:3576/dev_hzims_ticket?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true"); // dsc.setUrl("jdbc:mysql://192.168.1.20:3576/dev_hzims_ticket?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true");
// dsc.setSchemaName("public"); // // dsc.setSchemaName("public");
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // dsc.setDriverName("com.mysql.cj.jdbc.Driver");
dsc.setUsername("root"); // dsc.setUsername("root");
dsc.setPassword("123"); // dsc.setPassword("123");
mpg.setDataSource(dsc); // mpg.setDataSource(dsc);
//
// 包配置 // // 包配置
PackageConfig pc = new PackageConfig(); // PackageConfig pc = new PackageConfig();
pc.setModuleName("processflow"); // pc.setModuleName("processflow");
pc.setParent("com.hnac.hzims.ticket"); // pc.setParent("com.hnac.hzims.ticket");
mpg.setPackageInfo(pc); // mpg.setPackageInfo(pc);
//
// 自定义配置 // // 自定义配置
InjectionConfig cfg = new InjectionConfig() { // InjectionConfig cfg = new InjectionConfig() {
@Override // @Override
public void initMap() { // public void initMap() {
// to do nothing // // to do nothing
} // }
}; // };
//
// 如果模板引擎是 freemarker // // 如果模板引擎是 freemarker
String templatePath = "/templates/mapper.xml.ftl"; // String templatePath = "/templates/mapper.xml.ftl";
// 如果模板引擎是 velocity // // 如果模板引擎是 velocity
// String templatePath = "/templates/mapper.xml.vm"; // // String templatePath = "/templates/mapper.xml.vm";
//
// 自定义输出配置 // // 自定义输出配置
List<FileOutConfig> focList = new ArrayList<>(); // List<FileOutConfig> focList = new ArrayList<>();
cfg.setFileOutConfigList(focList); // cfg.setFileOutConfigList(focList);
mpg.setCfg(cfg); // mpg.setCfg(cfg);
//
// 配置模板 // // 配置模板
TemplateConfig templateConfig = new TemplateConfig(); // TemplateConfig templateConfig = new TemplateConfig();
//
// 配置自定义输出模板 // // 配置自定义输出模板
//指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别 // //指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别
// templateConfig.setEntity("templates/entity2.java"); // // templateConfig.setEntity("templates/entity2.java");
// templateConfig.setService(); // // templateConfig.setService();
// templateConfig.setController(); // // templateConfig.setController();
//
// templateConfig.setXml(null); // // templateConfig.setXml(null);
mpg.setTemplate(templateConfig); // mpg.setTemplate(templateConfig);
//
// 策略配置 // // 策略配置
StrategyConfig strategy = new StrategyConfig(); // StrategyConfig strategy = new StrategyConfig();
strategy.setNaming(NamingStrategy.underline_to_camel); // strategy.setNaming(NamingStrategy.underline_to_camel);
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // strategy.setColumnNaming(NamingStrategy.underline_to_camel);
// strategy.setSuperEntityClass("你自己的父类实体,没有就不用设置!"); // // strategy.setSuperEntityClass("你自己的父类实体,没有就不用设置!");
strategy.setEntityLombokModel(true); // strategy.setEntityLombokModel(true);
strategy.setRestControllerStyle(true); // strategy.setRestControllerStyle(true);
strategy.setEntityBooleanColumnRemoveIsPrefix(true); // strategy.setEntityBooleanColumnRemoveIsPrefix(true);
strategy.setEntityLombokModel(true); // strategy.setEntityLombokModel(true);
strategy.setEntitySerialVersionUID(true); // strategy.setEntitySerialVersionUID(true);
strategy.setChainModel(true); // strategy.setChainModel(true);
strategy.setEntityTableFieldAnnotationEnable(true); // strategy.setEntityTableFieldAnnotationEnable(true);
// strategy.setFieldPrefix("hzims_"); // // strategy.setFieldPrefix("hzims_");
// 公共父类 // // 公共父类
// strategy.setSuperControllerClass("你自己的父类控制器,没有就不用设置!"); // // strategy.setSuperControllerClass("你自己的父类控制器,没有就不用设置!");
// 写于父类中的公共字段 // // 写于父类中的公共字段
// strategy.setSuperEntityColumns("id"); // // strategy.setSuperEntityColumns("id");
strategy.setInclude("hzims_process_type"); // strategy.setInclude("hzims_process_type");
strategy.setControllerMappingHyphenStyle(true); // strategy.setControllerMappingHyphenStyle(true);
strategy.setTablePrefix("hzims_"); // strategy.setTablePrefix("hzims_");
mpg.setStrategy(strategy); // mpg.setStrategy(strategy);
// mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // // mpg.setTemplateEngine(new FreemarkerTemplateEngine());
mpg.execute(); // mpg.execute();
} // }
//
} // }

3
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/constant/TicketProcessConstant.java

@ -10,5 +10,6 @@ package com.hnac.hzims.ticket.processflow.constant;
*/ */
public class TicketProcessConstant { public class TicketProcessConstant {
public final static String STARTEVENT = "startEvent1"; // public final static String STARTEVENT = "startEvent1";
public final static String STARTEVENT = "newFirstWorkTicket";
} }

14
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/consumer/StandardWorkTicketConsumer.java

@ -44,19 +44,21 @@ public class StandardWorkTicketConsumer implements IQueueConsume {
WorkflowQueue ticker = new WorkflowQueue(); WorkflowQueue ticker = new WorkflowQueue();
ticker.setProcessDefinitionKey(taskDefinitionKey); ticker.setProcessDefinitionKey(taskDefinitionKey);
//判断执行具体的实现类 //判断执行具体的实现类
ProcessService ticketService = ticketServiceList.stream().filter(item -> item.isWorkflowProcess(ticker)) ProcessService ticketService = ticketServiceList.stream().filter(item -> item.isWorkflowProcess(ticker)).findFirst().orElse(null);
.findFirst().orElse(null);
if (ObjectUtils.isNotEmpty(ticketService)) { if (ObjectUtils.isNotEmpty(ticketService)) {
//执行业务方法 //执行业务方法
try { try {
ticketService.calculate(response); ticketService.calculate(response);
} catch (Exception e) { } catch (Exception e) {
//todo 业务出错误 做补偿 //todo 业务出错误 做补偿
log.error("业务出错,StandardWorkTicketConsumer: ", e); log.error("业务出错,StandardWorkTicketConsumer: {}", e.getMessage());
log.info("正在保存到hzims_workflow_operation_log...."); log.error("业务出错,StandardWorkTicketConsumer: {} ", response);
WorkflowOperationLog workflowOperationLog = new WorkflowOperationLog(); WorkflowOperationLog workflowOperationLog = new WorkflowOperationLog();
BeanUtils.copyProperties(response, workflowOperationLog); BeanUtils.copyProperties(response,workflowOperationLog);
workflowOperationLogService.save(workflowOperationLog); if (ObjectUtils.isNotEmpty(workflowOperationLog)) {
log.info("正在保存到hzims_workflow_operation_log.... :{}", workflowOperationLog);
workflowOperationLogService.save(workflowOperationLog);
}
} }
} }

10
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/entity/WorkflowOperationLog.java

@ -1,10 +1,8 @@
package com.hnac.hzims.ticket.processflow.entity; package com.hnac.hzims.ticket.processflow.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable; import java.io.Serializable;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -44,8 +42,8 @@ public class WorkflowOperationLog implements Serializable {
/** /**
* 当前环节流程ID * 当前环节流程ID
*/ */
@TableField("task_definition_key") @TableField("process_definition_key")
private String taskDefinitionKey; private String processDefinitionKey;
/** /**
* 实例key * 实例key

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/processflow/strategy/serviceimpl/MakeProcessServiceImpl.java

@ -43,7 +43,7 @@ public class MakeProcessServiceImpl extends ProcessAbstractService {
log.info("已执行开工作票流程环节操作~~~~"); log.info("已执行开工作票流程环节操作~~~~");
return true; return true;
} }
log.info("未是否执行开工作票流程环节操作,请联系管理员~~~~"); log.error("未是否执行开工作票流程环节操作,请联系管理员~~~~");
return false; return false;
} }

140
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java

@ -2,11 +2,15 @@ package com.hnac.hzims.ticket.standardTicket.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType; import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.ticket.areamonthly.StandardTicketVo;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto; import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity;
import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService; import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService;
import com.hnac.hzims.ticket.standardTicket.vo.StandardTicketInfoVO; import com.hnac.hzims.ticket.standardTicket.vo.StandardTicketInfoVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -20,6 +24,7 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.flow.core.vo.ComleteTask; import org.springblade.flow.core.vo.ComleteTask;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -30,76 +35,93 @@ import java.util.Map;
/** /**
* @author hx * @author hx
*/ */
@Api(value = "标准票管理",tags = "标准票管理") @Api(value = "标准票管理", tags = "标准票管理")
@RestController @RestController
@RequestMapping("/standard/ticket") @RequestMapping("/standard/ticket")
@AllArgsConstructor @AllArgsConstructor
@Slf4j @Slf4j
public class StandardTicketInfoController extends BladeController { public class StandardTicketInfoController extends BladeController {
private final IStandardTicketInfoService standardTicketInfoService; private final IStandardTicketInfoService standardTicketInfoService;
@PostMapping("/remove") @PostMapping("/remove")
@ApiOperationSupport(order = 10) @ApiOperationSupport(order = 10)
@ApiOperation(value = "逻辑删除") @ApiOperation(value = "逻辑删除")
public R remove(@RequestParam Long id,@RequestParam String comment) { public R remove(@RequestParam Long id, @RequestParam String comment) {
return standardTicketInfoService.remove(id,comment); return standardTicketInfoService.remove(id, comment);
} }
@PostMapping("/save") @PostMapping("/save")
@ApiOperationSupport(order = 20) @ApiOperationSupport(order = 20)
@ApiOperation(value = "新增") @ApiOperation(value = "新增")
public R save(@Valid @RequestBody StandardTicketInfoDto req) { public R save(@Valid @RequestBody StandardTicketInfoDto req) {
return standardTicketInfoService.doSave(req); return standardTicketInfoService.doSave(req);
} }
@PostMapping("/update") @PostMapping("/update")
@ApiOperationSupport(order = 30) @ApiOperationSupport(order = 30)
@ApiOperation(value = "修改") @ApiOperation(value = "修改")
public R update(@Valid @RequestBody StandardTicketInfoDto req) { public R update(@Valid @RequestBody StandardTicketInfoDto req) {
return R.status(standardTicketInfoService.updateById(req)); return R.status(standardTicketInfoService.updateById(req));
} }
@GetMapping("/detail") @GetMapping("/detail")
@ApiOperationSupport(order = 40) @ApiOperationSupport(order = 40)
@ApiOperation(value = "详情") @ApiOperation(value = "详情")
public R<StandardTicketInfoVO> detail(@RequestParam Long id) { public R<StandardTicketInfoVO> detail(@RequestParam Long id) {
return standardTicketInfoService.detail(id); return standardTicketInfoService.detail(id);
} }
@ApiLog @ApiLog
@PostMapping("/queryList") @PostMapping("/queryList")
@ApiOperationSupport(order = 50) @ApiOperationSupport(order = 50)
@ApiOperation(value = "分页") @ApiOperation(value = "分页")
@OperationAnnotation(moduleName = "两票管理",title = "操作票",operatorType = OperatorType.MOBILE,businessType = @OperationAnnotation(moduleName = "两票管理", title = "操作票", operatorType = OperatorType.MOBILE, businessType =
BusinessType.GENCODE, BusinessType.GENCODE,
action = "分页") action = "分页")
public R<IPage<StandardTicketInfoVO>> queryList(StandardTicketInfoDto req, Query query) { public R<IPage<StandardTicketInfoVO>> queryList(StandardTicketInfoDto req, Query query) {
return standardTicketInfoService.queryList(req, query); return standardTicketInfoService.queryList(req, query);
} }
@PostMapping("/list") @PostMapping("/list")
@ApiOperationSupport(order = 60) @ApiOperationSupport(order = 60)
@ApiOperation(value = "分页") @ApiOperation(value = "分页")
public R<List<StandardTicketInfoVO>> list(@RequestBody StandardTicketInfoDto req){ public R<List<StandardTicketInfoVO>> list(@RequestBody StandardTicketInfoDto req) {
return R.data(standardTicketInfoService.list(req)); return R.data(standardTicketInfoService.list(req));
} }
@GetMapping("/completeTask") @GetMapping("/completeTask")
@ApiOperationSupport(order = 70) @ApiOperationSupport(order = 70)
@ApiOperation(value = "操作票完成工作流") @ApiOperation(value = "操作票完成工作流")
public R completeTask(@RequestBody Map<String,Object> params){ public R completeTask(@RequestBody Map<String, Object> params) {
if(CollectionUtil.isEmpty(params) || ObjectUtil.isEmpty(params.get("info")) || ObjectUtil.isEmpty(params.get("flow"))){ if (CollectionUtil.isEmpty(params) || ObjectUtil.isEmpty(params.get("info")) || ObjectUtil.isEmpty(params.get("flow"))) {
return R.fail(400,"传参错误"); return R.fail(400, "传参错误");
} }
StandardTicketInfoDto infoDto = JSONObject.parseObject(JSONObject.toJSONString(params.get("info")),StandardTicketInfoDto.class); StandardTicketInfoDto infoDto = JSONObject.parseObject(JSONObject.toJSONString(params.get("info")), StandardTicketInfoDto.class);
ComleteTask comleteTask = JSONObject.parseObject(JSONObject.toJSONString(params.get("flow")),ComleteTask.class); ComleteTask comleteTask = JSONObject.parseObject(JSONObject.toJSONString(params.get("flow")), ComleteTask.class);
return standardTicketInfoService.completeTask(infoDto,comleteTask); return standardTicketInfoService.completeTask(infoDto, comleteTask);
} }
@GetMapping("/exportTicketPdf") @GetMapping("/exportTicketPdf")
@ApiOperationSupport(order = 80) @ApiOperationSupport(order = 80)
@ApiOperation(value = "导出操作票") @ApiOperation(value = "导出操作票")
public void exportTicketPdf(@RequestParam Long id, HttpServletResponse response){ public void exportTicketPdf(@RequestParam Long id, HttpServletResponse response) {
standardTicketInfoService.exportTicketPdf(id,response); standardTicketInfoService.exportTicketPdf(id, response);
} }
/**
* 根据月份区域 获取操作详情数据
*
* @return
*/
@GetMapping("/areaMonthlyWithOperation/{page}/{size}")
public R<IPage<StandardTicketVo>> areaMonthlyWithOperation(
@PathVariable("page") Long page,
@PathVariable("size") Long size,
@SpringQueryMap AreaMonthlyVo areaMonthlyVo) {
Page<StandardTicketInfoEntity> searchPage = new Page<>(page, size);
IPage<StandardTicketVo> standardTicketInfoEntity =
standardTicketInfoService.areaMonthlyWithOperation(areaMonthlyVo, searchPage);
return R.data(standardTicketInfoEntity);
}
} }

16
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java

@ -1,8 +1,11 @@
package com.hnac.hzims.ticket.standardTicket.service; package com.hnac.hzims.ticket.standardTicket.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO; import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO;
import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO;
import com.hnac.hzims.ticket.areamonthly.StandardTicketVo;
import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo;
import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto; import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity;
import com.hnac.hzims.ticket.standardTicket.vo.StandardTicketInfoVO; import com.hnac.hzims.ticket.standardTicket.vo.StandardTicketInfoVO;
@ -11,13 +14,10 @@ import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.flow.core.vo.ComleteTask; import org.springblade.flow.core.vo.ComleteTask;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author hx * @author hx
@ -97,4 +97,14 @@ public interface IStandardTicketInfoService extends BaseService<StandardTicketIn
* @return * @return
*/ */
R<TicketMonthVO> getOperateWorkStatistic(LocalDateTime firstDateTime,LocalDateTime endDateTime,List<Long> list); R<TicketMonthVO> getOperateWorkStatistic(LocalDateTime firstDateTime,LocalDateTime endDateTime,List<Long> list);
/**
* 根据区域Id 分页查询
* @param areaMonthly
* @param searchPage
* @return
*/
Page<StandardTicketVo> areaMonthlyWithOperation(AreaMonthlyVo areaMonthly, Page<StandardTicketInfoEntity> searchPage);
} }

965
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java

File diff suppressed because it is too large Load Diff

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

@ -5,10 +5,14 @@ import com.hnac.hzims.ticket.twoTicket.service.TicketProcessService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService; import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.flow.core.feign.IFlowClient; import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.flow.core.vo.TaskList;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -49,7 +53,23 @@ public class TicketProcessServiceImpl implements TicketProcessService {
// variables.put("task_id", taskId); // variables.put("task_id", taskId);
// variables.put("signUserIds", formData); // variables.put("signUserIds", formData);
// flowClient.startProcessInstanceContainNameByKey(processDefinitionKey,"workTicket:task:"+1,)
Map<String,Object> params = new HashMap<String, Object>(2) {{
put("taskId", "1644624168666353665");
put("signUserIds", AuthUtil.getUserId());
}};
flowClient.startProcessInstanceContainNameByKey(
processDefinitionKey,"workTicket:task:"+1,
"开启工作的任务",
params);
R<List<TaskList>> listR = flowClient.todoList(processDefinitionKey);
listR.getData().forEach(taskList -> {
System.out.println("任务名称:"+taskList);
System.out.println(taskList.getTaskName());
System.out.println(taskList.getStatus());
});
} }
} }

365
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClient.java

@ -14,7 +14,6 @@ import com.hnac.hzims.ticket.workTicket.service.IWorkTicketDelayService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService; import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketPrincipalChangeService; import com.hnac.hzims.ticket.workTicket.service.IWorkTicketPrincipalChangeService;
import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO; import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketReportStatisticVO;
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketStatisticVO; import com.hnac.hzims.ticket.workTicket.vo.WorkTicketStatisticVO;
import com.hnac.hzims.vo.SafeCheckStatisticVO; import com.hnac.hzims.vo.SafeCheckStatisticVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -47,192 +46,196 @@ import java.util.stream.Collectors;
@RequestMapping("/feign/workTicket/info") @RequestMapping("/feign/workTicket/info")
public class TicketInfoClient implements ITicketInfoClient { public class TicketInfoClient implements ITicketInfoClient {
private final IWorkTicketInfoService infoService; private final IWorkTicketInfoService infoService;
private final IStandardTicketInfoService standardService; private final IStandardTicketInfoService standardService;
private final IWorkTicketPrincipalChangeService transferService; private final IWorkTicketPrincipalChangeService transferService;
private final IFlowClient flowClient; private final IFlowClient flowClient;
private final IWorkTicketDelayService delayService; private final IWorkTicketDelayService delayService;
@Override @Override
@GetMapping("/updateUndoneStatus") @GetMapping("/updateUndoneStatus")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public R<Boolean> updateUndoneStatus(@RequestParam Long ticketId) { public R<Boolean> updateUndoneStatus(@RequestParam Long ticketId) {
log.info("--开始处理逾期完成的票据--"); log.info("--开始处理逾期完成的票据--");
WorkTicketInfoEntity entity = infoService.getById(ticketId); WorkTicketInfoEntity entity = infoService.getById(ticketId);
synchronized (entity) { synchronized (entity) {
entity.setId(ticketId); entity.setId(ticketId);
entity.setStatus(TicketConstants.FirstWorkTicketFlowStatusEnum.UNDONE.getStatus()); entity.setStatus(TicketConstants.FirstWorkTicketFlowStatusEnum.UNDONE.getStatus());
Boolean flag = infoService.updateById(entity); Boolean flag = infoService.updateById(entity);
//修改票据状态后需要终止工作流任务 //修改票据状态后需要终止工作流任务
if(StringUtil.isNotBlank(entity.getProcessInstanceId())){ if (StringUtil.isNotBlank(entity.getProcessInstanceId())) {
R result = flowClient.delProcessInstanceById(entity.getProcessInstanceId(),"检修任务已逾期,暂停两票工作流任务"); R result = flowClient.delProcessInstanceById(entity.getProcessInstanceId(), "检修任务已逾期,暂停两票工作流任务");
if(!result.isSuccess()){ if (!result.isSuccess()) {
throw new ServiceException(result.getMsg()); throw new ServiceException(result.getMsg());
} }
} }
return R.status(flag); return R.status(flag);
} }
} }
@Override @Override
@GetMapping("/getWorkTicketByTime") @GetMapping("/getWorkTicketByTime")
public R<List<WorkTicketInfoEntity>> getWorkTicketByTime(@RequestParam String startDate, @RequestParam String endDate) { public R<List<WorkTicketInfoEntity>> getWorkTicketByTime(@RequestParam String startDate, @RequestParam String endDate) {
List<WorkTicketInfoEntity> infoList = infoService.list(new LambdaQueryWrapper<WorkTicketInfoEntity>(){{ List<WorkTicketInfoEntity> infoList = infoService.list(new LambdaQueryWrapper<WorkTicketInfoEntity>() {{
ge(WorkTicketInfoEntity::getPlanStartTime,startDate); ge(WorkTicketInfoEntity::getPlanStartTime, startDate);
le(WorkTicketInfoEntity::getPlanStartTime,endDate); le(WorkTicketInfoEntity::getPlanStartTime, endDate);
}}); }});
return R.data(infoList); return R.data(infoList);
} }
@Override @Override
@GetMapping("/getOperateTicketByTime") @GetMapping("/getOperateTicketByTime")
public R<List<StandardTicketInfoEntity>> getOperateTicketByTime(@RequestParam String startDate, @RequestParam String endDate) { public R<List<StandardTicketInfoEntity>> getOperateTicketByTime(@RequestParam String startDate, @RequestParam String endDate) {
List<StandardTicketInfoEntity> infoList = standardService.list(new LambdaQueryWrapper<StandardTicketInfoEntity>(){{ List<StandardTicketInfoEntity> infoList = standardService.list(new LambdaQueryWrapper<StandardTicketInfoEntity>() {{
ge(StandardTicketInfoEntity::getStartTime,startDate); ge(StandardTicketInfoEntity::getStartTime, startDate);
le(StandardTicketInfoEntity::getStartTime,endDate); le(StandardTicketInfoEntity::getStartTime, endDate);
}}); }});
return R.data(infoList); return R.data(infoList);
} }
@Override @Override
@GetMapping("/getWorkTicketTransfer") @GetMapping("/getWorkTicketTransfer")
public R<List<WorkTicketPrincipalChangeEntity>> getWorkTicketTransfer(@RequestParam String startDate, @RequestParam String endDate) { public R<List<WorkTicketPrincipalChangeEntity>> getWorkTicketTransfer(@RequestParam String startDate, @RequestParam String endDate) {
List<WorkTicketInfoEntity> infoList = infoService.list(new LambdaQueryWrapper<WorkTicketInfoEntity>(){{ List<WorkTicketInfoEntity> infoList = infoService.list(new LambdaQueryWrapper<WorkTicketInfoEntity>() {{
ge(WorkTicketInfoEntity::getPlanStartTime,startDate); ge(WorkTicketInfoEntity::getPlanStartTime, startDate);
le(WorkTicketInfoEntity::getPlanStartTime,endDate); le(WorkTicketInfoEntity::getPlanStartTime, endDate);
}}); }});
if(CollectionUtil.isEmpty(infoList)){ if (CollectionUtil.isEmpty(infoList)) {
return R.data(Lists.newArrayList()); return R.data(Lists.newArrayList());
} }
List<Long> infoIdList = infoList.stream().map(WorkTicketInfoEntity::getId).collect(Collectors.toList()); List<Long> infoIdList = infoList.stream().map(WorkTicketInfoEntity::getId).collect(Collectors.toList());
List<WorkTicketPrincipalChangeEntity> moveList = transferService.list(new LambdaQueryWrapper<WorkTicketPrincipalChangeEntity>(){{ List<WorkTicketPrincipalChangeEntity> moveList = transferService.list(new LambdaQueryWrapper<WorkTicketPrincipalChangeEntity>() {{
in(WorkTicketPrincipalChangeEntity::getTicketId,infoIdList); in(WorkTicketPrincipalChangeEntity::getTicketId, infoIdList);
}}); }});
return R.data(moveList); return R.data(moveList);
} }
@Override @Override
@PostMapping("/getWorkTicketStatistic") @PostMapping("/getWorkTicketStatistic")
public R<WorkTicketStatisticVO> getWorkTicketStatistic(@RequestBody Map<String,Object> params) { public R<WorkTicketStatisticVO> getWorkTicketStatistic(@RequestBody Map<String, Object> params) {
String startDate = (String) params.get("startDate"); String startDate = (String) params.get("startDate");
String endDate = (String) params.get("endDate"); String endDate = (String) params.get("endDate");
List<Long> deptList = (List<Long>) params.get("deptList"); List<Long> deptList = (List<Long>) params.get("deptList");
log.info("开始main方法"); log.info("开始main方法");
WorkTicketStatisticVO workTicketStatisticVO = new WorkTicketStatisticVO(); WorkTicketStatisticVO workTicketStatisticVO = new WorkTicketStatisticVO();
List<WorkTicketInfoEntity> infoList = infoService.list(new LambdaQueryWrapper<WorkTicketInfoEntity>(){{ List<WorkTicketInfoEntity> infoList = infoService.list(new LambdaQueryWrapper<WorkTicketInfoEntity>() {{
ge(WorkTicketInfoEntity::getPlanStartTime,startDate); ge(WorkTicketInfoEntity::getPlanStartTime, startDate);
le(WorkTicketInfoEntity::getPlanStartTime,endDate); le(WorkTicketInfoEntity::getPlanStartTime, endDate);
in(WorkTicketInfoEntity::getCreateDept,deptList); in(WorkTicketInfoEntity::getCreateDept, deptList);
}}); }});
if(CollectionUtil.isNotEmpty(infoList)){ if (CollectionUtil.isNotEmpty(infoList)) {
List<Long> infoIdList = infoList.stream().map(WorkTicketInfoEntity::getId).collect(Collectors.toList()); List<Long> infoIdList = infoList.stream().map(WorkTicketInfoEntity::getId).collect(Collectors.toList());
workTicketStatisticVO.setTotal(infoList.size()); workTicketStatisticVO.setTotal(infoList.size());
//工作票作废 //工作票作废
List<WorkTicketInfoEntity> invalidList = infoList.stream().filter(w-> TicketConstants.FirstWorkTicketFlowStatusEnum.INVALID.getStatus().equals(w.getStatus())) List<WorkTicketInfoEntity> invalidList = infoList.stream().filter(w -> TicketConstants.FirstWorkTicketFlowStatusEnum.INVALID.getStatus().equals(w.getStatus()))
.collect(Collectors.toList()); .collect(Collectors.toList());
workTicketStatisticVO.setInvalid(CollectionUtil.isNotEmpty(invalidList) ? invalidList.size() : 0); workTicketStatisticVO.setInvalid(CollectionUtil.isNotEmpty(invalidList) ? invalidList.size() : 0);
// 工作票完成数 // 工作票完成数
List<WorkTicketInfoEntity> completeList = infoList.stream().filter(w-> TicketConstants.FirstWorkTicketFlowStatusEnum.FINISH.getStatus().equals(w.getStatus())) List<WorkTicketInfoEntity> completeList = infoList.stream().filter(w -> TicketConstants.FirstWorkTicketFlowStatusEnum.FINISH.getStatus().equals(w.getStatus()))
.collect(Collectors.toList()); .collect(Collectors.toList());
workTicketStatisticVO.setComplete(CollectionUtil.isNotEmpty(completeList) ? completeList.size() : 0); workTicketStatisticVO.setComplete(CollectionUtil.isNotEmpty(completeList) ? completeList.size() : 0);
//工作票移交 //工作票移交
FutureTask transferTask = new FutureTask(()->{ FutureTask transferTask = new FutureTask(() -> {
log.info("开始工作票移交"); log.info("开始工作票移交");
List<WorkTicketPrincipalChangeEntity> moveList = transferService.list(new LambdaQueryWrapper<WorkTicketPrincipalChangeEntity>(){{ List<WorkTicketPrincipalChangeEntity> moveList = transferService.list(new LambdaQueryWrapper<WorkTicketPrincipalChangeEntity>() {{
in(WorkTicketPrincipalChangeEntity::getTicketId,infoIdList); in(WorkTicketPrincipalChangeEntity::getTicketId, infoIdList);
}}); }});
return CollectionUtil.isNotEmpty(moveList) ? moveList.size() : 0; return CollectionUtil.isNotEmpty(moveList) ? moveList.size() : 0;
}); });
new Thread(transferTask,"工作票移交Thread").start(); new Thread(transferTask, "工作票移交Thread").start();
//工作票延期 //工作票延期
FutureTask delayTask = new FutureTask(()->{ FutureTask delayTask = new FutureTask(() -> {
log.info("开始工作票延期"); log.info("开始工作票延期");
List<WorkTicketDelayEntity> delayEntityList = delayService.list(Wrappers.<WorkTicketDelayEntity>lambdaQuery() List<WorkTicketDelayEntity> delayEntityList = delayService.list(Wrappers.<WorkTicketDelayEntity>lambdaQuery()
.in(WorkTicketDelayEntity::getTicketId,infoIdList) .in(WorkTicketDelayEntity::getTicketId, infoIdList)
); );
return CollectionUtil.isNotEmpty(delayEntityList) ? delayEntityList.size() : 0; return CollectionUtil.isNotEmpty(delayEntityList) ? delayEntityList.size() : 0;
}); });
new Thread(delayTask,"工作票延期Thread").start(); new Thread(delayTask, "工作票延期Thread").start();
try { try {
workTicketStatisticVO.setDelay((Integer) delayTask.get()); workTicketStatisticVO.setDelay((Integer) delayTask.get());
workTicketStatisticVO.setTransfer((Integer) transferTask.get()); workTicketStatisticVO.setTransfer((Integer) transferTask.get());
} catch (InterruptedException | ExecutionException e) { } catch (InterruptedException | ExecutionException e) {
e.printStackTrace(); e.printStackTrace();
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }
} }
return R.data(workTicketStatisticVO); return R.data(workTicketStatisticVO);
} }
/** /**
* 获取首页操作票统计结果 * 获取首页操作票统计结果
* @param params *
* @return * @param params
*/ * @return
@Override */
@PostMapping("/getOperateTicketStatistic") @Override
public R<Integer> getOperateTicketStatistic(@RequestBody Map<String, Object> params) { @PostMapping("/getOperateTicketStatistic")
String startDate = (String) params.get("startDate"); public R<Integer> getOperateTicketStatistic(@RequestBody Map<String, Object> params) {
String endDate = (String) params.get("endDate"); String startDate = (String) params.get("startDate");
List<Long> deptList = (List<Long>) params.get("deptList"); String endDate = (String) params.get("endDate");
List<StandardTicketInfoEntity> standardTicketList = standardService.list(new LambdaQueryWrapper<StandardTicketInfoEntity>(){{ List<Long> deptList = (List<Long>) params.get("deptList");
ge(StandardTicketInfoEntity::getStartTime,startDate); List<StandardTicketInfoEntity> standardTicketList = standardService.list(new LambdaQueryWrapper<StandardTicketInfoEntity>() {{
le(StandardTicketInfoEntity::getStartTime,endDate); ge(StandardTicketInfoEntity::getStartTime, startDate);
in(StandardTicketInfoEntity::getCreateDept,deptList); le(StandardTicketInfoEntity::getStartTime, endDate);
}}); in(StandardTicketInfoEntity::getCreateDept, deptList);
if(CollectionUtil.isEmpty(standardTicketList)){ }});
return R.data(0); if (CollectionUtil.isEmpty(standardTicketList)) {
} return R.data(0);
return R.data(standardTicketList.size()); }
} return R.data(standardTicketList.size());
}
/** /**
* 获取首页月工作票,操作票统计结果 * 获取首页月工作票,操作票统计结果
* @param params *
* @return * @param params
*/ * @return
@Override */
@PostMapping("/getOperateWorkStatistic") @Override
public R<TicketMonthVO> getOperateWorkStatistic(@RequestBody Map<String, Object> params) { @PostMapping("/getOperateWorkStatistic")
try{ public R<TicketMonthVO> getOperateWorkStatistic(@RequestBody Map<String, Object> params) {
SimpleDateFormat sdf = new SimpleDateFormat(DateUtil.PATTERN_DATETIME); try {
Date startDate = sdf.parse((String) params.get("startDate")); SimpleDateFormat sdf = new SimpleDateFormat(DateUtil.PATTERN_DATETIME);
Date endDate = sdf.parse((String) params.get("endDate")); Date startDate = sdf.parse((String) params.get("startDate"));
DateTimeFormatter df = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME); Date endDate = sdf.parse((String) params.get("endDate"));
LocalDateTime firstDateTime = LocalDateTime.parse(DateUtil.format(startDate,DateUtil.PATTERN_DATETIME),df); DateTimeFormatter df = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME);
LocalDateTime endDateTime = LocalDateTime.parse(DateUtil.format(endDate,DateUtil.PATTERN_DATETIME),df); LocalDateTime firstDateTime = LocalDateTime.parse(DateUtil.format(startDate, DateUtil.PATTERN_DATETIME), df);
List<Long> list = (List<Long>) params.get("deptList"); LocalDateTime endDateTime = LocalDateTime.parse(DateUtil.format(endDate, DateUtil.PATTERN_DATETIME), df);
return standardService.getOperateWorkStatistic(firstDateTime,endDateTime,list); List<Long> list = (List<Long>) params.get("deptList");
}catch (ParseException e){ return standardService.getOperateWorkStatistic(firstDateTime, endDateTime, list);
return R.fail("获取失败"); } catch (ParseException e) {
} return R.fail("获取失败");
} }
}
/**
* 安全检查工作票事项统计
*
* @param startDate 开始时间
* @param endDate 结束时间
* @param dept 机构ID
* @return WorkTicketStatisticVO统计对象
*/
@Override
@GetMapping("/getWorkTicketCheck")
public R<SafeCheckStatisticVO> getWorkTicketCheck(@RequestParam(value = "startDate") String startDate,
@RequestParam(value = "endDate") String endDate,
@RequestParam(value = "dept") Long dept) {
SafeCheckStatisticVO vo = infoService.getWorkTicketStatistic(startDate, endDate, dept);
if (vo == null) {
vo = new SafeCheckStatisticVO();
}
vo.setProjectType(Constants.SafeCheckProjectEnum.WORK_TICKET.getType());
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.WORK_TICKET.getName());
//计算合格率
if (ObjectUtil.isNotEmpty(vo.getTotal()) && vo.getTotal() != 0) {
double qualifiedRate = new BigDecimal(
vo.getQualified() / (double) vo.getTotal() * 100
).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
vo.setQualifiedRate(qualifiedRate);
}
return R.data(vo);
}
/**
* 安全检查工作票事项统计
* @param startDate 开始时间
* @param endDate 结束时间
* @param dept 机构ID
* @return WorkTicketStatisticVO统计对象
*/
@Override
@GetMapping("/getWorkTicketCheck")
public R<SafeCheckStatisticVO> getWorkTicketCheck(@RequestParam(value = "startDate") String startDate,
@RequestParam(value = "endDate") String endDate,
@RequestParam(value = "dept") Long dept){
SafeCheckStatisticVO vo = infoService.getWorkTicketStatistic(startDate,endDate,dept);
if(vo == null){
vo = new SafeCheckStatisticVO();
}
vo.setProjectType(Constants.SafeCheckProjectEnum.WORK_TICKET.getType());
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.WORK_TICKET.getName());
//计算合格率
if(ObjectUtil.isNotEmpty(vo.getTotal()) && vo.getTotal() != 0){
double qualifiedRate = new BigDecimal(
vo.getQualified() / (double) vo.getTotal() * 100
).setScale(2 , BigDecimal.ROUND_HALF_UP).doubleValue();
vo.setQualifiedRate(qualifiedRate);
}
return R.data(vo);
}
} }

Loading…
Cancel
Save