|
|
|
|
@ -26,13 +26,16 @@ |
|
|
|
|
package org.springblade.desk.energy.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import jakarta.annotation.Resource; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.desk.energy.excel.BsEpciuPatrolInspectionExcel; |
|
|
|
|
import org.springblade.desk.energy.mapper.BsEpciuPatrolInspectionMapper; |
|
|
|
|
import org.springblade.desk.energy.pojo.entity.BsEpciuInspectionPointEntity; |
|
|
|
|
@ -44,13 +47,12 @@ import org.springblade.desk.energy.service.IBsEpciuInspectionPointService; |
|
|
|
|
import org.springblade.desk.energy.service.IBsEpciuPatrolInspectionService; |
|
|
|
|
import org.springblade.desk.energy.service.IBsSafeInspectionPointService; |
|
|
|
|
import org.springblade.desk.energy.service.IBsSafePatrolInspectionService; |
|
|
|
|
import org.springblade.system.feign.IUserClient; |
|
|
|
|
import org.springblade.system.pojo.entity.User; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.Calendar; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Set; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
@ -65,6 +67,8 @@ public class BsEpciuPatrolInspectionServiceImpl extends BaseServiceImpl<BsEpciuP |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IBsEpciuInspectionPointService bsEpciuInspectionPointService; |
|
|
|
|
@Resource |
|
|
|
|
IUserClient userClient; |
|
|
|
|
@Override |
|
|
|
|
public IPage<BsEpciuPatrolInspectionVO> selectBsEpciuPatrolInspectionPage(IPage<BsEpciuPatrolInspectionVO> page, BsEpciuPatrolInspectionVO bsEpciuPatrolInspection) { |
|
|
|
|
if(bsEpciuPatrolInspection.getQueryLaunchTime()!=null){ |
|
|
|
|
@ -74,7 +78,31 @@ public class BsEpciuPatrolInspectionServiceImpl extends BaseServiceImpl<BsEpciuP |
|
|
|
|
bsEpciuPatrolInspection.setStartTestDate(bsEpciuPatrolInspection.getQueryTestTime().split(",")[0]); |
|
|
|
|
bsEpciuPatrolInspection.setEndTestDate(bsEpciuPatrolInspection.getQueryTestTime().split(",")[1]); |
|
|
|
|
} |
|
|
|
|
return page.setRecords(baseMapper.selectBsEpciuPatrolInspectionPage(page, bsEpciuPatrolInspection)); |
|
|
|
|
IPage<BsEpciuPatrolInspectionVO> bsEpciuPatrolInspectionVOIPage = |
|
|
|
|
page.setRecords(baseMapper.selectBsEpciuPatrolInspectionPage(page, bsEpciuPatrolInspection)); |
|
|
|
|
|
|
|
|
|
Set<String> manIds = |
|
|
|
|
bsEpciuPatrolInspectionVOIPage.getRecords().stream().map(BsEpciuPatrolInspectionVO::getInsMan).collect(Collectors.toSet()); |
|
|
|
|
if (CollUtil.isNotEmpty(manIds)) { |
|
|
|
|
String userId = Func.toStr(manIds); |
|
|
|
|
List<User> users = new ArrayList<>(); |
|
|
|
|
try { |
|
|
|
|
users = userClient.userUNListByIds(userId); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
return bsEpciuPatrolInspectionVOIPage; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (CollUtil.isEmpty( users)){ |
|
|
|
|
return bsEpciuPatrolInspectionVOIPage; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Map<String, String> userMap = users.stream().collect(Collectors.toMap(s -> s.getId().toString(), User::getName)); |
|
|
|
|
bsEpciuPatrolInspectionVOIPage.getRecords().forEach(bsEpciuPatrolInspectionVO -> { |
|
|
|
|
bsEpciuPatrolInspectionVO.setInsMan(userMap.getOrDefault(bsEpciuPatrolInspectionVO.getInsMan(),bsEpciuPatrolInspectionVO.getInsMan())); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
return bsEpciuPatrolInspectionVOIPage; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -201,10 +229,14 @@ public class BsEpciuPatrolInspectionServiceImpl extends BaseServiceImpl<BsEpciuP |
|
|
|
|
//query.setParameter("taskStatusText", EpPatrolInspection.PREPARE_TEXT);
|
|
|
|
|
//query.setParameter("code", code);
|
|
|
|
|
//query.executeUpdate();
|
|
|
|
|
Date date = new Date(); |
|
|
|
|
BsEpciuPatrolInspectionEntity bsEpciuPatrolInspection = getById(epPatrolInspection.getId()); |
|
|
|
|
bsEpciuPatrolInspection.setTaskStatus(BsEpciuPatrolInspectionEntity.CHECKED.toString()); |
|
|
|
|
bsEpciuPatrolInspection.setTestTime(new Date()); |
|
|
|
|
bsEpciuPatrolInspection.setTestTime(date); |
|
|
|
|
bsEpciuPatrolInspection.setInsMan(AuthUtil.getUserId().toString()); |
|
|
|
|
|
|
|
|
|
bsEpciuPatrolInspection.setPath(epPatrolInspection.getPath()); |
|
|
|
|
bsEpciuPatrolInspection.setParMemo(epPatrolInspection.getParMemo()); |
|
|
|
|
updateById(bsEpciuPatrolInspection); |
|
|
|
|
// 将其他同类的巡检任务置为未检
|
|
|
|
|
List<BsEpciuInspectionPointEntity> safeInspectionPointList = bsEpciuInspectionPointService.listByCode(bsEpciuPatrolInspection.getInsNum()); |
|
|
|
|
@ -213,6 +245,9 @@ public class BsEpciuPatrolInspectionServiceImpl extends BaseServiceImpl<BsEpciuP |
|
|
|
|
.in(BsEpciuPatrolInspectionEntity::getEpcId, pointIds) |
|
|
|
|
.eq(BsEpciuPatrolInspectionEntity::getTaskStatus, BsEpciuPatrolInspectionEntity.PREPARE_TEXT.toString()) |
|
|
|
|
.set(BsEpciuPatrolInspectionEntity::getTaskStatus, BsEpciuPatrolInspectionEntity.NO_CHECK.toString())); |
|
|
|
|
|
|
|
|
|
safeInspectionPointList.forEach(point -> point.setLastInsCycle(date)); |
|
|
|
|
bsEpciuInspectionPointService.updateBatchById(safeInspectionPointList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|