package com.gkhy.safePlatform.safeCheck.service.baseService.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.gkhy.safePlatform.commons.enums.E;
|
import com.gkhy.safePlatform.commons.exception.AusinessException;
|
import com.gkhy.safePlatform.safeCheck.entity.SafeCheckTask;
|
import com.gkhy.safePlatform.safeCheck.entity.SafeCheckTaskAndQuota;
|
import com.gkhy.safePlatform.safeCheck.entity.WorkOrderRelatedDataDO;
|
import com.gkhy.safePlatform.safeCheck.enums.TaskResultEnum;
|
import com.gkhy.safePlatform.safeCheck.repository.SafeCheckTaskAndQuotaRepository;
|
import com.gkhy.safePlatform.safeCheck.service.baseService.SafeCheckTaskAndQuotaService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.util.Date;
|
import java.util.List;
|
|
|
@Service("SafeCheckTaskAndQuotaService")
|
public class SafeCheckTaskAndQuotaServiceImpl extends ServiceImpl<SafeCheckTaskAndQuotaRepository, SafeCheckTaskAndQuota> implements SafeCheckTaskAndQuotaService {
|
|
@Autowired
|
private SafeCheckTaskAndQuotaRepository safeCheckTaskAndQuotaRepository;
|
/**
|
* @description 将任务关联的指标插入到任务指标关联表中
|
*/
|
@Override
|
public int saveTaskAndQuotas(List<SafeCheckTaskAndQuota> taskAndQuotas) {
|
int insertResult = safeCheckTaskAndQuotaRepository.saveTaskAndQuotas(taskAndQuotas);
|
return insertResult;
|
}
|
|
/**
|
* @description 根据任务id查询该任务下所有的巡检点检查结果
|
*/
|
@Override
|
public Page listTaskAndQuotaByPage(Page pageInfo, Long taskId) {
|
LambdaQueryWrapper<SafeCheckTaskAndQuota> queryWrapper = new LambdaQueryWrapper<>();
|
queryWrapper.eq(taskId != null,SafeCheckTaskAndQuota::getTaskId,taskId);
|
Page page = safeCheckTaskAndQuotaRepository.selectPage(pageInfo,queryWrapper);
|
return page;
|
}
|
|
/**
|
* @description 根据任务与巡检点关联表查询数据
|
*/
|
@Override
|
public SafeCheckTaskAndQuota getTaskAndQuotaById(int taskAndQuotaId) {
|
SafeCheckTaskAndQuota safeCheckTaskAndQuota = safeCheckTaskAndQuotaRepository.getTaskAndQuotaById(taskAndQuotaId);
|
return safeCheckTaskAndQuota;
|
}
|
|
/**
|
* @description 将任务关联的巡检点rfid相同的数据rfid定位状态都改为已定位
|
*/
|
@Override
|
public int updateRfidPositionStatusByTaskIdAndRfid(Long taskId, String rfid,Byte rifdPositionStatus) {
|
int updateResult = safeCheckTaskAndQuotaRepository.updateRfidPositionStatusByTaskIdAndRfid(taskId,rfid,rifdPositionStatus);
|
if (updateResult == 0){
|
throw new AusinessException(E.UPDATE_FAIL,"任务关联巡检点定位状态更新失败");
|
}
|
return updateResult;
|
}
|
|
/**
|
* @description 统计同一个任务的巡检点rfid相同的数量
|
*/
|
@Override
|
public int countRfidSameByTaskId(Long taskId, String rfid) {
|
int countResult = safeCheckTaskAndQuotaRepository.countRfidSameByTaskId(taskId,rfid);
|
return countResult;
|
}
|
|
/**
|
* @description 将巡检点检查结果信息进行修改
|
*/
|
@Override
|
public void updatePointCheckResultByIdAndTaskId(SafeCheckTaskAndQuota safeCheckTaskAndQuota) {
|
int updateResult = safeCheckTaskAndQuotaRepository.updatePointCheckResultByIdAndTaskId(safeCheckTaskAndQuota);
|
if (updateResult == 0){
|
throw new AusinessException(E.UPDATE_FAIL,"巡检点巡检结果更新失败");
|
}
|
|
}
|
|
/**
|
* @description 查询该任务下巡检点是否还有没有定位的
|
*/
|
@Override
|
public List<String> selectNoRfidPositionByTaskId(Long taskId) {
|
List<String> points = safeCheckTaskAndQuotaRepository.selectNoRfidPositionByTaskId(taskId);
|
return points;
|
}
|
|
/**
|
* @description 查询该任务下巡检点是否还有没提交的
|
*/
|
@Override
|
public List<String> selectRfidNoReportByTaskId(Long taskId) {
|
List<String> points = safeCheckTaskAndQuotaRepository.selectRfidNoReportByTaskId(taskId);
|
return points;
|
}
|
|
/**
|
* @description 统计巡检点中是否存在巡检异常的数据
|
*/
|
@Override
|
public int countRfidReportIsAbnormalByTaskId(Long taskId,Byte reportResult) {
|
int countResult = safeCheckTaskAndQuotaRepository.countRfidReportIsAbnormalByTaskId(taskId,reportResult);
|
return countResult;
|
}
|
|
/**
|
* @description 根据任务id查询所有的巡检链数据
|
*/
|
@Override
|
public List<SafeCheckTaskAndQuota> listTaskAndQuotaByTaskId(Long taskId) {
|
List<SafeCheckTaskAndQuota> taskAndQuotas = safeCheckTaskAndQuotaRepository.listTaskAndQuotaByTaskId(taskId);
|
return taskAndQuotas;
|
}
|
|
/**
|
* @description 根据任务id和巡检点对应的id查询巡检记录
|
*/
|
@Override
|
public SafeCheckTaskAndQuota getTaskAndQuotaByIdAndTaskId(int id, Long taskId) {
|
SafeCheckTaskAndQuota safeCheckTaskAndQuota = safeCheckTaskAndQuotaRepository.getTaskAndQuotaByIdAndTaskId(id,taskId);
|
return safeCheckTaskAndQuota;
|
}
|
|
/**
|
* 根据巡检指标id查询所有相关的数据rifd、region、point
|
*/
|
@Override
|
public WorkOrderRelatedDataDO getWorkOrderRelatedData(int id) {
|
return safeCheckTaskAndQuotaRepository.getWorkOrderRelatedData(id);
|
}
|
}
|