diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/DefectService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/DefectService.java index fd9ebce..73fbb5f 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/DefectService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/DefectService.java @@ -11,5 +11,4 @@ import java.util.List; */ public interface DefectService extends BaseService { - SolveHomeVO solve_count(List deptIds, String start, String end); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/PhenomenonService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/PhenomenonService.java index 26a354e..4cc1312 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/PhenomenonService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/PhenomenonService.java @@ -1,6 +1,7 @@ package com.hnac.hzims.scheduled.service.operation.business; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; +import com.hnac.hzims.operational.defect.vo.SolveHomeVO; import com.hnac.hzims.operational.main.vo.ShortagesVo; import com.hnac.hzims.operational.report.vo.DutyDefectVO; import org.springblade.core.mp.base.BaseService; @@ -12,6 +13,8 @@ import java.util.List; */ public interface PhenomenonService extends BaseService { + SolveHomeVO solve_count(List deptIds, String start, String end); + DutyDefectVO defect(String start, String end, List areas); ShortagesVo defectMonth(String start, String end, List list); diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/DefectServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/DefectServiceImpl.java index 1103e13..9efd2c3 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/DefectServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/DefectServiceImpl.java @@ -26,28 +26,4 @@ import java.util.stream.Collectors; @AllArgsConstructor public class DefectServiceImpl extends BaseServiceImpl implements DefectService { - /** - * 消缺数量统计 - * @param deptIds - * @param start - * @param end - * @return - */ - @Override - public SolveHomeVO solve_count(List deptIds, String start, String end) { - SolveHomeVO solve = new SolveHomeVO(); - List defects = this.list(Wrappers.lambdaQuery() - .in(OperDefectEntity::getCreateDept,deptIds) - .gt(OperDefectEntity::getCreateTime,start) - .lt(OperDefectEntity::getCreateTime,end) - ); - if(cn.hutool.core.collection.CollectionUtil.isEmpty(defects)){ - solve.setDefectCount(0); - solve.setSolveCount(0); - }else{ - solve.setDefectCount(defects.size()); - solve.setSolveCount((int) defects.stream().filter(defect-> ObjectUtil.isNotEmpty(defect.getHandleTaskId())).count()); - } - return solve; - } } \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/PhenomenonServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/PhenomenonServiceImpl.java index 1dc8019..314cf00 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/PhenomenonServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/business/impl/PhenomenonServiceImpl.java @@ -1,7 +1,10 @@ package com.hnac.hzims.scheduled.service.operation.business.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.hnac.hzims.operational.defect.entity.OperDefectEntity; import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; +import com.hnac.hzims.operational.defect.vo.SolveHomeVO; import com.hnac.hzims.operational.main.vo.ShortagesVo; import com.hnac.hzims.operational.report.vo.DutyDefectVO; import com.hnac.hzims.scheduled.mapper.operation.PhenomenonMapper; @@ -11,6 +14,7 @@ import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.Func; +import org.springblade.core.tool.utils.ObjectUtil; import org.springframework.stereotype.Service; import java.time.LocalDate; @@ -28,6 +32,32 @@ import java.util.stream.Collectors; public class PhenomenonServiceImpl extends BaseServiceImpl implements PhenomenonService { /** + * 消缺数量统计 + * @param deptIds + * @param start + * @param end + * @return + */ + @Override + public SolveHomeVO solve_count(List deptIds, String start, String end) { + SolveHomeVO solve = new SolveHomeVO(); + List defects = this.list(Wrappers.lambdaQuery() + .in(OperPhenomenonEntity::getCreateDept,deptIds) + .gt(OperPhenomenonEntity::getCreateTime,start) + .lt(OperPhenomenonEntity::getCreateTime,end) + ); + if(cn.hutool.core.collection.CollectionUtil.isEmpty(defects)){ + solve.setDefectCount(0); + solve.setSolveCount(0); + }else{ + solve.setDefectCount(defects.size()); + solve.setSolveCount((int) defects.stream().filter(defect-> !ObjectUtil.isEmpty(defect.getHandleTaskId())).count()); + } + return solve; + } + + + /** * 时间范围内机构缺陷数据查询 * @param start * @param end diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java index 9d573a6..be7492f 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/home/impl/ShowServiceImpl.java @@ -80,7 +80,6 @@ public class ShowServiceImpl implements ShowService { private final OtherService otherService; private final AccessService accessService; private final TicketService ticketService; - private final DefectService defectService; private final DutyService dutyService; private final StationService stationService; private final OverDetailsService detailsService; @@ -397,7 +396,7 @@ public class ShowServiceImpl implements ShowService { }); // 消缺率 exe.execute(() -> { - SolveHomeVO solve = defectService.solve_count(areas,DateUtil.format(DateUtil.toDate(firstDateTime.toLocalDate()),DateUtil.PATTERN_DATETIME),DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME)); + SolveHomeVO solve = phenomenonService.solve_count(areas,DateUtil.format(DateUtil.toDate(firstDateTime.toLocalDate()),DateUtil.PATTERN_DATETIME),DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME)); if(Math.abs(solve.getSolveCount()) > 0 && Math.abs(solve.getDefectCount()) > 0){ target.setTaget_three(BigDecimal.valueOf((double)solve.getSolveCount() / solve.getDefectCount() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); }else{ diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java index 2624f0a..4032dff 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java @@ -547,8 +547,7 @@ public class OperPhenomenonServiceImpl extends BaseServiceImplString.valueOf(o.getId())).collect(Collectors.joining(","))); defectVO.setDefectSum(operPhenomenonList.size()); // 消缺数 - List defectList = operPhenomenonList.stream().filter(o -> (Func.isNotEmpty(o.getIsDefect()) && o.getIsDefect() == 0) || "1".equals(o.getConclusionStatus())). - map(OperPhenomenonEntity::getId).collect(Collectors.toList()); + List defectList = operPhenomenonList.stream().filter(defect -> !ObjectUtil.isEmpty(defect.getHandleTaskId())).map(OperPhenomenonEntity::getId).collect(Collectors.toList()); if(CollectionUtil.isEmpty(defectList)){ defectVO.setDefect(0); return defectVO; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java index 717f72e..f047a22 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java @@ -474,6 +474,7 @@ public class HomeServiceImpl implements HomeService { e.printStackTrace(); Thread.currentThread().interrupt(); } + exe.shutdown(); return target; }