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. 12
      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. 48
      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. 299
      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. 95
      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";
} }

12
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);
if (ObjectUtils.isNotEmpty(workflowOperationLog)) {
log.info("正在保存到hzims_workflow_operation_log.... :{}", workflowOperationLog);
workflowOperationLogService.save(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;
} }

48
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,7 +35,7 @@ import java.util.Map;
/** /**
* @author hx * @author hx
*/ */
@Api(value = "标准票管理",tags = "标准票管理") @Api(value = "标准票管理", tags = "标准票管理")
@RestController @RestController
@RequestMapping("/standard/ticket") @RequestMapping("/standard/ticket")
@AllArgsConstructor @AllArgsConstructor
@ -41,8 +46,8 @@ public class StandardTicketInfoController extends BladeController {
@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")
@ -70,7 +75,7 @@ public class StandardTicketInfoController extends BladeController {
@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) {
@ -80,26 +85,43 @@ public class StandardTicketInfoController extends BladeController {
@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);
} }

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

@ -2,14 +2,17 @@ package com.hnac.hzims.ticket.standardTicket.service.impl;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService; import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO; import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassVO; import com.hnac.hzims.ticket.allTicket.vo.DoublePassVO;
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.constants.TicketConstants; import com.hnac.hzims.ticket.constants.TicketConstants;
import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto; import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto;
import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketMeasureDto; import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketMeasureDto;
@ -33,7 +36,6 @@ import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; 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.DateUtil; import org.springblade.core.tool.utils.DateUtil;
@ -41,6 +43,7 @@ import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.flow.core.feign.IFlowClient; import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.flow.core.vo.ComleteTask; import org.springblade.flow.core.vo.ComleteTask;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -48,9 +51,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.YearMonth; import java.time.YearMonth;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters; import java.time.temporal.TemporalAdjusters;
@ -88,8 +89,8 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
@Override @Override
public R<StandardTicketInfoVO> detail(Long id) { public R<StandardTicketInfoVO> detail(Long id) {
StandardTicketInfoEntity standardTicketInfoEntity = this.getById(id); StandardTicketInfoEntity standardTicketInfoEntity = this.getById(id);
if(ObjectUtil.isEmpty(standardTicketInfoEntity)){ if (ObjectUtil.isEmpty(standardTicketInfoEntity)) {
return R.fail(400,"未查询到相关记录"); return R.fail(400, "未查询到相关记录");
} }
StandardTicketInfoVO standardTicketInfoVO = StandardTicketInfoWrapper.build().entityVO(standardTicketInfoEntity); StandardTicketInfoVO standardTicketInfoVO = StandardTicketInfoWrapper.build().entityVO(standardTicketInfoEntity);
/**完善安全措施执行情况列表**/ /**完善安全措施执行情况列表**/
@ -104,7 +105,7 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
public R<IPage<StandardTicketInfoVO>> queryList(StandardTicketInfoDto req, Query query) { public R<IPage<StandardTicketInfoVO>> queryList(StandardTicketInfoDto req, Query query) {
LambdaQueryWrapper<StandardTicketInfoEntity> queryWrapper = this.getQueryWrapper(req); LambdaQueryWrapper<StandardTicketInfoEntity> queryWrapper = this.getQueryWrapper(req);
queryWrapper.orderByDesc(StandardTicketInfoEntity::getCreateTime); queryWrapper.orderByDesc(StandardTicketInfoEntity::getCreateTime);
IPage pages = super.page(Condition.getPage(query),queryWrapper); IPage pages = super.page(Condition.getPage(query), queryWrapper);
return R.data(pages.setRecords(StandardTicketInfoWrapper.build().listVO(pages.getRecords()))); return R.data(pages.setRecords(StandardTicketInfoWrapper.build().listVO(pages.getRecords())));
} }
@ -117,42 +118,42 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
@Override @Override
@Transactional @Transactional
public R doSave(StandardTicketInfoDto req) { public R doSave(StandardTicketInfoDto req) {
if(CollectionUtil.isEmpty(req.getWorkTicketSafetyMeasureDtoList())){ if (CollectionUtil.isEmpty(req.getWorkTicketSafetyMeasureDtoList())) {
return R.fail("请选择对应的安全措施"); return R.fail("请选择对应的安全措施");
} }
req.setCode(this.getOperateTicketCode()); req.setCode(this.getOperateTicketCode());
req.setIssueOrderTime(LocalDateTime.now()); req.setIssueOrderTime(LocalDateTime.now());
req.setStatus(TicketConstants.StandardTicketStatusEnum.GUARDIAN_CONFIRM.getStatus()); req.setStatus(TicketConstants.StandardTicketStatusEnum.GUARDIAN_CONFIRM.getStatus());
boolean flag = this.save(req); boolean flag = this.save(req);
if(!flag){ if (!flag) {
return R.fail("保存标准票失败!"); return R.fail("保存标准票失败!");
} }
req.getWorkTicketSafetyMeasureDtoList().forEach(standardTicketMeasureEntity -> { req.getWorkTicketSafetyMeasureDtoList().forEach(standardTicketMeasureEntity -> {
standardTicketMeasureEntity.setTicketId(req.getId()); standardTicketMeasureEntity.setTicketId(req.getId());
}); });
boolean measureFlag = measureService.saveOrUpdateBatch(req.getWorkTicketSafetyMeasureDtoList()); boolean measureFlag = measureService.saveOrUpdateBatch(req.getWorkTicketSafetyMeasureDtoList());
if(!measureFlag){ if (!measureFlag) {
return R.fail(400,"保存安全措施失败"); return R.fail(400, "保存安全措施失败");
} }
/*开启工作流*/ /*开启工作流*/
String processInstanceId = this.startProcessInstance(standardFlowKey,req); String processInstanceId = this.startProcessInstance(standardFlowKey, req);
return R.status(this.update( return R.status(this.update(
Wrappers.<StandardTicketInfoEntity>lambdaUpdate() Wrappers.<StandardTicketInfoEntity>lambdaUpdate()
.set(StandardTicketInfoEntity::getProcessInstanceId,processInstanceId) .set(StandardTicketInfoEntity::getProcessInstanceId, processInstanceId)
.eq(StandardTicketInfoEntity::getId,req.getId()) .eq(StandardTicketInfoEntity::getId, req.getId())
)); ));
} }
@Override @Override
public R completeTask(StandardTicketInfoDto infoDto, ComleteTask comleteTask) { public R completeTask(StandardTicketInfoDto infoDto, ComleteTask comleteTask) {
/**若完成待监护人确认则设置监护人确认时间**/ /**若完成待监护人确认则设置监护人确认时间**/
if(TicketConstants.StandardTicketStatusEnum.PRINCIPAL_CONFIRM.getStatus().equals(infoDto.getStatus())){ if (TicketConstants.StandardTicketStatusEnum.PRINCIPAL_CONFIRM.getStatus().equals(infoDto.getStatus())) {
infoDto.setGuardianshipTime(LocalDateTime.now()); infoDto.setGuardianshipTime(LocalDateTime.now());
infoDto.setPrincipalTime(LocalDateTime.now()); infoDto.setPrincipalTime(LocalDateTime.now());
this.updateById(infoDto); this.updateById(infoDto);
} }
/**若完成工作负责人确认则设置工作负责人确认时间**/ /**若完成工作负责人确认则设置工作负责人确认时间**/
else if(TicketConstants.StandardTicketStatusEnum.END.getStatus().equals(infoDto.getStatus())){ else if (TicketConstants.StandardTicketStatusEnum.END.getStatus().equals(infoDto.getStatus())) {
infoDto.setPrincipalTime(LocalDateTime.now()); infoDto.setPrincipalTime(LocalDateTime.now());
this.updateById(infoDto); this.updateById(infoDto);
//操作票设置默认为合格 //操作票设置默认为合格
@ -161,38 +162,37 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
ticketInfoEvaluateService.save(evaluateEntity); ticketInfoEvaluateService.save(evaluateEntity);
} }
R completeR = flowClient.completeTask(comleteTask); R completeR = flowClient.completeTask(comleteTask);
if(completeR.isSuccess()){ if (completeR.isSuccess()) {
throw new ServiceException(completeR.getMsg()); throw new ServiceException(completeR.getMsg());
} }
return R.success("操作成功!"); return R.success("操作成功!");
} }
@Override @Override
public void exportTicketPdf(Long id, HttpServletResponse response){ public void exportTicketPdf(Long id, HttpServletResponse response) {
R<StandardTicketInfoVO> voR = this.detail(id); R<StandardTicketInfoVO> voR = this.detail(id);
if(!voR.isSuccess()){ if (!voR.isSuccess()) {
throw new ServiceException(voR.getMsg()); throw new ServiceException(voR.getMsg());
} }
StandardTicketInfoVO infoVO = voR.getData(); StandardTicketInfoVO infoVO = voR.getData();
Map<String,Object> ticketInfoMap = new HashMap<>(); Map<String, Object> ticketInfoMap = new HashMap<>();
try { try {
ticketInfoMap = PdfUtils.objectToMap(infoVO); ticketInfoMap = PdfUtils.objectToMap(infoVO);
} } catch (Exception e) {
catch (Exception e) {
log.info("转换对象失败!"); log.info("转换对象失败!");
} }
/**格式化时间**/ /**格式化时间**/
ticketInfoMap.put("startTime",DateUtil.format(infoVO.getStartTime(),TicketConstants.TICKET_DATE_PATTERN)); ticketInfoMap.put("startTime", DateUtil.format(infoVO.getStartTime(), TicketConstants.TICKET_DATE_PATTERN));
ticketInfoMap.put("endTime",DateUtil.format(infoVO.getEndTime(),TicketConstants.TICKET_DATE_PATTERN)); ticketInfoMap.put("endTime", DateUtil.format(infoVO.getEndTime(), TicketConstants.TICKET_DATE_PATTERN));
ticketInfoMap.put("issueOrderTime",DateUtil.format(infoVO.getIssueOrderTime(),TicketConstants.TICKET_DATE_PATTERN)); ticketInfoMap.put("issueOrderTime", DateUtil.format(infoVO.getIssueOrderTime(), TicketConstants.TICKET_DATE_PATTERN));
List<StandardTicketMeasureVO> measureVOList = infoVO.getStandardTicketMeasureVOList(); List<StandardTicketMeasureVO> measureVOList = infoVO.getStandardTicketMeasureVOList();
AtomicInteger index = new AtomicInteger(1); AtomicInteger index = new AtomicInteger(1);
if(CollectionUtil.isNotEmpty(measureVOList)){ if (CollectionUtil.isNotEmpty(measureVOList)) {
List<Map<String,Object>> measureMapList = measureVOList.stream().map(measure->{ List<Map<String, Object>> measureMapList = measureVOList.stream().map(measure -> {
try { try {
Map<String,Object> map = PdfUtils.objectToMap(measure); Map<String, Object> map = PdfUtils.objectToMap(measure);
map.put("index",index.get()); map.put("index", index.get());
map.put("status",TicketConstants.MATTER_FINISH_STATUS.equals(measure.getStatus()) ? "√" : ""); map.put("status", TicketConstants.MATTER_FINISH_STATUS.equals(measure.getStatus()) ? "√" : "");
index.getAndIncrement(); index.getAndIncrement();
return map; return map;
} catch (Exception e) { } catch (Exception e) {
@ -200,30 +200,30 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
return null; return null;
} }
}).collect(Collectors.toList()); }).collect(Collectors.toList());
ticketInfoMap.put("measureMapList",measureMapList); ticketInfoMap.put("measureMapList", measureMapList);
} }
//ticketInfoMap.put("stamp_image",stampImageUrl); //ticketInfoMap.put("stamp_image",stampImageUrl);
String fileName = TicketConstants.WordFileNameEnum.getFileNameByType(infoVO.getTicketType()) + PdfUtils.XLSX_SUFFIX; String fileName = TicketConstants.WordFileNameEnum.getFileNameByType(infoVO.getTicketType()) + PdfUtils.XLSX_SUFFIX;
TemplateExportParams templateExportParams = new TemplateExportParams("template/" + fileName, true); TemplateExportParams templateExportParams = new TemplateExportParams("template/" + fileName, true);
Workbook workbook = null; Workbook workbook = null;
try { try {
workbook = ExcelUtil.getWorkbook(templateExportParams,ticketInfoMap); workbook = ExcelUtil.getWorkbook(templateExportParams, ticketInfoMap);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
//上传xlsx至服务器 //上传xlsx至服务器
try { try {
ExcelUtil.upload(workbook,xlsSavePath,infoVO.getTitle()+PdfUtils.XLSX_SUFFIX); ExcelUtil.upload(workbook, xlsSavePath, infoVO.getTitle() + PdfUtils.XLSX_SUFFIX);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
//将xlsx文件转换为pdf并保存 //将xlsx文件转换为pdf并保存
String pdfFileName = infoVO.getTitle() + PdfUtils.PDF_SUFFIX; String pdfFileName = infoVO.getTitle() + PdfUtils.PDF_SUFFIX;
String xlsFileName = infoVO.getTitle()+PdfUtils.XLSX_SUFFIX; String xlsFileName = infoVO.getTitle() + PdfUtils.XLSX_SUFFIX;
PdfUtils.convertPdf(xlsSavePath, xlsFileName, pdfSavePath, pdfFileName); PdfUtils.convertPdf(xlsSavePath, xlsFileName, pdfSavePath, pdfFileName);
String savePath = pdfSavePath + pdfFileName; String savePath = pdfSavePath + pdfFileName;
// 设置response参数,可以打开下载页面 // 设置response参数,可以打开下载页面
PdfUtils.readPdf(response,savePath); PdfUtils.readPdf(response, savePath);
//WordUtils.exportWord(wordTemplatePath, ticketInfoMap,"大隆水电站倒闸操作票模板",response); //WordUtils.exportWord(wordTemplatePath, ticketInfoMap,"大隆水电站倒闸操作票模板",response);
} }
@ -231,18 +231,18 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
@Transactional @Transactional
public R remove(Long id, String comment) { public R remove(Long id, String comment) {
StandardTicketInfoEntity ticketInfoEntity = this.getById(id); StandardTicketInfoEntity ticketInfoEntity = this.getById(id);
if(ObjectUtil.isEmpty(ticketInfoEntity)){ if (ObjectUtil.isEmpty(ticketInfoEntity)) {
return R.fail(400,"未查找到该记录对应的操作票"); return R.fail(400, "未查找到该记录对应的操作票");
} }
if(Func.isEmpty(ticketInfoEntity.getProcessInstanceId())){ if (Func.isEmpty(ticketInfoEntity.getProcessInstanceId())) {
return R.fail("该操作票未开启工作流"); return R.fail("该操作票未开启工作流");
} }
this.update(Wrappers.<StandardTicketInfoEntity>lambdaUpdate() this.update(Wrappers.<StandardTicketInfoEntity>lambdaUpdate()
.set(StandardTicketInfoEntity::getStatus,TicketConstants.StandardTicketStatusEnum.TERMINATION.getStatus()) .set(StandardTicketInfoEntity::getStatus, TicketConstants.StandardTicketStatusEnum.TERMINATION.getStatus())
.eq(StandardTicketInfoEntity::getId,id)); .eq(StandardTicketInfoEntity::getId, id));
/**删除工作流**/ /**删除工作流**/
R r = flowClient.delProcessInstanceById(ticketInfoEntity.getProcessInstanceId(),comment); R r = flowClient.delProcessInstanceById(ticketInfoEntity.getProcessInstanceId(), comment);
if(!r.isSuccess()){ if (!r.isSuccess()) {
throw new ServiceException(r.getMsg()); throw new ServiceException(r.getMsg());
} }
return R.success("删除成功!"); return R.success("删除成功!");
@ -251,6 +251,7 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
/** /**
* 获取双票合格率 * 获取双票合格率
*
* @param depatList * @param depatList
* @param firstDateTime * @param firstDateTime
* @param now * @param now
@ -260,18 +261,18 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
public DoublePassRateVO getDoublePassRate(List<Long> depatList, LocalDateTime firstDateTime, LocalDateTime now) { public DoublePassRateVO getDoublePassRate(List<Long> depatList, LocalDateTime firstDateTime, LocalDateTime now) {
DoublePassRateVO doublePassRateVO = new DoublePassRateVO(); DoublePassRateVO doublePassRateVO = new DoublePassRateVO();
// 查询操作票 // 查询操作票
List<StandardTicketInfoEntity> standardList = this.list(new LambdaQueryWrapper<StandardTicketInfoEntity>(){{ List<StandardTicketInfoEntity> standardList = this.list(new LambdaQueryWrapper<StandardTicketInfoEntity>() {{
ge(StandardTicketInfoEntity::getCreateTime,firstDateTime); ge(StandardTicketInfoEntity::getCreateTime, firstDateTime);
le(StandardTicketInfoEntity::getCreateTime,now); le(StandardTicketInfoEntity::getCreateTime, now);
in(StandardTicketInfoEntity::getCreateDept,depatList); in(StandardTicketInfoEntity::getCreateDept, depatList);
}}); }});
// 查询工作票 // 查询工作票
List<WorkTicketInfoEntity> workList = iWorkTicketInfoService.list(new LambdaQueryWrapper<WorkTicketInfoEntity>(){{ List<WorkTicketInfoEntity> workList = iWorkTicketInfoService.list(new LambdaQueryWrapper<WorkTicketInfoEntity>() {{
ge(WorkTicketInfoEntity::getCreateTime,firstDateTime); ge(WorkTicketInfoEntity::getCreateTime, firstDateTime);
le(WorkTicketInfoEntity::getCreateTime,now); le(WorkTicketInfoEntity::getCreateTime, now);
in(WorkTicketInfoEntity::getCreateDept,depatList); in(WorkTicketInfoEntity::getCreateDept, depatList);
}}); }});
if(CollectionUtil.isEmpty(standardList) && CollectionUtil.isEmpty(workList)){ if (CollectionUtil.isEmpty(standardList) && CollectionUtil.isEmpty(workList)) {
doublePassRateVO.setDoubleTicketCount(0); doublePassRateVO.setDoubleTicketCount(0);
doublePassRateVO.setDoubleTicketPassCount(0); doublePassRateVO.setDoubleTicketPassCount(0);
doublePassRateVO.setDoublePassRate("0"); doublePassRateVO.setDoublePassRate("0");
@ -282,13 +283,13 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
standardIdList.addAll(workList.stream().map(WorkTicketInfoEntity::getId).collect(Collectors.toList())); standardIdList.addAll(workList.stream().map(WorkTicketInfoEntity::getId).collect(Collectors.toList()));
doublePassRateVO.setDoubleTicketCount(standardIdList.size()); doublePassRateVO.setDoubleTicketCount(standardIdList.size());
// 查询合格评价 // 查询合格评价
List<TicketInfoEvaluateEntity> evaluateList = ticketInfoEvaluateService.list(new LambdaQueryWrapper<TicketInfoEvaluateEntity>(){{ List<TicketInfoEvaluateEntity> evaluateList = ticketInfoEvaluateService.list(new LambdaQueryWrapper<TicketInfoEvaluateEntity>() {{
ge(TicketInfoEvaluateEntity::getCreateTime,firstDateTime); ge(TicketInfoEvaluateEntity::getCreateTime, firstDateTime);
le(TicketInfoEvaluateEntity::getCreateTime,now); le(TicketInfoEvaluateEntity::getCreateTime, now);
in(TicketInfoEvaluateEntity::getTicketId,standardIdList); in(TicketInfoEvaluateEntity::getTicketId, standardIdList);
eq(TicketInfoEvaluateEntity::getStatus,TicketConstants.TicketQualifiedEnum.Qualified.getCode()); eq(TicketInfoEvaluateEntity::getStatus, TicketConstants.TicketQualifiedEnum.Qualified.getCode());
}}); }});
if(CollectionUtil.isEmpty(evaluateList)){ if (CollectionUtil.isEmpty(evaluateList)) {
doublePassRateVO.setDoubleTicketPassCount(0); doublePassRateVO.setDoubleTicketPassCount(0);
doublePassRateVO.setDoublePassRate("0"); doublePassRateVO.setDoublePassRate("0");
return doublePassRateVO; return doublePassRateVO;
@ -301,33 +302,66 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
/** /**
* 获取首页区域当月操作票/工作票 * 获取首页区域当月操作票/工作票
*
* @param list * @param list
* @return * @return
*/ */
@Override @Override
public R<TicketMonthVO> getOperateWorkStatistic(LocalDateTime firstDateTime,LocalDateTime endDateTime,List<Long> list) { public R<TicketMonthVO> getOperateWorkStatistic(LocalDateTime firstDateTime, LocalDateTime endDateTime, List<Long> list) {
TicketMonthVO ticketMonthVO = new TicketMonthVO(); TicketMonthVO ticketMonthVO = new TicketMonthVO();
// 查询操作票 // 查询操作票
getOperateMoth(firstDateTime,endDateTime,list,ticketMonthVO); getOperateMoth(firstDateTime, endDateTime, list, ticketMonthVO);
// 查询工作票 // 查询工作票
getWorkMoth(firstDateTime,endDateTime,list,ticketMonthVO); getWorkMoth(firstDateTime, endDateTime, list, ticketMonthVO);
return R.data(ticketMonthVO); return R.data(ticketMonthVO);
} }
/** /**
* 根据区域Id 分页查询
*
* @param areaMonthly
* @param searchPage
* @return
*/
@Override
public Page<StandardTicketVo> areaMonthlyWithOperation(AreaMonthlyVo areaMonthly, Page<StandardTicketInfoEntity> searchPage) {
QueryWrapper<StandardTicketInfoEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("CREATE_DEPT", areaMonthly.getAreaId());
queryWrapper.eq(areaMonthly.getYearMonth() != null,
"date_format(create_time,'%Y-%m')", areaMonthly.getYearMonth());
Page<StandardTicketInfoEntity> standardTicketInfoEntityPage = baseMapper.selectPage(searchPage, queryWrapper);
//数据转换StandardTicketInfoEntity ==> StandardTicketVo
List<StandardTicketVo> standardTicketInfoVOList = new ArrayList<>();
if (CollectionUtil.isNotEmpty(standardTicketInfoEntityPage.getRecords())) {
standardTicketInfoVOList = standardTicketInfoEntityPage.getRecords().stream().map(item -> {
StandardTicketVo standardTicketVo = new StandardTicketVo();
BeanUtils.copyProperties(item, standardTicketVo);
return standardTicketVo;
}).collect(Collectors.toList());
}
Page<StandardTicketVo> page = new Page<>();
page.setSize(standardTicketInfoEntityPage.getSize());
page.setCurrent(standardTicketInfoEntityPage.getCurrent());
page.setTotal(standardTicketInfoEntityPage.getTotal());
page.setRecords(standardTicketInfoVOList);
return page;
}
/**
* 首页-当月操作票获取 * 首页-当月操作票获取
*
* @param firstDateTime * @param firstDateTime
* @param endDateTime * @param endDateTime
* @param list * @param list
* @param ticketMonthVO * @param ticketMonthVO
*/ */
private void getOperateMoth(LocalDateTime firstDateTime, LocalDateTime endDateTime, List<Long> list, TicketMonthVO ticketMonthVO) { private void getOperateMoth(LocalDateTime firstDateTime, LocalDateTime endDateTime, List<Long> list, TicketMonthVO ticketMonthVO) {
List<StandardTicketInfoEntity> operateList = this.list(new LambdaQueryWrapper<StandardTicketInfoEntity>(){{ List<StandardTicketInfoEntity> operateList = this.list(new LambdaQueryWrapper<StandardTicketInfoEntity>() {{
ge(StandardTicketInfoEntity::getCreateTime,firstDateTime); ge(StandardTicketInfoEntity::getCreateTime, firstDateTime);
le(StandardTicketInfoEntity::getCreateTime,endDateTime); le(StandardTicketInfoEntity::getCreateTime, endDateTime);
in(StandardTicketInfoEntity::getCreateDept,list); in(StandardTicketInfoEntity::getCreateDept, list);
}}); }});
if(CollectionUtil.isEmpty(operateList)){ if (CollectionUtil.isEmpty(operateList)) {
ticketMonthVO.setOperate(0); ticketMonthVO.setOperate(0);
ticketMonthVO.setOperateQualify(0); ticketMonthVO.setOperateQualify(0);
return; return;
@ -335,11 +369,11 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
ticketMonthVO.setOperate(operateList.size()); ticketMonthVO.setOperate(operateList.size());
List<Long> operateIdList = operateList.stream().map(StandardTicketInfoEntity::getId).collect(Collectors.toList()); List<Long> operateIdList = operateList.stream().map(StandardTicketInfoEntity::getId).collect(Collectors.toList());
// 查询合格评价 // 查询合格评价
List<TicketInfoEvaluateEntity> operateQualifyList = ticketInfoEvaluateService.list(new LambdaQueryWrapper<TicketInfoEvaluateEntity>(){{ List<TicketInfoEvaluateEntity> operateQualifyList = ticketInfoEvaluateService.list(new LambdaQueryWrapper<TicketInfoEvaluateEntity>() {{
in(TicketInfoEvaluateEntity::getTicketId,operateIdList); in(TicketInfoEvaluateEntity::getTicketId, operateIdList);
eq(TicketInfoEvaluateEntity::getStatus,TicketConstants.TicketQualifiedEnum.Qualified.getCode()); eq(TicketInfoEvaluateEntity::getStatus, TicketConstants.TicketQualifiedEnum.Qualified.getCode());
}}); }});
if(CollectionUtil.isEmpty(operateQualifyList)){ if (CollectionUtil.isEmpty(operateQualifyList)) {
ticketMonthVO.setOperateQualify(0); ticketMonthVO.setOperateQualify(0);
return; return;
} }
@ -348,16 +382,17 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
/** /**
* 首页-当月工作票获取 * 首页-当月工作票获取
*
* @param list * @param list
* @param ticketMonthVO * @param ticketMonthVO
*/ */
private void getWorkMoth(LocalDateTime firstDateTime,LocalDateTime endDateTime,List<Long> list, TicketMonthVO ticketMonthVO) { private void getWorkMoth(LocalDateTime firstDateTime, LocalDateTime endDateTime, List<Long> list, TicketMonthVO ticketMonthVO) {
List<WorkTicketInfoEntity> workList = iWorkTicketInfoService.list(new LambdaQueryWrapper<WorkTicketInfoEntity>(){{ List<WorkTicketInfoEntity> workList = iWorkTicketInfoService.list(new LambdaQueryWrapper<WorkTicketInfoEntity>() {{
ge(WorkTicketInfoEntity::getCreateTime,firstDateTime); ge(WorkTicketInfoEntity::getCreateTime, firstDateTime);
le(WorkTicketInfoEntity::getCreateTime,endDateTime); le(WorkTicketInfoEntity::getCreateTime, endDateTime);
in(WorkTicketInfoEntity::getCreateDept,list); in(WorkTicketInfoEntity::getCreateDept, list);
}}); }});
if(CollectionUtil.isEmpty(workList)){ if (CollectionUtil.isEmpty(workList)) {
ticketMonthVO.setWork(0); ticketMonthVO.setWork(0);
ticketMonthVO.setWorkQualify(0); ticketMonthVO.setWorkQualify(0);
return; return;
@ -365,11 +400,11 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
ticketMonthVO.setWork(workList.size()); ticketMonthVO.setWork(workList.size());
List<Long> workIdList = workList.stream().map(WorkTicketInfoEntity::getId).collect(Collectors.toList()); List<Long> workIdList = workList.stream().map(WorkTicketInfoEntity::getId).collect(Collectors.toList());
// 查询合格评价 // 查询合格评价
List<TicketInfoEvaluateEntity> operateQualifyList = ticketInfoEvaluateService.list(new LambdaQueryWrapper<TicketInfoEvaluateEntity>(){{ List<TicketInfoEvaluateEntity> operateQualifyList = ticketInfoEvaluateService.list(new LambdaQueryWrapper<TicketInfoEvaluateEntity>() {{
in(TicketInfoEvaluateEntity::getTicketId,workIdList); in(TicketInfoEvaluateEntity::getTicketId, workIdList);
eq(TicketInfoEvaluateEntity::getStatus,TicketConstants.TicketQualifiedEnum.Qualified.getCode()); eq(TicketInfoEvaluateEntity::getStatus, TicketConstants.TicketQualifiedEnum.Qualified.getCode());
}}); }});
if(CollectionUtil.isEmpty(operateQualifyList)){ if (CollectionUtil.isEmpty(operateQualifyList)) {
ticketMonthVO.setOperateQualify(0); ticketMonthVO.setOperateQualify(0);
return; return;
} }
@ -378,63 +413,65 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
/** /**
* 获取StandardTicketInfoEntity - LambdaQueryWrapper * 获取StandardTicketInfoEntity - LambdaQueryWrapper
*
* @param req * @param req
* @return * @return
*/ */
private LambdaQueryWrapper getQueryWrapper(StandardTicketInfoDto req){ private LambdaQueryWrapper getQueryWrapper(StandardTicketInfoDto req) {
LambdaQueryWrapper<StandardTicketInfoEntity> queryWrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<StandardTicketInfoEntity> queryWrapper = new LambdaQueryWrapper();
if(Func.isNotEmpty(req.getCompany())){ if (Func.isNotEmpty(req.getCompany())) {
queryWrapper.like(StandardTicketInfoEntity::getCompany,"%".concat(req.getCompany()).concat("%")); queryWrapper.like(StandardTicketInfoEntity::getCompany, "%".concat(req.getCompany()).concat("%"));
} }
if(Func.isNotEmpty(req.getStatus())){ if (Func.isNotEmpty(req.getStatus())) {
queryWrapper.eq(StandardTicketInfoEntity::getStatus,req.getStatus()); queryWrapper.eq(StandardTicketInfoEntity::getStatus, req.getStatus());
} }
if(Func.isNotEmpty(req.getTicketType())){ if (Func.isNotEmpty(req.getTicketType())) {
queryWrapper.eq(StandardTicketInfoEntity::getTicketType,req.getTicketType()); queryWrapper.eq(StandardTicketInfoEntity::getTicketType, req.getTicketType());
} }
if(Func.isNotEmpty(req.getTaskType())){ if (Func.isNotEmpty(req.getTaskType())) {
queryWrapper.eq(StandardTicketInfoEntity::getTaskType,req.getTaskType()); queryWrapper.eq(StandardTicketInfoEntity::getTaskType, req.getTaskType());
} }
if(Func.isNotEmpty(req.getCode())){ if (Func.isNotEmpty(req.getCode())) {
queryWrapper.like(StandardTicketInfoEntity::getCode,req.getCode()); queryWrapper.like(StandardTicketInfoEntity::getCode, req.getCode());
} }
if(Func.isNotEmpty(req.getIssueOrderPerson())){ if (Func.isNotEmpty(req.getIssueOrderPerson())) {
queryWrapper.eq(StandardTicketInfoEntity::getIssueOrderPerson,req.getIssueOrderPerson()); queryWrapper.eq(StandardTicketInfoEntity::getIssueOrderPerson, req.getIssueOrderPerson());
} }
if(Func.isNotEmpty(req.getAccessOrderPerson())){ if (Func.isNotEmpty(req.getAccessOrderPerson())) {
queryWrapper.eq(StandardTicketInfoEntity::getAccessOrderPerson,req.getAccessOrderPerson()); queryWrapper.eq(StandardTicketInfoEntity::getAccessOrderPerson, req.getAccessOrderPerson());
} }
if(Func.isNotEmpty(req.getAccessOrderPerson())){ if (Func.isNotEmpty(req.getAccessOrderPerson())) {
queryWrapper.eq(StandardTicketInfoEntity::getAccessOrderPerson,req.getAccessOrderPerson()); queryWrapper.eq(StandardTicketInfoEntity::getAccessOrderPerson, req.getAccessOrderPerson());
} }
if(Func.isNotEmpty(req.getTitle())){ if (Func.isNotEmpty(req.getTitle())) {
queryWrapper.like(StandardTicketInfoEntity::getTitle,"%".concat(req.getTitle()).concat("%")); queryWrapper.like(StandardTicketInfoEntity::getTitle, "%".concat(req.getTitle()).concat("%"));
} }
if(Func.isNotEmpty(req.getStartTime())){ if (Func.isNotEmpty(req.getStartTime())) {
queryWrapper.ge(StandardTicketInfoEntity::getCreateTime,req.getStartTime()); queryWrapper.ge(StandardTicketInfoEntity::getCreateTime, req.getStartTime());
} }
if(Func.isNotEmpty(req.getEndTime())){ if (Func.isNotEmpty(req.getEndTime())) {
queryWrapper.le(StandardTicketInfoEntity::getCreateTime,req.getEndTime()); queryWrapper.le(StandardTicketInfoEntity::getCreateTime, req.getEndTime());
} }
if(!CollectionUtil.isEmpty(req.getDeptIds())){ if (!CollectionUtil.isEmpty(req.getDeptIds())) {
queryWrapper.in(StandardTicketInfoEntity::getCreateDept,req.getDeptIds()); queryWrapper.in(StandardTicketInfoEntity::getCreateDept, req.getDeptIds());
} }
return queryWrapper; return queryWrapper;
} }
/** /**
* 开启标准票流程 * 开启标准票流程
*
* @param processDefinitionKey 标准票流程key * @param processDefinitionKey 标准票流程key
* @param entity * @param entity
* @return * @return
*/ */
private String startProcessInstance(String processDefinitionKey, StandardTicketInfoEntity entity) { private String startProcessInstance(String processDefinitionKey, StandardTicketInfoEntity entity) {
Map<String,Object> params = new HashMap<String, Object>(2) {{ Map<String, Object> params = new HashMap<String, Object>(2) {{
put("taskId", entity.getId()); put("taskId", entity.getId());
put("guardianUserIds", "taskUser_".concat(entity.getGuardian().toString())); put("guardianUserIds", "taskUser_".concat(entity.getGuardian().toString()));
}}; }};
return flowClient.startProcessInstanceContainNameByKey(processDefinitionKey,"standardTicket:task:" + entity.getId(),entity.getTitle(), params) return flowClient.startProcessInstanceContainNameByKey(processDefinitionKey, "standardTicket:task:" + entity.getId(), entity.getTitle(), params)
.getData() .getData()
.getProcessInstanceId(); .getProcessInstanceId();
} }
@ -443,7 +480,7 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
* 获取标准票编号 * 获取标准票编号
* @return * @return
*/ */
private String getOperateTicketCode(){ private String getOperateTicketCode() {
/**获取当前时间**/ /**获取当前时间**/
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMM"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMM");
YearMonth yearMonth = YearMonth.now(); YearMonth yearMonth = YearMonth.now();
@ -451,13 +488,13 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
LocalDateTime date = LocalDateTime.now(); LocalDateTime date = LocalDateTime.now();
LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0); LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
LocalDateTime lastDay = date.with(TemporalAdjusters.lastDayOfMonth()).withHour(23).withMinute(59).withSecond(59); LocalDateTime lastDay = date.with(TemporalAdjusters.lastDayOfMonth()).withHour(23).withMinute(59).withSecond(59);
log.info("当月第一天:{};当月最后一天{}",firstDay,lastDay); log.info("当月第一天:{};当月最后一天{}", firstDay, lastDay);
/**获取当月工作票总条数**/ /**获取当月工作票总条数**/
List<StandardTicketInfoEntity> infoEntityList = this.list(new LambdaQueryWrapper<StandardTicketInfoEntity>(){{ List<StandardTicketInfoEntity> infoEntityList = this.list(new LambdaQueryWrapper<StandardTicketInfoEntity>() {{
ge(StandardTicketInfoEntity::getCreateTime,firstDay); ge(StandardTicketInfoEntity::getCreateTime, firstDay);
le(StandardTicketInfoEntity::getCreateTime,lastDay); le(StandardTicketInfoEntity::getCreateTime, lastDay);
}}); }});
if(CollectionUtil.isEmpty(infoEntityList)){ if (CollectionUtil.isEmpty(infoEntityList)) {
return TicketConstants.TicketCodePreEnum.DQ_OPERATE.getPrefix().concat("-").concat(tym).concat("-001"); return TicketConstants.TicketCodePreEnum.DQ_OPERATE.getPrefix().concat("-").concat(tym).concat("-001");
} }
return TicketConstants.TicketCodePreEnum.DQ_OPERATE.getPrefix().concat("-").concat(tym).concat("-").concat(String.format("%03d", infoEntityList.size())); return TicketConstants.TicketCodePreEnum.DQ_OPERATE.getPrefix().concat("-").concat(tym).concat("-").concat(String.format("%03d", infoEntityList.size()));
@ -465,6 +502,7 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
/** /**
* 根据站点获取双票数量 * 根据站点获取双票数量
*
* @param stationMap * @param stationMap
* @param firstDateTime * @param firstDateTime
* @param now * @param now
@ -473,24 +511,24 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
public List<DoublePassVO> getDoublePassQuantity(Map<String, String> stationMap, LocalDateTime firstDateTime, LocalDateTime now) { public List<DoublePassVO> getDoublePassQuantity(Map<String, String> stationMap, LocalDateTime firstDateTime, LocalDateTime now) {
List<DoublePassVO> doublePassVOList = new ArrayList<>(); List<DoublePassVO> doublePassVOList = new ArrayList<>();
// 站点遍历 // 站点遍历
stationMap.forEach((key,value)->{ stationMap.forEach((key, value) -> {
DoublePassVO doublePassVO = new DoublePassVO(); DoublePassVO doublePassVO = new DoublePassVO();
doublePassVO.setStationId(Long.valueOf(key)); doublePassVO.setStationId(Long.valueOf(key));
// 查询操作票 // 查询操作票
List<StandardTicketInfoEntity> standardList = this.list(new LambdaQueryWrapper<StandardTicketInfoEntity>(){{ List<StandardTicketInfoEntity> standardList = this.list(new LambdaQueryWrapper<StandardTicketInfoEntity>() {{
ge(StandardTicketInfoEntity::getCreateTime,firstDateTime); ge(StandardTicketInfoEntity::getCreateTime, firstDateTime);
le(StandardTicketInfoEntity::getCreateTime,now); le(StandardTicketInfoEntity::getCreateTime, now);
eq(StandardTicketInfoEntity::getCreateDept,value); eq(StandardTicketInfoEntity::getCreateDept, value);
}}); }});
List<Long> standardIdList = standardList.stream().map(StandardTicketInfoEntity::getId).collect(Collectors.toList()); List<Long> standardIdList = standardList.stream().map(StandardTicketInfoEntity::getId).collect(Collectors.toList());
// 查询工作票 // 查询工作票
List<WorkTicketInfoEntity> workList = iWorkTicketInfoService.list(new LambdaQueryWrapper<WorkTicketInfoEntity>(){{ List<WorkTicketInfoEntity> workList = iWorkTicketInfoService.list(new LambdaQueryWrapper<WorkTicketInfoEntity>() {{
ge(WorkTicketInfoEntity::getCreateTime,firstDateTime); ge(WorkTicketInfoEntity::getCreateTime, firstDateTime);
le(WorkTicketInfoEntity::getCreateTime,now); le(WorkTicketInfoEntity::getCreateTime, now);
eq(WorkTicketInfoEntity::getCreateDept,value); eq(WorkTicketInfoEntity::getCreateDept, value);
}}); }});
List<Long> workIdList = workList.stream().map(WorkTicketInfoEntity::getId).collect(Collectors.toList()); List<Long> workIdList = workList.stream().map(WorkTicketInfoEntity::getId).collect(Collectors.toList());
if(CollectionUtil.isEmpty(standardIdList) && CollectionUtil.isEmpty(workIdList)){ if (CollectionUtil.isEmpty(standardIdList) && CollectionUtil.isEmpty(workIdList)) {
doublePassVO.setDoubleTicketCount(0); doublePassVO.setDoubleTicketCount(0);
doublePassVO.setQualifiedCount(0); doublePassVO.setQualifiedCount(0);
doublePassVOList.add(doublePassVO); doublePassVOList.add(doublePassVO);
@ -499,13 +537,13 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
// 双票 = 查询操作票 + 查询工作票 // 双票 = 查询操作票 + 查询工作票
standardIdList.addAll(workIdList); standardIdList.addAll(workIdList);
// 查询合格评价 // 查询合格评价
List<TicketInfoEvaluateEntity> evaluateList = ticketInfoEvaluateService.list(new LambdaQueryWrapper<TicketInfoEvaluateEntity>(){{ List<TicketInfoEvaluateEntity> evaluateList = ticketInfoEvaluateService.list(new LambdaQueryWrapper<TicketInfoEvaluateEntity>() {{
ge(TicketInfoEvaluateEntity::getCreateTime,firstDateTime); ge(TicketInfoEvaluateEntity::getCreateTime, firstDateTime);
le(TicketInfoEvaluateEntity::getCreateTime,now); le(TicketInfoEvaluateEntity::getCreateTime, now);
in(TicketInfoEvaluateEntity::getTicketId,standardIdList); in(TicketInfoEvaluateEntity::getTicketId, standardIdList);
eq(TicketInfoEvaluateEntity::getStatus,TicketConstants.TicketQualifiedEnum.Qualified.getCode()); eq(TicketInfoEvaluateEntity::getStatus, TicketConstants.TicketQualifiedEnum.Qualified.getCode());
}}); }});
if(CollectionUtil.isEmpty(evaluateList)){ if (CollectionUtil.isEmpty(evaluateList)) {
doublePassVO.setDoubleTicketCount(standardIdList.size()); doublePassVO.setDoubleTicketCount(standardIdList.size());
doublePassVO.setQualifiedCount(0); doublePassVO.setQualifiedCount(0);
doublePassVOList.add(doublePassVO); doublePassVOList.add(doublePassVO);
@ -520,6 +558,7 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
/** /**
* 站点统计月报 - 操作票统计 * 站点统计月报 - 操作票统计
*
* @param startDate 开始时间 * @param startDate 开始时间
* @param endDate 结束时间 * @param endDate 结束时间
* @param deptIdList 机构ID * @param deptIdList 机构ID
@ -530,14 +569,14 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
TicketInfoStatisticVO result = new TicketInfoStatisticVO(); TicketInfoStatisticVO result = new TicketInfoStatisticVO();
result.setTicketInfoType("操作票"); result.setTicketInfoType("操作票");
List<OperateTicketStatisticVO> operateTicketReportStatistic = this.baseMapper.getOperateTicketReportStatistic(startDate, endDate, deptIdList); List<OperateTicketStatisticVO> operateTicketReportStatistic = this.baseMapper.getOperateTicketReportStatistic(startDate, endDate, deptIdList);
if(CollectionUtil.isNotEmpty(operateTicketReportStatistic)) { if (CollectionUtil.isNotEmpty(operateTicketReportStatistic)) {
//已完成数量 //已完成数量
int ticketInfoCompleteNum = operateTicketReportStatistic.stream().filter(ticket -> TicketConstants.StandardTicketStatusEnum.END.getStatus().equals(ticket.getStatus())) int ticketInfoCompleteNum = operateTicketReportStatistic.stream().filter(ticket -> TicketConstants.StandardTicketStatusEnum.END.getStatus().equals(ticket.getStatus()))
.collect(Collectors.toList()).size(); .collect(Collectors.toList()).size();
//合格数量 //合格数量
int ticketInfoQualifiedNum = operateTicketReportStatistic.stream().filter(ticket -> Func.isNotEmpty(ticket.getEvaluation()) && 1 == ticket.getEvaluation().intValue()).collect(Collectors.toList()).size(); int ticketInfoQualifiedNum = operateTicketReportStatistic.stream().filter(ticket -> Func.isNotEmpty(ticket.getEvaluation()) && 1 == ticket.getEvaluation().intValue()).collect(Collectors.toList()).size();
//计算合格率 //计算合格率
double ticketInfoProportion = new BigDecimal(ticketInfoQualifiedNum / (double)operateTicketReportStatistic.size() *100) double ticketInfoProportion = new BigDecimal(ticketInfoQualifiedNum / (double) operateTicketReportStatistic.size() * 100)
.setScale(2, RoundingMode.HALF_DOWN).doubleValue(); .setScale(2, RoundingMode.HALF_DOWN).doubleValue();
result = TicketInfoStatisticVO.builder() result = TicketInfoStatisticVO.builder()
.ticketInfoType("操作票") .ticketInfoType("操作票")

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

95
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;
@ -64,9 +63,9 @@ public class TicketInfoClient implements ITicketInfoClient {
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());
} }
} }
@ -77,9 +76,9 @@ public class TicketInfoClient implements ITicketInfoClient {
@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);
} }
@ -87,9 +86,9 @@ public class TicketInfoClient implements ITicketInfoClient {
@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);
} }
@ -97,62 +96,62 @@ public class TicketInfoClient implements ITicketInfoClient {
@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());
@ -166,6 +165,7 @@ public class TicketInfoClient implements ITicketInfoClient {
/** /**
* 获取首页操作票统计结果 * 获取首页操作票统计结果
*
* @param params * @param params
* @return * @return
*/ */
@ -175,12 +175,12 @@ public class TicketInfoClient implements ITicketInfoClient {
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");
List<StandardTicketInfoEntity> standardTicketList = standardService.list(new LambdaQueryWrapper<StandardTicketInfoEntity>(){{ List<StandardTicketInfoEntity> standardTicketList = standardService.list(new LambdaQueryWrapper<StandardTicketInfoEntity>() {{
ge(StandardTicketInfoEntity::getStartTime,startDate); ge(StandardTicketInfoEntity::getStartTime, startDate);
le(StandardTicketInfoEntity::getStartTime,endDate); le(StandardTicketInfoEntity::getStartTime, endDate);
in(StandardTicketInfoEntity::getCreateDept,deptList); in(StandardTicketInfoEntity::getCreateDept, deptList);
}}); }});
if(CollectionUtil.isEmpty(standardTicketList)){ if (CollectionUtil.isEmpty(standardTicketList)) {
return R.data(0); return R.data(0);
} }
return R.data(standardTicketList.size()); return R.data(standardTicketList.size());
@ -188,28 +188,30 @@ public class TicketInfoClient implements ITicketInfoClient {
/** /**
* 获取首页月工作票,操作票统计结果 * 获取首页月工作票,操作票统计结果
*
* @param params * @param params
* @return * @return
*/ */
@Override @Override
@PostMapping("/getOperateWorkStatistic") @PostMapping("/getOperateWorkStatistic")
public R<TicketMonthVO> getOperateWorkStatistic(@RequestBody Map<String, Object> params) { public R<TicketMonthVO> getOperateWorkStatistic(@RequestBody Map<String, Object> params) {
try{ try {
SimpleDateFormat sdf = new SimpleDateFormat(DateUtil.PATTERN_DATETIME); SimpleDateFormat sdf = new SimpleDateFormat(DateUtil.PATTERN_DATETIME);
Date startDate = sdf.parse((String) params.get("startDate")); Date startDate = sdf.parse((String) params.get("startDate"));
Date endDate = sdf.parse((String) params.get("endDate")); Date endDate = sdf.parse((String) params.get("endDate"));
DateTimeFormatter df = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME); DateTimeFormatter df = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME);
LocalDateTime firstDateTime = LocalDateTime.parse(DateUtil.format(startDate,DateUtil.PATTERN_DATETIME),df); LocalDateTime firstDateTime = LocalDateTime.parse(DateUtil.format(startDate, DateUtil.PATTERN_DATETIME), df);
LocalDateTime endDateTime = LocalDateTime.parse(DateUtil.format(endDate,DateUtil.PATTERN_DATETIME),df); LocalDateTime endDateTime = LocalDateTime.parse(DateUtil.format(endDate, DateUtil.PATTERN_DATETIME), df);
List<Long> list = (List<Long>) params.get("deptList"); List<Long> list = (List<Long>) params.get("deptList");
return standardService.getOperateWorkStatistic(firstDateTime,endDateTime,list); return standardService.getOperateWorkStatistic(firstDateTime, endDateTime, list);
}catch (ParseException e){ } catch (ParseException e) {
return R.fail("获取失败"); return R.fail("获取失败");
} }
} }
/** /**
* 安全检查工作票事项统计 * 安全检查工作票事项统计
*
* @param startDate 开始时间 * @param startDate 开始时间
* @param endDate 结束时间 * @param endDate 结束时间
* @param dept 机构ID * @param dept 机构ID
@ -219,20 +221,21 @@ public class TicketInfoClient implements ITicketInfoClient {
@GetMapping("/getWorkTicketCheck") @GetMapping("/getWorkTicketCheck")
public R<SafeCheckStatisticVO> getWorkTicketCheck(@RequestParam(value = "startDate") String startDate, public R<SafeCheckStatisticVO> getWorkTicketCheck(@RequestParam(value = "startDate") String startDate,
@RequestParam(value = "endDate") String endDate, @RequestParam(value = "endDate") String endDate,
@RequestParam(value = "dept") Long dept){ @RequestParam(value = "dept") Long dept) {
SafeCheckStatisticVO vo = infoService.getWorkTicketStatistic(startDate,endDate,dept); SafeCheckStatisticVO vo = infoService.getWorkTicketStatistic(startDate, endDate, dept);
if(vo == null){ if (vo == null) {
vo = new SafeCheckStatisticVO(); vo = new SafeCheckStatisticVO();
} }
vo.setProjectType(Constants.SafeCheckProjectEnum.WORK_TICKET.getType()); vo.setProjectType(Constants.SafeCheckProjectEnum.WORK_TICKET.getType());
vo.setProjectTypeName(Constants.SafeCheckProjectEnum.WORK_TICKET.getName()); vo.setProjectTypeName(Constants.SafeCheckProjectEnum.WORK_TICKET.getName());
//计算合格率 //计算合格率
if(ObjectUtil.isNotEmpty(vo.getTotal()) && vo.getTotal() != 0){ if (ObjectUtil.isNotEmpty(vo.getTotal()) && vo.getTotal() != 0) {
double qualifiedRate = new BigDecimal( double qualifiedRate = new BigDecimal(
vo.getQualified() / (double) vo.getTotal() * 100 vo.getQualified() / (double) vo.getTotal() * 100
).setScale(2 , BigDecimal.ROUND_HALF_UP).doubleValue(); ).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
vo.setQualifiedRate(qualifiedRate); vo.setQualifiedRate(qualifiedRate);
} }
return R.data(vo); return R.data(vo);
} }
} }

Loading…
Cancel
Save