Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 1 year ago
parent
commit
ebf69d182d
  1. 8
      hzims-biz-common/pom.xml
  2. 1
      hzims-service-api/ticket-api/pom.xml
  3. 1
      hzims-service/hzims-middle/pom.xml
  4. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/controller/ProcessTypeController.java
  5. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/TimeUtils.java
  6. 10
      hzims-service/pom.xml
  7. 50
      hzims-service/ticket/pom.xml
  8. 2
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/config/ThreadConfig.java
  9. 8
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java
  10. 16
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java
  11. 45
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketCountController.java
  12. 112
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/TicketCount.java
  13. 14
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/TicketCountMapper.java
  14. 5
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/TicketCountMapper.xml
  15. 23
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketCountService.java
  16. 254
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java
  17. 8
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketInfoService.java
  18. 16
      hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java
  19. 21
      hzims-service/ticket/src/main/resources/db/2.0.0.sql
  20. 6
      hzims-service/weather/pom.xml
  21. 9
      pom.xml

8
hzims-biz-common/pom.xml

@ -44,14 +44,6 @@
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-starter-datascope</artifactId> <artifactId>blade-starter-datascope</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/cn.afterturn/easypoi-spring-boot-starter -->
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-spring-boot-starter</artifactId>
<version>4.4.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

1
hzims-service-api/ticket-api/pom.xml

@ -24,7 +24,6 @@
<dependency> <dependency>
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>
<artifactId>middle-api</artifactId> <artifactId>middle-api</artifactId>
<version>4.0.0-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>

1
hzims-service/hzims-middle/pom.xml

@ -116,7 +116,6 @@
<dependency> <dependency>
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>
<artifactId>middle-api</artifactId> <artifactId>middle-api</artifactId>
<version>4.0.0-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/controller/ProcessTypeController.java

