diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/PlanMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/PlanMapper.java new file mode 100644 index 0000000..d2948fa --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/equipment/PlanMapper.java @@ -0,0 +1,17 @@ +package com.hnac.hzims.scheduled.mapper.equipment; + + +import com.hnac.hzims.equipment.entity.PlanGenerationEntity; +import org.apache.ibatis.annotations.Param; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +import java.util.List; + +/** + * @author ysj + */ +public interface PlanMapper extends UserDataScopeBaseMapper { + + // 查询计划发电量 + List planGeneration(@Param("stationIds") List stationIds, @Param("deptIds") List deptIds, @Param("date") String date); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AccessMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AccessMapper.java new file mode 100644 index 0000000..a9b5957 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/AccessMapper.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.mapper.operation; + +import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface AccessMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/DefectMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/DefectMapper.java new file mode 100644 index 0000000..34d3a1c --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/DefectMapper.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.scheduled.mapper.operation; + +import com.hnac.hzims.operational.defect.entity.OperDefectEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface DefectMapper extends UserDataScopeBaseMapper { + + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/MaintenanceMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/MaintenanceMapper.java new file mode 100644 index 0000000..2480f52 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/MaintenanceMapper.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.mapper.operation; + +import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface MaintenanceMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/OtherMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/OtherMapper.java similarity index 73% rename from hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/OtherMapper.java rename to hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/OtherMapper.java index 5d0b450..90c2d6d 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/OtherMapper.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/OtherMapper.java @@ -1,8 +1,11 @@ -package com.hnac.hzims.operational.fill.mapper; +package com.hnac.hzims.scheduled.mapper.operation; import com.hnac.hzims.operational.fill.entity.OtherEntity; import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; +/** + * @author ysj + */ public interface OtherMapper extends UserDataScopeBaseMapper { } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/OverDetailsMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/OverDetailsMapper.java new file mode 100644 index 0000000..32582ec --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/OverDetailsMapper.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.mapper.operation; + +import com.hnac.hzims.operational.fill.entity.OverDetailsEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface OverDetailsMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/OverMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/OverMapper.java new file mode 100644 index 0000000..17f20f9 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/OverMapper.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.mapper.operation; + +import com.hnac.hzims.operational.fill.entity.OverEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface OverMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/SolveMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/SolveMapper.java new file mode 100644 index 0000000..e09fef2 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/operation/SolveMapper.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.mapper.operation; + +import com.hnac.hzims.operational.fill.entity.SolveEntity; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +public interface SolveMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/ticket/TicketEvaluateMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/ticket/TicketEvaluateMapper.java new file mode 100644 index 0000000..31feb3e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/ticket/TicketEvaluateMapper.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.mapper.ticket; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; + +/** + * @author ysj + */ +public interface TicketEvaluateMapper extends BaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/ticket/TicketMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/ticket/TicketMapper.java new file mode 100644 index 0000000..a17dd00 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/ticket/TicketMapper.java @@ -0,0 +1,13 @@ +package com.hnac.hzims.scheduled.mapper.ticket; + +import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +@Mapper +public interface TicketMapper extends UserDataScopeBaseMapper { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/ticket/WorkTicketMapper.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/ticket/WorkTicketMapper.java new file mode 100644 index 0000000..e30a55e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/mapper/ticket/WorkTicketMapper.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.scheduled.mapper.ticket; + +import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; + +/** + * @author ysj + */ +@Mapper +public interface WorkTicketMapper extends UserDataScopeBaseMapper { + + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java index c7bb905..426502e 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/scheduled/ShowScheduledTask.java @@ -1,8 +1,18 @@ package com.hnac.hzims.scheduled.scheduled; +import com.hnac.hzims.scheduled.service.operation.ShowService; +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.LOAD_HOME_TARGET; + /** * @author ysj @@ -11,4 +21,18 @@ import org.springframework.stereotype.Component; @Component public class ShowScheduledTask { + @Autowired + private ShowService service; + + /** + * 首页-指标数据加载 + */ + @XxlJob(LOAD_HOME_TARGET) + public ReturnT loadHomeTarget(String param) { + if (Func.isBlank(param)) { + param = DateUtil.format(new Date(), "yyyy-MM"); + } + service.loadHomeTarget(param); + 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/equipment/PlanService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/PlanService.java new file mode 100644 index 0000000..52f4d3a --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/PlanService.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.scheduled.service.equipment; + +import com.hnac.hzims.equipment.entity.PlanGenerationEntity; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author ysj + */ +public interface PlanService extends BaseService { + + + // 查询计划发电量 + List planGeneration(List stationIds, List deptIds, String date); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/PlanServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/PlanServiceImpl.java new file mode 100644 index 0000000..1091c99 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/PlanServiceImpl.java @@ -0,0 +1,33 @@ +package com.hnac.hzims.scheduled.service.equipment.impl; + +import com.hnac.hzims.equipment.entity.PlanGenerationEntity; +import com.hnac.hzims.scheduled.mapper.equipment.PlanMapper; +import com.hnac.hzims.scheduled.service.equipment.PlanService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +public class PlanServiceImpl extends BaseServiceImpl implements PlanService { + + + /** + * 查询计划发电量 + * @param stationIds + * @param deptIds + * @param date + * @return + */ + @Override + public List planGeneration(List stationIds, List deptIds, String date) { + return this.baseMapper.planGeneration(stationIds,deptIds,date); + } +} 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 new file mode 100644 index 0000000..f42d943 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/AccessService.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.scheduled.service.operation; + +import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author ysj + */ +public interface AccessService extends BaseService { + + double accessCount(List areas); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/DefectService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/DefectService.java new file mode 100644 index 0000000..929732f --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/DefectService.java @@ -0,0 +1,14 @@ +package com.hnac.hzims.scheduled.service.operation; + +import com.hnac.hzims.operational.defect.entity.OperDefectEntity; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author Lch + */ +public interface DefectService extends BaseService { + + Double defectCount(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 new file mode 100644 index 0000000..49b4012 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/MaintenanceService.java @@ -0,0 +1,15 @@ +package com.hnac.hzims.scheduled.service.operation; + +import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; +import org.springblade.core.mp.base.BaseService; + +import java.util.List; + +/** + * @author ysj + */ +public interface MaintenanceService extends BaseService { + + // 查询当年日常维护数量 + Integer maintenanceCount(List departList); +} 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 087a7e5..d9bfd85 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 @@ -9,8 +9,9 @@ public interface MonitorService { // realId刷新 void loadRealId(String param); + // 实时数据刷新 + void loadRealData(String param); + // 集中监控数据处理 void loadMonitoring(String param); - - void loadRealData(String param); } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/OtherService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/OtherService.java new file mode 100644 index 0000000..50451a4 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/OtherService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.service.operation; + +import com.hnac.hzims.operational.fill.entity.OtherEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface OtherService extends BaseService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/OverDetailsService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/OverDetailsService.java new file mode 100644 index 0000000..13e6eab --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/OverDetailsService.java @@ -0,0 +1,12 @@ +package com.hnac.hzims.scheduled.service.operation; + + +import com.hnac.hzims.operational.fill.entity.OverDetailsEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface OverDetailsService extends BaseService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/OverService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/OverService.java new file mode 100644 index 0000000..3412374 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/OverService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.service.operation; + +import com.hnac.hzims.operational.fill.entity.OverEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface OverService extends BaseService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/ShowService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/ShowService.java new file mode 100644 index 0000000..a86eed7 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/ShowService.java @@ -0,0 +1,9 @@ +package com.hnac.hzims.scheduled.service.operation; + +/** + * @author ysj + */ +public interface ShowService { + + void loadHomeTarget(String param); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/SolveService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/SolveService.java new file mode 100644 index 0000000..5888433 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/SolveService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.service.operation; + +import com.hnac.hzims.operational.fill.entity.SolveEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author ysj + */ +public interface SolveService extends BaseService { + +} 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 new file mode 100644 index 0000000..1a1fb7c --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/AccessServiceImpl.java @@ -0,0 +1,51 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; +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.springframework.stereotype.Service; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.List; + + +/** + * @author ysj + */ +@Service +@Slf4j +@AllArgsConstructor +public class AccessServiceImpl extends BaseServiceImpl implements AccessService { + + /** + * 查询当年检修任务数量 + * @param areas + * @return + */ + @Override + public double accessCount(List areas) { + if(CollectionUtil.isEmpty(areas)) { + return 0; + } + LocalDate firstDay = LocalDate.now().withDayOfYear(1); + LocalDateTime firstDateTime = LocalDateTime.of(firstDay, LocalTime.MIN); + LocalDateTime now = LocalDateTime.now(); + //日常维护 + List accesss = this.list(new LambdaQueryWrapper(){{ + ge(OperAccessTaskEntity::getPlanStartTime,firstDateTime); + le(OperAccessTaskEntity::getPlanStartTime,now); + in(OperAccessTaskEntity::getCreateDept,areas); + }}); + if(CollectionUtil.isEmpty(accesss)){ + return 0; + } + return accesss.size(); + } +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/DefectServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/DefectServiceImpl.java new file mode 100644 index 0000000..84af907 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/DefectServiceImpl.java @@ -0,0 +1,55 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hnac.hzims.operational.defect.entity.OperDefectEntity; +import com.hnac.hzims.scheduled.mapper.operation.DefectMapper; +import com.hnac.hzims.scheduled.service.operation.DefectService; +import lombok.AllArgsConstructor; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author ysj + */ +@Service +@AllArgsConstructor +public class DefectServiceImpl extends BaseServiceImpl implements DefectService { + + /** + * 获取消缺率 + * @param areas + * @return + */ + @Override + public Double defectCount(List areas) { + if(CollectionUtil.isEmpty(areas)) { + return 100.00; + } + LocalDate firstDay = LocalDate.now().withDayOfYear(1); + LocalDateTime firstDateTime = LocalDateTime.of(firstDay, LocalTime.MIN); + LocalDateTime now = LocalDateTime.now(); + List pTaskList = this.list(new LambdaQueryWrapper(){{ + ge(OperDefectEntity::getCreateTime,firstDateTime); + le(OperDefectEntity::getCreateTime,now); + in(OperDefectEntity::getCreateDept,areas); + }}); + if(CollectionUtil.isEmpty(pTaskList)){ + return 0.0; + } + // 缺陷处理完成数 + List finishTask = pTaskList.stream().filter(defect -> "1".equals(defect.getHandleStatus())).collect(Collectors.toList()); + if(CollectionUtil.isEmpty(finishTask)){ + return 0.0; + } + // 消缺率 = (缺陷数 / 总数) * 100 + return BigDecimal.valueOf(finishTask.size() / (double) pTaskList.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + } +} \ 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 new file mode 100644 index 0000000..6ec8d3e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MaintenanceServiceImpl.java @@ -0,0 +1,50 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; +import com.hnac.hzims.scheduled.mapper.operation.MaintenanceMapper; +import com.hnac.hzims.scheduled.service.operation.MaintenanceService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springframework.stereotype.Service; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.List; + +/** + * @author ysj + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class MaintenanceServiceImpl extends BaseServiceImpl implements MaintenanceService { + + /** + * 获取日常维护数量 + * @param departList + * @return + */ + @Override + public Integer maintenanceCount(List departList) { + if(CollectionUtil.isEmpty(departList)){ + return 0; + } + LocalDate firstDay = LocalDate.now().withDayOfYear(1); + LocalDateTime firstDateTime = LocalDateTime.of(firstDay, LocalTime.MIN); + LocalDateTime now = LocalDateTime.now(); + //日常维护 + List mTaskList = this.list(new LambdaQueryWrapper(){{ + ge(OperMaintenanceTaskEntity::getDisposeTime,firstDateTime); + le(OperMaintenanceTaskEntity::getDisposeTime,now); + in(OperMaintenanceTaskEntity::getCreateDept,departList); + }}); + if(CollectionUtil.isEmpty(mTaskList)){ + return 0; + } + return mTaskList.size(); + } +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/OtherServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/OtherServiceImpl.java new file mode 100644 index 0000000..202c396 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/OtherServiceImpl.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.hnac.hzims.operational.fill.entity.OtherEntity; +import com.hnac.hzims.scheduled.mapper.operation.OtherMapper; +import com.hnac.hzims.scheduled.service.operation.OtherService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Slf4j +@Service +@AllArgsConstructor +public class OtherServiceImpl extends BaseServiceImpl implements OtherService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/OverDetailsServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/OverDetailsServiceImpl.java new file mode 100644 index 0000000..dc69ec3 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/OverDetailsServiceImpl.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.hnac.hzims.operational.fill.entity.OverDetailsEntity; +import com.hnac.hzims.scheduled.mapper.operation.OverDetailsMapper; +import com.hnac.hzims.scheduled.service.operation.OverDetailsService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Slf4j +@Service +@AllArgsConstructor +public class OverDetailsServiceImpl extends BaseServiceImpl implements OverDetailsService { + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/OverServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/OverServiceImpl.java new file mode 100644 index 0000000..f629fc7 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/OverServiceImpl.java @@ -0,0 +1,19 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.hnac.hzims.operational.fill.entity.OverEntity; +import com.hnac.hzims.scheduled.mapper.operation.OverMapper; +import com.hnac.hzims.scheduled.service.operation.OverService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Slf4j +@Service +@AllArgsConstructor +public class OverServiceImpl extends BaseServiceImpl implements OverService { + +} 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 eacda88..c34da3f 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 @@ -87,7 +87,6 @@ public class RealTargetServiceImpl implements RealTargetService { private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key"; - /** * 加载水电站机组实时数据 * @param param diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ShowServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ShowServiceImpl.java new file mode 100644 index 0000000..5d87218 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/ShowServiceImpl.java @@ -0,0 +1,480 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +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.operational.fill.entity.*; +import com.hnac.hzims.operational.main.constant.HomePageConstant; +import com.hnac.hzims.operational.main.vo.*; +import com.hnac.hzims.operational.station.entity.StationEntity; +import com.hnac.hzims.scheduled.service.equipment.PlanService; +import com.hnac.hzims.scheduled.service.operation.*; +import com.hnac.hzims.scheduled.service.ticket.TicketService; +import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +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.cache.DictCache; +import org.springblade.system.entity.Dept; +import org.springblade.system.feign.ISysClient; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.math.BigDecimal; +import java.net.HttpURLConnection; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.util.Date; +import java.util.List; +import java.util.concurrent.*; +import java.util.stream.Collectors; + +/** + * @author ysj + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class ShowServiceImpl implements ShowService { + + private final OverService overService; + private final PlanService planService; + private final PowerService powerService; + private final SolveService solveService; + private final OtherService otherService; + private final AccessService accessService; + private final TicketService ticketService; + private final DefectService defectService; + private final StationService stationService; + private final OverDetailsService detailsService; + private final MaintenanceService maintenanceService; + private final RedisTemplate redisTemplate; + private final ISysClient sysClient; + + + private final static String charge = "hzims:operation:key:charge"; + private final static String home_target_cache_final = "load:operation:home:target:key"; + private final static String hydropower_real_cache_final = "hzims:operation:loadhydropowerunit:real:key"; + private final static String hydropower_target_cache_final = "hzims:operation:loadhydropowerunit:target:key"; + private final static String photovoltaic_real_cache_final = "hzims:operation:photovoltaic:real:key"; + private final static String photovoltaic_target_cache_final = "hzims:operation:photovoltaic:target:key"; + + @Value("${hzims.operation.homePage.charge.url}") + public String charge_url; + + /** + * 集团总指标-首页数据 + */ + @Override + public void loadHomeTarget(String param) { + List targets = HomePageConstant.HOME_TYPES.stream().map(type->{ + if(type == 0) { + return this.hydropowerTaget(); + } + if (type == 1) { + return this.windTaget(); + } + if (type == 2) { + return this.waterStorageTaget(true); + } + if (type == 3) { + return this.waterStorageTaget(false); + } + if (type == 4) { + return this.networkTaget(); + } + if (type == 5) { + return this.photovoltaicTaget(); + } + if (type == 6) { + return this.affairsTaget(); + } + if(type == 7) { + return this.chargeTarget(); + } + return new TargetVo(); + }).collect(Collectors.toList()); + redisTemplate.opsForValue().set(home_target_cache_final,targets.stream().filter(( target -> ObjectUtil.isNotEmpty(target.getType()))).collect(Collectors.toList())); + } + + /** + * 水电站指标 + * @return + */ + private TargetVo hydropowerTaget() { + TargetVo target = new TargetVo(); + target.setType(HomePageConstant.HYDROPOWER); + target.setTypeName(DictCache.getValue("stationType", HomePageConstant.HYDROPOWER)); + // 实时数据 + List reals = (List) redisTemplate.opsForValue().get(hydropower_real_cache_final); + // 指标数据 + List targets = (List) redisTemplate.opsForValue().get(hydropower_target_cache_final); + if(CollectionUtil.isNotEmpty(reals)){ + // 装机容量 + target.setTaget_one(reals.stream().mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum()); + } + if(CollectionUtil.isNotEmpty(targets)){ + // 发电量 + target.setTaget_two(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum()); + } + // 计划发电量 + List stations = stationService.list(Wrappers.lambdaQuery() + .eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) + .eq(StationEntity::getType,HomePageConstant.HYDROPOWER)); + if(CollectionUtil.isNotEmpty(stations)){ + List plans = planService.planGeneration(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy")); + if(CollectionUtil.isNotEmpty(plans)){ + double plan = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum(); + if(Math.abs(plan) > 0){ + target.setTaget_three(BigDecimal.valueOf(target.getTaget_two() / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); + } + } + } + // 双票合格率 + R> result = sysClient.getDeptList(); + if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData()) && CollectionUtil.isNotEmpty(stations)){ + List areas = result.getData().stream().filter(dept -> stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(dept.getId())).map(Dept::getParentId).collect(Collectors.toList()); + if(CollectionUtil.isNotEmpty(areas)){ + LocalDateTime firstDateTime = LocalDateTime.of(LocalDate.now().withDayOfYear(1), LocalTime.MIN); + DoublePassRateVO pass = ticketService.doublePassRate(areas, firstDateTime, LocalDateTime.now()); + if(ObjectUtil.isNotEmpty(pass)){ + target.setTaget_four(Double.valueOf(pass.getDoublePassRate())); + } + } + } + return target; + } + + /** + * 风电指标 + * @return + */ + private TargetVo windTaget() { + TargetVo target = new TargetVo(); + target.setType(HomePageConstant.WIND_POWER); + target.setTypeName(DictCache.getValue("stationType", HomePageConstant.WIND_POWER)); + // 填报发电量 + List stations = stationService.list(Wrappers.lambdaQuery() + .eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) + .eq(StationEntity::getType,HomePageConstant.WIND_POWER)); + if(CollectionUtil.isEmpty(stations)){ + return target; + } + QueryWrapper queryWrapper = new QueryWrapper() {{ + in("create_dept", stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); + eq("type", HomePageConstant.WIND_POWER_TYPE); + likeRight("mon", DateUtil.format(new Date(),"yyyy")); + }}; + List list = powerService.list(queryWrapper); + if(CollectionUtil.isEmpty(list)){ + return target; + } + double plan = list.stream().mapToDouble(PowerEntity::getPlannedPowerMon).sum(); + double pass = list.stream().mapToDouble(power -> Double.parseDouble(power.getDoubleQualifyRate())).sum(); + // 装机容量 + target.setTaget_one(list.stream().map(PowerEntity::getInstalledCapacity).collect(Collectors.toSet()).stream().mapToDouble(Double::valueOf).sum()); + // 发电量 + target.setTaget_two(list.stream().mapToDouble(PowerEntity::getPowerMon).sum()); + if(Math.abs(plan) > 0){ + // 发电完成率 + target.setTaget_three(BigDecimal.valueOf(target.getTaget_two() / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); + } + // 双票合格率 + target.setTaget_four(BigDecimal.valueOf(pass / list.size()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); + return target; + } + + /** + * 储能指标 + * @param flag : true - 水利 false - 储能 + * @return + */ + private TargetVo waterStorageTaget(boolean flag) { + TargetVo target = new TargetVo(); + if(flag){ + target.setType(HomePageConstant.WATER_CONSERVANCY); + target.setTypeName(DictCache.getValue("stationType", HomePageConstant.WATER_CONSERVANCY)); + }else{ + target.setType(HomePageConstant.ENERGY_STORAGE); + target.setTypeName(DictCache.getValue("stationType", HomePageConstant.ENERGY_STORAGE)); + } + // 查询储能站点 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE); + if(flag){ + wrapper.eq(StationEntity::getType,HomePageConstant.WATER_CONSERVANCY); + }else{ + wrapper.eq(StationEntity::getType,HomePageConstant.ENERGY_STORAGE); + } + List stations = stationService.list(wrapper); + if(CollectionUtil.isEmpty(stations)){ + return target; + } + // 获取储能区域级别机构 + R> result = sysClient.getDeptList(); + if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData()) && CollectionUtil.isNotEmpty(stations)){ + List areas = result.getData().stream().filter(dept -> stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(dept.getId())).map(Dept::getParentId).collect(Collectors.toList()); + if(CollectionUtil.isNotEmpty(areas)){ + ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("storage-taget-pool-%d").build(); + ScheduledExecutorService exe = new ScheduledThreadPoolExecutor(4, namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); + // 监控线程执行完后返回结果 + CountDownLatch countDownLatch = new CountDownLatch(4); + // 日常维护 + exe.execute(() -> { + target.setTaget_one(Double.valueOf(maintenanceService.maintenanceCount(areas))); + countDownLatch.countDown(); + }); + // 检修任务 + exe.execute(() -> { + target.setTaget_two(accessService.accessCount(areas)); + countDownLatch.countDown(); + }); + // 消缺率 + exe.execute(() -> { + target.setTaget_three(defectService.defectCount(areas)); + countDownLatch.countDown(); + }); + // 双票合格率 + exe.execute(() -> { + LocalDate firstDay = LocalDate.now().withDayOfYear(1); + LocalDateTime firstDateTime = LocalDateTime.of(firstDay, LocalTime.MIN); + DoublePassRateVO pass = ticketService.doublePassRate(areas, firstDateTime, LocalDateTime.now()); + if (ObjectUtil.isNotEmpty(pass)) { + target.setTaget_four(Double.valueOf(pass.getDoublePassRate())); + } + countDownLatch.countDown(); + }); + try { + countDownLatch.await(); + } catch (InterruptedException e) { + e.printStackTrace(); + Thread.currentThread().interrupt(); + } + exe.shutdown(); + } + } + return target; + } + + /** + * 配网 + * @return + */ + private TargetVo networkTaget() { + TargetVo target = new TargetVo(); + target.setType(HomePageConstant.DISTRIBUTION_NETWORK); + target.setTypeName(DictCache.getValue("stationType", HomePageConstant.DISTRIBUTION_NETWORK)); + // 线程池 + ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("network-taget-pool-%d").build(); + ScheduledExecutorService exe = new ScheduledThreadPoolExecutor(3, namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); + // 监控线程执行完后返回结果 + CountDownLatch countDownLatch = new CountDownLatch(3); + // 当月 + LocalDate firstDay = LocalDate.now().withDayOfYear(1); + LocalDateTime firstDateTime = LocalDateTime.of(firstDay, LocalTime.MIN); + // 检修卡 + exe.execute(()->{ + List overs = overService.list(new QueryWrapper() {{ + ge("create_time", firstDateTime); + le("create_time", LocalDateTime.now()); + }}); + if(CollectionUtil.isEmpty(overs)){ + countDownLatch.countDown(); + return; + } + List details = detailsService.list(new QueryWrapper() {{ + ge("create_time", firstDateTime); + le("create_time", LocalDateTime.now()); + in("over_id",overs.stream().map(OverEntity::getId).collect(Collectors.toList())); + }}); + if(CollectionUtil.isEmpty(details)){ + countDownLatch.countDown(); + return; + } + target.setTaget_one(details.stream().mapToDouble(OverDetailsEntity::getQuantity).sum()); + countDownLatch.countDown(); + }); + // 消缺 + exe.execute(()->{ + List solves = solveService.list(new QueryWrapper() {{ + ge("create_time", firstDateTime); + le("create_time", LocalDateTime.now()); + }}); + if(CollectionUtil.isEmpty(solves)){ + countDownLatch.countDown(); + return; + } + target.setTaget_two(solves.stream().mapToDouble(SolveEntity::getSolveQuantity).sum()); + countDownLatch.countDown(); + }); + // 其他 + exe.execute(()->{ + List others = otherService.list(new QueryWrapper() {{ + ge("create_time", firstDateTime); + le("create_time", LocalDateTime.now()); + }}); + if(CollectionUtil.isEmpty(others)){ + countDownLatch.countDown(); + return; + } + // FA上线率 + double online = others.stream().mapToDouble(o-> Double.parseDouble(o.getOnlineRate())).sum(); + if(Math.abs(online) > 0){ + target.setTaget_three(BigDecimal.valueOf(online / others.size()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); + } + // FA投入条数 + target.setTaget_four(others.stream().mapToDouble(OtherEntity::getFaQuantity).sum()); + countDownLatch.countDown(); + }); + // 等待所有线程执行完成 + try { + countDownLatch.await(); + } catch (InterruptedException e) { + e.printStackTrace(); + Thread.currentThread().interrupt(); + } + return target; + } + + /** + * 光伏指标 + * @return + */ + private TargetVo photovoltaicTaget() { + TargetVo target = new TargetVo(); + target.setType(HomePageConstant.PHOTOVOLTAIC); + target.setTypeName(DictCache.getValue("stationType", HomePageConstant.PHOTOVOLTAIC)); + // 实时数据 + List reals = (List) redisTemplate.opsForValue().get(photovoltaic_real_cache_final); + // 指标数据 + List targets = (List) redisTemplate.opsForValue().get(photovoltaic_target_cache_final); + if(CollectionUtil.isNotEmpty(reals)){ + // 装机容量 + target.setTaget_one(reals.stream().mapToDouble(PhotovoltaicRealVo::getCapacity).sum()); + } + if(CollectionUtil.isNotEmpty(targets)){ + // 发电量 + target.setTaget_two(targets.stream().mapToDouble(PhotovoltaicTargetVo::getGenerationYear).sum()); + } + // 计划发电量、双票合格率 + List stations = stationService.list(Wrappers.lambdaQuery() + .eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE) + .eq(StationEntity::getType,HomePageConstant.PHOTOVOLTAIC)); + if(CollectionUtil.isNotEmpty(stations)){ + QueryWrapper queryWrapper = new QueryWrapper() {{ + in("create_dept", stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); + eq("type", HomePageConstant.PHOTOVOLTAIC_TYPE); + likeRight("mon", DateUtil.format(new Date(),"yyyy")); + }}; + List list = powerService.list(queryWrapper); + if(CollectionUtil.isEmpty(list)){ + return target; + } + double plan = list.stream().mapToDouble(PowerEntity::getPlannedPowerMon).sum(); + double pass = list.stream().mapToDouble(power -> Double.parseDouble(power.getDoubleQualifyRate())).sum(); + if(Math.abs(plan) > 0){ + // 发电完成率 + target.setTaget_three(BigDecimal.valueOf(target.getTaget_two() / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); + } + // 双票合格率 + target.setTaget_four(BigDecimal.valueOf(pass / list.size()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); + } + return target; + } + + /** + * 水务指标 + * @return + */ + private TargetVo affairsTaget() { + TargetVo target = new TargetVo(); + target.setType(HomePageConstant.WATER_AFFAIRS); + target.setTypeName(DictCache.getValue("stationType", HomePageConstant.WATER_AFFAIRS)); + // TODO 统计业务数据 + return target; + } + + /** + * 充电桩 + * @return + */ + private TargetVo chargeTarget() { + TargetVo target = (TargetVo) redisTemplate.opsForValue().get(charge); + if(ObjectUtil.isNotEmpty(target)){ + return target; + } + target = new TargetVo(); + try { + URL serverUrl = new URL(charge_url); + HttpURLConnection conn = (HttpURLConnection) serverUrl.openConnection(); + conn.setRequestMethod("GET"); + conn.setRequestProperty("Content-type", "application/json"); + //必须设置false,否则会自动redirect到重定向后的地址 + conn.setInstanceFollowRedirects(false); + conn.connect(); + String result = responseFormat(conn); + if (StringUtil.isBlank(result)) { + return new TargetVo(); + } + JSONObject jsonObject = JSONObject.parseObject(result); + JSONObject data = JSONObject.parseObject(jsonObject.get("data").toString()); + target.setType(HomePageConstant.CHARGE); + target.setTypeName(DictCache.getValue("stationType", HomePageConstant.CHARGE)); + target.setTaget_one(Double.valueOf(data.get("ordersCount").toString())); + target.setTaget_two(Double.valueOf(data.get("todayDegree").toString())); + target.setTaget_three(Double.valueOf(data.get("income").toString())); + target.setTaget_four(Double.valueOf(data.get("kilowatt").toString())); + target.setCharge(Integer.valueOf(data.get("stationNum").toString())); + redisTemplate.opsForValue().set(charge,target); + redisTemplate.expire(charge,30, TimeUnit.MINUTES); + } catch (Exception e) { + target.setType(HomePageConstant.CHARGE); + target.setTypeName(DictCache.getValue("stationType", HomePageConstant.CHARGE)); + target.setTaget_one(0.0); + target.setTaget_two(0.0); + target.setTaget_three(0.0); + target.setTaget_four(0.0); + target.setCharge(0); + log.error("charge_target_exception: {} ", e.getMessage()); + } + return target; + } + + /*** + * 获取返回的内容 + * @param connection + * @return + */ + private String responseFormat(HttpURLConnection connection) { + StringBuilder stringBuilder = new StringBuilder(); + //将返回的输入流转换成字符串 + try ( + InputStream inputStream = connection.getInputStream(); + InputStreamReader inputStreamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8); + BufferedReader bufferedReader = new BufferedReader(inputStreamReader) + ) { + String str; + while ((str = bufferedReader.readLine()) != null) { + stringBuilder.append(str); + } + } catch (IOException e) { + return null; + } + return stringBuilder.toString(); + } +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/SolveServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/SolveServiceImpl.java new file mode 100644 index 0000000..6d5238a --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/SolveServiceImpl.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.scheduled.service.operation.impl; + +import com.hnac.hzims.operational.fill.entity.SolveEntity; +import com.hnac.hzims.scheduled.mapper.operation.SolveMapper; +import com.hnac.hzims.scheduled.service.operation.SolveService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Slf4j +@Service +@AllArgsConstructor +public class SolveServiceImpl extends BaseServiceImpl implements SolveService { + + +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/TicketEvaluateService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/TicketEvaluateService.java new file mode 100644 index 0000000..ad99144 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/TicketEvaluateService.java @@ -0,0 +1,11 @@ +package com.hnac.hzims.scheduled.service.ticket; + +import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; +import org.springblade.core.mp.base.BaseService; + +/** + * @author hx + */ +public interface TicketEvaluateService extends BaseService { + +} 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 new file mode 100644 index 0000000..5716e58 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/TicketService.java @@ -0,0 +1,16 @@ +package com.hnac.hzims.scheduled.service.ticket; + +import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO; +import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; +import org.springblade.core.mp.base.BaseService; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * @author ysj + */ +public interface TicketService extends BaseService { + + DoublePassRateVO doublePassRate(List areas, LocalDateTime firstDateTime, LocalDateTime now); +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/WorkTicketService.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/WorkTicketService.java new file mode 100644 index 0000000..536b410 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/WorkTicketService.java @@ -0,0 +1,7 @@ +package com.hnac.hzims.scheduled.service.ticket; + +import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; +import org.springblade.core.mp.base.BaseService; + +public interface WorkTicketService extends BaseService { +} diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/TicketEvaluateServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/TicketEvaluateServiceImpl.java new file mode 100644 index 0000000..1bd217e --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/TicketEvaluateServiceImpl.java @@ -0,0 +1,20 @@ +package com.hnac.hzims.scheduled.service.ticket.impl; + +import com.hnac.hzims.scheduled.mapper.ticket.TicketEvaluateMapper; +import com.hnac.hzims.scheduled.service.ticket.TicketEvaluateService; +import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * @author ysj + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class TicketEvaluateServiceImpl extends BaseServiceImpl implements TicketEvaluateService { + + +} 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 new file mode 100644 index 0000000..204a17b --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/TicketServiceImpl.java @@ -0,0 +1,85 @@ +package com.hnac.hzims.scheduled.service.ticket.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.hnac.hzims.scheduled.mapper.ticket.TicketMapper; +import com.hnac.hzims.scheduled.service.ticket.TicketEvaluateService; +import com.hnac.hzims.scheduled.service.ticket.TicketService; +import com.hnac.hzims.scheduled.service.ticket.WorkTicketService; +import com.hnac.hzims.ticket.allTicket.entity.TicketInfoEvaluateEntity; +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 lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author ysj + */ +@Service +@RequiredArgsConstructor +@Slf4j +public class TicketServiceImpl extends BaseServiceImpl implements TicketService { + + private final WorkTicketService workTicketService; + private final TicketEvaluateService ticketEvaluateService; + + /** + * 获取双票合格率 + * @param depatList + * @param firstDateTime + * @param now + * @return + */ + @Override + public DoublePassRateVO doublePassRate(List depatList, LocalDateTime firstDateTime, LocalDateTime now) { + DoublePassRateVO doublePassRateVO = new DoublePassRateVO(); + // 查询操作票 + List standardList = this.list(new LambdaQueryWrapper() {{ + ge(StandardTicketInfoEntity::getCreateTime, firstDateTime); + le(StandardTicketInfoEntity::getCreateTime, now); + in(StandardTicketInfoEntity::getCreateDept, depatList); + }}); + // 查询工作票 + List workList = workTicketService.list(new LambdaQueryWrapper() {{ + ge(WorkTicketInfoEntity::getCreateTime, firstDateTime); + le(WorkTicketInfoEntity::getCreateTime, now); + in(WorkTicketInfoEntity::getCreateDept, depatList); + }}); + if (CollectionUtil.isEmpty(standardList) && CollectionUtil.isEmpty(workList)) { + doublePassRateVO.setDoubleTicketCount(0); + doublePassRateVO.setDoubleTicketPassCount(0); + doublePassRateVO.setDoublePassRate("0"); + return doublePassRateVO; + } + List standardIdList = new ArrayList<>(); + standardIdList.addAll(standardList.stream().map(StandardTicketInfoEntity::getId).collect(Collectors.toList())); + standardIdList.addAll(workList.stream().map(WorkTicketInfoEntity::getId).collect(Collectors.toList())); + doublePassRateVO.setDoubleTicketCount(standardIdList.size()); + // 查询合格评价 + List evaluateList = ticketEvaluateService.list(new LambdaQueryWrapper() {{ + ge(TicketInfoEvaluateEntity::getCreateTime, firstDateTime); + le(TicketInfoEvaluateEntity::getCreateTime, now); + in(TicketInfoEvaluateEntity::getTicketId, standardIdList); + eq(TicketInfoEvaluateEntity::getStatus, TicketConstants.TicketQualifiedEnum.Qualified.getCode()); + }}); + if (CollectionUtil.isEmpty(evaluateList)) { + doublePassRateVO.setDoubleTicketPassCount(0); + doublePassRateVO.setDoublePassRate("0"); + return doublePassRateVO; + } + double doublePassRate = BigDecimal.valueOf(evaluateList.size() / (double) standardIdList.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); + doublePassRateVO.setDoubleTicketPassCount(evaluateList.size()); + doublePassRateVO.setDoublePassRate(String.valueOf(doublePassRate)); + return doublePassRateVO; + } +} \ No newline at end of file diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/WorkTicketServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/WorkTicketServiceImpl.java new file mode 100644 index 0000000..13dbc45 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/ticket/impl/WorkTicketServiceImpl.java @@ -0,0 +1,1093 @@ +package com.hnac.hzims.scheduled.service.ticket.impl; + +import cn.afterturn.easypoi.excel.entity.TemplateExportParams; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +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.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.google.common.collect.Lists; +import com.hnac.hzims.common.logs.utils.StringUtils; +import com.hnac.hzims.operational.access.constants.AccessConstants; +import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; +import com.hnac.hzims.operational.access.feign.IOperAccessTaskClient; +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.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.service.TicketInfoDangerService; +import com.hnac.hzims.ticket.twoTicket.service.impl.WorkTicketFinishServiceImpl; +import com.hnac.hzims.ticket.twoTicket.vo.process.WorkTicketVo; +import com.hnac.hzims.ticket.utils.ExcelUtil; +import com.hnac.hzims.ticket.utils.PdfUtils; +import com.hnac.hzims.ticket.workTicket.entity.*; +import com.hnac.hzims.ticket.workTicket.mapper.WorkDelayNoScopeMapper; +import com.hnac.hzims.ticket.workTicket.mapper.WorkTicketInfoMapper; +import com.hnac.hzims.ticket.workTicket.wrapper.WorkTicketDelayWrapper; +import com.hnac.hzims.ticket.workTicket.wrapper.WorkTicketInfoWrapper; +import com.hnac.hzims.vo.SafeCheckStatisticVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.map.HashedMap; +import org.apache.poi.ss.usermodel.Workbook; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.mp.base.BaseServiceImpl; +import org.springblade.core.mp.support.BladePage; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.secure.utils.AuthUtil; +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.Func; +import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.flow.core.entity.BladeFlow; +import org.springblade.flow.core.feign.IFlowClient; +import org.springblade.flow.core.vo.ComleteTask; +import org.springblade.system.user.cache.UserCache; +import org.springblade.system.user.entity.User; +import org.springblade.system.user.feign.IUserClient; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; + +import javax.servlet.http.HttpServletResponse; +import java.time.LocalDateTime; +import java.time.YearMonth; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAdjusters; +import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; +import java.util.stream.Collectors; + + +/** + *

+ * 工作票 服务实现类 + *

+ * + * @author hx + * @since 2021-10-22 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class WorkTicketServiceImpl extends BaseServiceImpl implements IWorkTicketInfoService { + + private final IWorkTicketSafetyMeasureService workTicketSafetyMeasureService; + private final IWorkTicketPrincipalChangeService workTicketPrincipalChangeService; + private final IWorkTicketDelayService delayService; + private final IWorkTicketMembersChangeService workTicketMembersChangeService; + private final IWorkTicketOperateTimeService workTicketOperateTimeService; + private final IWorkTicketFlowService workTicketFlowService; + private final IFlowClient flowClient; + private final IUserClient userClient; + private final WorkDelayNoScopeMapper workDelayNoScopeMapper; + private final IOperAccessTaskClient operAccessTaskClient; + private final ITaskClient taskClient; + private final TicketInfoEvaluateService ticketInfoEvaluateService; + private final IWorkTicketContentService workTicketContentService; + private final WorkTicketFinishServiceImpl workTicketFinishService; + private final TicketInfoDangerService ticketInfoDangerService; + + /** 生成两票编号锁 **/ + private Lock lock = new ReentrantLock(); + + /** word模板预览导出保存路径 **/ + @Value("${hzims.ticket.path.xlsx.savePath}") + private String xlsSavePath; + + @Value("${hzims.ticket.first-work-flow-key}") + private String firstWorkTicketFlowKey; + + @Value("${hzims.tenantId}") + private String tenantId; + + @Value("${hzims.ticket.path.pdf.savePath}") + private String pdfSavePath; + + @Override + @Transactional + @AroundFlow + public R doSave(WorkTicketInfoDto req) { + req.setCode(this.getWorkTicketCode()); + req.setStatus(Func.isEmpty(req.getPrincipal()) || Func.isEmpty(req.getClassGroupMembers()) ? TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE.getStatus() : TicketConstants.FirstWorkTicketFlowStatusEnum.SIGN.getStatus()); + boolean flag = this.save(req); + /**保存安全措施**/ + if (flag && CollectionUtil.isNotEmpty(req.getWorkTicketSafetyMeasureDtoList())) { + req.getWorkTicketSafetyMeasureDtoList().forEach(workTicketSafetyMeasureDto -> { + workTicketSafetyMeasureDto.setTicketId(req.getId()); + workTicketSafetyMeasureService.save(workTicketSafetyMeasureDto); + }); + } + if (Func.isEmpty(req.getPrincipal()) || Func.isEmpty(req.getClassGroupMembers())) { + //将票据ID会传至计划/任务内 + returnTicket(req); + return R.success("开票成功!该票走线下未开启流程"); + } + /**开启工作流**/ + BladeFlow bladeFlow = this.startProcessInstance(firstWorkTicketFlowKey, req); + this.update(Wrappers.lambdaUpdate().set(WorkTicketInfoEntity::getProcessInstanceId, bladeFlow.getProcessInstanceId()).eq(WorkTicketInfoEntity::getId, req.getId())); + //将票据ID会传至计划/任务内 + returnTicket(req); + return R.success("保存成功"); + } + + /** + * 工作票延期 进入许可人确认工作票延期 + * + * @param ticketId 工作票ID + * @param status 状态 + * @param completeTask 工作流进行 + */ + @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED) + public void delay(Long ticketId, Integer status, ComleteTask completeTask) { + //新增延期信息 + Assert.notNull(completeTask.getVariables().get("delay"), "延期信息不能为空"); + WorkTicketDelayEntity delayEntity = (WorkTicketDelayEntity) completeTask.getVariables().get("delay"); + delayService.save(delayEntity); + //更新负责人确认执行情况流程 填充信息 + WorkTicketFlowEntity workTicketFlowEntity = workTicketFlowService.getOne(Wrappers.lambdaQuery().eq(WorkTicketFlowEntity::getTicketId, ticketId).eq(WorkTicketFlowEntity::getFlowCode, TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_WORK_FINISH.getStatus()).orderByDesc(WorkTicketFlowEntity::getCreateTime).last("limit 1;")); + workTicketFlowService.update(Wrappers.lambdaUpdate().set(WorkTicketFlowEntity::getExecutor, AuthUtil.getUserId().toString()).set(WorkTicketFlowEntity::getExecuteTime, LocalDateTime.now()).eq(WorkTicketFlowEntity::getId, workTicketFlowEntity.getId())); + //更新工作票状态 + this.update(Wrappers.lambdaUpdate().set(WorkTicketInfoEntity::getStatus, status).eq(WorkTicketInfoEntity::getId, ticketId)); + //创建延期流程 + WorkTicketInfoEntity infoEntity = this.getById(ticketId); + WorkTicketFlowEntity currentFlowEntity = new WorkTicketFlowEntity(); + currentFlowEntity.setTicketId(ticketId); + currentFlowEntity.setFlowCode(status.toString()); + currentFlowEntity.setExecutor(infoEntity.getLicensor().toString()); + currentFlowEntity.setProcTaskId((String) completeTask.getVariables().get("procTaskId")); + workTicketFlowService.save(workTicketFlowEntity); + //进入工作流下一步 + R result = flowClient.completeTask(completeTask); + if (!result.isSuccess()) { + throw new ServiceException("执行工作流失败"); + } + } + + @Override + public R detail(Long id) { + WorkTicketInfoEntity workTicketInfoEntity = this.getById(id); + if (ObjectUtil.isEmpty(workTicketInfoEntity)) { + return R.fail("未查询到该ID对应的记录"); + } else { + WorkTicketInfoVO workTicketInfoVO = WorkTicketInfoWrapper.build().entityVO(workTicketInfoEntity); + + /**获取工作票安全措施列表**/ + WorkTicketSafetyMeasureDto workTicketSafetyMeasureDto = new WorkTicketSafetyMeasureDto(); + workTicketSafetyMeasureDto.setTicketId(id); + List workTicketSafetyMeasureVOList = workTicketSafetyMeasureService.list(workTicketSafetyMeasureDto); + workTicketInfoVO.setWorkTicketSafetyMeasureVOList(workTicketSafetyMeasureVOList); + + /**获取工作票负责人变更**/ + WorkTicketPrincipalChangeDto workTicketPrincipalChangeDto = new WorkTicketPrincipalChangeDto(); + workTicketPrincipalChangeDto.setTicketId(id); + List workTicketPrincipalChangeVOList = workTicketPrincipalChangeService.list(workTicketPrincipalChangeDto); + workTicketInfoVO.setWorkTicketPrincipalChangeVOList(workTicketPrincipalChangeVOList); + + /**获取工作票工作组员变更**/ + WorkTicketMembersChangeDto workTicketMembersChangeDto = new WorkTicketMembersChangeDto(); + workTicketMembersChangeDto.setTicketId(id); + List workTicketMembersChangeVOList = workTicketMembersChangeService.list(workTicketMembersChangeDto); + workTicketInfoVO.setWorkTicketMembersChangeVOList(workTicketMembersChangeVOList); + + /**获取工作票跨日运行时间列表**/ + WorkTicketOperateTimeDto workTicketOperateTimeDto = new WorkTicketOperateTimeDto(); + workTicketOperateTimeDto.setTicketId(id); + List workTicketOperateTimeVOList = workTicketOperateTimeService.list(workTicketOperateTimeDto); + workTicketInfoVO.setWorkTicketOperateTimeVOList(workTicketOperateTimeVOList); + + /**获取工作票处理流程列表**/ + WorkTicketFlowDto workTicketFlowDto = new WorkTicketFlowDto(); + workTicketFlowDto.setTicketId(id); + List workTicketFlowVOList = workTicketFlowService.list(workTicketFlowDto); + workTicketInfoVO.setWorkTicketFlowVOList(workTicketFlowVOList); + + /**获取工作票延期列表**/ + WorkTicketDelayDto workTicketDelayDto = new WorkTicketDelayDto(); + workTicketDelayDto.setTicketId(id); + List workTicketDelayList = workDelayNoScopeMapper.selectList(new LambdaQueryWrapper() {{ + eq(WorkTicketDelayEntity::getTicketId, id); + eq(WorkTicketDelayEntity::getIsDeleted, 0L); + }}); + if (CollectionUtil.isNotEmpty(workTicketDelayList)) { + workTicketInfoVO.setWorkTicketDelayVOList(WorkTicketDelayWrapper.build().listVO(workTicketDelayList)); + } + + return R.data(workTicketInfoVO); + } + } + + @Override + public R> queryList(WorkTicketInfoDto req, Query query) { + LambdaQueryWrapper lqw = this.getQueryWrapper(req); + if (ObjectUtil.isNotEmpty(req.getCreateDept())) { + lqw.eq(WorkTicketInfoEntity::getCreateDept, req.getCreateDept()); + } + + lqw.orderByDesc(WorkTicketInfoEntity::getCreateTime).orderByDesc(WorkTicketInfoEntity::getUpdateTime); + IPage pages = this.page(Condition.getPage(query), lqw); + //数据转换 + IPage workTicketInfoVOIPage = new Page<>(pages.getCurrent(), pages.getSize()); + workTicketInfoVOIPage.setRecords(WorkTicketInfoWrapper.build().listVO(pages.getRecords())); + workTicketInfoVOIPage.setPages(pages.getPages()); + workTicketInfoVOIPage.setTotal(pages.getTotal()); + //获取创建人 + workTicketInfoVOIPage.getRecords().forEach(item -> { + User user = UserCache.getUser(item.getCreateUser()); + if (user != null) { + item.setCreateUserName(user.getName()); + } + }); + + + return R.data(workTicketInfoVOIPage); + } + + @Override + public List list(WorkTicketInfoDto req) { + LambdaQueryWrapper lqw = this.getQueryWrapper(req); + List workTicketInfoEntityList = this.list(lqw); + return CollectionUtil.isNotEmpty(workTicketInfoEntityList) ? WorkTicketInfoWrapper.build().listVO(workTicketInfoEntityList) : null; + } + + @Override + @Transactional + public R remove(Long id, String comment) { + WorkTicketInfoEntity entity = this.getById(id); + if (ObjectUtil.isEmpty(entity)) { + return R.fail(400, "删除失败!未查询到相关记录"); + } + + boolean flag = this.update(Wrappers.lambdaUpdate().set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.TERMINATION.getStatus()).eq(WorkTicketInfoEntity::getId, id)); + + /**线下单独删除**/ + if (TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE.getStatus().equals(entity.getStatus())) { + return R.status(flag); + } + /**终止工作流**/ + R r = flowClient.delProcessInstanceById(entity.getProcessInstanceId(), comment); + if (!r.isSuccess()) { + throw new ServiceException("终止工作流失败!"); + } + return R.success("删除成功!"); + } + + @Override + public void exportWorkTicketTemplate(Long id, HttpServletResponse response) { + exportWorkTicketInfoPdf(id, response); + } + + @Override + @SuppressWarnings("unchecked") + public void exportWorkTicketInfoPdf(Long id, HttpServletResponse response) { + R workTicketInfoVOR = this.detail(id); + if (!workTicketInfoVOR.isSuccess()) { + log.error("未查询到相关工作票记录!"); + return; + } + WorkTicketInfoVO workTicketInfoVO = workTicketInfoVOR.getData(); + //将workTicketInfoVO封装进Map,以便pdf导出 + Map workTicketInfoMap = new HashMap<>(); + try { + workTicketInfoMap = PdfUtils.objectToMap(workTicketInfoVO); + } catch (Exception e) { + log.info("转换对象失败!"); + } + //安全措施 + if (CollectionUtil.isNotEmpty(workTicketInfoVO.getWorkTicketSafetyMeasureVOList())) { + Map> measureMap = workTicketInfoVO.getWorkTicketSafetyMeasureVOList().stream().collect(Collectors.groupingBy(WorkTicketSafetyMeasureVO::getType)); + if (ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_ONE))) { + workTicketInfoMap.put("matterLibraryListOne", measureMap.get(TicketConstants.MEASURE_TYPE_ONE).stream().map(measure -> { + Map map = PdfUtils.objectToMap(measure); + map.put("safetyMeasure", ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null); + String status = TicketConstants.SafetyMeasureStatusEnum.FINISH.getStatus().equals(measure.getStatus()) ? TicketConstants.SafetyMeasureStatusEnum.FINISH.getDescribe() : " "; + map.put("status", status); + return map; + }).collect(Collectors.toList())); + } else { + workTicketInfoMap.put("matterLibraryListOne", new ArrayList>(1)); + } + if (ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_TWO))) { + workTicketInfoMap.put("matterLibraryListTwo", measureMap.get(TicketConstants.MEASURE_TYPE_TWO).stream().map(measure -> { + Map map = PdfUtils.objectToMap(measure); + map.put("safetyMeasure", ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null); + String status = TicketConstants.SafetyMeasureStatusEnum.FINISH.getStatus().equals(measure.getStatus()) ? TicketConstants.SafetyMeasureStatusEnum.FINISH.getDescribe() : " "; + map.put("status", status); + return map; + }).collect(Collectors.toList())); + } else { + workTicketInfoMap.put("matterLibraryListTwo", new ArrayList>(1)); + } + if (ObjectUtil.isNotEmpty(measureMap.get(TicketConstants.MEASURE_TYPE_THREE))) { + workTicketInfoMap.put("matterLibraryListThree", measureMap.get(TicketConstants.MEASURE_TYPE_THREE).stream().map(measure -> { + Map map = PdfUtils.objectToMap(measure); + map.put("safetyMeasure", ObjectUtil.isNotEmpty(map.get("measure")) ? map.get("measure") : null); + String status = TicketConstants.SafetyMeasureStatusEnum.FINISH.getStatus().equals(measure.getStatus()) ? TicketConstants.SafetyMeasureStatusEnum.FINISH.getDescribe() : " "; + map.put("status", status); + return map; + }).collect(Collectors.toList())); + } else { + workTicketInfoMap.put("matterLibraryListThree", new ArrayList>(1)); + } + } + //线下开票确认人为空 + workTicketInfoMap.put("membersConfirm", TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE.getStatus().equals(workTicketInfoVO.getStatus()) ? "" : workTicketInfoVO.getMembersName()); + //获取工作票工作流处理信息 + List workTicketFlowVOList = workTicketInfoVO.getWorkTicketFlowVOList(); + //签发 + List signFlow = workTicketFlowVOList.stream().filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(signFlow)) { + workTicketInfoMap.put("signer", signFlow.get(0).getCreateUserName()); + workTicketInfoMap.put("signTime", DateUtil.format(signFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); + } else { + workTicketInfoMap.put("signer", ""); + workTicketInfoMap.put("signTime", ""); + } + //许可人许可 + if (Func.isNotEmpty(workTicketInfoVO.getLicenseTime())) { + workTicketInfoMap.put("licensorConfirm", workTicketInfoVO.getLicensorName()); + workTicketInfoMap.put("licenseTime", DateUtil.format(workTicketInfoVO.getLicenseTime(), TicketConstants.TICKET_DATE_PATTERN)); + } else { + workTicketInfoMap.put("licensorConfirm", ""); + workTicketInfoMap.put("licenseTime", ""); + } + + /**负责人收到工作票**/ + List receiveFlow = workTicketFlowVOList.stream().filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(receiveFlow)) { + workTicketInfoMap.put("receivePrincipal", receiveFlow.get(0).getCreateUserName()); + workTicketInfoMap.put("receiveTime", DateUtil.format(receiveFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); + workTicketInfoMap.put("principalConfirm", workTicketInfoVO.getPrincipalName()); + } else { + workTicketInfoMap.put("receivePrincipal", ""); + workTicketInfoMap.put("receiveTime", ""); + workTicketInfoMap.put("principalConfirm", ""); + } + /**负责人确认安全事项**/ + List confirmFlow = workTicketFlowVOList.stream().filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_MEMBERS.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(confirmFlow)) { + workTicketInfoMap.put("confirmPrincipal", confirmFlow.get(0).getCreateUserName()); + workTicketInfoMap.put("confirmTime", DateUtil.format(confirmFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); + } else { + workTicketInfoMap.put("confirmPrincipal", ""); + workTicketInfoMap.put("confirmTime", ""); + } + /**工作结束**/ + List finishFlow = workTicketFlowVOList.stream().filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.END.getStatus().equals(Integer.parseInt(f.getFlowCode()))).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(finishFlow)) { + workTicketInfoMap.put("finisher", finishFlow.get(0).getCreateUserName()); + workTicketInfoMap.put("finishTime", DateUtil.format(finishFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); + workTicketInfoMap.put("principalFinish", workTicketInfoVO.getPrincipalName()); + } else { + workTicketInfoMap.put("finisher", ""); + workTicketInfoMap.put("finishTime", ""); + workTicketInfoMap.put("principalFinish", ""); + } + /**工作终结**/ + List endFlow = workTicketFlowVOList.stream().filter(f -> TicketConstants.FirstWorkTicketFlowStatusEnum.FINISH.getStatus().intValue() == Integer.parseInt(f.getFlowCode())).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(endFlow)) { + workTicketInfoMap.put("endLicensor", endFlow.get(0).getCreateUserName()); + workTicketInfoMap.put("endTime", DateUtil.format(endFlow.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); + workTicketInfoMap.put("groundSwitchCount", ObjectUtil.isNotEmpty(endFlow.get(0).getGroundSwitchCount()) ? endFlow.get(0).getGroundSwitchCount() : ""); + workTicketInfoMap.put("groundWireCode", ObjectUtil.isNotEmpty(endFlow.get(0).getGroundWireCode()) ? endFlow.get(0).getGroundWireCode() : ""); + workTicketInfoMap.put("groundWireCount", ObjectUtil.isNotEmpty(endFlow.get(0).getGroundWireCount()) ? endFlow.get(0).getGroundWireCount() : ""); + } else { + workTicketInfoMap.put("endLicensor", ""); + workTicketInfoMap.put("endTime", ""); + workTicketInfoMap.put("groundSwitchCount", ""); + workTicketInfoMap.put("groundWireCode", ""); + workTicketInfoMap.put("groundWireCount", ""); + } + /**负责人变更**/ + List workTicketPrincipalChangeVOList = workTicketInfoVO.getWorkTicketPrincipalChangeVOList(); + if (CollectionUtil.isNotEmpty(workTicketPrincipalChangeVOList)) { + workTicketInfoMap.put("initPrincipal", workTicketPrincipalChangeVOList.get(0).getInitialPrincipalName()); + workTicketInfoMap.put("changePrincipal", workTicketPrincipalChangeVOList.get(0).getChangePrincipalName()); + workTicketInfoMap.put("principalChangeSigner", workTicketPrincipalChangeVOList.get(0).getCreateUserName()); + workTicketInfoMap.put("principalChangeTime", DateUtil.format(workTicketPrincipalChangeVOList.get(0).getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); + } else { + workTicketInfoMap.put("initPrincipal", ""); + workTicketInfoMap.put("changePrincipal", ""); + workTicketInfoMap.put("principalChangeSigner", ""); + workTicketInfoMap.put("principalChangeTime", ""); + } + /**工作成员变更**/ + List membersChangeList = workTicketInfoVO.getWorkTicketMembersChangeVOList(); + if (CollectionUtil.isNotEmpty(membersChangeList)) { + /**工作成员变更详情**/ + String membersChangeSituation = membersChangeList.stream().map(mc -> DateUtil.format(mc.getCreateTime(), TicketConstants.TICKET_DATE_PATTERN).concat(":").concat(mc.getChangeMembersName())).collect(Collectors.joining(";")); + workTicketInfoMap.put("membersChangeSituation", membersChangeSituation); + workTicketInfoMap.put("memberChangePrincipal", membersChangeList.get(0).getCreateUserName()); + } else { + workTicketInfoMap.put("membersChangeSituation", ""); + workTicketInfoMap.put("memberChangePrincipal", ""); + } + /**工作票延期**/ + List workTicketDelayVOList = workTicketInfoVO.getWorkTicketDelayVOList(); + if (CollectionUtil.isNotEmpty(workTicketDelayVOList)) { + WorkTicketDelayVO workTicketDelayVO = workTicketDelayVOList.get(0); + workTicketInfoMap.put("delayTime", DateUtil.format(workTicketDelayVO.getChangeTime(), TicketConstants.TICKET_DATE_PATTERN)); + workTicketInfoMap.put("delayPrincipal", workTicketDelayVO.getCreateUserName()); + workTicketInfoMap.put("delayPrincipalTime", DateUtil.format(workTicketDelayVO.getCreateTime(), TicketConstants.TICKET_DATE_PATTERN)); + workTicketInfoMap.put("delayLicensor", workTicketDelayVO.getLicensorName()); + workTicketInfoMap.put("delayLicenseTime", DateUtil.format(workTicketDelayVO.getLicenseTime(), TicketConstants.TICKET_DATE_PATTERN)); + } else { + workTicketInfoMap.put("delayTime", ""); + workTicketInfoMap.put("delayPrincipal", ""); + workTicketInfoMap.put("delayPrincipalTime", ""); + workTicketInfoMap.put("delayLicensor", ""); + workTicketInfoMap.put("delayLicenseTime", ""); + } + + /**跨日工作时间**/ + List operateList = workTicketInfoVO.getWorkTicketOperateTimeVOList(); + if (CollectionUtil.isNotEmpty(operateList)) { + List> operateMapList = operateList.stream().map(operate -> { + Map map = new HashMap<>(4); + map.put("startTime", DateUtil.format(operate.getStartTime(), TicketConstants.TICKET_DATE_PATTERN)); + map.put("endTime", DateUtil.format(operate.getEndTime(), TicketConstants.TICKET_DATE_PATTERN)); + map.put("principal", operate.getPrincipalName()); + map.put("licensor", operate.getLicensorName()); + return map; + }).collect(Collectors.toList()); + workTicketInfoMap.put("operateMapList", operateMapList); + } else { + List> operateMapList = new ArrayList<>(); + Map map = new HashMap<>(4); + map.put("startTime", ""); + map.put("endTime", ""); + map.put("principal", ""); + map.put("licensor", ""); + operateMapList.add(map); + workTicketInfoMap.put("operateMapList", operateMapList); + } + + /**运行值班人员暂为空**/ + workTicketInfoMap.put("dutyPersonName", "/"); + + String fileName = TicketConstants.WordFileNameEnum.getFileNameByType(workTicketInfoVO.getType()) + PdfUtils.XLSX_SUFFIX; + log.info("工作票模板为:{}", fileName); + TemplateExportParams templateExportParams = new TemplateExportParams("template/" + fileName, true); + Workbook workbook = null; + try { + workbook = ExcelUtil.getWorkbook(templateExportParams, workTicketInfoMap); + } catch (Exception e) { + e.printStackTrace(); + } + //上传xlsx至服务器 + try { + ExcelUtil.upload(workbook, xlsSavePath, workTicketInfoVO.getWorkContent() + PdfUtils.XLSX_SUFFIX); + } catch (Exception e) { + e.printStackTrace(); + } + //将xlsx文件转换为pdf并保存 + String pdfFileName = workTicketInfoVO.getWorkContent() + PdfUtils.PDF_SUFFIX; + String xlsFileName = workTicketInfoVO.getWorkContent() + PdfUtils.XLSX_SUFFIX; + PdfUtils.convertPdf(xlsSavePath, xlsFileName, pdfSavePath, pdfFileName); + String savePath = pdfSavePath + pdfFileName; + // 设置response参数,可以打开下载页面 + PdfUtils.readPdf(response, savePath); + } + + @Override + @Transactional + public R completeTask(WorkTicketInfoDto req, BladeFlow flow) { + ComleteTask task = new ComleteTask(); + task.setTaskId(flow.getTaskId()); + task.setComment(flow.getComment()); + task.setAttachments(flow.getAttachments()); + task.setFlag(flow.getFlag()); + task.setProcessInstanceId(flow.getProcessInstanceId()); + task.setVariables(flow.getVariables()); + + //待许可时获取许可人角色下用户开启工作流 + if (TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(req.getStatus())) { + R> userListR = userClient.relationUserListByRoleAlias(AuthUtil.getTenantId(), req.getCreateDept(), TicketConstants.LICENSOR_ROLE); + if (!userListR.isSuccess()) { + throw new ServiceException(userListR.getMsg()); + } + Map variables = CollectionUtil.isEmpty(flow.getVariables()) ? new HashMap<>() : flow.getVariables(); + String taskUser = userListR.getData().stream().map(u -> "taskUser_".concat(u.getId().toString())).collect(Collectors.joining(",")); + variables.put("licenseUserIds", taskUser); + task.setVariables(variables); + } + log.info("工作流对象为:{}", JSONObject.toJSONString(flow)); + + if (TicketConstants.FirstWorkTicketFlowStatusEnum.LICENSE.getStatus().equals(req.getStatus())) { + req.setSigner(AuthUtil.getUserId()); + } else if (TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(req.getStatus())) { + req.setLicensor(AuthUtil.getUserId()); + } else if (TicketConstants.FirstWorkTicketFlowStatusEnum.INVALID.getStatus().equals(req.getStatus())) { + this.invalidTicket(req); + } + + //更新状态 + boolean flag = this.update(Wrappers.lambdaUpdate().set(WorkTicketInfoEntity::getStatus, req.getStatus()).set(WorkTicketInfoEntity::getPrincipal, req.getPrincipal()).set(WorkTicketInfoEntity::getLicensor, req.getLicensor()).set(WorkTicketInfoEntity::getLicenseTime, req.getLicenseTime()).set(WorkTicketInfoEntity::getLicenseEndTime, req.getLicenseEndTime()).eq(WorkTicketInfoEntity::getId, req.getId())); + + //新增流程信息 + WorkTicketFlowEntity workTicketFlowEntity = new WorkTicketFlowEntity(); + workTicketFlowEntity.setTicketId(req.getId()); + workTicketFlowEntity.setFlowCode(req.getStatus().toString()); + workTicketFlowEntity.setExecutor(AuthUtil.getUserId().toString()); + workTicketFlowEntity.setExecuteTime(LocalDateTime.now()); + workTicketFlowEntity.setRemark(Optional.ofNullable(flow.getVariables()).map(v -> v.get("remark")).map(s -> s.toString()).orElse("")); + workTicketFlowEntity.setSignImgPath(Optional.ofNullable(flow.getVariables()).map(v -> v.get("signImgPath")).map(s -> s.toString()).orElse("")); + workTicketFlowEntity.setGroundWireCount(Optional.ofNullable(flow.getVariables()).map(v -> v.get("groundWireCount")).map(s -> Integer.parseInt(s.toString())).orElse(null)); + workTicketFlowEntity.setGroundSwitchCount(Optional.ofNullable(flow.getVariables()).map(v -> v.get("groundSwitchCount")).map(s -> Integer.parseInt(s.toString())).orElse(null)); + workTicketFlowEntity.setStatus(req.getStatus()); + workTicketFlowService.save(workTicketFlowEntity); + //执行流程 + R flowResult = flowClient.completeTask(task); + //更新任务状态 + updateAccessStatus(req); + + if (!flowResult.isSuccess()) { + throw new ServiceException("执行工作流失败!"); + } + + return R.success("操作成功!"); + } + + @Transactional(rollbackFor = Exception.class) + public void updateAccessStatus(WorkTicketInfoDto req) { + if (TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType()) || TicketConstants.TaskTypeEnum.JXJH.getType().equals(req.getTaskType())) { + log.info("许可通过:{}", JSONObject.toJSONString(req)); + //许可人通过将检修任务状态设为执行中 + if (TicketConstants.FirstWorkTicketFlowStatusEnum.CONFIRM_MEASURE_PRINCIPAL.getStatus().equals(req.getStatus())) { + OperAccessTaskEntity taskEntity = new OperAccessTaskEntity(); + taskEntity.setId(req.getTaskId()); + taskEntity.setStatus(AccessConstants.ACCESS_TASK_STATUS_1); + //设置开始时间 + taskEntity.setActStartTime(DateUtil.now()); + operAccessTaskClient.updateById(taskEntity); + } + } + } + + /*** + * 票据作废时 对应任务ID应该置空 + * @param req + */ + public void invalidTicket(WorkTicketInfoDto req) { + if (TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType()) || TicketConstants.TaskTypeEnum.JXJH.getType().equals(req.getTaskType())) { + OperAccessTaskEntity taskEntity = new OperAccessTaskEntity(); + taskEntity.setId(req.getTaskId()); + taskEntity.setInvalid(true); + taskEntity.setTicketId(null); + operAccessTaskClient.updateById(taskEntity); + } + if (TicketConstants.TaskTypeEnum.RCWH.getType().equals(req.getTaskType())) { + OperMaintenanceTaskDTO dto = new OperMaintenanceTaskDTO(); + dto.setId(req.getTaskId()); + dto.setInvalid(true); + //dto.setTicketId(null); + taskClient.doUpdateTaskById(dto); + } + } + + /*** + * 回传票据ID + * @param req + */ + @Transactional(rollbackFor = Exception.class) + public void returnTicket(WorkTicketInfoDto req) { + if (TicketConstants.TaskTypeEnum.JXRW.getType().equals(req.getTaskType())) { + OperAccessTaskEntity taskEntity = new OperAccessTaskEntity(); + taskEntity.setId(req.getTaskId()); + taskEntity.setTicketId(req.getId()); + operAccessTaskClient.updateById(taskEntity); + } + if (TicketConstants.TaskTypeEnum.RCWH.getType().equals(req.getTaskType())) { + OperMaintenanceTaskDTO dto = new OperMaintenanceTaskDTO(); + dto.setId(req.getTaskId()); + dto.setTicketId(req.getId()); + taskClient.doUpdateTaskById(dto); + } + } + + /** + * 获取queryWrapper + * + * @param req + * @return + */ + private LambdaQueryWrapper getQueryWrapper(WorkTicketInfoDto req) { + LambdaQueryWrapper lqw = new LambdaQueryWrapper(); + if (Func.isNotBlank(req.getProcessInstanceId())) { + lqw.eq(WorkTicketInfoEntity::getProcessInstanceId, req.getProcessInstanceId()); + } + if (Func.isNotEmpty(req.getType())) { + lqw.eq(WorkTicketInfoEntity::getType, req.getType()); + } + if (Func.isNotEmpty(req.getTaskType())) { + lqw.eq(WorkTicketInfoEntity::getTaskType, req.getTaskType()); + } + if (Func.isNotEmpty(req.getCode())) { + lqw.like(WorkTicketInfoEntity::getCode, req.getCode()); + } + if (Func.isNotEmpty(req.getStatus())) { + lqw.eq(WorkTicketInfoEntity::getStatus, req.getStatus()); + } + if (Func.isNotEmpty(req.getCompany())) { + lqw.like(WorkTicketInfoEntity::getType, "%".concat(req.getCompany()).concat("%")); + } + if (Func.isNotEmpty(req.getClassGroup())) { + lqw.eq(WorkTicketInfoEntity::getClassGroup, req.getClassGroup()); + } + if (Func.isNotEmpty(req.getTaskId())) { + lqw.eq(WorkTicketInfoEntity::getTaskId, req.getTaskId()); + } + if (Func.isNotEmpty(req.getClassGroup())) { + lqw.eq(WorkTicketInfoEntity::getClassGroup, req.getClassGroup()); + } + if (Func.isNotEmpty(req.getClassGroupMembers())) { + lqw.like(WorkTicketInfoEntity::getClassGroupMembers, "%".concat(req.getClassGroupMembers()).concat("%")); + } + if (Func.isNotEmpty(req.getWorkContent())) { + lqw.like(WorkTicketInfoEntity::getWorkContent, "%".concat(req.getWorkContent()).concat("%")); + } + if (Func.isNotEmpty(req.getSigner())) { + lqw.eq(WorkTicketInfoEntity::getSigner, req.getSigner()); + } + if (Func.isNotEmpty(req.getLicensor())) { + lqw.eq(WorkTicketInfoEntity::getLicensor, req.getLicensor()); + } + if (Func.isNotEmpty(req.getStartTime())) { + lqw.ge(WorkTicketInfoEntity::getCreateTime, req.getStartTime()); + } + if (Func.isNotEmpty(req.getEndTime())) { + lqw.le(WorkTicketInfoEntity::getCreateTime, req.getEndTime()); + } + if (!CollectionUtil.isEmpty(req.getDeptIds())) { + lqw.in(WorkTicketInfoEntity::getCreateDept, req.getDeptIds()); + } + return lqw; + } + + /** + * 开启一个流程实例 + * + * @author hx + **/ + @Override + public BladeFlow startProcessInstance(String processDefinitionKey, WorkTicketInfoEntity workTicketInfoEntity) { + /**获取签发人角色下的人员**/ + R> listR = userClient.relationUserListByRoleAlias(tenantId, Long.parseLong(AuthUtil.getUser().getDeptId()), TicketConstants.SIGNER_ROLE); + if (!listR.isSuccess() || CollectionUtil.isEmpty(listR.getData())) { + throw new ServiceException("工作票签发人角色下未查询到相关人员"); + } + String signUserIds = listR.getData().stream().map(user -> "taskUser_".concat(user.getId().toString())).collect(Collectors.joining(",")); + + Map params = new HashMap(2) {{ + put("taskId", workTicketInfoEntity.getId()); + put("signUserIds", signUserIds); + }}; + + R r = flowClient.startProcessInstanceContainNameByKey(processDefinitionKey, "workTicket:task:" + workTicketInfoEntity.getId(), workTicketInfoEntity.getWorkContent(), params); + if (!r.isSuccess()) { + throw new ServiceException(r.getMsg()); + } + return r.getData(); + } + + /** + * 许可人通过线下工作票 + * + * @param req + * @return + */ + @Override + public R licenseOfflineTicket(WorkTicketInfoDto req) { + Long ticketId = req.getId(); + WorkTicketInfoEntity infoEntity = getById(ticketId); + //获取许可人角色下的人员 + R> listR = userClient.relationUserListByRoleAlias(tenantId, infoEntity.getCreateDept(), TicketConstants.LICENSOR_ROLE); + if (!listR.isSuccess() || CollectionUtil.isEmpty(listR.getData())) { + throw new ServiceException("工作票许可人角色下未查询到相关人员"); + } + List userId = listR.getData().stream().map(User::getId).distinct().collect(Collectors.toList()); + if (!userId.contains(AuthUtil.getUserId())) { + throw new ServiceException("当前操作人没有许可人角色,无法执行该操作"); + } + update(Wrappers.lambdaUpdate().set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_LICENSE.getStatus()).set(WorkTicketInfoEntity::getLicensor, AuthUtil.getUserId()).set(WorkTicketInfoEntity::getLicenseTime, LocalDateTime.now()).set(WorkTicketInfoEntity::getLicenseEndTime, req.getLicenseEndTime()).eq(WorkTicketInfoEntity::getId, ticketId)); + return R.success("操作成功"); + } + + /** + * 完成线下工作票 + * + * @param ticketAccessTaskDto + * @return + */ + @Override + public R finishOfflineTicket(TicketAccessTaskDto ticketAccessTaskDto) { + //更新工作票 + WorkTicketInfoDto infoDto = ticketAccessTaskDto.getWorkTicketInfoDto(); + update(Wrappers.lambdaUpdate().set(WorkTicketInfoEntity::getStatus, TicketConstants.FirstWorkTicketFlowStatusEnum.OFFLINE_END.getStatus()).eq(WorkTicketInfoEntity::getId, infoDto.getId())); + //获取工作票实体类 + WorkTicketInfoEntity infoEntity = getById(infoDto.getId()); + //根据任务类型执行任务 + if (ObjectUtil.isEmpty(infoEntity.getTaskType())) { + return R.success("操作成功"); + } + //FIXME 日常维护、检修任务暂时不形成闭环(因许可人无需填入任务结束完成所需参数,故选择由执行人手动闭环) ~2022--05-06 +// if(TicketConstants.TaskTypeEnum.JXRW.getType().equals(infoEntity.getTaskType()) +// || TicketConstants.TaskTypeEnum.JXJH.getType().equals(infoEntity.getTaskType())) { +// //执行检修任务 +// OperAccessTaskDTO accessTaskDTO = ticketAccessTaskDto.getAccessTaskDTO(); +// accessTaskDTO.setId(infoEntity.getTaskId()); +// if(ObjectUtil.isNotEmpty(accessTaskDTO) && ObjectUtil.isNotEmpty(accessTaskDTO.getId())){ +// log.info("线下检修任务执行调用传参为:{}",JSONObject.toJSONString(accessTaskDTO)); +// //operAccessTaskClient.finishAccessTask(accessTaskDTO); +// } +// } +// else if(TicketConstants.TaskTypeEnum.RCWH.getType().equals(infoEntity.getTaskType())) { +// //执行日常维护任务 +// OperMaintenanceTaskDTO operMaintenanceTaskDTO = new OperMaintenanceTaskDTO(); +// operMaintenanceTaskDTO.setId(infoEntity.getTaskId()); +// operMaintenanceTaskDTO.setStatus(MaintenanceConstant.TASK_STATUS_3); +// if(ObjectUtil.isNotEmpty(operMaintenanceTaskDTO) && ObjectUtil.isNotEmpty(operMaintenanceTaskDTO.getId()) ){ +// ComleteTask comleteTask = new ComleteTask(); +// comleteTask.setProcessInstanceId(operMaintenanceTaskDTO.getProcessInstanceId()); +// comleteTask.setFlag("ok"); +// comleteTask.setPass(true); +// comleteTask.setComment("执行完成"); +// TaskFlowDTO taskFlowDTO = TaskFlowDTO.builder().taskDTO(operMaintenanceTaskDTO).comleteTask(comleteTask).build(); +// log.info("线下日常维护任务执行调用传参为:{}",JSONObject.toJSONString(taskFlowDTO)); +// //R result = taskClient.updateTaskStatus(taskFlowDTO); +// } +// } + return R.success("操作成功"); + } + + /*** + * 获取工作票编号 + * @return + */ + @Override + public String getWorkTicketCode() { + String code = ""; + lock.lock(); + try { + /**获取当前时间**/ + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMM"); + YearMonth yearMonth = YearMonth.now(); + String tym = yearMonth.format(formatter); + LocalDateTime date = LocalDateTime.now(); + LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0); + LocalDateTime lastDay = date.with(TemporalAdjusters.lastDayOfMonth()).withHour(23).withMinute(59).withSecond(59); + log.info("当月第一天:{};当月最后一天{}", firstDay, lastDay); + /**获取当月工作票总条数**/ + List infoEntityList = this.list(new LambdaQueryWrapper() {{ + ge(WorkTicketInfoEntity::getCreateTime, firstDay); + le(WorkTicketInfoEntity::getCreateTime, lastDay); + }}); + if (CollectionUtil.isEmpty(infoEntityList)) { + code = TicketConstants.TicketCodePreEnum.DQ_WORK.getPrefix().concat("-").concat(tym).concat("-001"); + } else { + code = TicketConstants.TicketCodePreEnum.DQ_WORK.getPrefix().concat("-").concat(tym).concat("-").concat(String.format("%03d", infoEntityList.size() + 1)); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + lock.unlock(); + } + return code; + } + + /** + * 获取安全检查工作票项统计 + * + * @param startDate 开始时间 + * @param endDate 结束时间 + * @param dept 机构ID + * @return WorkTicketStatisticVO统计对象 + */ + @Override + public SafeCheckStatisticVO getWorkTicketStatistic(String startDate, String endDate, Long dept) { + return this.baseMapper.getWorkTicketStatistic(startDate, endDate, dept); + } + + /** + * 验证角色是否能查询到相关人员 + * + * @param deptId 机构ID + * @param roleAliasArray 角色 按逗号分隔 + * @return + */ + @Override + public R> verificationRole(Long deptId, String roleAliasArray) { + Map result = new HashedMap(2); + List failRoleAliasList = Lists.newArrayList(); + AtomicBoolean flag = new AtomicBoolean(true); + Arrays.stream(roleAliasArray.split(",")).forEach(roleAlias -> { + //查询机构下角色是否有对应人员列表 + R> listR = userClient.relationUserListByRoleAlias(tenantId, deptId, roleAlias); + if (!listR.isSuccess() || ObjectUtil.isEmpty(listR.getData())) { + failRoleAliasList.add(roleAlias); + flag.set(false); + } + }); + result.put("flag", flag.get()); + if (CollectionUtil.isNotEmpty(failRoleAliasList)) { + result.put("message", "验证失败,获取" + JSON.toJSONString(failRoleAliasList) + "角色下的人员失败"); + } + + return R.data(result); + } + + /** + * 根据月份和区域查询工作票列表详情 + * + * @param pageEntity + * @param areaVo + * @return + */ + @Override + public BladePage workTicketListByMonthAndArea(Page pageEntity, StandardTicketWithAreaVo areaVo) { + //1.查询 + QueryWrapper queryWrapper = new QueryWrapper<>(); + + //开票来源 + queryWrapper.eq(Func.isNotEmpty(areaVo.getTaskType()), "sti.task_type", areaVo.getTaskType()); + //编号 + queryWrapper.like(Func.isNotEmpty(areaVo.getCode()), "sti.code", areaVo.getCode()); + + //状态 + queryWrapper.eq(Func.isNotEmpty(areaVo.getStatus()), "sti.status", areaVo.getStatus()); + + //开始时间 + queryWrapper.lt(Func.isNotEmpty(areaVo.getStartTime()), "sti.create_time", areaVo.getStartTime()); + + //结束时间 + queryWrapper.le(Func.isNotEmpty(areaVo.getEndTime()), "sti.create_time", areaVo.getEndTime()); + + + queryWrapper.eq("sti.create_dept", areaVo.getAreaId()); + queryWrapper.eq(areaVo.getYearMonth() != null, "date_format(sti.create_time,'%Y-%m')", areaVo.getYearMonth()); + //如果为1为合格 + // queryWrapper.eq("tie.status",1); + Page workTicketInfoEntityPage = baseMapper.selectPages(pageEntity, queryWrapper); + //数据转换 + List standardWorkList = new ArrayList<>(); + if (CollectionUtil.isNotEmpty(workTicketInfoEntityPage.getRecords())) { + standardWorkList = workTicketInfoEntityPage.getRecords().stream().map(workTicketInfoEntity -> { + StandardWorkVo standardWorkVo = new StandardWorkVo(); + BeanUtils.copyProperties(workTicketInfoEntity, standardWorkVo); + return standardWorkVo; + }).collect(Collectors.toList()); + } + + IPage page = new Page<>(); + page.setRecords(standardWorkList); + page.setTotal(workTicketInfoEntityPage.getTotal()); + page.setCurrent(workTicketInfoEntityPage.getCurrent()); + page.setSize(workTicketInfoEntityPage.getSize()); + BladePage bladePage = BladePage.of(page); + return bladePage; + } + + + /** + * 判断是否存在合格率 如果存在返回true 否则为false + * + * @param item + * @return + */ + private boolean isTicketPercentById(WorkTicketInfoEntity item) { + LambdaQueryWrapper ticketInfoEvaluateEntityLambdaQueryWrapper = new LambdaQueryWrapper<>(); + ticketInfoEvaluateEntityLambdaQueryWrapper.eq(TicketInfoEvaluateEntity::getTicketId, item.getId()); + ticketInfoEvaluateEntityLambdaQueryWrapper.eq(TicketInfoEvaluateEntity::getStatus, TicketConstants.TicketQualifiedEnum.Qualified.getCode()); + // 查询合格评价 + int count = ticketInfoEvaluateService.count(ticketInfoEvaluateEntityLambdaQueryWrapper); + return count > 0; + } + + + /** + * 更新状态值 + * + * @param status + * @param description + * @param id + */ + @Override + public void updateFlowStatusById(Integer status, String description, Long id) { + LambdaUpdateWrapper queryWrapper = new LambdaUpdateWrapper<>(); + queryWrapper.set(WorkTicketInfoEntity::getFlowStatus, status); + queryWrapper.set(WorkTicketInfoEntity::getFlowDescription, description); + queryWrapper.eq(WorkTicketInfoEntity::getId, id); + } + + /** + * 获取工作详情 + * + * @param ticketId + * @return + */ + @Override + public WorkTicketVo selectDetailsById(Long ticketId) { + WorkTicketVo workTicketVo = new WorkTicketVo(); + + //1. 获取工作票详情数据 + WorkTicketInfoEntity workTicketInfo = this.getById(ticketId); + if (ObjectUtils.isEmpty(workTicketInfo)) { + throw new ServiceException("未查询到ticketId对应的信息"); + } + + //赋值签发人 + if (workTicketInfo.getSigner() != null) { + User user = UserCache.getUser(workTicketInfo.getSigner()); + workTicketInfo.setSignerName(user == null ? null : user.getName()); + } + + if (workTicketInfo.getSigner() != null && workTicketInfo.getSignerName() == null) { + User user = UserCache.getUser(workTicketInfo.getSigner()); + workTicketInfo.setSignerName(user == null ? null : user.getName()); + } + + //赋值许可人名称 + if (workTicketInfo.getLicensor() != null) { + User user = UserCache.getUser(workTicketInfo.getLicensor()); + workTicketInfo.setLicensorName(user == null ? null : user.getName()); + } + + if (workTicketInfo.getLicensor() != null && workTicketInfo.getLicensorName() == null) { + User user = UserCache.getUser(workTicketInfo.getLicensor()); + workTicketInfo.setLicensorName(user == null ? null : user.getName()); + } + + // 负责值班负责人 + if (workTicketInfo.getWatchPrincipal() != null) { + User user = UserCache.getUser(workTicketInfo.getWatchPrincipal()); + workTicketInfo.setWatchPrincipalName(user == null ? null : user.getName()); + } + + if (workTicketInfo.getWatchPrincipal() != null && workTicketInfo.getWatchPrincipalName() == null) { + User user = UserCache.getUser(workTicketInfo.getWatchPrincipal()); + workTicketInfo.setWatchPrincipalName(user == null ? null : user.getName()); + } + + + StringBuilder sb = new StringBuilder(); + String classGroupMembers = workTicketInfo.getClassGroupMembers(); + if (StringUtils.isNoneBlank(classGroupMembers)) { + // System.out.println("获取classGroupMembers ==> " + classGroupMembers); + String[] split = classGroupMembers.split(","); + for (String classGroupMember : split) { + System.out.println(classGroupMember); + if (StringUtils.isNoneBlank(classGroupMember)) { + boolean matches = classGroupMember.matches("[0-9]+"); + if (matches) { + User user = UserCache.getUser(Long.valueOf(classGroupMember)); + String name = user == null ? null : user.getName(); + if (StringUtils.isNotBlank(name)) { + sb.append(name).append(","); + } + } + } + } + + //统计人数 + if (workTicketInfo.getTotalPerson() == null) { + workTicketInfo.setTotalPerson(sb.toString().trim().split(",").length); + } + + //成员信息 + if (workTicketInfo.getClassGroupMembersName() == null) { + workTicketInfo.setClassGroupMembersName(sb.toString().endsWith(",") ? + sb.toString().substring(0, sb.length() - 1) : sb.toString()); + } + } + + + //负责人名称 + if (workTicketInfo.getPrincipalName() == null && workTicketInfo.getPrincipal() != null) { + User user = UserCache.getUser(workTicketInfo.getPrincipal()); + workTicketInfo.setPrincipalName(user == null ? "" : user.getName()); + } + + + workTicketVo.setWorkTicket(workTicketInfo); + + //2. 安全措施数组 + List workTicketSafetyMeasureEntity = workTicketSafetyMeasureService.selectByTicketId(ticketId); + if (CollectionUtils.isNotEmpty(workTicketSafetyMeasureEntity)) { + workTicketVo.setSafetyMeasuresList(workTicketSafetyMeasureEntity); + } + + //3. 工作票工作任务组 + List workTicketContentEntities = workTicketContentService.selectByTicketId(ticketId); + if (CollectionUtils.isNotEmpty(workTicketContentEntities)) { + workTicketVo.setWorkTicketContentDtoList(workTicketContentEntities); + } + + //4. 工作票延期 + WorkTicketDelayEntity workTicketDelayEntity = delayService.selectByTicketId(ticketId); + if (ObjectUtils.isNotEmpty(workTicketDelayEntity)) { + workTicketVo.setWorkTicketDelay(workTicketDelayEntity); + } + + + //5.工作结束 + WorkTicketFinish workTicketFinish = workTicketFinishService.selectByTicketId(ticketId); + if (ObjectUtils.isNotEmpty(workTicketFinish)) { + workTicketVo.setWorkTicketFinish(workTicketFinish); + } + + + //6.工作开始时间和结束时间 + List workTicketOperateTimeEntities = + workTicketOperateTimeService.selectByTicketId(ticketId); + if (CollectionUtils.isNotEmpty(workTicketOperateTimeEntities)) { + workTicketVo.setWorkTicketOperateTimeEntities(workTicketOperateTimeEntities); + } + + + //7. 工作票负责人变更 + WorkTicketPrincipalChangeEntity workTicketPrincipalChangeEntity = + workTicketPrincipalChangeService.selectByTicketId(ticketId); + if (ObjectUtils.isNotEmpty(workTicketPrincipalChangeEntity)) { + //原负责人 + if (workTicketPrincipalChangeEntity.getInitialPrincipal() != null) { + workTicketPrincipalChangeEntity.setInitialPrincipalName( + UserCache.getUser(workTicketPrincipalChangeEntity.getInitialPrincipal()).getName() + ); + } + //变更负责人 + if (workTicketPrincipalChangeEntity.getChangePrincipal() != null) { + workTicketPrincipalChangeEntity.setChangePrincipalName( + UserCache.getUser(workTicketPrincipalChangeEntity.getChangePrincipal()).getName() + ); + } + + workTicketVo.setWorkTicketPrincipalChange(workTicketPrincipalChangeEntity); + } + + + //7. 根据工作票Id查询工作票危险点分析及控制措施票 + List list = ticketInfoDangerService.selectAllByTicket(workTicketInfo.getId()); + if (CollectionUtils.isNotEmpty(list)) { + workTicketVo.setTicketInfoDangers(list); + } + return workTicketVo; + } +} diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/PlanMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/PlanMapper.xml new file mode 100644 index 0000000..4cb6c9b --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/equipment/PlanMapper.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/AccessMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/AccessMapper.xml new file mode 100644 index 0000000..41e93fb --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/AccessMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/DefectMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/DefectMapper.xml new file mode 100644 index 0000000..5e93d41 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/DefectMapper.xml @@ -0,0 +1,4 @@ + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/MaintenanceMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/MaintenanceMapper.xml new file mode 100644 index 0000000..2cfd506 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/MaintenanceMapper.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/OtherMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/OtherMapper.xml similarity index 95% rename from hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/OtherMapper.xml rename to hzims-service/hzims-scheduled/src/main/resources/mapper/operation/OtherMapper.xml index 44e22e4..af9c98d 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/mapper/OtherMapper.xml +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/OtherMapper.xml @@ -1,6 +1,6 @@ - + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/OverDetailsMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/OverDetailsMapper.xml new file mode 100644 index 0000000..4f13622 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/OverDetailsMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + ID, OVER_ID , OVER_CONFIG_ID , PRICE , QUANTITY , TOTAL_PRICE, TENANT_ID, STATUS, CREATE_TIME, UPDATE_TIME, + CREATE_USER, UPDATE_USER, IS_DELETED, CREATE_DEPT + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/OverMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/OverMapper.xml new file mode 100644 index 0000000..c8d9cf8 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/OverMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + ID, START_DATE , END_DATE , TOTAL_PRICE , ENCL_PATH , ENCL_NAME ,TENANT_ID, STATUS, + CREATE_TIME, UPDATE_TIME, CREATE_USER, UPDATE_USER, IS_DELETED, CREATE_DEPT + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/SolveMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/SolveMapper.xml new file mode 100644 index 0000000..3e900d4 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/operation/SolveMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + ID, SOLVE_DATE , SOLVE_QUANTITY , SOLVE_SUC_QUANTITY ,TENANT_ID, STATUS, CREATE_TIME, + UPDATE_TIME, CREATE_USER, UPDATE_USER, IS_DELETED, CREATE_DEPT + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/ticket/TicketEvaluateMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/ticket/TicketEvaluateMapper.xml new file mode 100644 index 0000000..d378bac --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/ticket/TicketEvaluateMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/ticket/TicketMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/ticket/TicketMapper.xml new file mode 100644 index 0000000..24b9def --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/ticket/TicketMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/hzims-service/hzims-scheduled/src/main/resources/mapper/ticket/WorkTicketMapper.xml b/hzims-service/hzims-scheduled/src/main/resources/mapper/ticket/WorkTicketMapper.xml new file mode 100644 index 0000000..3eb5e81 --- /dev/null +++ b/hzims-service/hzims-scheduled/src/main/resources/mapper/ticket/WorkTicketMapper.xml @@ -0,0 +1,4 @@ + + + + diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperDefectService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperDefectService.java index f1e652b..30ab90c 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperDefectService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/IOperDefectService.java @@ -1,101 +1,13 @@ package com.hnac.hzims.operational.defect.service; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.hnac.hzims.operational.defect.entity.OperDefectEntity; -import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; -import com.hnac.hzims.operational.defect.vo.OperDefectVO; -import com.hnac.hzims.operational.report.vo.DefectReportsVO; -import com.hnac.hzims.vo.SafeCheckStatisticVO; import org.springblade.core.mp.base.BaseService; -import org.springblade.core.tool.api.R; -import org.springblade.flow.core.entity.BladeFlow; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.time.LocalDate; -import java.util.List; -import java.util.Map; /** - * 服务类 - * - * @author Chill + * @author ysj */ public interface IOperDefectService extends BaseService { - /** - * 开始问题处理流程 - * 问题处理流程的第一个处理节点人key 必须是 problemUser - * @param - */ - void startFlow(OperPhenomenonEntity entity, OperDefectEntity defectEntity); - /** - * 处理问题 - * @param flow - * @return - */ - boolean handleProcess(BladeFlow flow); - - /** - * 获取缺陷的统计月报 - * @param month 格式:"2021-01" - */ - Map getDefectStatistics(String month); - - /** - * 导出缺陷统计月报报表 - * @param response - * @param month 格式 "2021-01" - * @throws IOException - */ - void exportFualtMonthExcel(HttpServletResponse response, String month) throws IOException; - - - List getDefectList(String emCode,List list); - - List getDefectByEmCodeList(String emCode); - - /** - * 站点月报统计 - 消缺 - * @param startDate - * @param endDate - * @param deptIdList - * @return - */ - List getFaultByFaultCode(LocalDate startDate,LocalDate endDate,List deptIdList); - - List getFaultByFaultCode(Map params); - - List> getDefectConclusion(Map params); - - /** - * 缺陷详情 - * @param defect - * @return - */ - R detail(OperDefectEntity defect); - - /** - * 获取安全检查消缺项统计 - * @param startDate 开始时间 - * @param endDate 结束时间 - * @param dept 机构ID - * @param defectType 缺陷类型;1: 重大缺陷 2:一般缺陷 - * @return SafeCheckStatisticVO 对象 - */ - SafeCheckStatisticVO getDefectCheck(String startDate,String endDate,Long dept,String defectType); - - boolean updateDefectInfo(OperDefectEntity entity); - - boolean updateDefectHanderState(OperDefectEntity entity); - - /** - * 分页查询 - * @param operDefectEntityPage - * @param defect - * @return - */ - IPage selectPage(Page operDefectEntityPage, OperDefectEntity defect); }