From b904a9fb7ca37af5abe1fe69bca3e8b0418c410a Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Wed, 7 Jun 2023 14:32:28 +0800 Subject: [PATCH] =?UTF-8?q?#=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=E6=8A=BD?= =?UTF-8?q?=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/operational/report/vo/DutyDefectVO.java | 20 + .../hzims/scheduled/mapper/inspect/TaskMapper.java | 13 + .../mapper/operation/PhenomenonMapper.java | 11 + .../mapper/safeproduct/CompanyMapper.java | 10 + .../mapper/safeproduct/InstanceMapper.java | 16 + .../scheduled/mapper/safeproduct/MonthMapper.java | 11 + .../scheduled/mapper/safeproduct/TrialMapper.java | 11 + .../scheduled/scheduled/MonitorScheduledTask.java | 4 +- .../scheduled/scheduled/ReportScheduledTask.java | 26 + .../scheduled/service/inspect/TaskService.java | 15 + .../service/inspect/impl/TaskServiceImpl.java | 64 +++ .../scheduled/service/operation/AccessService.java | 3 + .../service/operation/MaintenanceService.java | 3 + .../service/operation/MonitorService.java | 4 + .../service/operation/PhenomenonService.java | 15 + .../scheduled/service/operation/ReportService.java | 9 + .../service/operation/impl/AccessServiceImpl.java | 37 +- .../operation/impl/MaintenanceServiceImpl.java | 38 ++ .../operation/impl/PhenomenonServiceImpl.java | 60 +++ .../operation/impl/RealTargetServiceImpl.java | 1 - .../service/operation/impl/ReportServiceImpl.java | 527 +++++++++++++++++++++ .../service/safeproduct/CompanyService.java | 11 + .../service/safeproduct/InstanceService.java | 12 + .../service/safeproduct/MonthService.java | 14 + .../service/safeproduct/TrialService.java | 13 + .../safeproduct/impl/CompanyServiceImpl.java | 19 + .../safeproduct/impl/InstanceServiceImpl.java | 19 + .../service/safeproduct/impl/MonthServiceImpl.java | 96 ++++ .../service/safeproduct/impl/TrialServiceImpl.java | 50 ++ .../scheduled/service/ticket/TicketService.java | 4 + .../service/ticket/impl/TicketServiceImpl.java | 62 +++ .../main/resources/mapper/inspect/TaskMapper.xml | 4 + .../mapper/operation/PhenomenonMapper.xml | 5 + .../resources/mapper/safeproduct/CompanyMapper.xml | 6 + .../mapper/safeproduct/InstanceMapper.xml | 5 + .../resources/mapper/safeproduct/MonthMapper.xml | 5 + .../resources/mapper/safeproduct/TrialMapper.xml | 20 + .../hzims/operational/report/vo/DutyDefectVO.java | 17 - .../mapper/CheckItemInstanceMapper.java | 16 - .../safeproduct/mapper/CheckItemInstanceMapper.xml | 20 - .../service/impl/CheckItemServiceImpl.java | 3 - 41 files changed, 1239 insertions(+), 60 deletions(-) create mode 100644 hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/DutyDefectVO.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/PhenomenonMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/safeproduct/CompanyMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/safeproduct/InstanceMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/safeproduct/MonthMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/safeproduct/TrialMapper.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/PhenomenonService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/ReportService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/PhenomenonServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ReportServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/CompanyService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/InstanceService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/MonthService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/TrialService.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/impl/CompanyServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/impl/InstanceServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/impl/MonthServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/impl/TrialServiceImpl.java create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/operation/PhenomenonMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/safeproduct/CompanyMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/safeproduct/InstanceMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/safeproduct/MonthMapper.xml create mode 100644 hzims-service/hzims-scheduled/src/main/resources/mapper/safeproduct/TrialMapper.xml delete mode 100644 hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/DutyDefectVO.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckItemInstanceMapper.java delete mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckItemInstanceMapper.xml diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/DutyDefectVO.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/DutyDefectVO.java new file mode 100644 index 0000000..177185d --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/report/vo/DutyDefectVO.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.operational.report.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author ysj + */ +@Data +public class DutyDefectVO{ + + @ApiModelProperty("缺陷总数") + private Integer defectSum; + + @ApiModelProperty("缺陷数") + private Integer defect; + + @ApiModelProperty("缺陷总数ID 按逗号分隔") + private String totalIds; +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskMapper.java new file mode 100644 index 0000000..1a4a34b --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/inspect/TaskMapper.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.mapper.inspect; + +import com.hnac.hzinfo.inspect.task.entity.TaskEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +@Mapper +public interface TaskMapper extends UserDataScopeBaseMapper { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/PhenomenonMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/PhenomenonMapper.java new file mode 100644 index 0000000..58eebab --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/PhenomenonMapper.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.mapper.operation; + +import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface PhenomenonMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/safeproduct/CompanyMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/safeproduct/CompanyMapper.java new file mode 100644 index 0000000..00aa8a5 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/safeproduct/CompanyMapper.java @@ -0,0 +1,10 @@ +package com.hnac.hzims.scheduled.mapper.safeproduct; + +import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface CompanyMapper extends UserDataScopeBaseMapper { +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/safeproduct/InstanceMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/safeproduct/InstanceMapper.java new file mode 100644 index 0000000..1dedec0 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/safeproduct/InstanceMapper.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.scheduled.mapper.safeproduct; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.safeproduct.entity.CheckItemInstanceEntity; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * Created by Sam Huang 2022/5/6 8:23 + */ +public interface InstanceMapper extends BaseMapper { + + List getCheckItemInstanceByMonth(@Param("months") List months, @Param("deptId") Long deptId); + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/safeproduct/MonthMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/safeproduct/MonthMapper.java new file mode 100644 index 0000000..4454508 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/safeproduct/MonthMapper.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.mapper.safeproduct; + +import com.hnac.hzims.safeproduct.entity.CheckMonthEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface MonthMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/safeproduct/TrialMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/safeproduct/TrialMapper.java new file mode 100644 index 0000000..04496f0 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/safeproduct/TrialMapper.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.mapper.safeproduct; + +import com.hnac.hzims.safeproduct.entity.SafeEquipmentTrialEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * 设备试验mapper接口 + */ +public interface TrialMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java index ed0af83..6e5a0e9 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/MonitorScheduledTask.java @@ -42,7 +42,7 @@ public class MonitorScheduledTask { */ @XxlJob(REAL_TIME_DATA) //@Scheduled(cron = "0/40 * * * * ? ") - public ReturnT loadRealData(String param) throws Exception { + public ReturnT loadRealData(String param) { if (Func.isBlank(param)) { param = DateUtil.format(new Date(), "yyyy-MM"); } @@ -55,7 +55,7 @@ public class MonitorScheduledTask { * @return ReturnT */ @XxlJob(CENTRALIZED_MONITORING) - public ReturnT loadMonitoring(String param) throws Exception { + public ReturnT loadMonitoring(String param) { if (Func.isBlank(param)) { param = DateUtil.format(new Date(), "yyyy-MM"); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java index b5d19a6..7f59697 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ReportScheduledTask.java @@ -1,8 +1,18 @@ package com.hnac.hzims.scheduled.scheduled; +import com.hnac.hzims.scheduled.service.operation.ReportService; +import com.xxl.job.core.biz.model.ReturnT; +import com.xxl.job.core.handler.annotation.XxlJob; import lombok.extern.slf4j.Slf4j; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.Func; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.util.Date; + +import static com.hnac.hzims.operational.main.constant.MainConstants.AREA_MONTH_REPORT; + /** * @author ysj @@ -11,4 +21,20 @@ import org.springframework.stereotype.Component; @Component public class ReportScheduledTask { + @Autowired + private ReportService service; + + /** + * 首页-生产月报表 + * @return ReturnT + */ + @XxlJob(AREA_MONTH_REPORT) + public ReturnT loadMonthReport(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"); + } + service.loadMonthReport(param,1); + return new ReturnT<>("SUCCESS"); + } + } \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskService.java new file mode 100644 index 0000000..6d25531 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/TaskService.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.scheduled.service.inspect; + +import com.hnac.hzinfo.inspect.task.entity.TaskEntity; +import com.hnac.hzinfo.inspect.task.vo.DutyInspectTaskVO; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author ysj + */ +public interface TaskService extends BaseService { + + DutyInspectTaskVO task(String start, String end, List areas); +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskServiceImpl.java new file mode 100644 index 0000000..6fcc206 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/inspect/impl/TaskServiceImpl.java @@ -0,0 +1,64 @@ +package com.hnac.hzims.scheduled.service.inspect.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hnac.hzims.scheduled.mapper.inspect.TaskMapper; +import com.hnac.hzims.scheduled.service.inspect.TaskService; +import com.hnac.hzinfo.inspect.task.entity.TaskEntity; +import com.hnac.hzinfo.inspect.task.vo.DutyInspectTaskVO; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +public class TaskServiceImpl extends BaseServiceImpl implements TaskService { + + /** + * 时间区间机构的巡检任务数据查询 + * @param start + * @param end + * @param areas + * @return + */ + @Override + public DutyInspectTaskVO task(String start, String end, List areas) { + DutyInspectTaskVO task = new DutyInspectTaskVO(); + task.setInspectTaskSum(0); + task.setInspectTaskFinish(0); + task.setNotExecuteTaskCount(0); + // 查询所有巡检任务 + List tasks = this.list(new LambdaQueryWrapper() {{ + ge(TaskEntity::getPlanStartTime, start) + .le(TaskEntity::getPlanStartTime, end) + .in(TaskEntity::getCreateDept, areas); + }}); + if(CollectionUtil.isEmpty(tasks)){ + return task; + } + task.setInspectTaskIds(tasks.stream().map(TaskEntity::getId).map(Object::toString).collect(Collectors.joining(","))); + task.setInspectTaskSum(tasks.size()); + // 所有处理完成巡检任务 + List finshList = tasks.stream().filter(o-> null != o.getStatus() && o.getStatus().equals(3)).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(finshList)){ + return task; + } + task.setInspectTaskFinish(finshList.size()); + // 未执行任务数 + List notExecuteList = tasks.stream().filter(o-> null != o.getStatus() && o.getStatus().equals(0)).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(notExecuteList)){ + return task; + } + task.setNotExecuteTaskCount(notExecuteList.size()); + return task; + } +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AccessService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AccessService.java index f42d943..9a2d858 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AccessService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AccessService.java @@ -1,6 +1,7 @@ package com.hnac.hzims.scheduled.service.operation; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; +import com.hnac.hzims.operational.main.vo.OverhaulVo; import org.springblade.core.mp.base.BaseService; import java.util.List; @@ -11,4 +12,6 @@ import java.util.List; public interface AccessService extends BaseService { double accessCount(List areas); + + OverhaulVo overhaul(String start, String end, List areas); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/MaintenanceService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/MaintenanceService.java index 49b4012..31d2be0 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/MaintenanceService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/MaintenanceService.java @@ -1,5 +1,6 @@ package com.hnac.hzims.scheduled.service.operation; +import com.hnac.hzims.operational.main.vo.MaintainVo; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import org.springblade.core.mp.base.BaseService; @@ -12,4 +13,6 @@ public interface MaintenanceService extends BaseService departList); + + MaintainVo maintain(String start, String end, List areas); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/MonitorService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/MonitorService.java index d9bfd85..5df3786 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/MonitorService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/MonitorService.java @@ -1,5 +1,9 @@ package com.hnac.hzims.scheduled.service.operation; +import org.springblade.core.tool.api.R; + +import java.util.Map; + /** * WEB水电站首页接口 * @author ysj diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/PhenomenonService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/PhenomenonService.java new file mode 100644 index 0000000..fe294d8 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/PhenomenonService.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.scheduled.service.operation; + +import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; +import com.hnac.hzims.operational.report.vo.DutyDefectVO; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author ysj + */ +public interface PhenomenonService extends BaseService { + + DutyDefectVO defect(String start, String end, List areas); +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/ReportService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/ReportService.java new file mode 100644 index 0000000..2fe62ac --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/ReportService.java @@ -0,0 +1,9 @@ +package com.hnac.hzims.scheduled.service.operation; + +/** + * @author ysj + */ +public interface ReportService { + + void loadMonthReport(String param, int i); +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AccessServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AccessServiceImpl.java index 1a1fb7c..da01d8e 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AccessServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AccessServiceImpl.java @@ -1,20 +1,23 @@ package com.hnac.hzims.scheduled.service.operation.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hnac.hzims.operational.access.constants.AccessConstants; import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; +import com.hnac.hzims.operational.main.vo.OverhaulVo; import com.hnac.hzims.scheduled.mapper.operation.AccessMapper; import com.hnac.hzims.scheduled.service.operation.AccessService; import lombok.AllArgsConstructor; 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.springframework.stereotype.Service; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.util.List; - +import java.util.stream.Collectors; /** * @author ysj @@ -48,4 +51,36 @@ public class AccessServiceImpl extends BaseServiceImpl areas) { + OverhaulVo overhaulVo = new OverhaulVo(); + // 检修总数 + List overhaulList = this.list(new LambdaQueryWrapper(){{ + ge(OperAccessTaskEntity::getPlanStartTime,start); + le(OperAccessTaskEntity::getPlanStartTime,end); + in(OperAccessTaskEntity::getCreateDept,areas); + }}); + if(CollectionUtil.isEmpty(overhaulList)){ + overhaulVo.setOverhaul(0); + overhaulVo.setOverhaulFinish(0); + return overhaulVo; + } + overhaulVo.setOverhaul(overhaulList.size()); + // 检修完成数量 + List overhaulFinishTask = overhaulList.stream().filter(task-> Func.isNotEmpty(task.getStatus()) && AccessConstants.ACCESS_TASK_STATUS_4 == task.getStatus()) + .map(OperAccessTaskEntity::getId).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(overhaulFinishTask)){ + overhaulVo.setOverhaulFinish(0); + } + overhaulVo.setOverhaulFinish(overhaulFinishTask.size()); + return overhaulVo; + } } \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MaintenanceServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MaintenanceServiceImpl.java index 6ec8d3e..7152ace 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MaintenanceServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MaintenanceServiceImpl.java @@ -1,6 +1,8 @@ package com.hnac.hzims.scheduled.service.operation.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hnac.hzims.operational.main.vo.MaintainVo; +import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.scheduled.mapper.operation.MaintenanceMapper; import com.hnac.hzims.scheduled.service.operation.MaintenanceService; @@ -8,12 +10,14 @@ import lombok.RequiredArgsConstructor; 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.springframework.stereotype.Service; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.util.List; +import java.util.stream.Collectors; /** * @author ysj @@ -47,4 +51,38 @@ public class MaintenanceServiceImpl extends BaseServiceImpl areas) { + MaintainVo maintainVo = new MaintainVo(); + //日常维护 + List maintainList = this.list(new LambdaQueryWrapper(){{ + ge(OperMaintenanceTaskEntity::getDisposeTime,start); + le(OperMaintenanceTaskEntity::getDisposeTime,end); + in(OperMaintenanceTaskEntity::getCreateDept,areas); + }}); + if(CollectionUtil.isEmpty(maintainList)){ + maintainVo.setMaintain(0); + maintainVo.setMaintainFinish(0); + return maintainVo; + } + // 日常维护完成数 + maintainVo.setMaintain(maintainList.size()); + List maintainFinish = maintainList.stream().filter(o-> Func.isNotEmpty(o.getStatus()) && MaintenanceConstant.TASK_STATUS_5 == o.getStatus()) + .map(OperMaintenanceTaskEntity::getId).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(maintainFinish)){ + maintainVo.setMaintainFinish(0); + } + maintainVo.setMaintainFinish(maintainFinish.size()); + return maintainVo; + } + + } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/PhenomenonServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/PhenomenonServiceImpl.java new file mode 100644 index 0000000..4afdf08 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/PhenomenonServiceImpl.java @@ -0,0 +1,60 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; +import com.hnac.hzims.operational.report.vo.DutyDefectVO; +import com.hnac.hzims.scheduled.mapper.operation.PhenomenonMapper; +import com.hnac.hzims.scheduled.service.operation.PhenomenonService; +import lombok.AllArgsConstructor; +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.springframework.stereotype.Service; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +public class PhenomenonServiceImpl extends BaseServiceImpl implements PhenomenonService { + + /** + * 时间范围内机构缺陷数据查询 + * @param start + * @param end + * @param areas + * @return + */ + @Override + public DutyDefectVO defect(String start, String end, List areas) { + DutyDefectVO defectVO = new DutyDefectVO(); + // 查询缺陷现象总数 + List operPhenomenonList = this.list(new LambdaQueryWrapper(){{ + ge(OperPhenomenonEntity::getCreateTime,start); + le(OperPhenomenonEntity::getCreateTime,end); + in(OperPhenomenonEntity::getCreateDept,areas); + }}); + if(CollectionUtil.isEmpty(operPhenomenonList)){ + defectVO.setDefectSum(0); + defectVO.setDefect(0); + return defectVO; + } + defectVO.setTotalIds(operPhenomenonList.stream().map(o->String.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()); + if(CollectionUtil.isEmpty(defectList)){ + defectVO.setDefect(0); + return defectVO; + } + // 缺陷总数 + defectVO.setDefect(defectList.size()); + return defectVO; + } +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java index c34da3f..6e08365 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java @@ -82,7 +82,6 @@ public class RealTargetServiceImpl implements RealTargetService { private final static String loadwaterpump_target_key = "hzims:operation:loadwaterpump:target:key"; private final static String loadwaterpump_real_key = "hzims:operation:loadwaterpump:real:key"; private final static String loadwater_level_key = "hzims:operation:loadwater:level:key"; - private final static String loadwater_group_key = "hzims:operation:group:key"; private final static String load_photovoltaic_real_key = "hzims:operation:photovoltaic:real:key"; private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key"; diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ReportServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ReportServiceImpl.java new file mode 100644 index 0000000..df04ec4 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ReportServiceImpl.java @@ -0,0 +1,527 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import com.hnac.hzims.equipment.entity.PlanGenerationEntity; +import com.hnac.hzims.message.dto.MailPushDto; +import com.hnac.hzims.message.fegin.IPushMsgClient; +import com.hnac.hzims.operational.main.constant.HomePageConstant; +import com.hnac.hzims.operational.main.vo.AreaMonthReportVo; +import com.hnac.hzims.operational.main.vo.MaintainVo; +import com.hnac.hzims.operational.main.vo.OverhaulVo; +import com.hnac.hzims.operational.report.vo.DutyDefectVO; +import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO; +import com.hnac.hzims.scheduled.service.equipment.PlanService; +import com.hnac.hzims.scheduled.service.inspect.TaskService; +import com.hnac.hzims.scheduled.service.operation.*; +import com.hnac.hzims.scheduled.service.safeproduct.MonthService; +import com.hnac.hzims.scheduled.service.safeproduct.TrialService; +import com.hnac.hzims.scheduled.service.ticket.TicketService; +import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO; +import com.hnac.hzinfo.inspect.task.vo.DutyInspectTaskVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.MapUtils; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.DateUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.core.tool.utils.StringUtil; +import org.springblade.system.entity.Dept; +import org.springblade.system.feign.ISysClient; +import org.springblade.system.user.entity.User; +import org.springblade.system.user.feign.IUserClient; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.*; +import java.util.concurrent.*; +import java.util.stream.Collectors; + +/** + * @author ysj + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class ReportServiceImpl implements ReportService { + + private final PlanService planService; + private final TaskService taskService; + private final TrialService trialService; + private final AccessService accessService; + private final TicketService ticketService; + private final StationService stationService; + private final MonthService monthService; + private final PhenomenonService phenomenonService; + private final MaintenanceService maintenanceService; + private final RedisTemplate redisTemplate; + private final ISysClient sysClient; + private final IUserClient userClient; + private final IPushMsgClient pushMsgClient; + + private final static String recent_year_cache_final = "hzims:operation:key:power:data"; + + @Value("${hzims.operation.area.report}") + private String report_month_cache_final; + + + /** + * 区域-月报 + * @param param + * @param year + */ + @Override + public void loadMonthReport(String param, int year) { + // 获取所有机构 + R> R = sysClient.getDeptList(); + if (!R.isSuccess() || CollectionUtil.isEmpty(R.getData())) { + return; + } + // 查询所有服务类型——"运维服务"、站点类型——"水电站" + List stations = stationService.list(Wrappers.lambdaQuery() + .eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) + .eq(StationEntity::getType,HomePageConstant.HYDROPOWER) + ); + if (CollectionUtil.isEmpty(stations)) { + return; + } + // 站点近年发电数据 + Map> powerMap = (Map>) redisTemplate.opsForValue().get(recent_year_cache_final); + // 存储数据节点 key - 月份 value - 区域数据集合 + Map> map = new HashMap<>(); + // 月份集合 + List monthList = getMonthList(year, Calendar.getInstance().get(Calendar.MONTH)); + monthList.forEach(mon -> { + List list = this.getAreaReportByMon(R.getData(), powerMap, stations, mon); + if (CollectionUtil.isEmpty(list)) { + return; + } + map.put(mon, list); + }); + // 推送当月报表邮件 + this.sendMonthReport(map, R.getData()); + redisTemplate.opsForValue().set(report_month_cache_final, map); + } + + /** + * 获取近年月份集合 + * + * @param year + * @return + */ + public static List getMonthList(int year, int endMoth) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM"); + // 开始日期 + Calendar endCal = Calendar.getInstance(); + endCal.setTime(new Date()); + endCal.add(Calendar.MONTH, -endCal.get(Calendar.MONTH) + endMoth); + endCal.add(Calendar.DATE, -endCal.get(Calendar.DATE) + 1); + + // 结束日期 + Calendar startCal = Calendar.getInstance(); + startCal.setTime(new Date()); + startCal.set(Calendar.YEAR, startCal.get(Calendar.YEAR) - year); + startCal.add(Calendar.MONTH, -startCal.get(Calendar.MONTH)); + startCal.add(Calendar.DATE, -startCal.get(Calendar.DATE) + 1); + // 获取日期之间的月份 + List list = new ArrayList<>(); + while (endCal.after(startCal)) { + list.add(format.format(startCal.getTime())); + startCal.add(Calendar.MONTH, 1); + } + list.add(format.format(endCal.getTime())); + return list; + } + + /** + * 区域月报数据加载 + * @param deptList + * @param powerMap + * @param stationList + * @param mon + * @return + */ + private List getAreaReportByMon(List deptList, Map> powerMap, List stationList, String mon) { + LocalDateTime startTime = LocalDateTime.parse(mon + "-01 00:00:00", DateUtil.DATETIME_FORMATTER); + LocalDateTime endTime = getEndTime(mon); + // 查询所有站点的计划发电量 + List planList = this.planPower(stationList, mon); + // 站点实际发电量 + Map actualMap = this.actualPower(powerMap, stationList, mon + "-01"); + // 站点去年发电量 + Map oldActualMap = this.actualPower(powerMap, stationList, lastyear(1,mon)); + // 站点前发电量 + Map oldOldActualMap = this.actualPower(powerMap, stationList, lastyear(2,mon)); + // 取机构中区域部分 + List areaList = deptList.stream().filter(o -> o.getDeptCategory().equals(3)).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(areaList)) { + return null; + } + List areaMonthReportVoList = new ArrayList<>(); + areaList.forEach(area -> { + AreaMonthReportVo areaMonthReport = new AreaMonthReportVo(); + areaMonthReport.setAreaId(area.getId()); + areaMonthReport.setAreaName(area.getDeptName()); + // 获取区域下的站点 + List stationIdList = deptList.stream().filter(o -> o.getParentId().equals(area.getId()) && o.getDeptCategory().equals(4)).map(Dept::getId).collect(Collectors.toList()); + List areaStationList = stationList.stream().filter(o -> stationIdList.contains(o.getRefDept())).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(areaStationList)) { + return; + } + // 计划发电量、实际发电量、发电完成率 + this.powerMonth(planList, actualMap, oldActualMap, areaStationList, areaMonthReport); + // 操作票、操作票合格率/ 工作票、工作票合格率 + this.doubleMonth(area, areaMonthReport, mon + "-01 00:00:00", this.strEndTime(mon)); + // 日常维护、巡检任务、缺陷数、消缺率、检修任务 + this.taskMonth(Collections.singletonList(area.getId()), areaMonthReport, mon + "-01 00:00:00", strEndTime(mon)); + // 预测 + this.predictPlanPower(oldActualMap,oldOldActualMap,areaStationList,areaMonthReport); + // 安全生产会议次数、月度检查报告、技能培训、安全大检查 + this.securityCheck(Collections.singletonList(area.getId()),areaMonthReport,mon + "-01 00:00:00", strEndTime(mon)); + // 设备试验 + this.getDeviceTry(mon + "-01 00:00:00", strEndTime(mon), Collections.singletonList(area.getId()),areaMonthReport); + areaMonthReportVoList.add(areaMonthReport); + }); + return areaMonthReportVoList; + } + + /** + * 获取结束时间 + */ + private LocalDateTime getEndTime(String mon) { + Date date = DateUtil.parse(mon + "-01 00:00:00",DateUtil.DATETIME_FORMAT); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.MONTH, 1); + return calendar.getTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + } + + /** + * 获取站点计划发电量 + */ + private List planPower(List stationList, String mon) { + List list = stationList.stream().map(StationEntity::getCode).collect(Collectors.toList()); + return planService.planGeneration(list, null, mon); + } + + /** + * 获取站点月份实际发电量 + */ + private Map actualPower(Map> powerMap, List stationList, String month) { + if (MapUtils.isEmpty(powerMap)) { + return null; + } + // 站点Id集合 + List stationIdList = stationList.stream().map(StationEntity::getId).collect(Collectors.toList()); + // 存储站点实际发电量 + Map actualPowerMap = new HashMap<>(); + stationIdList.forEach(key -> { + Map monthMap = powerMap.get(key); + if (MapUtils.isEmpty(monthMap)) { + return; + } + float actualPower = 0f; + if(ObjectUtil.isNotEmpty(monthMap.get(month))){ + actualPower = monthMap.get(month); + } + actualPowerMap.put(key, actualPower); + }); + return actualPowerMap; + } + + /** + * 获取去年时间 + */ + private String lastyear(int year,String mon) { + Date date = DateUtil.parse(mon + "-01 00:00:00",DateUtil.DATETIME_FORMAT); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - year); + calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); + return DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); + } + + /** + * 获取结束时间 + */ + private String strEndTime(String mon) { + Date date = DateUtil.parse(mon + "-01 00:00:00",DateUtil.DATETIME_FORMAT); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.MONTH, 1); + return DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); + } + + /** + * 区域-月计划发电量、月实际发电量、月发电完成率、同比 + * + * @param planList + * @param actualMap + * @param oldActualMap + * @param areaStationList + * @param areaMonthReport + */ + private void powerMonth(List planList, Map actualMap, Map oldActualMap, List areaStationList, AreaMonthReportVo areaMonthReport) { + // 计划发电量 + List codeList = areaStationList.stream().map(StationEntity::getCode).collect(Collectors.toList()); + double planPower = planList.stream().filter(o -> codeList.contains(o.getStationId())).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); + areaMonthReport.setPlanPower(Float.parseFloat(String.valueOf(planPower))); + if (MapUtils.isEmpty(actualMap)) { + areaMonthReport.setActualPower(0f); + areaMonthReport.setPowerFinishRate(0.0); + return; + } + // 实际发电量 + List ids = areaStationList.stream().map(StationEntity::getId).collect(Collectors.toList()); + double actualPower = actualMap.entrySet().stream().filter(e -> ids.contains(e.getKey())).mapToDouble(Map.Entry::getValue).sum(); + areaMonthReport.setActualPower(Float.parseFloat(String.valueOf(actualPower))); + if (Math.abs(planPower) <= 0) { + areaMonthReport.setPowerFinishRate(0.0); + } else { + // 发电完成率 + double powerFinishRate = BigDecimal.valueOf(actualPower / planPower * 100).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); + areaMonthReport.setPowerFinishRate(powerFinishRate); + } + // 同比 + double oldActualPower = oldActualMap.entrySet().stream().filter(e -> ids.contains(e.getKey())).mapToDouble(Map.Entry::getValue).sum(); + if (Math.abs(actualPower) <= 0 || Math.abs(oldActualPower) <= 0) { + areaMonthReport.setComparePowerRate(0.0); + return; + } + double comparePowerRate = BigDecimal.valueOf(actualPower / oldActualPower).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + areaMonthReport.setComparePowerRate(comparePowerRate); + } + + /** + * 区域-操作票、操作票合格率/ 工作票、工作票合格率 + * + * @param area + * @param areaMonthReport + */ + private void doubleMonth(Dept area, AreaMonthReportVo areaMonthReport, String startTime, String endTime) { + // 站点归属机构集合 + TicketMonthVO ticket = ticketService.operateWork(startTime,endTime,Collections.singletonList(area.getId())); + if (ObjectUtil.isEmpty(ticket)) { + areaMonthReport.setOperate(0); + areaMonthReport.setOperaQualifyRate(0.0); + areaMonthReport.setWork(0); + areaMonthReport.setWorkQualifyRate(0.0); + return; + } + // 操作票 + int operate = ticket.getOperate(); + int operateQualify = ticket.getOperateQualify(); + areaMonthReport.setOperate(operate); + if (operateQualify <= 0) { + areaMonthReport.setOperaQualifyRate(0.0); + } else { + double operateQualifyRate = BigDecimal.valueOf(operateQualify / (double) operate * 100L).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); + areaMonthReport.setOperaQualifyRate(operateQualifyRate); + } + //工作票 + int work = ticket.getWork(); + int workQualify = ticket.getWorkQualify(); + areaMonthReport.setWork(work); + if (workQualify <= 0) { + areaMonthReport.setWorkQualifyRate(0.0); + } else { + double workQualifyRate = BigDecimal.valueOf(workQualify / (double) work * 100L).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); + areaMonthReport.setWorkQualifyRate(workQualifyRate); + } + } + + /** + * 任务月报-日常维护、巡检任务、缺陷数、消缺率、检修任务 + * + * @param areas + * @param areaMonthReport + */ + private void taskMonth(List areas, AreaMonthReportVo areaMonthReport, String startTime, String endTime) { + //通过线程池异步获取月报各模块内容 主要分为五块内容 + ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("area_month_report-pool-%d").build(); + ExecutorService exe = new ThreadPoolExecutor(4, 4, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); + //监控线程执行完后返回结果 + CountDownLatch countDownLatch = new CountDownLatch(4); + // 日常维护 + exe.execute(() -> { + MaintainVo maintainVo = maintenanceService.maintain(startTime, endTime, areas); + int maintainSum = maintainVo.getMaintain(); + areaMonthReport.setRoutineMaintenance(maintainSum); + countDownLatch.countDown(); + }); + + // 巡检任务 + exe.execute(() -> { + DutyInspectTaskVO task = taskService.task(startTime,endTime,areas); + if (ObjectUtil.isEmpty(task)) { + areaMonthReport.setInspect(0); + } else { + int inspect = task.getInspectTaskSum(); + areaMonthReport.setInspect(inspect); + } + countDownLatch.countDown(); + }); + + // 消缺 + exe.execute(() -> { + DutyDefectVO defectVO = phenomenonService.defect(startTime, endTime, areas); + int defectSum = defectVO.getDefectSum(); + int defect = defectVO.getDefect(); + areaMonthReport.setDefect(defectSum); + if (defectSum <= 0) { + areaMonthReport.setDefectRate(0.0); + } else { + double deletionRate = BigDecimal.valueOf(defect / defectSum * 100L).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue(); + areaMonthReport.setDefectRate(deletionRate); + } + countDownLatch.countDown(); + }); + + // 检修 + exe.execute(() -> { + OverhaulVo overhaulVo = accessService.overhaul(startTime, endTime, areas); + int overhaul = overhaulVo.getOverhaul(); + areaMonthReport.setMaintenanceTasks(overhaul); + countDownLatch.countDown(); + }); + + //所有模板数据获取完成后释放锁 + try { + countDownLatch.await(); + } catch (InterruptedException e) { + e.printStackTrace(); + Thread.currentThread().interrupt(); + } + exe.shutdown(); + } + + /** + * 预测发电量 + * @param oldActualMap + * @param oldOldActualMap + * @param areaStationList + * @param areaMonthReport + */ + private void predictPlanPower(Map oldActualMap, Map oldOldActualMap, List areaStationList, AreaMonthReportVo areaMonthReport) { + areaMonthReport.setPredictPlanPower(0.0); + // 实际发电量 + List ids = areaStationList.stream().map(StationEntity::getId).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(ids)){ + return; + } + double oldActualPower = oldActualMap.entrySet().stream().filter(e -> ids.contains(e.getKey())).mapToDouble(Map.Entry::getValue).sum(); + double oldOldActualPower = oldOldActualMap.entrySet().stream().filter(e -> ids.contains(e.getKey())).mapToDouble(Map.Entry::getValue).sum(); + if(Math.abs(oldActualPower) <= 0 && Math.abs(oldOldActualPower) <= 0 ){ + return; + } + double predictPlanPower = BigDecimal.valueOf((oldActualPower + oldOldActualPower) / 2).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + areaMonthReport.setPredictPlanPower(predictPlanPower); + } + + /** + * 安全检查 + * @param areas + * @param areaMonthReport + * @param startTime + * @param endTime + */ + private void securityCheck(List areas, AreaMonthReportVo areaMonthReport,String startTime,String endTime) { + areaMonthReport.setSafetyMeeting(0); + areaMonthReport.setSelfReport(0); + areaMonthReport.setSkillTrainy(0); + areaMonthReport.setSecurityCheck(0); + // 站点归属机构集合 + Map map = new HashMap<>(); + map.put("startDate", startTime); + map.put("endDate", endTime); + map.put("deptList", areas); + // 调用安全大检查fegin接口 + Map count = monthService.check(map); + if(MapUtils.isEmpty(count)){ + return; + } + // 安全生产会议 + areaMonthReport.setSafetyMeeting((Integer) count.get("safetyMeetingNum")); + // 月度自查报告 + areaMonthReport.setSelfReport((Integer) count.get("monthCheckNum")); + // 技能培训 + areaMonthReport.setSkillTrainy((Integer) count.get("skillsTrainingNum")); + // 安全大检查 + areaMonthReport.setSecurityCheck((Integer) count.get("bigCheckNum")); + } + + /** + * 获取设备试验数据 + * @param startTime + * @param endTime + * @param areas + * @param areaMonthReport + */ + private void getDeviceTry(String startTime,String endTime,List areas,AreaMonthReportVo areaMonthReport) { + areaMonthReport.setDeviceTry(0); + SafeEquipmentTrialDTO request = new SafeEquipmentTrialDTO(); + request.setDeptList(areas); + request.setStartTime(startTime); + request.setEndTime(endTime); + areaMonthReport.setDeviceTry(trialService.count(request)); + } + + /** + * 推送当月月报 + * + * @param map + * @param list + */ + private void sendMonthReport(Map> map, List list) { + if (MapUtils.isEmpty(map) || CollectionUtil.isEmpty(list)) { + return; + } + // 获取邮件接收人 + Dept dept = list.stream().min(Comparator.comparing(Dept::getDeptCategory)).get(); + if(ObjectUtil.isEmpty(dept)){ + return; + } + R> userR = userClient.userListByDeptId(dept.getId()); + if(!userR.isSuccess() && CollectionUtil.isEmpty(userR.getData())){ + return; + } + List userList = userR.getData().stream().filter(o->dept.getId().equals(o.getCreateDept())).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(userList)){ + return; + } + List mailList = userList.stream().map(User::getEmail).filter(StringUtil::isNotBlank).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(mailList)){ + return; + } + // 获取月报数据 + List entityList = map.get(DateUtil.format(new Date(),"yyyy-MM")); + if (CollectionUtil.isEmpty(entityList)) { + return; + } + // 发送邮件 + MailPushDto pushDto = new MailPushDto(); + pushDto.setBusinessClassify("system"); + pushDto.setBusinessKey("Month_Report"); + pushDto.setSubject("水电站生产运行"); + Map param = new HashMap<>(); + param.put("templatePath", "/data/hzims/message/mail/template/stationRunMonthReport.html"); + Map parameters = new HashMap<>(); + parameters.put("data",entityList); + param.put("parameters", parameters); + pushDto.setExtras(param); + pushDto.setText("水电站生产运行月报内容"); + pushDto.setToAccount(mailList.toArray(new String[0])); + pushDto.setHtml(true); + pushDto.setCreateUser(userR.getData().get(0).getCreateUser()); + pushDto.setTenantId(dept.getTenantId()); + pushDto.setCreateDept(dept.getId()); + pushMsgClient.sendMail(pushDto); + } +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/CompanyService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/CompanyService.java new file mode 100644 index 0000000..ecdb769 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/CompanyService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.service.safeproduct; + +import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface CompanyService extends BaseService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/InstanceService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/InstanceService.java new file mode 100644 index 0000000..0581c6f --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/InstanceService.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.scheduled.service.safeproduct; + +import com.hnac.hzims.safeproduct.entity.CheckItemInstanceEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * Created by Sam Huang 2022/5/6 8:28 + */ +public interface InstanceService extends BaseService { + + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/MonthService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/MonthService.java new file mode 100644 index 0000000..5582515 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/MonthService.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.scheduled.service.safeproduct; + +import com.hnac.hzims.safeproduct.entity.CheckMonthEntity; +import org.springblade.core.mp.base.BaseService; + +import java.util.Map; + +/** + * @author ysj + */ +public interface MonthService extends BaseService { + + Map check(Map map); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/TrialService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/TrialService.java new file mode 100644 index 0000000..c472c89 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/TrialService.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.service.safeproduct; + +import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO; +import com.hnac.hzims.safeproduct.entity.SafeEquipmentTrialEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface TrialService extends BaseService { + + int count(SafeEquipmentTrialDTO trial); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/impl/CompanyServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/impl/CompanyServiceImpl.java new file mode 100644 index 0000000..7004ad3 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/impl/CompanyServiceImpl.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.scheduled.service.safeproduct.impl; + +import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity; +import com.hnac.hzims.scheduled.mapper.safeproduct.CompanyMapper; +import com.hnac.hzims.scheduled.service.safeproduct.CompanyService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Service +@AllArgsConstructor +@Slf4j +public class CompanyServiceImpl extends BaseServiceImpl implements CompanyService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/impl/InstanceServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/impl/InstanceServiceImpl.java new file mode 100644 index 0000000..1b44fa8 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/impl/InstanceServiceImpl.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.scheduled.service.safeproduct.impl; + +import com.hnac.hzims.safeproduct.entity.CheckItemInstanceEntity; +import com.hnac.hzims.scheduled.mapper.safeproduct.InstanceMapper; +import com.hnac.hzims.scheduled.service.safeproduct.InstanceService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Service +@AllArgsConstructor +@Slf4j +public class InstanceServiceImpl extends BaseServiceImpl implements InstanceService { + +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/impl/MonthServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/impl/MonthServiceImpl.java new file mode 100644 index 0000000..697e6c0 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/impl/MonthServiceImpl.java @@ -0,0 +1,96 @@ +package com.hnac.hzims.scheduled.service.safeproduct.impl; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hnac.hzims.safeproduct.entity.CheckCompanyEntity; +import com.hnac.hzims.safeproduct.entity.CheckItemInstanceEntity; +import com.hnac.hzims.safeproduct.entity.CheckMonthEntity; +import com.hnac.hzims.scheduled.mapper.safeproduct.MonthMapper; +import com.hnac.hzims.scheduled.service.safeproduct.CompanyService; +import com.hnac.hzims.scheduled.service.safeproduct.InstanceService; +import com.hnac.hzims.scheduled.service.safeproduct.MonthService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * @author ysj + */ +@Service +@AllArgsConstructor +@Slf4j +public class MonthServiceImpl extends BaseServiceImpl implements MonthService { + + private final CompanyService companyService; + private final InstanceService instanceService; + + @Override + public Map check(Map map) { + if (ObjectUtil.isEmpty(map)) { + return null; + } + Map result = new HashMap<>(); + String startDate = (String) map.get("startDate"); + String endDate = (String) map.get("endDate"); + List deptList = (List) map.get("deptList"); + String startMonth = startDate.substring(0, 7); + String endMonth = endDate.substring(0, 7); + //月度自查次数 + Wrapper wrapper = new LambdaQueryWrapper() {{ + in(CheckMonthEntity::getCreateDept, deptList); + between(CheckMonthEntity::getMonth, startMonth, endMonth); + }}; + List monthList = this.list(wrapper); + result.put("monthCheckNum", monthList != null ? monthList.size() : 0); + //公司大检查次数 + Wrapper wrapper1 = new LambdaQueryWrapper() {{ + in(CheckCompanyEntity::getCreateDept, deptList); + ge(CheckCompanyEntity::getStartTime, startDate); + le(CheckCompanyEntity::getEndTime, endDate); + }}; + List companyList = companyService.list(wrapper1); + result.put("bigCheckNum", companyList != null ? companyList.size() : 0); + + AtomicInteger safetyMeetingNum = new AtomicInteger(0); + AtomicInteger skillsTrainingNum = new AtomicInteger(0); + + if (CollectionUtil.isNotEmpty(monthList)) { + monthList.forEach(checkMonthEntity -> { + Long checkId = checkMonthEntity.getId(); + Wrapper wrapper2 = new LambdaQueryWrapper() {{ + eq(CheckItemInstanceEntity::getCheckId, checkId); + }}; + List list = instanceService.list(wrapper2); + if (CollectionUtil.isNotEmpty(list)) { + list.forEach(instanceEntity -> { + //安全生产会议检查项,系统统计情况不为空纳入统计次数 + if ("现场每月1次安全生产会议".equals(instanceEntity.getItem())) { + if (StringUtils.isNotEmpty(instanceEntity.getSystemSituation())) { + safetyMeetingNum.addAndGet(1); + } + } + //技能培训检查项,系统统计情况不为空纳入统计次数 + if ("每月开展1次技能培训".equals(instanceEntity.getItem())) { + if (StringUtils.isNotEmpty(instanceEntity.getSystemSituation())) { + skillsTrainingNum.addAndGet(1); + } + } + }); + } + }); + } + result.put("safetyMeetingNum", safetyMeetingNum.get()); + result.put("skillsTrainingNum", skillsTrainingNum.get()); + return result; + } +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/impl/TrialServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/impl/TrialServiceImpl.java new file mode 100644 index 0000000..37a2050 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/safeproduct/impl/TrialServiceImpl.java @@ -0,0 +1,50 @@ +package com.hnac.hzims.scheduled.service.safeproduct.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.hnac.hzims.safeproduct.dto.SafeEquipmentTrialDTO; +import com.hnac.hzims.safeproduct.entity.SafeEquipmentTrialEntity; +import com.hnac.hzims.scheduled.mapper.safeproduct.TrialMapper; +import com.hnac.hzims.scheduled.service.safeproduct.TrialService; +import lombok.RequiredArgsConstructor; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springframework.stereotype.Service; + +import java.util.Optional; + +/** + * @author ysj + */ +@Service +@RequiredArgsConstructor +public class TrialServiceImpl extends BaseServiceImpl implements TrialService { + + /** + * 时间区间机构的设备实验数据查询 + * @param trial + * @return + */ + @Override + public int count(SafeEquipmentTrialDTO trial) { + if (ObjectUtil.isEmpty(trial)) { + return 0; + } + QueryWrapper queryWrapper = new QueryWrapper() {{ + if (CollectionUtil.isEmpty(trial.getDeptList())) { + if (Optional.ofNullable(trial.getCreateDept()).isPresent()) { + eq("create_dept", trial.getCreateDept()); + } + } else { + in("create_dept", trial.getDeptList()); + } + if (Optional.ofNullable(trial.getStartTime()).isPresent()) { + gt("create_time", trial.getStartTime()); + } + if (Optional.ofNullable(trial.getEndTime()).isPresent()) { + lt("create_time", trial.getEndTime()); + } + }}; + return this.baseMapper.selectCount(queryWrapper); + } +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/TicketService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/TicketService.java index 5716e58..ff5e1ad 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/TicketService.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/TicketService.java @@ -2,7 +2,9 @@ package com.hnac.hzims.scheduled.service.ticket; import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO; import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; +import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO; import org.springblade.core.mp.base.BaseService; +import org.springblade.core.tool.api.R; import java.time.LocalDateTime; import java.util.List; @@ -13,4 +15,6 @@ import java.util.List; public interface TicketService extends BaseService { DoublePassRateVO doublePassRate(List areas, LocalDateTime firstDateTime, LocalDateTime now); + + TicketMonthVO operateWork(String start, String end, List list); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/TicketServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/TicketServiceImpl.java index 5e3bab9..62ef9a0 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/TicketServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/TicketServiceImpl.java @@ -11,9 +11,11 @@ import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO; import com.hnac.hzims.ticket.constants.TicketConstants; import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; +import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; import org.springframework.stereotype.Service; @@ -85,4 +87,64 @@ public class TicketServiceImpl extends BaseServiceImpl list) { + TicketMonthVO ticket = new TicketMonthVO(); + // 操作票 + List operateList = this.list(new LambdaQueryWrapper() {{ + ge(StandardTicketInfoEntity::getCreateTime, start); + le(StandardTicketInfoEntity::getCreateTime, end); + in(StandardTicketInfoEntity::getCreateDept, list); + }}); + if (CollectionUtil.isEmpty(operateList)) { + ticket.setOperate(0); + ticket.setOperateQualify(0); + }else{ + ticket.setOperate(operateList.size()); + List operateIdList = operateList.stream().map(StandardTicketInfoEntity::getId).collect(Collectors.toList()); + // 查询合格评价 + List operateQualifyList = ticketEvaluateService.list(new LambdaQueryWrapper() {{ + in(TicketInfoEvaluateEntity::getTicketId, operateIdList); + eq(TicketInfoEvaluateEntity::getStatus, TicketConstants.TicketQualifiedEnum.Qualified.getCode()); + }}); + if (CollectionUtil.isEmpty(operateQualifyList)) { + ticket.setOperateQualify(0); + }else{ + ticket.setOperateQualify(operateQualifyList.size()); + } + } + // 工作票 + List works = workTicketService.list(new LambdaQueryWrapper() {{ + ge(WorkTicketInfoEntity::getCreateTime, start); + le(WorkTicketInfoEntity::getCreateTime, end); + in(WorkTicketInfoEntity::getCreateDept, list); + }}); + if (CollectionUtil.isEmpty(works)) { + ticket.setWork(0); + ticket.setWorkQualify(0); + }else{ + ticket.setWork(works.size()); + List workIds = works.stream().map(WorkTicketInfoEntity::getId).collect(Collectors.toList()); + // 查询合格评价 + List operateQualifyList = ticketEvaluateService.list(new LambdaQueryWrapper() {{ + in(TicketInfoEvaluateEntity::getTicketId, workIds); + eq(TicketInfoEvaluateEntity::getStatus, TicketConstants.TicketQualifiedEnum.Qualified.getCode()); + }}); + if (CollectionUtil.isEmpty(operateQualifyList)) { + ticket.setOperateQualify(0); + }else{ + ticket.setWorkQualify(operateQualifyList.size()); + } + } + return ticket; + } + } \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskMapper.xml new file mode 100644 index 0000000..9acf610 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/inspect/TaskMapper.xml @@ -0,0 +1,4 @@ + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/PhenomenonMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/PhenomenonMapper.xml new file mode 100644 index 0000000..e12c289 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/PhenomenonMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/safeproduct/CompanyMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/safeproduct/CompanyMapper.xml new file mode 100644 index 0000000..63605a2 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/safeproduct/CompanyMapper.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/safeproduct/InstanceMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/safeproduct/InstanceMapper.xml new file mode 100644 index 0000000..1e19e05 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/safeproduct/InstanceMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/safeproduct/MonthMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/safeproduct/MonthMapper.xml new file mode 100644 index 0000000..38f7539 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/safeproduct/MonthMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/safeproduct/TrialMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/safeproduct/TrialMapper.xml new file mode 100644 index 0000000..6fec5d0 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/safeproduct/TrialMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/DutyDefectVO.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/DutyDefectVO.java deleted file mode 100644 index 3e95f23..0000000 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/DutyDefectVO.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hnac.hzims.operational.report.vo; - -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@Data -public class DutyDefectVO{ - - @ApiModelProperty("缺陷总数") - private Integer defectSum; - - @ApiModelProperty("缺陷数") - private Integer defect; - - @ApiModelProperty("缺陷总数ID 按逗号分隔") - private String totalIds; -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckItemInstanceMapper.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckItemInstanceMapper.java deleted file mode 100644 index b7c4ba8..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckItemInstanceMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hnac.hzims.safeproduct.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.hnac.hzims.safeproduct.entity.CheckItemInstanceEntity; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * Created by Sam Huang 2022/5/6 8:23 - */ -public interface CheckItemInstanceMapper extends BaseMapper { - - List getCheckItemInstanceByMonth(@Param("months") List months, @Param("deptId") Long deptId); - -} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckItemInstanceMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckItemInstanceMapper.xml deleted file mode 100644 index 4e2231b..0000000 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/CheckItemInstanceMapper.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CheckItemServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CheckItemServiceImpl.java index 0a8eed5..b80c3d7 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CheckItemServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/CheckItemServiceImpl.java @@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.operational.duty.dto.ChangeShiftsReqDTO; import com.hnac.hzims.operational.duty.dto.ChangeShiftsRspDTO; -import com.hnac.hzims.operational.duty.entity.ImsDutyGroupEntity; import com.hnac.hzims.operational.duty.feign.IDutyRecClient; import com.hnac.hzims.operational.feign.IOperTaskClient; import com.hnac.hzims.safeproduct.dto.CheckItemDTO; @@ -27,7 +26,6 @@ import com.hnac.hzims.ticket.workTicket.feign.IOperateTicketClient; import com.hnac.hzims.ticket.workTicket.feign.ITicketInfoClient; import com.hnac.hzims.vo.SafeCheckStatisticVO; import com.hnac.hzinfo.inspect.task.feign.IInspectTaskClient; -import jodd.util.ArraysUtil; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; @@ -43,7 +41,6 @@ import org.springblade.system.feign.ISysClient; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.lang.reflect.Field; import java.time.LocalDateTime;