@ -15,7 +15,6 @@ import com.hnac.hzims.middle.processflow.strategy.service.ProcessService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.jackson.JsonUtil; import org.springblade.core.tool.jackson.JsonUtil;
import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.queue.produce.QueueProduceService; import org.springblade.queue.produce.QueueProduceService;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -50,9 +49,6 @@ public class ProcessTypeController {
private final RedisTemplate redisTemplate; private final RedisTemplate redisTemplate;
private final IFlowClient flowClient;
private final QueueProduceService queueProduceService; private final QueueProduceService queueProduceService;

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/util/TimeUtils.java

@ -15,19 +15,11 @@ public class TimeUtils {
* @return * @return
*/ */
public static Long getDifferTime(Date nowDate,Date endDate ) { public static Long getDifferTime(Date nowDate,Date endDate ) {
// long nd = 1000 * 24 * 60 * 60L;
// 获得两个时间的毫秒时间差异
// long nh = 1000 * 60 * 60L;
// long diff = endDate.getTime() - nowDate.getTime();
// BigDecimal s=BigDecimal.valueOf(diff).divide(BigDecimal.valueOf(diff)).setScale(0, BigDecimal.ROUND_HALF_UP);
// Long hour=s.longValue();
// return hour;
long nd = 1000 * 24 * 60 * 60L;
long nh = 1000 * 60 * 60L; long nh = 1000 * 60 * 60L;
// 获得两个时间的毫秒时间差异 // 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime(); long diff = endDate.getTime() - nowDate.getTime();
// 计算差多少小时 // 计算差多少小时
long hour = diff % nd / nh; long hour = diff/ nh;
return hour; return hour;
} }

10
hzims-service/pom.xml

@ -55,13 +55,15 @@
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-starter-datascope</artifactId> <artifactId>blade-starter-datascope</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>
<artifactId>middle-api</artifactId> <artifactId>middle-api</artifactId>
<version>4.0.0-SNAPSHOT</version> </dependency>
<!-- https://mvnrepository.com/artifact/cn.afterturn/easypoi-spring-boot-starter -->
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-spring-boot-starter</artifactId>
<version>${easpoi.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>

50
hzims-service/ticket/pom.xml

@ -21,6 +21,8 @@
<easypoi.version>3.2.0</easypoi.version> <easypoi.version>3.2.0</easypoi.version>
<documents4j.version>1.0.3</documents4j.version> <documents4j.version>1.0.3</documents4j.version>
<swagger-bootstrap-ui.version>1.9.6</swagger-bootstrap-ui.version> <swagger-bootstrap-ui.version>1.9.6</swagger-bootstrap-ui.version>
<!--特定版本-->
<poi.version>4.1.2</poi.version>
</properties> </properties>
<dependencies> <dependencies>
@ -57,7 +59,7 @@
<!--excel转换为pdf 通过https://repo.e-iceblue.cn/repository/maven-public/下载jar包--> <!--excel转换为pdf 通过https://repo.e-iceblue.cn/repository/maven-public/下载jar包-->
<dependency> <dependency>
<groupId>e-iceblue </groupId> <groupId>e-iceblue</groupId>
<artifactId>spire.xls.free</artifactId> <artifactId>spire.xls.free</artifactId>
<version>3.9.1</version> <version>3.9.1</version>
</dependency> </dependency>
@ -66,33 +68,12 @@
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId> <artifactId>poi</artifactId>
<version>4.0.0</version> <version>${poi.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId> <artifactId>poi-ooxml</artifactId>
<version>4.0.0</version> <version>${poi.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.apache.poi</groupId>-->
<!-- <artifactId>poi-ooxml-schemas</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.apache.poi</groupId>-->
<!-- <artifactId>poi-scratchpad</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>cn.afterturn</groupId>-->
<!-- <artifactId>easypoi-web</artifactId>-->
<!-- <version>${easypoi.version}</version>-->
<!-- </dependency>-->
<!-- https://mvnrepository.com/artifact/cn.afterturn/easypoi-spring-boot-starter -->
<dependency>
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-spring-boot-starter</artifactId>
<version>4.0.0</version>
</dependency> </dependency>
<dependency> <dependency>
@ -268,22 +249,21 @@
<artifactId>jedis</artifactId> <artifactId>jedis</artifactId>
</dependency> </dependency>
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>com.aliyun</groupId>--> <!-- <groupId>com.aliyun</groupId>-->
<!-- <artifactId>aliyun-java-sdk-ecs</artifactId>--> <!-- <artifactId>aliyun-java-sdk-ecs</artifactId>-->
<!-- <version>4.2.0</version>--> <!-- <version>4.2.0</version>-->
<!-- <scope>compile</scope>--> <!-- <scope>compile</scope>-->
<!-- </dependency>--> <!-- </dependency>-->
<!--swagger-bootstrap-ui--> <!--swagger-bootstrap-ui-->
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>com.github.xiaoymin</groupId>--> <!-- <groupId>com.github.xiaoymin</groupId>-->
<!-- <artifactId>swagger-bootstrap-ui</artifactId>--> <!-- <artifactId>swagger-bootstrap-ui</artifactId>-->
<!-- <version>${swagger-bootstrap-ui.version}</version>--> <!-- <version>${swagger-bootstrap-ui.version}</version>-->
<!-- </dependency>--> <!-- </dependency>-->
<dependency> <dependency>
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>
<artifactId>middle-api</artifactId> <artifactId>middle-api</artifactId>
<version>4.0.0-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>

2
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/config/ThreadConfig.java

@ -22,7 +22,7 @@ public class ThreadConfig {
@Autowired @Autowired
private ThreadPoolConfigProperties threadPoolConfigProperties; private ThreadPoolConfigProperties threadPoolConfigProperties;
// @Bean @Bean
public ThreadPoolExecutor threadPoolExecutor() { public ThreadPoolExecutor threadPoolExecutor() {
return new ThreadPoolExecutor(threadPoolConfigProperties.getCorePoolSize(), return new ThreadPoolExecutor(threadPoolConfigProperties.getCorePoolSize(),
threadPoolConfigProperties.getMaxSize(), threadPoolConfigProperties.getMaxSize(),

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

@ -117,4 +117,12 @@ public interface IStandardTicketInfoService extends BaseService<StandardTicketIn
* @return * @return
*/ */
StandardTicketInfoVo selectDetailsById(Long ticketId); StandardTicketInfoVo selectDetailsById(Long ticketId);
/**
* 根据部门Id数组查询操作票数据
* @param createDept
* @param ticketType
* @return
*/
List<StandardTicketInfoEntity> selectStandardTicketByDeptIdWithTicketType(List<Long> createDept, String ticketType);
} }

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

@ -700,4 +700,20 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl<StandardTicke
} }
return result; return result;
} }
/**
* 根据部门Id数组查询操作票数据
*
* @param createDept
* @param ticketType
* @return
*/
@Override
public List<StandardTicketInfoEntity> selectStandardTicketByDeptIdWithTicketType(List<Long> createDept, String ticketType) {
LambdaQueryWrapper<StandardTicketInfoEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StandardTicketInfoEntity::getTicketType,ticketType);
queryWrapper.in(StandardTicketInfoEntity::getCreateDept,createDept);
return baseMapper.selectList(queryWrapper);
}
} }

45
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketCountController.java

@ -0,0 +1,45 @@
package com.hnac.hzims.ticket.twoTicket.controller;
import com.hnac.hzims.ticket.twoTicket.service.TicketCountService;
import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.YearMonth;
/**
* 两票统计分析模块
*
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/7/3 13:41
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/ticket-count")
public class TicketCountController {
private final TicketCountService ticketCountService;
/**
* 两票生成月报统计
* @param dateTime 月份
* @return
*/
@PostMapping("/loadMonthReport/{dateTime}")
public R loadMonthReport(@PathVariable String dateTime) {
ticketCountService.loadMonthReport(dateTime);
return R.success("生成两票月报成功");
}
}

