|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.google.zxing.BarcodeFormat; |
|
|
|
import com.google.zxing.BarcodeFormat; |
|
|
|
|
|
|
|
import com.hnac.hzims.equipment.feign.IEmInfoClient; |
|
|
|
import com.hnac.hzinfo.inspect.Constants; |
|
|
|
import com.hnac.hzinfo.inspect.Constants; |
|
|
|
import com.hnac.hzinfo.inspect.obj.ObjectConstants; |
|
|
|
import com.hnac.hzinfo.inspect.obj.ObjectConstants; |
|
|
|
import com.hnac.hzinfo.inspect.obj.entity.*; |
|
|
|
import com.hnac.hzinfo.inspect.obj.entity.*; |
|
|
@ -58,6 +59,8 @@ public class ObjectServiceImpl extends BaseServiceImpl<InspectObjectMapper, Obje |
|
|
|
private IObjectDangerService objectDangerService; |
|
|
|
private IObjectDangerService objectDangerService; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private ProjectService projectService; |
|
|
|
private ProjectService projectService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IEmInfoClient emInfoClient; |
|
|
|
|
|
|
|
|
|
|
|
/** pdf文件存储路径 */ |
|
|
|
/** pdf文件存储路径 */ |
|
|
|
@Value("${hzinfo.task.pdf.file-path}") |
|
|
|
@Value("${hzinfo.task.pdf.file-path}") |
|
|
@ -268,15 +271,15 @@ public class ObjectServiceImpl extends BaseServiceImpl<InspectObjectMapper, Obje |
|
|
|
templateProjectService.remove(queryWrapper); |
|
|
|
templateProjectService.remove(queryWrapper); |
|
|
|
// 保存巡检模板与巡检项目的绑定关系
|
|
|
|
// 保存巡检模板与巡检项目的绑定关系
|
|
|
|
List<String> emCodeList = Func.toStrList(",", object.getEmCodes()); |
|
|
|
List<String> emCodeList = Func.toStrList(",", object.getEmCodes()); |
|
|
|
Function<Integer,TemplateProjectEntity> getTemplateProjectByEmCode = index -> { |
|
|
|
Function<String,TemplateProjectEntity> getTemplateProjectByEmCode = emCode -> { |
|
|
|
ProjectEntity project = new ProjectEntity(); |
|
|
|
ProjectEntity project = new ProjectEntity(); |
|
|
|
project.setEmCode(emCodeList.get(index)); |
|
|
|
project.setEmCode(emCode); |
|
|
|
project.setStatus(ObjectConstants.ProjectEnableEnum.YES.getEnableType()); |
|
|
|
project.setStatus(ObjectConstants.ProjectEnableEnum.YES.getEnableType()); |
|
|
|
ProjectEntity one = projectService.getOne(project); |
|
|
|
ProjectEntity one = projectService.getOne(project); |
|
|
|
return TemplateProjectEntity.builder().templateId(template.getId()).projectId(one.getId()).sort(index).build(); |
|
|
|
return TemplateProjectEntity.builder().templateId(template.getId()).projectId(one.getId()).build(); |
|
|
|
}; |
|
|
|
}; |
|
|
|
List<TemplateProjectEntity> templateProjectList = Stream.iterate(0,n -> n + 1).limit(emCodeList.size()) |
|
|
|
List<TemplateProjectEntity> templateProjectList = Stream.iterate(0,n -> n + 1).limit(emCodeList.size()) |
|
|
|
.map(getTemplateProjectByEmCode).collect(Collectors.toList()); |
|
|
|
.flatMap(index -> emInfoClient.getChildrenByEmCode(emCodeList.get(index)).getData().stream()).map(getTemplateProjectByEmCode).collect(Collectors.toList()); |
|
|
|
templateProjectService.saveBatch(templateProjectList); |
|
|
|
templateProjectService.saveBatch(templateProjectList); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|