|
|
@ -1,5 +1,7 @@ |
|
|
|
package org.dromara.platform.service.impl; |
|
|
|
|
|
|
|
import jakarta.annotation.Resource; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.dromara.common.core.utils.MapstructUtils; |
|
|
|
import org.dromara.common.core.utils.StringUtils; |
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
|
|
@ -8,6 +10,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.dromara.platform.domain.AgreementInfo; |
|
|
|
import org.dromara.platform.domain.dto.AgreementInfoDto; |
|
|
|
import org.dromara.platform.domain.vo.AgreementInfoVo; |
|
|
|
import org.dromara.platform.domain.vo.ContractInfoVo; |
|
|
|
import org.dromara.platform.mapper.AgreementInfoMapper; |
|
|
|
import org.dromara.platform.service.IAgreementInfoService; |
|
|
|
import org.dromara.platform.service.IContractInfoService; |
|
|
|
import org.dromara.platform.service.IServiceCatalogCategoryService; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.dromara.platform.domain.bo.InspectionPlanInfoBo; |
|
|
|
import org.dromara.platform.domain.vo.InspectionPlanInfoVo; |
|
|
@ -15,9 +25,8 @@ import org.dromara.platform.domain.InspectionPlanInfo; |
|
|
|
import org.dromara.platform.mapper.InspectionPlanInfoMapper; |
|
|
|
import org.dromara.platform.service.IInspectionPlanInfoService; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 巡检计划Service业务层处理 |
|
|
@ -27,10 +36,22 @@ import java.util.Collection; |
|
|
|
*/ |
|
|
|
@RequiredArgsConstructor |
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
|
public class InspectionPlanInfoServiceImpl implements IInspectionPlanInfoService { |
|
|
|
|
|
|
|
private final InspectionPlanInfoMapper baseMapper; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private IContractInfoService contractInfoService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private IServiceCatalogCategoryService serviceCatalogCategoryService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private IAgreementInfoService agreementInfoService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private AgreementInfoMapper agreementInfoMapper; |
|
|
|
/** |
|
|
|
* 查询巡检计划 |
|
|
|
* |
|
|
@ -136,4 +157,47 @@ public class InspectionPlanInfoServiceImpl implements IInspectionPlanInfoService |
|
|
|
} |
|
|
|
return baseMapper.deleteByIds(ids) > 0; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void createPlans(String contractId, String categoryId) { |
|
|
|
ContractInfoVo contractInfoVo = contractInfoService.queryById(contractId); |
|
|
|
// 获取到通用数据
|
|
|
|
String contractName = contractInfoVo.getContractName(); |
|
|
|
String projectName = contractInfoVo.getProjectName(); |
|
|
|
Date startDate = contractInfoVo.getStartDate(); |
|
|
|
Date endDate = contractInfoVo.getEndDate(); |
|
|
|
|
|
|
|
// 初始化待新增的协议信息集合
|
|
|
|
List<AgreementInfo> agreementInfos = new ArrayList<>(); |
|
|
|
// 根据服务目录最外层id获取到所有服务最里层id
|
|
|
|
List<AgreementInfoDto> agreementInfoDtoList = serviceCatalogCategoryService.findLeafNodeIds(categoryId); |
|
|
|
// 将id收集放入新的集合
|
|
|
|
List<String> leafNodeIds =agreementInfoDtoList.stream() |
|
|
|
.map(AgreementInfoDto::getId) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
for (String leafNodeId : leafNodeIds) { |
|
|
|
LambdaQueryWrapper<AgreementInfo> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
queryWrapper.eq(AgreementInfo::getServiceCategoryId, leafNodeId); |
|
|
|
List<AgreementInfo> infoList = agreementInfoMapper.selectList(queryWrapper); |
|
|
|
agreementInfos.addAll(infoList); |
|
|
|
|
|
|
|
} |
|
|
|
agreementInfos.forEach(item -> log.info("agreementInfo:{}", item.getServiceContent())); |
|
|
|
for (AgreementInfo agreementInfo : agreementInfos) { |
|
|
|
InspectionPlanInfo inspectionPlanInfo = new InspectionPlanInfo(); |
|
|
|
inspectionPlanInfo.setProjectName(projectName); |
|
|
|
inspectionPlanInfo.setContractName(contractName); |
|
|
|
inspectionPlanInfo.setStartDate(startDate); |
|
|
|
inspectionPlanInfo.setEndDate(endDate); |
|
|
|
inspectionPlanInfo.setDescription(agreementInfo.getServiceContent()); |
|
|
|
inspectionPlanInfo.setFrequency(agreementInfo.getFrequency()); |
|
|
|
inspectionPlanInfo.setIoCompany("测试运维单位1"); |
|
|
|
// 0未开始 1进行中 2已完成
|
|
|
|
inspectionPlanInfo.setStatus(0L); |
|
|
|
baseMapper.insert(inspectionPlanInfo); |
|
|
|
log.info("开始新增巡检计划!"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|