112
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/TicketCount.java

@ -0,0 +1,112 @@
package com.hnac.hzims.ticket.twoTicket.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.YearMonth;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/7/3 11:45
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode
@TableName("hzims_ticket_count")
public class TicketCount implements Serializable {
/**
* 编号
*/
private Long id;
/**
* 站点id
*/
private Long deptId;
/**
* 日期
*/
private String dateTime;
/**
* 站点名称
*/
private String deptName;
/**
* 票据类型
*/
private String ticketType;
/**
* 开票数量
*/
private Integer ticketNumber;
/**
* 完成数量
*/
private Integer ticketCompleteNum;
/**
* 延期数量
*/
private Integer ticketDelayNum;
/**
* 合格数量
*/
private Integer ticketProportionNum;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 逻辑删除
*/
@TableField(value = "is_deleted")
@TableLogic(value = "0", delval = "1")
private Boolean deleted;
/**
* 创建部门
*/
private String createDept;
/**
* 租户Id
*/
private String tenantId;
}

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

@ -0,0 +1,14 @@
package com.hnac.hzims.ticket.twoTicket.mapper;
import com.hnac.hzims.ticket.twoTicket.entity.TicketCount;
import com.hnac.hzims.ticket.workTicket.entity.SecondTicketInfoEntity;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/7/3 13:36
*/
public interface TicketCountMapper extends UserDataScopeBaseMapper<TicketCount> {
}

5
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/TicketCountMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.ticket.twoTicket.mapper.TicketCountMapper">
</mapper>

23
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketCountService.java

@ -0,0 +1,23 @@
package com.hnac.hzims.ticket.twoTicket.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.ticket.twoTicket.entity.TicketCount;
import com.hnac.hzims.ticket.twoTicket.entity.TicketInfoDanger;
import java.time.YearMonth;
import java.util.List;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/7/3 13:37
*/
public interface TicketCountService extends IService<TicketCount> {
/**
* 两票生成月报统计
*/
void loadMonthReport(String dateTime);
}

