|
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
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.DfCheckingProblemV2; |
|
|
import com.kms.yxgh.df.domain.DfCheckingRecord; |
|
|
import com.kms.yxgh.df.domain.DfCheckingRecord; |
|
|
import com.kms.yxgh.df.domain.DfCheckingV2ProjectItem; |
|
|
import com.kms.yxgh.df.domain.DfCheckingV2ProjectItem; |
|
@ -21,6 +22,7 @@ import com.shuili.common.core.service.BaseService; |
|
|
import com.shuili.common.utils.BeanUtils; |
|
|
import com.shuili.common.utils.BeanUtils; |
|
|
import lombok.AllArgsConstructor; |
|
|
import lombok.AllArgsConstructor; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
@ -74,9 +76,10 @@ public class DfCheckingRecordV2Service extends BaseService<DfCheckingRecordV2Map |
|
|
Optional.ofNullable(data.getEndTime()) |
|
|
Optional.ofNullable(data.getEndTime()) |
|
|
.filter(endTime -> endTime != null) |
|
|
.filter(endTime -> endTime != null) |
|
|
.ifPresent(endTime -> queryWrapper.le(DfCheckingRecord::getCreateTime, endTime)); |
|
|
.ifPresent(endTime -> queryWrapper.le(DfCheckingRecord::getCreateTime, endTime)); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 查询分页数据
|
|
|
// 查询分页数据
|
|
|
Page<DfCheckingRecord> queryPage = page(page, queryWrapper); |
|
|
Page<DfCheckingRecord> queryPage = page(page, queryWrapper); |
|
|
if (queryPage == null) { |
|
|
if (queryPage == null) { |
|
@ -131,34 +134,47 @@ public class DfCheckingRecordV2Service extends BaseService<DfCheckingRecordV2Map |
|
|
// 子项
|
|
|
// 子项
|
|
|
return dto; |
|
|
return dto; |
|
|
} |
|
|
} |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public DfRecordDetailV2Dto edit(DfRecordDetailV2Dto dfRecord, Boolean commit) { |
|
|
public DfRecordDetailV2Dto edit(DfRecordDetailV2Dto dfRecord, Boolean commit) { |
|
|
|
|
|
// 先删后加
|
|
|
|
|
|
myRemovePraIds(dfRecord); |
|
|
if (commit) { |
|
|
if (commit) { |
|
|
|
|
|
|
|
|
List<String> ids = dfRecord.getProblems() |
|
|
|
|
|
.stream() |
|
|
|
|
|
.map(DfRecordDetailV2Dto.DfRecordItemDetailV2Dto::getId).collect(Collectors.toList()); |
|
|
|
|
|
if (CollectionUtils.isNotEmpty(ids)) { |
|
|
|
|
|
dfCheckingProblemV2Service.remove(new LambdaQueryWrapper<DfCheckingProblemV2>().in(DfCheckingProblemV2::getId,ids)); |
|
|
|
|
|
} |
|
|
|
|
|
DfCheckingRecord dfCheckingRecord=new DfCheckingRecord(); |
|
|
DfCheckingRecord dfCheckingRecord=new DfCheckingRecord(); |
|
|
BeanUtils.copyProperties(dfRecord, dfCheckingRecord); |
|
|
BeanUtils.copyProperties(dfRecord, dfCheckingRecord); |
|
|
|
|
|
// 提交为已巡检
|
|
|
|
|
|
dfCheckingRecord.setStatus(DfYhV2StatusEnum.INSPECTED.getValue()); |
|
|
updateById(dfCheckingRecord); |
|
|
updateById(dfCheckingRecord); |
|
|
List<DfRecordDetailV2Dto.DfRecordItemDetailV2Dto> problems = dfRecord.getProblems(); |
|
|
dfCheckingProblemV2Service.updateBatchById(convertToImages(dfRecord.getProblems())); |
|
|
List<DfCheckingProblemV2> dfCheckingProblemV2s = ListUtil.copyListToResultList(problems, DfCheckingProblemV2.class); |
|
|
|
|
|
dfCheckingProblemV2Service.updateBatchById(dfCheckingProblemV2s); |
|
|
|
|
|
return dfRecord; |
|
|
return dfRecord; |
|
|
} |
|
|
} |
|
|
DfCheckingRecord dfCheckingRecord=new DfCheckingRecord(); |
|
|
DfCheckingRecord dfCheckingRecord=new DfCheckingRecord(); |
|
|
BeanUtils.copyProperties(dfRecord, dfCheckingRecord); |
|
|
BeanUtils.copyProperties(dfRecord, dfCheckingRecord); |
|
|
|
|
|
// 未提交维巡查中
|
|
|
|
|
|
dfCheckingRecord.setStatus(DfYhV2StatusEnum.DURING_INSPECTION.getValue()); |
|
|
save(dfCheckingRecord); |
|
|
save(dfCheckingRecord); |
|
|
List<DfRecordDetailV2Dto.DfRecordItemDetailV2Dto> problems = dfRecord.getProblems(); |
|
|
dfCheckingProblemV2Service.saveBatch(convertToImages(dfRecord.getProblems())); |
|
|
List<DfCheckingProblemV2> dfCheckingProblemV2s = ListUtil.copyListToResultList(problems, DfCheckingProblemV2.class); |
|
|
|
|
|
dfCheckingProblemV2Service.saveBatch(dfCheckingProblemV2s); |
|
|
|
|
|
return dfRecord; |
|
|
return dfRecord; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void myRemovePraIds(DfRecordDetailV2Dto dfRecord) { |
|
|
|
|
|
List<String> ids = dfRecord.getProblems() |
|
|
|
|
|
.stream() |
|
|
|
|
|
.map(DfRecordDetailV2Dto.DfRecordItemDetailV2Dto::getId).collect(Collectors.toList()); |
|
|
|
|
|
if (CollectionUtils.isNotEmpty(ids)) { |
|
|
|
|
|
dfCheckingProblemV2Service.remove(new LambdaQueryWrapper<DfCheckingProblemV2>().in(DfCheckingProblemV2::getId,ids)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static List<DfCheckingProblemV2> convertToImages(List<DfRecordDetailV2Dto.DfRecordItemDetailV2Dto> dtoList) { |
|
|
|
|
|
List<DfCheckingProblemV2> dfCheckingProblemV2s = new ArrayList<>(); |
|
|
|
|
|
dtoList.stream().forEach(e->{ |
|
|
|
|
|
DfCheckingProblemV2 dfCheckingProblemV2=new DfCheckingProblemV2(); |
|
|
|
|
|
BeanUtils.copyProperties(e,dfCheckingProblemV2); |
|
|
|
|
|
dfCheckingProblemV2.setDoc(e.getProblemImages().stream().collect(Collectors.joining(","))); |
|
|
|
|
|
}); |
|
|
|
|
|
return dfCheckingProblemV2s; |
|
|
|
|
|
} |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public Boolean myRemove(String[] ids) { |
|
|
public Boolean myRemove(String[] ids) { |
|
|
return Optional.ofNullable(ids) |
|
|
return Optional.ofNullable(ids) |
|
|
.filter(array -> array.length > 0) |
|
|
.filter(array -> array.length > 0) |
|
|