|
@@ -1,5 +1,6 @@
|
|
|
package org.springblade.manager.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
@@ -17,10 +18,7 @@ import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.constant.BladeConstant;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
-import org.springblade.manager.dto.ArchiveTreeContractAutoRuleMapDTO;
|
|
|
-import org.springblade.manager.dto.ArchiveTreeDTO;
|
|
|
-import org.springblade.manager.dto.ArchiveTreeSortDTO;
|
|
|
-import org.springblade.manager.dto.RoutingInspectionDTO;
|
|
|
+import org.springblade.manager.dto.*;
|
|
|
import org.springblade.manager.entity.*;
|
|
|
import org.springblade.manager.mapper.ArchiveAutoRuleWbsMapper;
|
|
|
import org.springblade.manager.mapper.ArchiveTreeMapper;
|
|
@@ -33,6 +31,7 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -46,7 +45,7 @@ public class RoutingInspectionServiceImpl extends BaseServiceImpl<RoutingInspect
|
|
|
@Transactional
|
|
|
public void add(RoutingInspectionDTO dto) {
|
|
|
//获取检查部位
|
|
|
- List<InspectionRectify> list = dto.getList();
|
|
|
+ List<InspectionRectifyDTO> list = dto.getList();
|
|
|
if (list == null || list.size() == 0){
|
|
|
throw new ServiceException("请填写检查项目");
|
|
|
}
|
|
@@ -57,15 +56,22 @@ public class RoutingInspectionServiceImpl extends BaseServiceImpl<RoutingInspect
|
|
|
inspection.setId(id);
|
|
|
this.save(inspection);
|
|
|
//再保存具体的巡检项目
|
|
|
- list.stream().forEach(l->l.setInspectId(id));
|
|
|
- rectifyService.saveBatch(list);
|
|
|
+ List<InspectionRectify> list1 = list.stream().map(l -> {
|
|
|
+ InspectionRectify rectify = new InspectionRectify();
|
|
|
+ BeanUtils.copyProperties(l, rectify);
|
|
|
+ rectify.setInspectId(id);
|
|
|
+ List<String> autoExpandKeys = l.getAutoExpandKeys();
|
|
|
+ rectify.setInspectLocation(JSON.toJSONString(autoExpandKeys));
|
|
|
+ return rectify;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ rectifyService.saveBatch(list1);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public void Update(RoutingInspectionDTO dto) {
|
|
|
//获取检查部位
|
|
|
- List<InspectionRectify> list = dto.getList();
|
|
|
+ List<InspectionRectifyDTO> list = dto.getList();
|
|
|
if (list == null || list.size() == 0){
|
|
|
throw new ServiceException("请填写检查项目");
|
|
|
}
|
|
@@ -74,8 +80,16 @@ public class RoutingInspectionServiceImpl extends BaseServiceImpl<RoutingInspect
|
|
|
this.updateById(inspection);
|
|
|
//修改先删除,再保存
|
|
|
rectifyService.deleteByInspectId(dto.getId());
|
|
|
- list.stream().forEach(l->l.setInspectId(dto.getId()));
|
|
|
- rectifyService.saveBatch(list);
|
|
|
+ //再保存具体的巡检项目
|
|
|
+ List<InspectionRectify> list1 = list.stream().map(l -> {
|
|
|
+ InspectionRectify rectify = new InspectionRectify();
|
|
|
+ BeanUtils.copyProperties(l, rectify);
|
|
|
+ rectify.setInspectId(dto.getId());
|
|
|
+ List<String> autoExpandKeys = l.getAutoExpandKeys();
|
|
|
+ rectify.setInspectLocation(JSON.toJSONString(autoExpandKeys));
|
|
|
+ return rectify;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ rectifyService.saveBatch(list1);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -97,7 +111,8 @@ public class RoutingInspectionServiceImpl extends BaseServiceImpl<RoutingInspect
|
|
|
@Override
|
|
|
public RoutingInspectionVO2 detail(Long id) {
|
|
|
//先查出巡检项目集合
|
|
|
- List<InspectionRectify> list = rectifyService.list(new LambdaQueryWrapper<InspectionRectify>().eq(InspectionRectify::getInspectId, id));
|
|
|
+ List<InspectionRectifyDTO> list = rectifyService.getDTOList(id);
|
|
|
+ list.stream().forEach(l->l.setAutoExpandKeys(JSON.parseArray(l.getInspectLocation(),String.class)));
|
|
|
//再查出巡检信息,集合设置进巡检信息
|
|
|
RoutingInspection inspection = this.getById(id);
|
|
|
RoutingInspectionVO2 vo2 = new RoutingInspectionVO2();
|
|
@@ -113,6 +128,7 @@ public class RoutingInspectionServiceImpl extends BaseServiceImpl<RoutingInspect
|
|
|
//复检未通过,修改复检状态为2未通过
|
|
|
this.update(new LambdaUpdateWrapper<RoutingInspection>()
|
|
|
.set(RoutingInspection::getReviewInspectStatus,2)
|
|
|
+ .set(RoutingInspection::getSubmitRectify,1)
|
|
|
.eq(RoutingInspection::getId,id));
|
|
|
}else if (status == 2){
|
|
|
//复检通过,修改复检状态为3通过,修改整改状态为2不用整改
|
|
@@ -131,10 +147,20 @@ public class RoutingInspectionServiceImpl extends BaseServiceImpl<RoutingInspect
|
|
|
//修改巡检信息状态为已经整改
|
|
|
this.update(new LambdaUpdateWrapper<RoutingInspection>()
|
|
|
.set(RoutingInspection::getSubmitRectify,2)
|
|
|
+ .set(RoutingInspection::getActualRectifyDate, LocalDate.now())
|
|
|
.eq(RoutingInspection::getId,dto.getId()));
|
|
|
//保存检查项目
|
|
|
- List<InspectionRectify> list = dto.getList();
|
|
|
- rectifyService.updateBatchById(list);
|
|
|
+ List<InspectionRectifyDTO> list = dto.getList();
|
|
|
+ //再保存具体的巡检项目
|
|
|
+ List<InspectionRectify> list1 = list.stream().map(l -> {
|
|
|
+ InspectionRectify rectify = new InspectionRectify();
|
|
|
+ BeanUtils.copyProperties(l, rectify);
|
|
|
+ //整改只能修改整改信息
|
|
|
+ List<String> autoExpandKeys = l.getAutoExpandKeys();
|
|
|
+ rectify.setInspectLocation(JSON.toJSONString(autoExpandKeys));
|
|
|
+ return rectify;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ rectifyService.updateBatchById(list1);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -142,6 +168,7 @@ public class RoutingInspectionServiceImpl extends BaseServiceImpl<RoutingInspect
|
|
|
//修改巡检信息为未整改
|
|
|
this.update(new LambdaUpdateWrapper<RoutingInspection>()
|
|
|
.set(RoutingInspection::getSubmitRectify,1)
|
|
|
+ .set(RoutingInspection::getActualRectifyDate,null)
|
|
|
.eq(RoutingInspection::getId,id));
|
|
|
}
|
|
|
}
|