From 6b022b9da4e68396605f1eb86ea32921e49c5943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Fri, 7 Jul 2023 16:11:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=A4=E7=A5=A8=E7=94=9F=E6=88=90=E6=9C=88?= =?UTF-8?q?=E6=8A=A5=E7=94=9F=E6=88=90=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/IStandardTicketInfoService.java | 15 ++++---- .../impl/StandardTicketInfoServiceImpl.java | 18 +++++----- .../controller/TicketCountController.java | 1 + .../service/impl/TicketCountServiceImpl.java | 40 +++++++++++++++++----- .../ticket/twoTicket/vo/ticket/TicketCountVo.java | 3 ++ .../workTicket/service/IWorkTicketInfoService.java | 5 +-- .../service/impl/WorkTicketInfoServiceImpl.java | 13 ++++--- 7 files changed, 62 insertions(+), 33 deletions(-) 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 f17194c..9ba86e3 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 @@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO; import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketVo; -import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo; import com.hnac.hzims.ticket.standardTicket.dto.StandardTicketInfoDto; import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; @@ -119,10 +118,12 @@ public interface IStandardTicketInfoService extends BaseService selectStandardTicketByDeptIdWithTicketType(List createDept, String ticketType); + * 根据部门Id数组查询操作票数据 + * + * @param createDept + * @param ticketType + * @param dateTime + * @return + */ + List selectStandardTicketByDeptIdWithTicketType(List createDept, String ticketType, String dateTime); } 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 e3dc3f2..22dd9ab 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 @@ -5,8 +5,6 @@ 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.toolkit.CollectionUtils; -import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; @@ -15,7 +13,6 @@ import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO; import com.hnac.hzims.ticket.allTicket.vo.DoublePassVO; import com.hnac.hzims.ticket.allTicket.vo.TicketInfoStatisticVO; import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketVo; -import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo; import com.hnac.hzims.ticket.constants.DictConstants; import com.hnac.hzims.ticket.constants.TicketConstants; @@ -401,7 +398,7 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl standardTicketMeasure = measureService.listStandardByTicketId(ticketId); - if (CollectionUtils.isNotEmpty(standardTicketMeasure)){ + if (CollectionUtils.isNotEmpty(standardTicketMeasure)) { List collect = standardTicketMeasure.stream().map(standardTicketMeasureEntity -> { StandardTicketMeasureVo standardTicketMeasureVO = new StandardTicketMeasureVo(); BeanUtils.copyProperties(standardTicketMeasureEntity, standardTicketMeasureVO); @@ -423,6 +420,7 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl selectStandardTicketByDeptIdWithTicketType(List createDept, String ticketType) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(StandardTicketInfoEntity::getTicketType,ticketType); - queryWrapper.in(StandardTicketInfoEntity::getCreateDept,createDept); + public List selectStandardTicketByDeptIdWithTicketType(List createDept, String ticketType, String dateTime) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(StandardTicketInfoEntity::getTicketType, ticketType); + queryWrapper.lambda().in(StandardTicketInfoEntity::getCreateDept, createDept); + queryWrapper.apply("date_format(CREATE_TIME,'%Y-%m') = {0}", dateTime); 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 index a52367b..202bb4e 100644 --- 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 @@ -9,6 +9,7 @@ import org.springblade.core.tool.api.R; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import java.time.YearMonth; import java.util.List; /** 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 index 66ac476..0003eaa 100644 --- 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 @@ -45,6 +45,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.URLEncoder; +import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ThreadPoolExecutor; @@ -90,7 +91,6 @@ public class TicketCountServiceImpl extends BaseServiceImpl createDept = userClient.getDataScope(user.getUserId()); - System.out.println("createDept = " + createDept); //根据月份查询统计的数据 CompletableFuture> ticketCountsCompletableFuture = CompletableFuture.supplyAsync(() -> { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); @@ -132,7 +132,8 @@ public class TicketCountServiceImpl extends BaseServiceImpl selectTicketCountLlist(TicketCountVo ticketCountVo) { //获取keyword String keyword = ticketCountVo.getKeyword(); + String dateTime = ticketCountVo.getDateTime(); QueryWrapper ticketCountQueryWrapper = new QueryWrapper<>(); ticketCountQueryWrapper.like(StringUtils.isNotBlank(keyword), "dept_name", keyword); + ticketCountQueryWrapper.eq(StringUtils.isNotBlank(dateTime), "date_time", dateTime); List ticketCounts = baseMapper.selectList(ticketCountQueryWrapper); List result = getTicketCountResponseList(ticketCounts); return result; @@ -300,7 +303,8 @@ public class TicketCountServiceImpl extends BaseServiceImpl getStandardTicketCountList(List createDept, List items, String ticketType, String dateTime, BladeUser user) { - List ticketInfoEntities = standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType); + List ticketInfoEntities = + standardTicketInfoService.selectStandardTicketByDeptIdWithTicketType(createDept, ticketType,dateTime); if (CollectionUtils.isEmpty(ticketInfoEntities)) { return null; } @@ -361,8 +365,13 @@ public class TicketCountServiceImpl extends BaseServiceImpl getTicketCountList(List createDept, List items, String ticketType, String dateTime, BladeUser user) { - List ticketInfoEntities = workTicketInfoService.selectTicketByDeptIdWithTicketType(createDept, ticketType); + private List getTicketCountList(List createDept, + List items, + String ticketType, + String dateTime, + BladeUser user) { + List ticketInfoEntities = + workTicketInfoService.selectTicketByDeptIdWithTicketType(createDept, ticketType,dateTime); if (CollectionUtils.isEmpty(ticketInfoEntities)) { return null; } @@ -391,16 +400,19 @@ public class TicketCountServiceImpl extends BaseServiceImpl 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()); + 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()); + List ticketCompleteNums = + values.stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList()); ticketCount.setTicketCompleteNum(ticketCompleteNums.size()); ticketCount.setTenantId(user.getTenantId()); ticketCount.setCreateDept(Long.valueOf(user.getDeptId())); ticketCount.setCreateUser(user.getUserId()); //3. 延期数据量 - List ticketDelayNums = values.stream().filter(item -> "延期".equals(item.getInput())).collect(Collectors.toList()); + 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()); @@ -413,4 +425,16 @@ public class TicketCountServiceImpl extends BaseServiceImpl selectTicketByDeptIdWithTicketType(List createDept, String ticketType); + List selectTicketByDeptIdWithTicketType(List createDept, String ticketType, String dateTime); } 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 f474bf5..5dbca58 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 @@ -20,14 +20,12 @@ import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO; import com.hnac.hzims.operational.maintenance.feign.ITaskClient; import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; import com.hnac.hzims.ticket.allTicket.service.TicketInfoEvaluateService; -import com.hnac.hzims.ticket.areamonthly.vo.AreaMonthlyVo; import com.hnac.hzims.ticket.areamonthly.vo.StandardTicketWithAreaVo; import com.hnac.hzims.ticket.areamonthly.vo.StandardWorkVo; import com.hnac.hzims.ticket.aspect.AroundFlow; import com.hnac.hzims.ticket.constants.TicketConstants; import com.hnac.hzims.ticket.twoTicket.entity.TicketInfoDanger; import com.hnac.hzims.ticket.twoTicket.entity.WorkTicketFinish; -import com.hnac.hzims.ticket.twoTicket.enums.FlowWorkTicketConstants; import com.hnac.hzims.ticket.twoTicket.service.TicketInfoDangerService; import com.hnac.hzims.ticket.twoTicket.service.impl.WorkTicketFinishServiceImpl; import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo; @@ -44,7 +42,6 @@ import com.hnac.hzims.ticket.workTicket.wrapper.WorkTicketInfoWrapper; import com.hnac.hzims.vo.SafeCheckStatisticVO; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import lombok.var; import org.apache.commons.collections.map.HashedMap; import org.apache.poi.ss.usermodel.Workbook; import org.springblade.core.log.exception.ServiceException; @@ -1100,13 +1097,15 @@ public class WorkTicketInfoServiceImpl extends BaseServiceImpl selectTicketByDeptIdWithTicketType(List createDept, String ticketType) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(WorkTicketInfoEntity::getType,ticketType); - queryWrapper.in(BaseEntity::getCreateDept,createDept); + public List selectTicketByDeptIdWithTicketType(List createDept, String ticketType, String dateTime) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.lambda().eq(WorkTicketInfoEntity::getType, ticketType); + queryWrapper.lambda().in(BaseEntity::getCreateDept, createDept); + queryWrapper.apply("date_format(CREATE_TIME,'%Y-%m') = {0}" , dateTime); return baseMapper.selectList(queryWrapper); } }