254
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java

@ -0,0 +1,254 @@
package com.hnac.hzims.ticket.twoTicket.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity;
import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService;
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity;
import com.hnac.hzims.ticket.standardTicket.service.IStandardTicketInfoService;
import com.hnac.hzims.ticket.twoTicket.entity.TicketCount;
import com.hnac.hzims.ticket.twoTicket.mapper.TicketCountMapper;
import com.hnac.hzims.ticket.twoTicket.service.TicketCountService;
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity;
import com.hnac.hzims.ticket.workTicket.service.IWorkTicketInfoService;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.stream.Collectors;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/7/3 13:38
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class TicketCountServiceImpl extends ServiceImpl<TicketCountMapper, TicketCount> implements TicketCountService {
private final ThreadPoolExecutor executor;
private final IWorkTicketInfoService workTicketInfoService;
private final IUserClient userClient;
private final ISysClient systemClient;
private final TicketInfoEvaluateService ticketInfoEvaluateService;
private final IStandardTicketInfoService standardTicketInfoService;
/**
* 两票生成月报统计
*
* @param dateTime
*/
@SneakyThrows
@Override
public void loadMonthReport(String dateTime) {
//根据登录人查询所属机构及下属机构
BladeUser user = AuthUtil.getUser();
List<Long> createDept = userClient.getDataScope(user.getUserId());
System.out.println("createDept = " + createDept);
//根据月份查询统计的数据
CompletableFuture<List<TicketCount>> ticketCountsCompletableFuture = CompletableFuture.supplyAsync(() -> {
LambdaQueryWrapper<TicketCount> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TicketCount::getDateTime, dateTime);
List<TicketCount> ticketCounts = baseMapper.selectList(queryWrapper);
return ticketCounts;
}, executor);
//第一种工作票
CompletableFuture<Void> oneTicketCompletableFuture = ticketCountsCompletableFuture.thenAcceptAsync((items) -> {
//查询第一种工作票
List<TicketCount> ticketCountList = getTicketCountList(createDept, items, "6", dateTime,user);
if (CollectionUtils.isNotEmpty(ticketCountList)) {
this.saveBatch(ticketCountList);
}
}, executor);
//第二种工作票
CompletableFuture<Void> twoTicketCompletableFuture = ticketCountsCompletableFuture.thenAcceptAsync((items) -> {
//查询第一种工作票
List<TicketCount> ticketCountList = getTicketCountList(createDept, items, "7", dateTime,user);
if (CollectionUtils.isNotEmpty(ticketCountList)) {
this.saveBatch(ticketCountList);
}
}, executor);
//水力机械工作票
CompletableFuture<Void> threeTicketCompletableFuture = ticketCountsCompletableFuture.thenAcceptAsync((items) -> {
//查询第一种工作票
List<TicketCount> ticketCountList = getTicketCountList(createDept, items, "8", dateTime,user);
if (CollectionUtils.isNotEmpty(ticketCountList)) {
this.saveBatch(ticketCountList);
}
}, executor);
//操作票
CompletableFuture<Void> standardCompletableFuture = ticketCountsCompletableFuture.thenAcceptAsync((items) -> {
//操作票
List<TicketCount> ticketCountList = getStandardTicketCountList(createDept, items, "3", dateTime,user);
if (CollectionUtils.isNotEmpty(ticketCountList)) {
this.saveBatch(ticketCountList);
}
}, executor);
//执行线程操作
CompletableFuture.allOf(ticketCountsCompletableFuture,
oneTicketCompletableFuture,
twoTicketCompletableFuture,
threeTicketCompletableFuture,
standardCompletableFuture)
.get();
}
/**
* 统计操作票功能
*
* @param createDept 所属机构及下属机构
* @param items 两票统计对象
* @param ticketType 两票状态
* @param dateTime
* @param user
* @return
*/
private List<TicketCount> getStandardTicketCountList(List<Long> createDept, List<TicketCount> items, String ticketType, String dateTime, BladeUser user) {
List<StandardTicketInfoEntity> ticketInfoEntities =
standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType);
if (CollectionUtils.isEmpty(ticketInfoEntities)) {
return null;
}
//根据站点分组
Map<Long, List<StandardTicketInfoEntity>> createDeptTickets =
ticketInfoEntities.stream().collect(Collectors.groupingBy(StandardTicketInfoEntity::getCreateDept));
//获取 操作票的id,删除
if (CollectionUtils.isNotEmpty(items)) {
List<Long> collect = items.stream().filter(item -> ticketType.equals(item.getTicketType())).map(TicketCount::getId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
baseMapper.deleteBatchIds(collect);
}
}
Set<Map.Entry<Long, List<StandardTicketInfoEntity>>> entries = createDeptTickets.entrySet();
List<TicketCount> ticketCountList = new ArrayList<>();
for (Map.Entry<Long, List<StandardTicketInfoEntity>> entry : entries) {
TicketCount ticketCount = new TicketCount();
ticketCount.setDateTime(dateTime);
ticketCount.setDeptId(entry.getKey());
ticketCount.setTenantId(user.getTenantId());
ticketCount.setCreateDept(user.getDeptId());
//根据id获取部门名称
R<String> deptName = systemClient.getDeptName(entry.getKey());
if (deptName.isSuccess()) {
ticketCount.setDeptName(deptName.getData());
}
List<StandardTicketInfoEntity> values = entry.getValue();
ticketCount.setTicketType(CollectionUtils.isNotEmpty(values) ? values.get(0).getTicketType() : ticketType);
//1. 开票数量
List<StandardTicketInfoEntity> ticketNumbers =
values.stream().filter(item -> item.getFlowTaskName() != null).collect(Collectors.toList());
ticketCount.setTicketNumber(ticketNumbers.size());
//2. 完成数量
List<StandardTicketInfoEntity> ticketCompleteNums =
values.stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList());
ticketCount.setTicketCompleteNum(ticketCompleteNums.size());
//3. 延期数据量
ticketCount.setTicketDelayNum(0);
//4. 合格数量
List<Long> ticketIdList = values.stream().map(item -> item.getId()).collect(Collectors.toList());
LambdaQueryWrapper<TicketInfoEvaluateEntity> evaluateEntityLambdaQueryWrapper =
new LambdaQueryWrapper<>();
evaluateEntityLambdaQueryWrapper.in(TicketInfoEvaluateEntity::getTicketId, ticketIdList);
evaluateEntityLambdaQueryWrapper.eq(BaseEntity::getStatus, 1);
List<TicketInfoEvaluateEntity> evaluateEntities = ticketInfoEvaluateService.list(evaluateEntityLambdaQueryWrapper);
ticketCount.setTicketProportionNum(evaluateEntities.size());
ticketCountList.add(ticketCount);
}
return ticketCountList;
}
/**
* 统计第一种工作票,第二种工作功能,机械工作票功能
*
* @param createDept 所属机构及下属机构
* @param items 两票统计对象
* @param ticketType 两票状态
* @param dateTime
* @param user
* @return
*/
private List<TicketCount> getTicketCountList(List<Long> createDept, List<TicketCount> items, String ticketType, String dateTime, BladeUser user) {
List<WorkTicketInfoEntity> ticketInfoEntities =
workTicketInfoService.selectTicketByDeptIdWithTicketType(createDept, ticketType);
if (CollectionUtils.isEmpty(ticketInfoEntities)) {
return null;
}
//根据站点分组
Map<Long, List<WorkTicketInfoEntity>> createDeptTickets = ticketInfoEntities.stream().collect(Collectors.groupingBy(BaseEntity::getCreateDept));
if (CollectionUtils.isNotEmpty(items)) {
//获取工作票的id,删除
List<Long> collect = items.stream().filter(item -> ticketType.equals(item.getTicketType())).map(TicketCount::getId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
baseMapper.deleteBatchIds(collect);
}
}
Set<Map.Entry<Long, List<WorkTicketInfoEntity>>> entries = createDeptTickets.entrySet();
List<TicketCount> ticketCountList = new ArrayList<>();
for (Map.Entry<Long, List<WorkTicketInfoEntity>> entry : entries) {
TicketCount ticketCount = new TicketCount();
ticketCount.setDeptId(entry.getKey());
ticketCount.setDateTime(dateTime);
//根据id获取部门名称
R<String> deptName = systemClient.getDeptName(entry.getKey());
if (deptName.isSuccess()) {
ticketCount.setDeptName(deptName.getData());
}
List<WorkTicketInfoEntity> values = entry.getValue();
ticketCount.setTicketType(CollectionUtils.isNotEmpty(values) ? values.get(0).getType() : ticketType);
//1. 开票数量
List<WorkTicketInfoEntity> ticketNumbers =
values.stream().filter(item -> item.getFlowTaskName() != null).collect(Collectors.toList());
ticketCount.setTicketNumber(ticketNumbers.size());
//2. 完成数量
List<WorkTicketInfoEntity> ticketCompleteNums =
values.stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList());
ticketCount.setTicketCompleteNum(ticketCompleteNums.size());
ticketCount.setTenantId(user.getTenantId());
ticketCount.setCreateDept(user.getDeptId());
//3. 延期数据量
List<WorkTicketInfoEntity> ticketDelayNums =
values.stream().filter(item -> "延期".equals(item.getInput())).collect(Collectors.toList());
ticketCount.setTicketDelayNum(ticketDelayNums.size());
//4. 合格数量
List<Long> ticketIdList = values.stream().map(item -> item.getId()).collect(Collectors.toList());
LambdaQueryWrapper<TicketInfoEvaluateEntity> evaluateEntityLambdaQueryWrapper =
new LambdaQueryWrapper<>();
evaluateEntityLambdaQueryWrapper.in(TicketInfoEvaluateEntity::getTicketId, ticketIdList);
evaluateEntityLambdaQueryWrapper.eq(BaseEntity::getStatus, 1);
List<TicketInfoEvaluateEntity> evaluateEntities = ticketInfoEvaluateService.list(evaluateEntityLambdaQueryWrapper);
ticketCount.setTicketProportionNum(evaluateEntities.size());
ticketCountList.add(ticketCount);
}
return ticketCountList;
}
}

