From 4ef691ad9ee21f40bb0a59e92ff0d184e4d6fa50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com>
Date: Wed, 5 Jul 2023 12:30:27 +0800
Subject: [PATCH 1/3] =?UTF-8?q?pon=E6=96=87=E4=BB=B6=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
hzims-service-api/ticket-api/pom.xml | 1 -
hzims-service/hzims-middle/pom.xml | 1 -
hzims-service/pom.xml | 1 -
hzims-service/ticket/pom.xml | 1 -
4 files changed, 4 deletions(-)
diff --git a/hzims-service-api/ticket-api/pom.xml b/hzims-service-api/ticket-api/pom.xml
index 3b3be45..dad632f 100644
--- a/hzims-service-api/ticket-api/pom.xml
+++ b/hzims-service-api/ticket-api/pom.xml
@@ -24,7 +24,6 @@
com.hnac.hzims
middle-api
- 4.0.0-SNAPSHOT
provided
diff --git a/hzims-service/hzims-middle/pom.xml b/hzims-service/hzims-middle/pom.xml
index f8c28c7..30a855c 100644
--- a/hzims-service/hzims-middle/pom.xml
+++ b/hzims-service/hzims-middle/pom.xml
@@ -116,7 +116,6 @@
com.hnac.hzims
middle-api
- 4.0.0-SNAPSHOT
diff --git a/hzims-service/pom.xml b/hzims-service/pom.xml
index 5db9e32..86fe1c4 100644
--- a/hzims-service/pom.xml
+++ b/hzims-service/pom.xml
@@ -61,7 +61,6 @@
com.hnac.hzims
middle-api
- 4.0.0-SNAPSHOT
diff --git a/hzims-service/ticket/pom.xml b/hzims-service/ticket/pom.xml
index 181070e..8f18243 100644
--- a/hzims-service/ticket/pom.xml
+++ b/hzims-service/ticket/pom.xml
@@ -283,7 +283,6 @@
com.hnac.hzims
middle-api
- 4.0.0-SNAPSHOT
From 05a1a64d7daa0139c25768d4b5f09d4a09a57f7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com>
Date: Wed, 5 Jul 2023 12:32:27 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E4=B8=A4=E7=A5=A8=E7=BB=9F=E8=AE=A1?=
=?UTF-8?q?=E5=88=86=E6=9E=90=E7=94=9F=E6=88=90=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../com/hnac/hzims/ticket/config/ThreadConfig.java | 2 +-
.../service/IStandardTicketInfoService.java | 8 +
.../impl/StandardTicketInfoServiceImpl.java | 16 ++
.../controller/TicketCountController.java | 45 ++++
.../hzims/ticket/twoTicket/entity/TicketCount.java | 112 +++++++++
.../ticket/twoTicket/mapper/TicketCountMapper.java | 14 ++
.../ticket/twoTicket/mapper/TicketCountMapper.xml | 5 +
.../twoTicket/service/TicketCountService.java | 23 ++
.../service/impl/TicketCountServiceImpl.java | 254 +++++++++++++++++++++
.../workTicket/service/IWorkTicketInfoService.java | 8 +
.../service/impl/WorkTicketInfoServiceImpl.java | 16 ++
.../ticket/src/main/resources/db/2.0.0.sql | 21 ++
12 files changed, 523 insertions(+), 1 deletion(-)
create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketCountController.java
create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/TicketCount.java
create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/TicketCountMapper.java
create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/TicketCountMapper.xml
create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketCountService.java
create mode 100644 hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java
create mode 100644 hzims-service/ticket/src/main/resources/db/2.0.0.sql
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/config/ThreadConfig.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/config/ThreadConfig.java
index 8b7385f..26cc40b 100644
--- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/config/ThreadConfig.java
+++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/config/ThreadConfig.java
@@ -22,7 +22,7 @@ public class ThreadConfig {
@Autowired
private ThreadPoolConfigProperties threadPoolConfigProperties;
- // @Bean
+ @Bean
public ThreadPoolExecutor threadPoolExecutor() {
return new ThreadPoolExecutor(threadPoolConfigProperties.getCorePoolSize(),
threadPoolConfigProperties.getMaxSize(),
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java
index b4aaa2e..f17194c 100644
--- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java
+++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/IStandardTicketInfoService.java
@@ -117,4 +117,12 @@ public interface IStandardTicketInfoService extends BaseService selectStandardTicketByDeptIdWithTicketType(List createDept, String ticketType);
}
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java
index 1a97a48..e3dc3f2 100644
--- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java
+++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java
@@ -700,4 +700,20 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl selectStandardTicketByDeptIdWithTicketType(List createDept, String ticketType) {
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(StandardTicketInfoEntity::getTicketType,ticketType);
+ queryWrapper.in(StandardTicketInfoEntity::getCreateDept,createDept);
+ return baseMapper.selectList(queryWrapper);
+ }
}
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketCountController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketCountController.java
new file mode 100644
index 0000000..913e112
--- /dev/null
+++ b/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("生成两票月报成功");
+ }
+
+
+
+
+
+
+}
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/TicketCount.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/entity/TicketCount.java
new file mode 100644
index 0000000..1e5cbd0
--- /dev/null
+++ b/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;
+
+
+}
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/TicketCountMapper.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/TicketCountMapper.java
new file mode 100644
index 0000000..7c2b085
--- /dev/null
+++ b/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 {
+}
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/TicketCountMapper.xml b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/TicketCountMapper.xml
new file mode 100644
index 0000000..6ff3619
--- /dev/null
+++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/mapper/TicketCountMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketCountService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/TicketCountService.java
new file mode 100644
index 0000000..baafdb9
--- /dev/null
+++ b/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 {
+
+ /**
+ * 两票生成月报统计
+ */
+ void loadMonthReport(String dateTime);
+
+}
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketCountServiceImpl.java
new file mode 100644
index 0000000..9101b20
--- /dev/null
+++ b/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 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 createDept = userClient.getDataScope(user.getUserId());
+ System.out.println("createDept = " + createDept);
+ //根据月份查询统计的数据
+ CompletableFuture> ticketCountsCompletableFuture = CompletableFuture.supplyAsync(() -> {
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(TicketCount::getDateTime, dateTime);
+ List ticketCounts = baseMapper.selectList(queryWrapper);
+ return ticketCounts;
+ }, executor);
+ //第一种工作票
+ CompletableFuture oneTicketCompletableFuture = ticketCountsCompletableFuture.thenAcceptAsync((items) -> {
+ //查询第一种工作票
+ List ticketCountList = getTicketCountList(createDept, items, "6", dateTime,user);
+ if (CollectionUtils.isNotEmpty(ticketCountList)) {
+ this.saveBatch(ticketCountList);
+ }
+ }, executor);
+ //第二种工作票
+ CompletableFuture twoTicketCompletableFuture = ticketCountsCompletableFuture.thenAcceptAsync((items) -> {
+ //查询第一种工作票
+ List ticketCountList = getTicketCountList(createDept, items, "7", dateTime,user);
+ if (CollectionUtils.isNotEmpty(ticketCountList)) {
+ this.saveBatch(ticketCountList);
+ }
+ }, executor);
+ //水力机械工作票
+ CompletableFuture threeTicketCompletableFuture = ticketCountsCompletableFuture.thenAcceptAsync((items) -> {
+ //查询第一种工作票
+ List ticketCountList = getTicketCountList(createDept, items, "8", dateTime,user);
+ if (CollectionUtils.isNotEmpty(ticketCountList)) {
+ this.saveBatch(ticketCountList);
+ }
+ }, executor);
+ //操作票
+ CompletableFuture standardCompletableFuture = ticketCountsCompletableFuture.thenAcceptAsync((items) -> {
+ //操作票
+ List 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 getStandardTicketCountList(List createDept, List items, String ticketType, String dateTime, BladeUser user) {
+ List ticketInfoEntities =
+ standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType);
+ if (CollectionUtils.isEmpty(ticketInfoEntities)) {
+ return null;
+ }
+ //根据站点分组
+ Map> createDeptTickets =
+ ticketInfoEntities.stream().collect(Collectors.groupingBy(StandardTicketInfoEntity::getCreateDept));
+ //获取 操作票的id,删除
+ if (CollectionUtils.isNotEmpty(items)) {
+ List collect = items.stream().filter(item -> ticketType.equals(item.getTicketType())).map(TicketCount::getId).collect(Collectors.toList());
+ if (CollectionUtils.isNotEmpty(collect)) {
+ baseMapper.deleteBatchIds(collect);
+ }
+ }
+ Set>> entries = createDeptTickets.entrySet();
+ List ticketCountList = new ArrayList<>();
+ for (Map.Entry> entry : entries) {
+ TicketCount ticketCount = new TicketCount();
+ ticketCount.setDateTime(dateTime);
+ ticketCount.setDeptId(entry.getKey());
+ ticketCount.setTenantId(user.getTenantId());
+ ticketCount.setCreateDept(user.getDeptId());
+ //根据id获取部门名称
+ R deptName = systemClient.getDeptName(entry.getKey());
+ if (deptName.isSuccess()) {
+ ticketCount.setDeptName(deptName.getData());
+ }
+ List values = entry.getValue();
+ ticketCount.setTicketType(CollectionUtils.isNotEmpty(values) ? values.get(0).getTicketType() : ticketType);
+ //1. 开票数量
+ List ticketNumbers =
+ values.stream().filter(item -> item.getFlowTaskName() != null).collect(Collectors.toList());
+ ticketCount.setTicketNumber(ticketNumbers.size());
+ //2. 完成数量
+ List ticketCompleteNums =
+ values.stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList());
+ ticketCount.setTicketCompleteNum(ticketCompleteNums.size());
+ //3. 延期数据量
+ ticketCount.setTicketDelayNum(0);
+ //4. 合格数量
+ List ticketIdList = values.stream().map(item -> item.getId()).collect(Collectors.toList());
+ LambdaQueryWrapper evaluateEntityLambdaQueryWrapper =
+ new LambdaQueryWrapper<>();
+ evaluateEntityLambdaQueryWrapper.in(TicketInfoEvaluateEntity::getTicketId, ticketIdList);
+ evaluateEntityLambdaQueryWrapper.eq(BaseEntity::getStatus, 1);
+ List 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 getTicketCountList(List createDept, List items, String ticketType, String dateTime, BladeUser user) {
+ List ticketInfoEntities =
+ workTicketInfoService.selectTicketByDeptIdWithTicketType(createDept, ticketType);
+ if (CollectionUtils.isEmpty(ticketInfoEntities)) {
+ return null;
+ }
+ //根据站点分组
+ Map> createDeptTickets = ticketInfoEntities.stream().collect(Collectors.groupingBy(BaseEntity::getCreateDept));
+ if (CollectionUtils.isNotEmpty(items)) {
+ //获取工作票的id,删除
+ List collect = items.stream().filter(item -> ticketType.equals(item.getTicketType())).map(TicketCount::getId).collect(Collectors.toList());
+ if (CollectionUtils.isNotEmpty(collect)) {
+ baseMapper.deleteBatchIds(collect);
+ }
+ }
+ Set>> entries = createDeptTickets.entrySet();
+
+ List ticketCountList = new ArrayList<>();
+ for (Map.Entry> entry : entries) {
+ TicketCount ticketCount = new TicketCount();
+ ticketCount.setDeptId(entry.getKey());
+ ticketCount.setDateTime(dateTime);
+ //根据id获取部门名称
+ R deptName = systemClient.getDeptName(entry.getKey());
+ if (deptName.isSuccess()) {
+ ticketCount.setDeptName(deptName.getData());
+ }
+ List values = entry.getValue();
+ ticketCount.setTicketType(CollectionUtils.isNotEmpty(values) ? values.get(0).getType() : ticketType);
+ //1. 开票数量
+ List ticketNumbers =
+ values.stream().filter(item -> item.getFlowTaskName() != null).collect(Collectors.toList());
+ ticketCount.setTicketNumber(ticketNumbers.size());
+ //2. 完成数量
+ List 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 ticketDelayNums =
+ values.stream().filter(item -> "延期".equals(item.getInput())).collect(Collectors.toList());
+ ticketCount.setTicketDelayNum(ticketDelayNums.size());
+ //4. 合格数量
+ List ticketIdList = values.stream().map(item -> item.getId()).collect(Collectors.toList());
+ LambdaQueryWrapper evaluateEntityLambdaQueryWrapper =
+ new LambdaQueryWrapper<>();
+ evaluateEntityLambdaQueryWrapper.in(TicketInfoEvaluateEntity::getTicketId, ticketIdList);
+ evaluateEntityLambdaQueryWrapper.eq(BaseEntity::getStatus, 1);
+ List evaluateEntities = ticketInfoEvaluateService.list(evaluateEntityLambdaQueryWrapper);
+ ticketCount.setTicketProportionNum(evaluateEntities.size());
+ ticketCountList.add(ticketCount);
+ }
+ return ticketCountList;
+ }
+}
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketInfoService.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketInfoService.java
index f5c48bf..1ecc3f5 100644
--- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketInfoService.java
+++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/IWorkTicketInfoService.java
@@ -155,4 +155,12 @@ public interface IWorkTicketInfoService extends BaseService selectTicketByDeptIdWithTicketType(List createDept, String ticketType);
}
diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java
index 0105a3d..f474bf5 100644
--- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/service/impl/WorkTicketInfoServiceImpl.java
+++ b/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.poi.ss.usermodel.Workbook;
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.support.BladePage;
import org.springblade.core.mp.support.Condition;
@@ -1093,4 +1094,19 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl selectTicketByDeptIdWithTicketType(List createDept, String ticketType) {
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(WorkTicketInfoEntity::getType,ticketType);
+ queryWrapper.in(BaseEntity::getCreateDept,createDept);
+ return baseMapper.selectList(queryWrapper);
+ }
}
diff --git a/hzims-service/ticket/src/main/resources/db/2.0.0.sql b/hzims-service/ticket/src/main/resources/db/2.0.0.sql
new file mode 100644
index 0000000..9d3c495
--- /dev/null
+++ b/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;
+
From a296d23e8394b8b32c49f56345e1c9e909598643 Mon Sep 17 00:00:00 2001
From: yang_shj <1069818635@QQ.com>
Date: Wed, 5 Jul 2023 14:20:05 +0800
Subject: [PATCH 3/3] =?UTF-8?q?#=E6=8A=A5=E8=A1=A8=E5=AF=BC=E5=87=BA?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../hzims/middle/processflow/controller/ProcessTypeController.java | 4 ----
hzims-service/weather/pom.xml | 6 ------
2 files changed, 10 deletions(-)
diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/controller/ProcessTypeController.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/controller/ProcessTypeController.java
index 3579ff7..900a62f 100644
--- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/controller/ProcessTypeController.java
+++ b/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 org.springblade.core.tool.api.R;
import org.springblade.core.tool.jackson.JsonUtil;
-import org.springblade.flow.core.feign.IFlowClient;
import org.springblade.queue.produce.QueueProduceService;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
@@ -50,9 +49,6 @@ public class ProcessTypeController {
private final RedisTemplate redisTemplate;
-
- private final IFlowClient flowClient;
-
private final QueueProduceService queueProduceService;
diff --git a/hzims-service/weather/pom.xml b/hzims-service/weather/pom.xml
index 3808259..b59b81d 100644
--- a/hzims-service/weather/pom.xml
+++ b/hzims-service/weather/pom.xml
@@ -23,12 +23,6 @@
-
-
- com.hnac.hzims
- hzims-biz-common
-
-
org.springblade
blade-common