From 1718b5b3167b7e6d405a9320a627d5bbdd51ba2e Mon Sep 17 00:00:00 2001 From: gjh <1421wake> Date: Thu, 17 Apr 2025 11:21:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=9C=8D=E5=8A=A1=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E8=87=AA=E5=8A=A8=E5=92=8C=E6=89=8B=E5=8A=A8=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E5=B7=A5=E4=BD=9C=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InspectionPlanInfoController.java | 12 ++++++++ .../RoutineInspectionInfoController.java | 27 ++++++++++++++++- .../domain/dto/RoutineInspectionDto.java | 7 +++++ .../service/IInspectionPlanInfoService.java | 2 ++ .../IRoutineInspectionInfoService.java | 5 ++++ .../impl/InspectionPlanInfoServiceImpl.java | 29 +++++++++++++++++++ .../RoutineInspectionInfoServiceImpl.java | 21 +++++++++++--- .../impl/WorkOrderInfoServiceImpl.java | 1 + 8 files changed, 99 insertions(+), 5 deletions(-) diff --git a/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/controller/InspectionPlanInfoController.java b/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/controller/InspectionPlanInfoController.java index e395e91..22093f4 100644 --- a/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/controller/InspectionPlanInfoController.java +++ b/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/controller/InspectionPlanInfoController.java @@ -9,6 +9,7 @@ import jakarta.validation.constraints.*; import cn.dev33.satoken.annotation.SaCheckPermission; import org.apache.ibatis.annotations.Param; import org.dromara.platform.domain.AgreementInfo; +import org.dromara.platform.domain.dto.RoutineWorkDto; import org.dromara.platform.domain.vo.ioCompanySelectVo; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; @@ -132,4 +133,15 @@ public class InspectionPlanInfoController extends BaseController { List rs = inspectionPlanInfoService.findLeafNodeInfos(categoryId); return R.ok(rs); } + + + @SaCheckPermission("platform:inspectPlanInfo:createPlansByHands") + @PostMapping("/createPlansByHands") + public R createPlansByHand(@RequestBody RoutineWorkDto routineWorkDto) { + String contractId = routineWorkDto.getContractId(); + String categoryId = routineWorkDto.getCategoryId(); + List serviceProjectList = routineWorkDto.getServiceProjectList(); + inspectionPlanInfoService.createPlansByHands(contractId,categoryId,serviceProjectList); + return R.ok("手动创建巡检计划成功!"); + } } diff --git a/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/controller/RoutineInspectionInfoController.java b/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/controller/RoutineInspectionInfoController.java index 69660d7..4649c00 100644 --- a/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/controller/RoutineInspectionInfoController.java +++ b/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/controller/RoutineInspectionInfoController.java @@ -1,5 +1,6 @@ package org.dromara.platform.controller; +import java.util.Date; import java.util.List; import jakarta.annotation.Resource; @@ -143,7 +144,7 @@ public class RoutineInspectionInfoController extends BaseController { return routineInspectionInfoService.queryPageSpecialList(bo, pageQuery); } - @SaCheckPermission("platform:routineInspectionInfo:specialList") + @SaCheckPermission("platform:routineInspectionInfo:autoCreatePlans") @PostMapping("/autoCreatePlans") public R autoCreatePlans(@RequestBody RoutineWorkDto routineWorkDto) { String contractId = routineWorkDto.getContractId(); @@ -152,5 +153,29 @@ public class RoutineInspectionInfoController extends BaseController { inspectionPlanInfoService.autoCreatePlans( contractId, categoryId, serviceProjectList); return R.ok("根据服务目录创建工作内容 !"); } + + + @SaCheckPermission("platform:routineInspectionInfo:createSpecialInspection") + @PostMapping("/createSpecialInspection") + public R createSpecialInspection(@RequestBody RoutineInspectionDto routineInspectionDto) { + String projectName = routineInspectionDto.getProjectName(); + String contractName = routineInspectionDto.getContractName(); + String description = routineInspectionDto.getDescription(); + String serviceProject = routineInspectionDto.getServiceProject(); + String ioCompany = routineInspectionDto.getIoCompany(); + String pointName = routineInspectionDto.getPointName(); + String deliverContent = routineInspectionDto.getDeliverContent(); + Date scheduleStartDate = routineInspectionDto.getScheduleStartDate(); + Date scheduleEndDate = routineInspectionDto.getScheduleEndDate(); + + routineInspectionInfoService.createSpecialInspection( projectName, + contractName, + description, + serviceProject, + ioCompany, + pointName,deliverContent,scheduleStartDate,scheduleEndDate + ); + return R.ok("创建成功!"); + } } diff --git a/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/domain/dto/RoutineInspectionDto.java b/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/domain/dto/RoutineInspectionDto.java index dfc3798..0a34a63 100644 --- a/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/domain/dto/RoutineInspectionDto.java +++ b/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/domain/dto/RoutineInspectionDto.java @@ -1,10 +1,12 @@ package org.dromara.platform.domain.dto; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.apache.ibatis.annotations.Param; import org.dromara.platform.domain.InspectionPlanInfo; import org.dromara.platform.domain.bo.RoutineInspectionInfoBo; +import java.util.Date; import java.util.List; @Data @@ -15,5 +17,10 @@ public class RoutineInspectionDto { private String serviceProject; private String ioCompany; private String pointName; + private String deliverContent; + @JsonFormat(pattern = "yyyy-MM-dd") + private Date scheduleStartDate; + @JsonFormat(pattern = "yyyy-MM-dd") + private Date scheduleEndDate; private List finishStatus; } diff --git a/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/IInspectionPlanInfoService.java b/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/IInspectionPlanInfoService.java index 1bc549f..237b38c 100644 --- a/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/IInspectionPlanInfoService.java +++ b/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/IInspectionPlanInfoService.java @@ -92,4 +92,6 @@ public interface IInspectionPlanInfoService { void autoCreatePlans(String contractId, String categoryId, List serviceProjectList); + + void createPlansByHands(String contractId, String categoryId, List serviceProjectList); } diff --git a/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/IRoutineInspectionInfoService.java b/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/IRoutineInspectionInfoService.java index 2e7b88a..94566d1 100644 --- a/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/IRoutineInspectionInfoService.java +++ b/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/IRoutineInspectionInfoService.java @@ -7,6 +7,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.PageQuery; import java.util.Collection; +import java.util.Date; import java.util.List; /** @@ -72,4 +73,8 @@ public interface IRoutineInspectionInfoService { String ioCompany,String pointName); TableDataInfo queryPageSpecialList(RoutineInspectionInfoBo bo, PageQuery pageQuery); + + void createSpecialInspection(String projectName, String contractName, String description, String serviceProject, + String ioCompany, String pointName, + String deliverContent, Date scheduleStartDate, Date scheduleEndDate); } diff --git a/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/impl/InspectionPlanInfoServiceImpl.java b/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/impl/InspectionPlanInfoServiceImpl.java index 530b7a4..7953878 100644 --- a/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/impl/InspectionPlanInfoServiceImpl.java +++ b/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/impl/InspectionPlanInfoServiceImpl.java @@ -314,4 +314,33 @@ public class InspectionPlanInfoServiceImpl implements IInspectionPlanInfoService } } + + @Override + public void createPlansByHands(String contractId, String categoryId, List serviceProjectList) { + ContractInfoVo contractInfoVo = contractInfoService.queryById(contractId); + // 获取到通用数据 + String contractName = contractInfoVo.getContractName(); + String projectName = contractInfoVo.getProjectName(); + Date startDate = contractInfoVo.getStartDate(); + Date endDate = contractInfoVo.getEndDate(); + String partyB = contractInfoVo.getPartyB(); + + List agreementInfoVos = agreementInfoMapper.selectVoByIds(serviceProjectList); + + for (AgreementInfoVo agreementInfoVo : agreementInfoVos) { + InspectionPlanInfo inspectionPlanInfo = new InspectionPlanInfo(); + inspectionPlanInfo.setProjectName(projectName); + inspectionPlanInfo.setContractName(contractName); + inspectionPlanInfo.setStartDate(startDate); + inspectionPlanInfo.setEndDate(endDate); + inspectionPlanInfo.setDescription(agreementInfoVo.getServiceContent()); + inspectionPlanInfo.setFrequency(agreementInfoVo.getFrequency()); + inspectionPlanInfo.setServiceProject(agreementInfoVo.getServiceProject()); + inspectionPlanInfo.setIoCompany(partyB); + inspectionPlanInfo.setDeliverContent(agreementInfoVo.getDeliverContent()); + inspectionPlanInfo.setStatus(0L); + baseMapper.insert(inspectionPlanInfo); + log.info("已根据服务目录创建全部工作!"); + } + } } diff --git a/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/impl/RoutineInspectionInfoServiceImpl.java b/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/impl/RoutineInspectionInfoServiceImpl.java index a9d48a1..4162806 100644 --- a/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/impl/RoutineInspectionInfoServiceImpl.java +++ b/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/impl/RoutineInspectionInfoServiceImpl.java @@ -17,10 +17,7 @@ import org.dromara.platform.domain.RoutineInspectionInfo; import org.dromara.platform.mapper.RoutineInspectionInfoMapper; import org.dromara.platform.service.IRoutineInspectionInfoService; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Collection; +import java.util.*; import java.util.stream.Collectors; /** @@ -184,4 +181,20 @@ public class RoutineInspectionInfoServiceImpl implements IRoutineInspectionInfoS result.setRecords(filteredRecords); return TableDataInfo.build(result); } + + @Override + public void createSpecialInspection(String projectName, String contractName, String description, String serviceProject, String ioCompany, String pointName,String deliverContent, Date scheduleStartDate, Date scheduleEndDate) { + RoutineInspectionInfo routineInspectionInfo = new RoutineInspectionInfo(); + routineInspectionInfo.setProjectName(projectName); + routineInspectionInfo.setContractName(contractName); + routineInspectionInfo.setDescription(description); + routineInspectionInfo.setServiceProject(serviceProject); + routineInspectionInfo.setIoCompany(ioCompany); + routineInspectionInfo.setPointName(pointName); + routineInspectionInfo.setScheduleStartDate(scheduleStartDate); + routineInspectionInfo.setScheduleEndDate(scheduleEndDate); + routineInspectionInfo.setDeliverContent(deliverContent); + routineInspectionInfo.setStatus(1L); + baseMapper.insert(routineInspectionInfo); + } } diff --git a/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/impl/WorkOrderInfoServiceImpl.java b/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/impl/WorkOrderInfoServiceImpl.java index 2132176..28ae235 100644 --- a/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/impl/WorkOrderInfoServiceImpl.java +++ b/ruoyi-modules/guoyan-platform/src/main/java/org/dromara/platform/service/impl/WorkOrderInfoServiceImpl.java @@ -106,6 +106,7 @@ public class WorkOrderInfoServiceImpl implements IWorkOrderInfoService { @Override public Boolean insertByBo(WorkOrderInfoBo bo) { WorkOrderInfo add = MapstructUtils.convert(bo, WorkOrderInfo.class); + add.setRepairTime(DateUtil.date()); validEntityBeforeSave(add); boolean flag = baseMapper.insert(add) > 0; if (flag) {