|
|
|
@ -1,9 +1,10 @@ |
|
|
|
package com.biutag.supervision.service; |
|
|
|
package com.biutag.supervision.service; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil; |
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.biutag.supervision.mapper.SupRiskPersonalSupRecordMapper; |
|
|
|
import com.biutag.supervision.mapper.SupRiskPersonalSupRecordMapper; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.dto.TaskProblemDto; |
|
|
|
|
|
|
|
import com.biutag.supervision.pojo.entity.SupRiskPersonal; |
|
|
|
import com.biutag.supervision.pojo.entity.SupRiskPersonalSupRecord; |
|
|
|
import com.biutag.supervision.pojo.entity.SupRiskPersonalSupRecord; |
|
|
|
import com.biutag.supervision.pojo.vo.FileVo; |
|
|
|
import com.biutag.supervision.pojo.vo.FileVo; |
|
|
|
import com.biutag.supervision.util.JSON; |
|
|
|
import com.biutag.supervision.util.JSON; |
|
|
|
@ -11,8 +12,6 @@ import lombok.RequiredArgsConstructor; |
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
import org.springframework.scheduling.annotation.Async; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream; |
|
|
|
|
|
|
|
import java.util.Base64; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
@RequiredArgsConstructor |
|
|
|
@RequiredArgsConstructor |
|
|
|
@ -23,8 +22,12 @@ public class SupRiskPersonalSupRecordAsyncService { |
|
|
|
|
|
|
|
|
|
|
|
private final SupRiskPersonalSupRecordMapper baseMapper; |
|
|
|
private final SupRiskPersonalSupRecordMapper baseMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final SupTaskProblemService taskProblemService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final SupRiskPersonalService riskPersonalService; |
|
|
|
|
|
|
|
|
|
|
|
@Async |
|
|
|
@Async |
|
|
|
public void uploadFile(List<FileVo> files, Integer id) { |
|
|
|
public void uploadFile(List<FileVo> files, SupRiskPersonalSupRecord supRecord) { |
|
|
|
if (!files.isEmpty()) { |
|
|
|
if (!files.isEmpty()) { |
|
|
|
for (FileVo file : files) { |
|
|
|
for (FileVo file : files) { |
|
|
|
if (StrUtil.isNotBlank(file.getFilePath())) { |
|
|
|
if (StrUtil.isNotBlank(file.getFilePath())) { |
|
|
|
@ -36,10 +39,30 @@ public class SupRiskPersonalSupRecordAsyncService { |
|
|
|
file.setBase64(null); |
|
|
|
file.setBase64(null); |
|
|
|
} |
|
|
|
} |
|
|
|
LambdaUpdateWrapper<SupRiskPersonalSupRecord> updateWrapper = new LambdaUpdateWrapper<>(); |
|
|
|
LambdaUpdateWrapper<SupRiskPersonalSupRecord> updateWrapper = new LambdaUpdateWrapper<>(); |
|
|
|
updateWrapper.eq(SupRiskPersonalSupRecord::getId, id) |
|
|
|
String fileString = JSON.toJSONString(files); |
|
|
|
.set(SupRiskPersonalSupRecord::getFiles, JSON.toJSONString(files)); |
|
|
|
updateWrapper.eq(SupRiskPersonalSupRecord::getId, supRecord.getId()) |
|
|
|
|
|
|
|
.set(SupRiskPersonalSupRecord::getFiles, fileString); |
|
|
|
baseMapper.update(updateWrapper); |
|
|
|
baseMapper.update(updateWrapper); |
|
|
|
|
|
|
|
supRecord.setFiles(fileString); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if ("失控".equals(supRecord.getSupStatus()) || "无法确认".equals(supRecord.getSupStatus())) { |
|
|
|
|
|
|
|
// 保存问题
|
|
|
|
|
|
|
|
saveProblem(files, supRecord); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void saveProblem(List<FileVo> files, SupRiskPersonalSupRecord supRecord) { |
|
|
|
|
|
|
|
TaskProblemDto problemDto = new TaskProblemDto(); |
|
|
|
|
|
|
|
problemDto.setHasProblem(true); |
|
|
|
|
|
|
|
SupRiskPersonal riskPersonal = riskPersonalService.getById(supRecord.getIdCode()); |
|
|
|
|
|
|
|
// 责任单位
|
|
|
|
|
|
|
|
problemDto.setDepartId(riskPersonal.getResponsibleDepartId()); |
|
|
|
|
|
|
|
problemDto.setTaskId(supRecord.getTaskId()); |
|
|
|
|
|
|
|
problemDto.setFiles(files); |
|
|
|
|
|
|
|
problemDto.setSupRecordId(supRecord.getId().toString()); |
|
|
|
|
|
|
|
problemDto.setThingDesc(supRecord.getSupDesc()); |
|
|
|
|
|
|
|
taskProblemService.save(problemDto); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|