package com.gkhy.safePlatform.safeCheck.rpc.service;
|
|
import com.gkhy.safePlatform.safeCheck.entity.SafeCheckTaskAndQuota;
|
import com.gkhy.safePlatform.safeCheck.model.dto.resp.SafeCheckPageGrByStatusOrByTimeRespDTO;
|
import com.gkhy.safePlatform.safeCheck.model.dto.resp.SafeCheckSmartScreenRepsDTO;
|
import com.gkhy.safePlatform.safeCheck.rpc.apimodel.SafeCheckTaskDataService;
|
import com.gkhy.safePlatform.safeCheck.rpc.apimodel.model.resp.*;
|
import com.gkhy.safePlatform.safeCheck.service.SafeCheckSmartScreenService;
|
import com.gkhy.safePlatform.safeCheck.service.baseService.SafeCheckTaskAndQuotaService;
|
import com.gkhy.safePlatform.safeCheck.service.impl.SafeCheckSmartScreenServiceImpl;
|
import org.apache.dubbo.config.annotation.DubboService;
|
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import java.util.List;
|
import java.util.stream.Collectors;
|
|
|
@DubboService(version = "0.0.1")
|
public class SafeCheckTaskDataServiceProvider implements SafeCheckTaskDataService {
|
|
@Autowired
|
private SafeCheckTaskAndQuotaService safeCheckTaskAndQuotaService;
|
|
@Autowired
|
private SafeCheckSmartScreenService smartScreenService;
|
|
/**
|
* @description 根据taskid获取巡检链数据并根据rfid进行分组
|
*/
|
@Override
|
public SafeCheckTaskAndQuotaGBRfidAndExcpOrderRPCRespDTO getTaskAndQuotaDataGBrfidDataByTaskId(Long taskId) {
|
SafeCheckTaskAndQuotaGBRfidAndExcpOrderRPCRespDTO rpcRespDTO = new SafeCheckTaskAndQuotaGBRfidAndExcpOrderRPCRespDTO();
|
List<SafeCheckSmartScreenRepsDTO> screenDataByTaskId = smartScreenService.getSmartScreenData(taskId);
|
if (screenDataByTaskId == null){
|
return null;
|
}
|
List<SafeCheckTaskAndQuotaGBRfidRPCRespDTO> datas = screenDataByTaskId.stream().map((screenData)->{
|
SafeCheckTaskAndQuotaGBRfidRPCRespDTO dataRPCRespDTO = new SafeCheckTaskAndQuotaGBRfidRPCRespDTO();
|
BeanUtils.copyProperties(screenData,dataRPCRespDTO);
|
List<SafeCheckTaskAndQuotaRPCRespDTO> quotaRPCRespDTOS = screenData.getPoints().stream().map((point)->{
|
SafeCheckTaskAndQuotaRPCRespDTO quotaRPCRespDTO = new SafeCheckTaskAndQuotaRPCRespDTO();
|
BeanUtils.copyProperties(point,quotaRPCRespDTO);
|
return quotaRPCRespDTO;
|
}).collect(Collectors.toList());
|
dataRPCRespDTO.setPoints(quotaRPCRespDTOS);
|
return dataRPCRespDTO;
|
}).collect(Collectors.toList());
|
rpcRespDTO.setRfidInfos(datas);
|
|
List<SafeCheckTaskAndQuotaExcepOrderRPCRespDTO> orderInfos = smartScreenService.getSmartScreenExcepOrderInfos(taskId);
|
rpcRespDTO.setExcepOrder(orderInfos);
|
return rpcRespDTO;
|
}
|
|
/**
|
* @description 根据taskid获取所有的巡检链数据(因为之前上面序列化失败,现在可以了。所以现在这个方法不用)
|
*/
|
@Override
|
public List<SafeCheckTaskAndQuotasRPCRespDTO> getTaskAndQuotaRPCByTaskId(Long taskId) {
|
List<SafeCheckTaskAndQuota> taskAndQuotas = safeCheckTaskAndQuotaService.listTaskAndQuotaByTaskId(taskId);
|
List<SafeCheckTaskAndQuotasRPCRespDTO> datas = taskAndQuotas.stream().map((taskAndQuota)->{
|
SafeCheckTaskAndQuotasRPCRespDTO quotasRPCRespDTO = new SafeCheckTaskAndQuotasRPCRespDTO();
|
BeanUtils.copyProperties(taskAndQuota,quotasRPCRespDTO);
|
return quotasRPCRespDTO;
|
}).collect(Collectors.toList());
|
return datas;
|
}
|
}
|