8
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketInfoService.java

@ -155,4 +155,12 @@ public interface IWorkTicketInfoService extends BaseService<WorkTicketInfoEntity
*/ */
WorkTicketVo selectDetailsById(Long ticketId); WorkTicketVo selectDetailsById(Long ticketId);
/**
* 根据部门Id数组查询工作票数据
* @param createDept
* @param ticketType
* @return
*/
List<WorkTicketInfoEntity> selectTicketByDeptIdWithTicketType(List<Long> createDept, String ticketType);
} }

16
hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java

@ -48,6 +48,7 @@ import lombok.var;
import org.apache.commons.collections.map.HashedMap; import org.apache.commons.collections.map.HashedMap;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
@ -1093,4 +1094,19 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl<WorkTicketInfoMap
} }
return workTicketVo; return workTicketVo;
} }
/**
* 根据部门Id数组查询工作票数据
*
* @param createDept
* @param ticketType
* @return
*/
@Override
public List<WorkTicketInfoEntity> selectTicketByDeptIdWithTicketType(List<Long> createDept, String ticketType) {
LambdaQueryWrapper<WorkTicketInfoEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(WorkTicketInfoEntity::getType,ticketType);
queryWrapper.in(BaseEntity::getCreateDept,createDept);
return baseMapper.selectList(queryWrapper);
}
} }

