Commit 15347069 authored by 史志龙's avatar 史志龙

作业以及分析删除逻辑--shizhilong

parent 6a657431
......@@ -2,8 +2,10 @@ package org.jeecg.modules.diseaseAnalysis.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.UUIDGenerator;
import org.jeecg.modules.diseaseAnalysis.algorithm.MultiProducerLine;
import org.jeecg.modules.diseaseAnalysis.dto.*;
......@@ -12,6 +14,8 @@ import org.jeecg.modules.diseaseAnalysis.mapper.*;
import org.jeecg.modules.diseaseAnalysis.service.IAnalysisLineBatchService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.diseaseAnalysis.vo.*;
import org.jeecg.modules.maintenanceWork.entity.WorkBatchDetail;
import org.jeecg.modules.maintenanceWork.service.IWorkBatchDetailService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -48,6 +52,8 @@ public class AnalysisLineBatchServiceImpl extends ServiceImpl<AnalysisLineBatchM
private AnalysisLineBatchUnitDevicePatrolInfoMapper analysisLineBatchUnitDevicePatrolInfoMapper;
@Resource
private AnalysisLineBatchUnitDevicePatrolAssistInfoMapper analysisLineBatchUnitDevicePatrolAssistInfoMapper;
@Resource
private IWorkBatchDetailService workBatchDetailService;
/**
* 线路质量分析-其他病害分析-检查记录-分页列表查询
*
......@@ -319,6 +325,11 @@ public class AnalysisLineBatchServiceImpl extends ServiceImpl<AnalysisLineBatchM
@Override
@Transactional
public void deleteBatchRecord(List<String> idList,Integer type) {
//查询是否具备删除分析批次得条件
List<WorkBatchDetail> list = workBatchDetailService.lambdaQuery().in(WorkBatchDetail::getAnalysisBatchId, idList).list();
if(CollectionUtils.isNotEmpty(list)){
throw JeecgBootException.error("删除失败,当前分析任务存在维修作业不允许删除!");
}
// 1.先删除病害分析主表与检查记录主表之间的关系表
LambdaQueryWrapper<AnalysisLineBatchCheckDataMap> wrapper = Wrappers.lambdaQuery();
wrapper.in(AnalysisLineBatchCheckDataMap::getAnalysisBatchId, idList);
......
......@@ -292,6 +292,14 @@ public class WorkBatchServiceImpl extends ServiceImpl<WorkBatchMapper, WorkBatch
@Override
@Transactional
public void deleteRecord(String workBatchId) {
//查询作业主表
WorkBatch workBatch = this.baseMapper.selectById(workBatchId);
if(workBatch == null){
throw JeecgBootException.error("删除失败,没找到作业数据!");
}
if(workBatch.getWorkStatus() == 9){
throw JeecgBootException.error("当前作业已完成无法删除!");
}
//删除整改详情表
LambdaQueryWrapper<WorkBatchDetailModify> delModifyWrapper = Wrappers.lambdaQuery();
delModifyWrapper.eq(WorkBatchDetailModify::getWorkBatchId, workBatchId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment