yang_shj
1 year ago
111 changed files with 6291 additions and 6042 deletions
@ -0,0 +1,11 @@
|
||||
package com.hnac.hzims.scheduled.mapper.operation; |
||||
|
||||
import com.hnac.hzims.operational.maintenance.entity.OperMaintenancePlanEntity; |
||||
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface MaintenancePlanMapper extends UserDataScopeBaseMapper<OperMaintenancePlanEntity> { |
||||
|
||||
} |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.alarm; |
||||
|
||||
import com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.alarm; |
||||
|
||||
|
||||
import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity; |
@ -1,8 +1,8 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.alarm.impl; |
||||
|
||||
import com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity; |
||||
import com.hnac.hzims.scheduled.mapper.operation.AbnormalAlarmMapper; |
||||
import com.hnac.hzims.scheduled.service.operation.AbnormalAlarmService; |
||||
import com.hnac.hzims.scheduled.service.operation.alarm.AbnormalAlarmService; |
||||
import lombok.RequiredArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
@ -1,8 +1,8 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.alarm.impl; |
||||
|
||||
import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity; |
||||
import com.hnac.hzims.scheduled.mapper.operation.RecordMapper; |
||||
import com.hnac.hzims.scheduled.service.operation.RecordService; |
||||
import com.hnac.hzims.scheduled.service.operation.alarm.RecordService; |
||||
import lombok.RequiredArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.business; |
||||
|
||||
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; |
||||
import com.hnac.hzims.operational.main.vo.OverhaulVo; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.business; |
||||
|
||||
import com.hnac.hzims.operational.defect.entity.OperDefectEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.business; |
||||
|
||||
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; |
||||
import com.hnac.hzims.operational.duty.vo.ImsDutyMainFeignVO; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.business; |
||||
|
||||
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; |
||||
import com.hnac.hzims.operational.duty.vo.DutyInfoVo; |
@ -0,0 +1,11 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.business; |
||||
|
||||
import com.hnac.hzims.operational.maintenance.entity.OperMaintenancePlanEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
public interface MaintenancePlanService extends BaseService<OperMaintenancePlanEntity> { |
||||
|
||||
} |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.business; |
||||
|
||||
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; |
||||
import com.hnac.hzims.operational.main.vo.ShortagesVo; |
@ -1,11 +1,11 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.business.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.hnac.hzims.operational.access.constants.AccessConstants; |
||||
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity; |
||||
import com.hnac.hzims.operational.main.vo.OverhaulVo; |
||||
import com.hnac.hzims.scheduled.mapper.operation.AccessMapper; |
||||
import com.hnac.hzims.scheduled.service.operation.AccessService; |
||||
import com.hnac.hzims.scheduled.service.operation.business.AccessService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
@ -1,9 +1,9 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.business.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 com.hnac.hzims.scheduled.service.operation.business.DefectService; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.tool.utils.CollectionUtil; |
@ -1,10 +1,10 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.business.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; |
||||
import com.hnac.hzims.operational.duty.vo.ImsDutyMainFeignVO; |
||||
import com.hnac.hzims.scheduled.mapper.operation.DutyMainMapper; |
||||
import com.hnac.hzims.scheduled.service.operation.DutyMainService; |
||||
import com.hnac.hzims.scheduled.service.operation.business.DutyMainService; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.tool.utils.ObjectUtil; |
@ -0,0 +1,19 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.business.impl; |
||||
|
||||
import com.hnac.hzims.operational.maintenance.entity.OperMaintenancePlanEntity; |
||||
import com.hnac.hzims.scheduled.mapper.operation.MaintenancePlanMapper; |
||||
import com.hnac.hzims.scheduled.service.operation.business.MaintenancePlanService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@AllArgsConstructor |
||||
@Slf4j |
||||
public class MaintenancePlanServiceImpl extends BaseServiceImpl<MaintenancePlanMapper, OperMaintenancePlanEntity> implements MaintenancePlanService { |
||||
|
||||
} |
@ -0,0 +1,294 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.business.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.hnac.hzims.message.dto.PlanMsgRecordDto; |
||||
import com.hnac.hzims.message.entity.config.MessageTemplateEntity; |
||||
import com.hnac.hzims.message.fegin.IMessageClient; |
||||
import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; |
||||
import com.hnac.hzims.operational.main.vo.MaintainVo; |
||||
import com.hnac.hzims.operational.main.vo.RegularWorkVO; |
||||
import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant; |
||||
import com.hnac.hzims.operational.maintenance.entity.OperMaintenancePlanEntity; |
||||
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; |
||||
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskEntityVo; |
||||
import com.hnac.hzims.scheduled.mapper.operation.MaintenanceMapper; |
||||
import com.hnac.hzims.scheduled.service.operation.business.MaintenancePlanService; |
||||
import com.hnac.hzims.scheduled.service.operation.business.MaintenanceService; |
||||
import lombok.RequiredArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.apache.commons.lang.StringUtils; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.*; |
||||
import org.springblade.flow.core.feign.IFlowClient; |
||||
import org.springframework.beans.BeanUtils; |
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.TransactionDefinition; |
||||
import org.springframework.transaction.TransactionStatus; |
||||
import org.springframework.transaction.support.DefaultTransactionDefinition; |
||||
|
||||
import java.beans.Transient; |
||||
import java.time.*; |
||||
import java.time.format.DateTimeFormatter; |
||||
import java.util.*; |
||||
import java.util.concurrent.CompletableFuture; |
||||
import java.util.concurrent.ThreadPoolExecutor; |
||||
import java.util.stream.Collectors; |
||||
import java.util.stream.Stream; |
||||
|
||||
import static org.springblade.core.tool.utils.DateUtil.PATTERN_DATE; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@RequiredArgsConstructor |
||||
@Slf4j |
||||
public class MaintenanceServiceImpl extends BaseServiceImpl<MaintenanceMapper, OperMaintenanceTaskEntity> implements MaintenanceService { |
||||
|
||||
private final MaintenancePlanService planService; |
||||
|
||||
private final DutyMainServiceImpl dutyMainService; |
||||
|
||||
private final IFlowClient flowClient; |
||||
|
||||
private final IMessageClient messageClient; |
||||
|
||||
private final DataSourceTransactionManager manager; |
||||
|
||||
private final ThreadPoolExecutor executor; |
||||
|
||||
/** |
||||
* 日常维护任务派发 |
||||
* @param param |
||||
*/ |
||||
@Override |
||||
@Transient |
||||
public void maintenanceTaskDistribute(String param) { |
||||
// 开始时间
|
||||
Date start = DateUtil.parse(DateUtil.formatDate(DateUtil.now()), DateUtil.PATTERN_DATE); |
||||
// 结束时间
|
||||
Date end = DateUtil.parse(DateUtil.formatDate(DateUtil.plusDays(start, 1)), DateUtil.PATTERN_DATE); |
||||
// 查询日常维护计划
|
||||
List<OperMaintenancePlanEntity> plans = planService.list(Wrappers.<OperMaintenancePlanEntity>lambdaQuery() |
||||
.ge(OperMaintenancePlanEntity::getDisposeTime,start) |
||||
.lt(OperMaintenancePlanEntity::getDisposeTime,end) |
||||
.isNotNull(OperMaintenancePlanEntity::getCreateTaskTime) |
||||
); |
||||
// 遍历计划列表生成相应任务
|
||||
if(CollectionUtil.isEmpty(plans)){ |
||||
return; |
||||
} |
||||
plans.forEach(plan -> { |
||||
// 生成日常任务对象
|
||||
OperMaintenanceTaskEntity task = BeanUtil.copy(plan,OperMaintenanceTaskEntity.class); |
||||
if(StringUtil.isEmpty(task.getEmCode())){ |
||||
this.taskDistribute(task,plan); |
||||
}else{ |
||||
for (String code : plan.getEmCode().split(",")) { |
||||
task.setEmCode(code); |
||||
this.taskDistribute(task,plan); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 日常维护任务派发 |
||||
* @param task |
||||
* @param plan |
||||
*/ |
||||
private void taskDistribute(OperMaintenanceTaskEntity task, OperMaintenancePlanEntity plan) { |
||||
DefaultTransactionDefinition defaultTransactionDefinition = new DefaultTransactionDefinition(); |
||||
defaultTransactionDefinition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); |
||||
TransactionStatus transaction = manager.getTransaction(defaultTransactionDefinition); |
||||
task.setId(null); |
||||
task.setCreateTime(new Date()); |
||||
task.setUpdateTime(new Date()); |
||||
task.setPlanId(plan.getId()); |
||||
task.setTaskCode(UUID.randomUUID().toString()); |
||||
if (task.getRefLibraryId() != 0) { |
||||
task.setCreateTime(DateUtil.now()); |
||||
} |
||||
if(ObjectUtil.isNotEmpty(plan.getDisposer())){ |
||||
task.setDisposer(plan.getDisposer().toString()); |
||||
} |
||||
//补充计划结束时间
|
||||
Instant instant = task.getDisposeTime().toInstant(); |
||||
ZoneId zoneId = ZoneId.systemDefault(); |
||||
LocalDateTime disposeTime = instant.atZone(zoneId).toLocalDateTime(); |
||||
task.setPlanEndTime(disposeTime.plusHours(task.getHours())); |
||||
//获取值班人员
|
||||
if (ObjectUtil.isNotEmpty(plan.getMaintenanceModel()) && plan.getMaintenanceModel() == 2) { |
||||
//查询值班信息
|
||||
LambdaQueryWrapper<ImsDutyMainEntity> dutyWrapper = new LambdaQueryWrapper<>(); |
||||
dutyWrapper.eq(ImsDutyMainEntity::getDutyDate, DateTimeFormatter.ofPattern(PATTERN_DATE).format(disposeTime)); |
||||
dutyWrapper.eq(ImsDutyMainEntity::getClassId, plan.getImsDutyClassId()); |
||||
ImsDutyMainEntity entity = dutyMainService.getOne(dutyWrapper); |
||||
if (ObjectUtil.isEmpty(entity) || StringUtils.isEmpty(entity.getDutyPersonIds())) { |
||||
log.error("计划ID为:{}未查询到排班记录", plan.getId()); |
||||
return; |
||||
} |
||||
String userId = entity.getDutyPersonIds(); |
||||
task.setDisposer(userId.replaceAll("\\^", ",")); |
||||
} |
||||
this.save(task); |
||||
// 事务提交
|
||||
manager.commit(transaction); |
||||
//启动流程
|
||||
String processInstanceId = this.startProcess(plan.getProcDefId(), task); |
||||
//推送消息
|
||||
CompletableFuture<Void> operMaintenanceTaskEntityCompletableFuture = |
||||
CompletableFuture.runAsync(() -> { |
||||
task.setProcessInstanceId(processInstanceId); |
||||
this.updateById(task); |
||||
plan.setCreateTaskTime(new Date()); |
||||
planService.updateById(plan); |
||||
//推送消息
|
||||
this.pushTaskMessage(task.getId()); |
||||
}, executor); |
||||
//启动队列
|
||||
try { |
||||
CompletableFuture.allOf(operMaintenanceTaskEntityCompletableFuture).get(); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 开启一个流程实例 |
||||
**/ |
||||
private String startProcess(String processDefinitionKey, OperMaintenanceTaskEntity taskEntity) { |
||||
OperMaintenanceTaskEntityVo operMaintenanceTaskEntityVo = new OperMaintenanceTaskEntityVo(); |
||||
BeanUtils.copyProperties(taskEntity, operMaintenanceTaskEntityVo); |
||||
Map<String, Object> params = new HashMap<>(); |
||||
params.put("taskId", taskEntity.getId()); |
||||
List<String> userIdList = Stream.of(taskEntity.getDisposer().split(",")).collect(Collectors.toList()); |
||||
String taskUsers = userIdList.stream().filter(StringUtils::isNotBlank).map("taskUser_"::concat).collect(Collectors.joining(",")); |
||||
params.put("initUserIds", taskUsers); |
||||
params.put("operMaintenanceTaskEntityVo", operMaintenanceTaskEntityVo); |
||||
return flowClient.startProcessInstanceContainNameByKey(processDefinitionKey, String.valueOf(taskEntity.getId()), taskEntity.getTitle(), params).getData().getProcessInstanceId(); |
||||
} |
||||
|
||||
/** |
||||
* 推送消息 |
||||
*/ |
||||
private void pushTaskMessage(Long taskId) { |
||||
OperMaintenanceTaskEntity task = this.getById(taskId); |
||||
if(ObjectUtil.isEmpty(task)){ |
||||
return; |
||||
} |
||||
// 根据消息模板Id查询模板
|
||||
R<MessageTemplateEntity> result = messageClient.getMsgTemplateById(task.getMessageTemplateId()); |
||||
if (result.isSuccess() && ObjectUtil.isNotEmpty(result.getData())) { |
||||
Func.toLongList(",", task.getDisposer()).forEach(userId -> { |
||||
//推送消息
|
||||
ZoneId zoneId = ZoneId.systemDefault(); |
||||
PlanMsgRecordDto msg = new PlanMsgRecordDto(); |
||||
msg.setTemplateId(task.getMessageTemplateId()); |
||||
msg.setCreateUser(task.getCreateUser()); |
||||
msg.setPlanTime(LocalDateTime.ofInstant(task.getDisposeTime().toInstant(), zoneId)); |
||||
msg.setTaskId(task.getId()); |
||||
msg.setDeptId(task.getCreateDept()); |
||||
msg.setReceiver(userId); |
||||
msg.setContent("距离任务执行时间已不满一小时,请及时处理"); |
||||
messageClient.planSendMessage(msg); |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 获取日常维护数量 |
||||
* @param departList |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public Integer maintenanceCount(List<Long> 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<OperMaintenanceTaskEntity> mTaskList = this.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>(){{ |
||||
ge(OperMaintenanceTaskEntity::getDisposeTime,firstDateTime); |
||||
le(OperMaintenanceTaskEntity::getDisposeTime,now); |
||||
in(OperMaintenanceTaskEntity::getCreateDept,departList); |
||||
}}); |
||||
if(CollectionUtil.isEmpty(mTaskList)){ |
||||
return 0; |
||||
} |
||||
return mTaskList.size(); |
||||
} |
||||
|
||||
/** |
||||
* 时间区间机构的日常维护数据查询 |
||||
* @param start |
||||
* @param end |
||||
* @param areas |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public MaintainVo maintain(String start, String end, List<Long> areas) { |
||||
MaintainVo maintainVo = new MaintainVo(); |
||||
//日常维护
|
||||
List<OperMaintenanceTaskEntity> maintainList = this.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>(){{ |
||||
ge(OperMaintenanceTaskEntity::getDisposeTime,start); |
||||
le(OperMaintenanceTaskEntity::getDisposeTime,end); |
||||
in(OperMaintenanceTaskEntity::getCreateDept,areas); |
||||
}}); |
||||
if(CollectionUtil.isEmpty(maintainList)){ |
||||
maintainVo.setMaintain(0); |
||||
maintainVo.setMaintainFinish(0); |
||||
return maintainVo; |
||||
} |
||||
// 日常维护完成数
|
||||
maintainVo.setMaintain(maintainList.size()); |
||||
List<Long> maintainFinish = maintainList.stream().filter(o-> Func.isNotEmpty(o.getStatus()) && MaintenanceConstant.TASK_STATUS_5 == o.getStatus()) |
||||
.map(OperMaintenanceTaskEntity::getId).collect(Collectors.toList()); |
||||
if(CollectionUtil.isEmpty(maintainFinish)){ |
||||
maintainVo.setMaintainFinish(0); |
||||
} |
||||
maintainVo.setMaintainFinish(maintainFinish.size()); |
||||
return maintainVo; |
||||
} |
||||
|
||||
/** |
||||
* 查询日常维护-定期工作类型数据 |
||||
* @param start |
||||
* @param end |
||||
* @param areas |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public RegularWorkVO regularWork(Date start, Date end, List<Long> areas) { |
||||
RegularWorkVO regularWorkVO = new RegularWorkVO(); |
||||
// 查询定期工作任务
|
||||
List<OperMaintenanceTaskEntity> regularWorkList = this.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{ |
||||
ge(OperMaintenanceTaskEntity::getDisposeTime, start) |
||||
.le(OperMaintenanceTaskEntity::getDisposeTime, end) |
||||
.eq(OperMaintenanceTaskEntity::getTypeCode, "05") |
||||
.in(OperMaintenanceTaskEntity::getCreateDept, areas); |
||||
}}); |
||||
if (CollectionUtil.isEmpty(regularWorkList)) { |
||||
regularWorkVO.setRegularWorkSum(0); |
||||
regularWorkVO.setRegularWork(0); |
||||
return regularWorkVO; |
||||
} |
||||
regularWorkVO.setMainTaskIds(regularWorkList.stream().map(OperMaintenanceTaskEntity::getId).map(Object::toString).collect(Collectors.joining(","))); |
||||
regularWorkVO.setRegularWorkSum(regularWorkList.size()); |
||||
// 定期工作任务完成数量
|
||||
List<OperMaintenanceTaskEntity> regularWorkFinishList = regularWorkList.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList()); |
||||
if (CollectionUtil.isEmpty(regularWorkFinishList)) { |
||||
regularWorkVO.setRegularWork(0); |
||||
return regularWorkVO; |
||||
} |
||||
regularWorkVO.setRegularWork(regularWorkFinishList.size()); |
||||
return regularWorkVO; |
||||
} |
||||
|
||||
|
||||
} |
@ -1,11 +1,11 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.business.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; |
||||
import com.hnac.hzims.operational.main.vo.ShortagesVo; |
||||
import com.hnac.hzims.operational.report.vo.DutyDefectVO; |
||||
import com.hnac.hzims.scheduled.mapper.operation.PhenomenonMapper; |
||||
import com.hnac.hzims.scheduled.service.operation.PhenomenonService; |
||||
import com.hnac.hzims.scheduled.service.operation.business.PhenomenonService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.fill; |
||||
|
||||
import com.hnac.hzims.operational.fill.entity.GenerateEntity; |
||||
import com.hnac.hzims.operational.main.vo.GenerationPowerVo; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.fill; |
||||
|
||||
import com.hnac.hzims.operational.fill.entity.OtherEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.fill; |
||||
|
||||
|
||||
import com.hnac.hzims.operational.fill.entity.OverDetailsEntity; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.fill; |
||||
|
||||
import com.hnac.hzims.operational.fill.entity.OverEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.fill; |
||||
|
||||
import com.hnac.hzims.operational.fill.entity.PowerEntity; |
||||
import com.hnac.hzims.operational.main.vo.PowerMonthVo; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.fill; |
||||
|
||||
import com.hnac.hzims.operational.fill.entity.SolveEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.fill; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.hnac.hzims.operational.fill.entity.UseEntity; |
@ -1,11 +1,11 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.fill.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.hnac.hzims.operational.fill.entity.GenerateEntity; |
||||
import com.hnac.hzims.operational.main.vo.GenerationPowerVo; |
||||
import com.hnac.hzims.operational.main.vo.PowerMonthVo; |
||||
import com.hnac.hzims.scheduled.mapper.operation.GenerateMapper; |
||||
import com.hnac.hzims.scheduled.service.operation.GenerateService; |
||||
import com.hnac.hzims.scheduled.service.operation.fill.GenerateService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
@ -1,8 +1,8 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.fill.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 com.hnac.hzims.scheduled.service.operation.fill.OtherService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
@ -1,8 +1,8 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.fill.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 com.hnac.hzims.scheduled.service.operation.fill.OverDetailsService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
@ -1,8 +1,8 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.fill.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 com.hnac.hzims.scheduled.service.operation.fill.OverService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
@ -1,10 +1,10 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.fill.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.hnac.hzims.operational.fill.entity.PowerEntity; |
||||
import com.hnac.hzims.operational.main.vo.PowerMonthVo; |
||||
import com.hnac.hzims.scheduled.mapper.operation.PowerMapper; |
||||
import com.hnac.hzims.scheduled.service.operation.PowerService; |
||||
import com.hnac.hzims.scheduled.service.operation.fill.PowerService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
@ -1,8 +1,8 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.fill.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 com.hnac.hzims.scheduled.service.operation.fill.SolveService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
@ -1,10 +1,10 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.fill.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
import com.hnac.hzims.operational.fill.entity.UseEntity; |
||||
import com.hnac.hzims.operational.main.vo.UsrPowerVo; |
||||
import com.hnac.hzims.scheduled.mapper.operation.UseMapper; |
||||
import com.hnac.hzims.scheduled.service.operation.UseService; |
||||
import com.hnac.hzims.scheduled.service.operation.fill.UseService; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.home; |
||||
|
||||
|
||||
import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.home; |
||||
|
||||
import java.util.List; |
||||
|
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.home; |
||||
|
||||
/** |
||||
* @author ysj |
@ -1,9 +1,9 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.home.impl; |
||||
|
||||
|
||||
import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity; |
||||
import com.hnac.hzims.scheduled.mapper.operation.ModelStationMapper; |
||||
import com.hnac.hzims.scheduled.service.operation.ModelStationService; |
||||
import com.hnac.hzims.scheduled.service.operation.home.ModelStationService; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
@ -1,124 +0,0 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.hnac.hzims.operational.main.vo.MaintainVo; |
||||
import com.hnac.hzims.operational.main.vo.RegularWorkVO; |
||||
import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant; |
||||
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; |
||||
import com.hnac.hzims.scheduled.mapper.operation.MaintenanceMapper; |
||||
import com.hnac.hzims.scheduled.service.operation.MaintenanceService; |
||||
import lombok.RequiredArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.tool.utils.CollectionUtil; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.time.LocalDate; |
||||
import java.time.LocalDateTime; |
||||
import java.time.LocalTime; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* @author ysj |
||||
*/ |
||||
@Service |
||||
@RequiredArgsConstructor |
||||
@Slf4j |
||||
public class MaintenanceServiceImpl extends BaseServiceImpl<MaintenanceMapper, OperMaintenanceTaskEntity> implements MaintenanceService { |
||||
|
||||
/** |
||||
* 获取日常维护数量 |
||||
* @param departList |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public Integer maintenanceCount(List<Long> 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<OperMaintenanceTaskEntity> mTaskList = this.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>(){{ |
||||
ge(OperMaintenanceTaskEntity::getDisposeTime,firstDateTime); |
||||
le(OperMaintenanceTaskEntity::getDisposeTime,now); |
||||
in(OperMaintenanceTaskEntity::getCreateDept,departList); |
||||
}}); |
||||
if(CollectionUtil.isEmpty(mTaskList)){ |
||||
return 0; |
||||
} |
||||
return mTaskList.size(); |
||||
} |
||||
|
||||
/** |
||||
* 时间区间机构的日常维护数据查询 |
||||
* @param start |
||||
* @param end |
||||
* @param areas |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public MaintainVo maintain(String start, String end, List<Long> areas) { |
||||
MaintainVo maintainVo = new MaintainVo(); |
||||
//日常维护
|
||||
List<OperMaintenanceTaskEntity> maintainList = this.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>(){{ |
||||
ge(OperMaintenanceTaskEntity::getDisposeTime,start); |
||||
le(OperMaintenanceTaskEntity::getDisposeTime,end); |
||||
in(OperMaintenanceTaskEntity::getCreateDept,areas); |
||||
}}); |
||||
if(CollectionUtil.isEmpty(maintainList)){ |
||||
maintainVo.setMaintain(0); |
||||
maintainVo.setMaintainFinish(0); |
||||
return maintainVo; |
||||
} |
||||
// 日常维护完成数
|
||||
maintainVo.setMaintain(maintainList.size()); |
||||
List<Long> maintainFinish = maintainList.stream().filter(o-> Func.isNotEmpty(o.getStatus()) && MaintenanceConstant.TASK_STATUS_5 == o.getStatus()) |
||||
.map(OperMaintenanceTaskEntity::getId).collect(Collectors.toList()); |
||||
if(CollectionUtil.isEmpty(maintainFinish)){ |
||||
maintainVo.setMaintainFinish(0); |
||||
} |
||||
maintainVo.setMaintainFinish(maintainFinish.size()); |
||||
return maintainVo; |
||||
} |
||||
|
||||
/** |
||||
* 查询日常维护-定期工作类型数据 |
||||
* @param start |
||||
* @param end |
||||
* @param areas |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public RegularWorkVO regularWork(Date start, Date end, List<Long> areas) { |
||||
RegularWorkVO regularWorkVO = new RegularWorkVO(); |
||||
// 查询定期工作任务
|
||||
List<OperMaintenanceTaskEntity> regularWorkList = this.list(new LambdaQueryWrapper<OperMaintenanceTaskEntity>() {{ |
||||
ge(OperMaintenanceTaskEntity::getDisposeTime, start) |
||||
.le(OperMaintenanceTaskEntity::getDisposeTime, end) |
||||
.eq(OperMaintenanceTaskEntity::getTypeCode, "05") |
||||
.in(OperMaintenanceTaskEntity::getCreateDept, areas); |
||||
}}); |
||||
if (CollectionUtil.isEmpty(regularWorkList)) { |
||||
regularWorkVO.setRegularWorkSum(0); |
||||
regularWorkVO.setRegularWork(0); |
||||
return regularWorkVO; |
||||
} |
||||
regularWorkVO.setMainTaskIds(regularWorkList.stream().map(OperMaintenanceTaskEntity::getId).map(Object::toString).collect(Collectors.joining(","))); |
||||
regularWorkVO.setRegularWorkSum(regularWorkList.size()); |
||||
// 定期工作任务完成数量
|
||||
List<OperMaintenanceTaskEntity> regularWorkFinishList = regularWorkList.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList()); |
||||
if (CollectionUtil.isEmpty(regularWorkFinishList)) { |
||||
regularWorkVO.setRegularWork(0); |
||||
return regularWorkVO; |
||||
} |
||||
regularWorkVO.setRegularWork(regularWorkFinishList.size()); |
||||
return regularWorkVO; |
||||
} |
||||
|
||||
|
||||
} |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.monitor; |
||||
|
||||
import org.springblade.core.tool.api.R; |
||||
|
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.plate; |
||||
|
||||
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; |
||||
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO; |
@ -1,7 +1,7 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.plate.impl; |
||||
|
||||
import com.google.common.collect.Lists; |
||||
import com.hnac.hzims.scheduled.service.operation.DataService; |
||||
import com.hnac.hzims.scheduled.service.operation.plate.DataService; |
||||
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient; |
||||
import com.hnac.hzinfo.datasearch.analyse.domain.FieldsData; |
||||
import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.report; |
||||
|
||||
/** |
||||
* @author ysj |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.station; |
||||
|
||||
import com.hnac.hzims.operational.station.entity.StationAttrConfigEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.station; |
||||
|
||||
import com.hnac.hzims.operational.station.entity.StationAttributeEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
@ -1,4 +1,4 @@
|
||||
package com.hnac.hzims.scheduled.service.operation; |
||||
package com.hnac.hzims.scheduled.service.operation.station; |
||||
|
||||
import com.hnac.hzims.operational.station.entity.StationEntity; |
||||
import org.springblade.core.mp.base.BaseService; |
@ -1,9 +1,9 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.station.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.hnac.hzims.operational.station.entity.StationAttrConfigEntity; |
||||
import com.hnac.hzims.scheduled.mapper.operation.StationAttrConfigMapper; |
||||
import com.hnac.hzims.scheduled.service.operation.StationAttrConfigService; |
||||
import com.hnac.hzims.scheduled.service.operation.station.StationAttrConfigService; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import org.springblade.core.tool.utils.CollectionUtil; |
@ -1,8 +1,8 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.station.impl; |
||||
|
||||
import com.hnac.hzims.operational.station.entity.StationAttributeEntity; |
||||
import com.hnac.hzims.scheduled.mapper.operation.StationAttributeMapper; |
||||
import com.hnac.hzims.scheduled.service.operation.StationAttributeService; |
||||
import com.hnac.hzims.scheduled.service.operation.station.StationAttributeService; |
||||
import lombok.RequiredArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
@ -1,8 +1,8 @@
|
||||
package com.hnac.hzims.scheduled.service.operation.impl; |
||||
package com.hnac.hzims.scheduled.service.operation.station.impl; |
||||
|
||||
import com.hnac.hzims.operational.station.entity.StationEntity; |
||||
import com.hnac.hzims.scheduled.mapper.operation.StationMapper; |
||||
import com.hnac.hzims.scheduled.service.operation.StationService; |
||||
import com.hnac.hzims.scheduled.service.operation.station.StationService; |
||||
import lombok.RequiredArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.hnac.hzims.scheduled.mapper.operation.MaintenancePlanMapper"> |
||||
|
||||
</mapper> |
Loading…
Reference in new issue