21
hzims-service/ticket/src/main/resources/db/2.0.0.sql

@ -0,0 +1,21 @@
-- auto-generated definition
create table hzims_ticket_count
(
id bigint auto_increment comment '主键ID'
primary key,
date_time varchar(20) null comment '日期',
dept_id bigint null comment '站点Id',
dept_name varchar(100) null comment '站点名称',
ticket_type varchar(255) null comment '票据类型',
ticket_number int null comment '开票数量',
ticket_complete_num int null comment '完成数量',
ticket_delay_num int null comment '延期数量',
ticket_proportion_num int null comment '合格数量',
create_time datetime default CURRENT_TIMESTAMP null comment '创建时间',
update_time datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间',
is_deleted tinyint(1) default 0 null comment '0',
tenant_id varchar(12) null comment '租户ID',
create_dept varchar(30) null comment '创建部门'
)
comment '两票统计分析' row_format = DYNAMIC;

6
hzims-service/weather/pom.xml

@ -23,12 +23,6 @@
</properties> </properties>
<dependencies> <dependencies>
<dependency>
<groupId>com.hnac.hzims</groupId>
<artifactId>hzims-biz-common</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springblade</groupId> <groupId>org.springblade</groupId>
<artifactId>blade-common</artifactId> <artifactId>blade-common</artifactId>

