|
|
@ -8,10 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.kms.yxgh.common.enums.DfYhV2StatusEnum; |
|
|
|
import com.kms.yxgh.df.domain.DfCheckingProblemV2; |
|
|
|
import com.kms.yxgh.df.domain.DfCheckingRecord; |
|
|
|
import com.kms.yxgh.df.domain.DfCheckingV2ProjectItem; |
|
|
|
import com.kms.yxgh.df.domain.DfCheckingV2ProjectManage; |
|
|
|
import com.kms.yxgh.df.domain.*; |
|
|
|
import com.kms.yxgh.df.dto.DfCheckingDetailDto; |
|
|
|
import com.kms.yxgh.df.dto.v2.DfProblemV2Dto; |
|
|
|
import com.kms.yxgh.df.dto.v2.DfRecordDetailV2Dto; |
|
|
@ -38,6 +35,8 @@ import java.util.stream.Collectors; |
|
|
|
@AllArgsConstructor |
|
|
|
public class DfCheckingRecordV2Service extends BaseService<DfCheckingRecordV2Mapper, DfCheckingRecord> { |
|
|
|
|
|
|
|
private final DfYhV2Service dfYhV2Service; |
|
|
|
|
|
|
|
|
|
|
|
private final DfCheckingV2ProjectItemV2Service dfCheckingV2ProjectItemV2Service; |
|
|
|
|
|
|
@ -71,12 +70,12 @@ public class DfCheckingRecordV2Service extends BaseService<DfCheckingRecordV2Map |
|
|
|
.ifPresent(status -> queryWrapper.like(DfCheckingRecord::getStatus, status)); |
|
|
|
|
|
|
|
Optional.ofNullable(data.getStartDate()) |
|
|
|
.filter(startTime -> startTime != null) |
|
|
|
.ifPresent(startTime -> queryWrapper.ge(DfCheckingRecord::getCreateTime, startTime)); |
|
|
|
.filter(startDate -> startDate != null) |
|
|
|
.ifPresent(startDate -> queryWrapper.ge(DfCheckingRecord::getStartDate, startDate)); |
|
|
|
|
|
|
|
Optional.ofNullable(data.getEndDate()) |
|
|
|
.filter(endTime -> endTime != null) |
|
|
|
.ifPresent(endTime -> queryWrapper.le(DfCheckingRecord::getCreateTime, endTime)); |
|
|
|
.filter(endDate -> endDate != null) |
|
|
|
.ifPresent(endDate -> queryWrapper.le(DfCheckingRecord::getEndDate, endDate)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -121,6 +120,7 @@ public class DfCheckingRecordV2Service extends BaseService<DfCheckingRecordV2Map |
|
|
|
// 巡查详情列表
|
|
|
|
SearchParam<DfRecordSearchV2Dto> sp=new SearchParam<>(); |
|
|
|
DfRecordSearchV2Dto searchV2Dto=new DfRecordSearchV2Dto(); |
|
|
|
assert dfCheckingRecord != null; |
|
|
|
searchV2Dto.setRecordId(dfCheckingRecord.getId()); |
|
|
|
sp.setData(searchV2Dto); |
|
|
|
sp.setPageSize(Integer.MAX_VALUE); |
|
|
@ -132,7 +132,6 @@ public class DfCheckingRecordV2Service extends BaseService<DfCheckingRecordV2Map |
|
|
|
ListUtil.copyListToResultList(records, DfRecordDetailV2Dto.DfRecordItemDetailV2Dto.class); |
|
|
|
dto.setProblems(dtoList); |
|
|
|
} |
|
|
|
// 子项
|
|
|
|
return dto; |
|
|
|
} |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@ -147,22 +146,22 @@ public class DfCheckingRecordV2Service extends BaseService<DfCheckingRecordV2Map |
|
|
|
// 如果相关缺陷大于一条就是养护中
|
|
|
|
if (!dfRecord.getProblems().isEmpty()) { |
|
|
|
dfCheckingRecord.setStatus(DfYhV2StatusEnum.UNDER_MAINTENANCE.getValue()); |
|
|
|
} |
|
|
|
// 提交时缺陷无数据就是无缺陷
|
|
|
|
if (dfRecord.getProblems().isEmpty()) { |
|
|
|
}else { |
|
|
|
// 提交时缺陷无数据就是无缺陷
|
|
|
|
dfCheckingRecord.setStatus(DfYhV2StatusEnum.NO_DEFECTS.getValue()); |
|
|
|
} |
|
|
|
updateById(dfCheckingRecord); |
|
|
|
dfCheckingProblemV2Service.updateBatchById(convertToImages(dfRecord.getProblems())); |
|
|
|
dfCheckingProblemV2Service.saveOrUpdateBatch(convertToImages(dfRecord.getProblems())); |
|
|
|
return dfRecord; |
|
|
|
}else { |
|
|
|
DfCheckingRecord dfCheckingRecord=new DfCheckingRecord(); |
|
|
|
BeanUtils.copyProperties(dfRecord, dfCheckingRecord); |
|
|
|
// 未提交维巡查中
|
|
|
|
dfCheckingRecord.setStatus(DfYhV2StatusEnum.DURING_INSPECTION.getValue()); |
|
|
|
save(dfCheckingRecord); |
|
|
|
dfCheckingProblemV2Service.saveOrUpdateBatch(convertToImages(dfRecord.getProblems())); |
|
|
|
return dfRecord; |
|
|
|
} |
|
|
|
DfCheckingRecord dfCheckingRecord=new DfCheckingRecord(); |
|
|
|
BeanUtils.copyProperties(dfRecord, dfCheckingRecord); |
|
|
|
// 未提交维巡查中
|
|
|
|
dfCheckingRecord.setStatus(DfYhV2StatusEnum.DURING_INSPECTION.getValue()); |
|
|
|
save(dfCheckingRecord); |
|
|
|
dfCheckingProblemV2Service.saveBatch(convertToImages(dfRecord.getProblems())); |
|
|
|
return dfRecord; |
|
|
|
} |
|
|
|
|
|
|
|
public void myRemovePraIds(DfRecordDetailV2Dto dfRecord) { |
|
|
@ -171,15 +170,16 @@ public class DfCheckingRecordV2Service extends BaseService<DfCheckingRecordV2Map |
|
|
|
.map(DfRecordDetailV2Dto.DfRecordItemDetailV2Dto::getId).collect(Collectors.toList()); |
|
|
|
if (CollectionUtils.isNotEmpty(ids)) { |
|
|
|
dfCheckingProblemV2Service.remove(new LambdaQueryWrapper<DfCheckingProblemV2>().in(DfCheckingProblemV2::getId,ids)); |
|
|
|
dfYhV2Service.remove(new LambdaQueryWrapper<DfYhV2>().in(DfYhV2::getDefectId,ids)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static List<DfCheckingProblemV2> convertToImages(List<DfRecordDetailV2Dto.DfRecordItemDetailV2Dto> dtoList) { |
|
|
|
List<DfCheckingProblemV2> dfCheckingProblemV2s = new ArrayList<>(); |
|
|
|
dtoList.stream().forEach(e->{ |
|
|
|
dtoList.forEach(e->{ |
|
|
|
DfCheckingProblemV2 dfCheckingProblemV2=new DfCheckingProblemV2(); |
|
|
|
BeanUtils.copyProperties(e,dfCheckingProblemV2); |
|
|
|
dfCheckingProblemV2.setDoc(e.getProblemImages().stream().collect(Collectors.joining(","))); |
|
|
|
dfCheckingProblemV2.setDoc(String.join(",", e.getProblemImages())); |
|
|
|
}); |
|
|
|
return dfCheckingProblemV2s; |
|
|
|
} |
|
|
|