9
pom.xml

@ -17,18 +17,14 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><java.version>1.8</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><java.version>1.8</java.version>
<maven.plugin.version>3.8.1</maven.plugin.version> <maven.plugin.version>3.8.1</maven.plugin.version>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<hzinfo.data.version>5.0.1-SNAPSHOT</hzinfo.data.version> <hzinfo.data.version>5.0.1-SNAPSHOT</hzinfo.data.version>
<!-- <hzinfo.data.api.version>4.5.3-SNAPSHOT</hzinfo.data.api.version>--> <!-- <hzinfo.data.api.version>4.5.3-SNAPSHOT</hzinfo.data.api.version>-->
<!-- <hzinfo.data.sdk.version>4.5.4-RELEASE</hzinfo.data.sdk.version>--> <!-- <hzinfo.data.sdk.version>4.5.4-RELEASE</hzinfo.data.sdk.version>-->
<flowable.version>6.4.2</flowable.version> <flowable.version>6.4.2</flowable.version>
<dubbo.version>2.7.5</dubbo.version> <dubbo.version>2.7.5</dubbo.version>
<spring.boot.version>2.1.14.RELEASE</spring.boot.version> <spring.boot.version>2.1.14.RELEASE</spring.boot.version>
<spring.cloud.version>Greenwich.SR6</spring.cloud.version> <spring.cloud.version>Greenwich.SR6</spring.cloud.version>
<spring.platform.version>Cairo-SR8</spring.platform.version> <spring.platform.version>Cairo-SR8</spring.platform.version>
<!-- 推荐使用Harbor --> <!-- 推荐使用Harbor -->
<docker.registry.url>192.168.0.157</docker.registry.url> <docker.registry.url>192.168.0.157</docker.registry.url>
<docker.registry.host>http://${docker.registry.url}:2375</docker.registry.host> <docker.registry.host>http://${docker.registry.url}:2375</docker.registry.host>
@ -36,16 +32,13 @@
<docker.password>Harbor12345</docker.password> <docker.password>Harbor12345</docker.password>
<docker.namespace>blade</docker.namespace> <docker.namespace>blade</docker.namespace>
<docker.plugin.version>1.4.13</docker.plugin.version> <docker.plugin.version>1.4.13</docker.plugin.version>
<poi.version>5.2.3</poi.version>
<!-- SonarQube代码走查 --> <!-- SonarQube代码走查 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<sonar.host.url>http://192.168.65.246:9000</sonar.host.url> <sonar.host.url>http://192.168.65.246:9000</sonar.host.url>
<sonar.login>2743eef4724b4e61f7fc43ae4d8f51e458856771</sonar.login> <sonar.login>2743eef4724b4e61f7fc43ae4d8f51e458856771</sonar.login>
<easpoi.version>4.4.0</easpoi.version>
</properties> </properties>
<modules> <modules>

Loading…
Cancel
Save