10 changed files with 755 additions and 0 deletions
@ -0,0 +1,131 @@ |
|||||
|
package org.dromara.platform.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import jakarta.servlet.http.HttpServletResponse; |
||||
|
import jakarta.validation.constraints.*; |
||||
|
import cn.dev33.satoken.annotation.SaCheckPermission; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.dromara.platform.domain.InspectionPlanInfo; |
||||
|
import org.dromara.platform.domain.RoutineInspectionInfo; |
||||
|
import org.dromara.platform.domain.dto.RoutineInspectionDto; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit; |
||||
|
import org.dromara.common.log.annotation.Log; |
||||
|
import org.dromara.common.web.core.BaseController; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
import org.dromara.common.core.domain.R; |
||||
|
import org.dromara.common.core.validate.AddGroup; |
||||
|
import org.dromara.common.core.validate.EditGroup; |
||||
|
import org.dromara.common.log.enums.BusinessType; |
||||
|
import org.dromara.common.excel.utils.ExcelUtil; |
||||
|
import org.dromara.platform.domain.vo.RoutineInspectionInfoVo; |
||||
|
import org.dromara.platform.domain.bo.RoutineInspectionInfoBo; |
||||
|
import org.dromara.platform.service.IRoutineInspectionInfoService; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
|
||||
|
/** |
||||
|
* 日常巡检-计划 |
||||
|
* |
||||
|
* @author gejunhao |
||||
|
* @date 2025-04-15 |
||||
|
*/ |
||||
|
@Validated |
||||
|
@RequiredArgsConstructor |
||||
|
@RestController |
||||
|
@RequestMapping("/platform/routineInspectionInfo") |
||||
|
public class RoutineInspectionInfoController extends BaseController { |
||||
|
|
||||
|
private final IRoutineInspectionInfoService routineInspectionInfoService; |
||||
|
|
||||
|
/** |
||||
|
* 查询日常巡检-计划列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("platform:routineInspectionInfo:list") |
||||
|
@GetMapping("/list") |
||||
|
public TableDataInfo<RoutineInspectionInfoVo> list(RoutineInspectionInfoBo bo, PageQuery pageQuery) { |
||||
|
return routineInspectionInfoService.queryPageList(bo, pageQuery); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导出日常巡检-计划列表 |
||||
|
*/ |
||||
|
@SaCheckPermission("platform:routineInspectionInfo:export") |
||||
|
@Log(title = "日常巡检-计划", businessType = BusinessType.EXPORT) |
||||
|
@PostMapping("/export") |
||||
|
public void export(RoutineInspectionInfoBo bo, HttpServletResponse response) { |
||||
|
List<RoutineInspectionInfoVo> list = routineInspectionInfoService.queryList(bo); |
||||
|
ExcelUtil.exportExcel(list, "日常巡检-计划", RoutineInspectionInfoVo.class, response); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取日常巡检-计划详细信息 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
*/ |
||||
|
@SaCheckPermission("platform:routineInspectionInfo:query") |
||||
|
@GetMapping("/{id}") |
||||
|
public R<RoutineInspectionInfoVo> getInfo(@NotNull(message = "主键不能为空") |
||||
|
@PathVariable String id) { |
||||
|
return R.ok(routineInspectionInfoService.queryById(id)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增日常巡检-计划 |
||||
|
*/ |
||||
|
@SaCheckPermission("platform:routineInspectionInfo:add") |
||||
|
@Log(title = "日常巡检-计划", businessType = BusinessType.INSERT) |
||||
|
@RepeatSubmit() |
||||
|
@PostMapping() |
||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody RoutineInspectionInfoBo bo) { |
||||
|
return toAjax(routineInspectionInfoService.insertByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改日常巡检-计划 |
||||
|
*/ |
||||
|
@SaCheckPermission("platform:routineInspectionInfo:edit") |
||||
|
@Log(title = "日常巡检-计划", businessType = BusinessType.UPDATE) |
||||
|
@RepeatSubmit() |
||||
|
@PutMapping() |
||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody RoutineInspectionInfoBo bo) { |
||||
|
return toAjax(routineInspectionInfoService.updateByBo(bo)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除日常巡检-计划 |
||||
|
* |
||||
|
* @param ids 主键串 |
||||
|
*/ |
||||
|
@SaCheckPermission("platform:routineInspectionInfo:remove") |
||||
|
@Log(title = "日常巡检-计划", businessType = BusinessType.DELETE) |
||||
|
@DeleteMapping("/{ids}") |
||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空") |
||||
|
@PathVariable String[] ids) { |
||||
|
return toAjax(routineInspectionInfoService.deleteWithValidByIds(List.of(ids), true)); |
||||
|
} |
||||
|
|
||||
|
@SaCheckPermission("platform:routineInspectionInfo:createRoutineInspection") |
||||
|
@PostMapping("/createRoutineInspection") |
||||
|
public R<Void> createPlans(@RequestBody RoutineInspectionDto routineInspectionDto) { |
||||
|
List<RoutineInspectionInfoBo> finishStatus = routineInspectionDto.getFinishStatus(); |
||||
|
String projectName = routineInspectionDto.getProjectName(); |
||||
|
String contractName = routineInspectionDto.getContractName(); |
||||
|
String description = routineInspectionDto.getDescription(); |
||||
|
String serviceProject = routineInspectionDto.getServiceProject(); |
||||
|
String ioCompany = routineInspectionDto.getIoCompany(); |
||||
|
String pointName = routineInspectionDto.getPointName(); |
||||
|
routineInspectionInfoService.createRoutineInspection(finishStatus, projectName, |
||||
|
contractName, |
||||
|
description, |
||||
|
serviceProject, |
||||
|
ioCompany, |
||||
|
pointName |
||||
|
); |
||||
|
return R.ok("创建日常巡检任务成功!"); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
@ -0,0 +1,106 @@ |
|||||
|
package org.dromara.platform.domain; |
||||
|
|
||||
|
import org.dromara.common.tenant.core.TenantEntity; |
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import java.util.Date; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
|
||||
|
/** |
||||
|
* 日常巡检-计划对象 routine_inspection_info |
||||
|
* |
||||
|
* @author gejunhao |
||||
|
* @date 2025-04-15 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@TableName("routine_inspection_info") |
||||
|
public class RoutineInspectionInfo extends TenantEntity { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 记录唯一标识符 |
||||
|
*/ |
||||
|
@TableId(value = "id") |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 项目名称 |
||||
|
*/ |
||||
|
private String projectName; |
||||
|
|
||||
|
/** |
||||
|
* 所属合同 |
||||
|
*/ |
||||
|
private String contractName; |
||||
|
|
||||
|
/** |
||||
|
* 计划描述 |
||||
|
*/ |
||||
|
private String description; |
||||
|
|
||||
|
/** |
||||
|
* 服务项目 |
||||
|
*/ |
||||
|
private String serviceProject; |
||||
|
|
||||
|
/** |
||||
|
* 代码 |
||||
|
*/ |
||||
|
private String code; |
||||
|
|
||||
|
/** |
||||
|
* 运维单位 |
||||
|
*/ |
||||
|
private String ioCompany; |
||||
|
|
||||
|
/** |
||||
|
* 计划开始时间 |
||||
|
*/ |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date scheduleStartDate; |
||||
|
|
||||
|
/** |
||||
|
* 计划结束时间 |
||||
|
*/ |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date scheduleEndDate; |
||||
|
|
||||
|
/** |
||||
|
* 实际完成时间 |
||||
|
*/ |
||||
|
private Date finishDate; |
||||
|
|
||||
|
/** |
||||
|
* 巡检点位 |
||||
|
*/ |
||||
|
private String pointName; |
||||
|
|
||||
|
/** |
||||
|
* 当前状态 |
||||
|
*/ |
||||
|
private Long status; |
||||
|
|
||||
|
/** |
||||
|
* 处理人 |
||||
|
*/ |
||||
|
private String handler; |
||||
|
|
||||
|
/** |
||||
|
* 审批人 |
||||
|
*/ |
||||
|
private String approver; |
||||
|
|
||||
|
/** |
||||
|
* 删除标志(0代表存在 2代表删除) |
||||
|
*/ |
||||
|
@TableLogic |
||||
|
private String delFlag; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,109 @@ |
|||||
|
package org.dromara.platform.domain.bo; |
||||
|
|
||||
|
import org.dromara.platform.domain.RoutineInspectionInfo; |
||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity; |
||||
|
import org.dromara.common.core.validate.AddGroup; |
||||
|
import org.dromara.common.core.validate.EditGroup; |
||||
|
import io.github.linpeilie.annotations.AutoMapper; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import jakarta.validation.constraints.*; |
||||
|
import java.util.Date; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
|
||||
|
/** |
||||
|
* 日常巡检-计划业务对象 routine_inspection_info |
||||
|
* |
||||
|
* @author gejunhao |
||||
|
* @date 2025-04-15 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@AutoMapper(target = RoutineInspectionInfo.class, reverseConvertGenerate = false) |
||||
|
public class RoutineInspectionInfoBo extends BaseEntity { |
||||
|
|
||||
|
/** |
||||
|
* 记录唯一标识符 |
||||
|
*/ |
||||
|
@NotBlank(message = "记录唯一标识符不能为空", groups = { EditGroup.class }) |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 项目名称 |
||||
|
*/ |
||||
|
@NotBlank(message = "项目名称不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String projectName; |
||||
|
|
||||
|
/** |
||||
|
* 所属合同 |
||||
|
*/ |
||||
|
@NotBlank(message = "所属合同不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String contractName; |
||||
|
|
||||
|
/** |
||||
|
* 计划描述 |
||||
|
*/ |
||||
|
@NotBlank(message = "计划描述不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String description; |
||||
|
|
||||
|
/** |
||||
|
* 服务项目 |
||||
|
*/ |
||||
|
@NotNull(message = "服务项目不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String serviceProject; |
||||
|
|
||||
|
/** |
||||
|
* 代码 |
||||
|
*/ |
||||
|
@NotBlank(message = "代码不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String code; |
||||
|
|
||||
|
/** |
||||
|
* 运维单位 |
||||
|
*/ |
||||
|
@NotBlank(message = "运维单位不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
private String ioCompany; |
||||
|
|
||||
|
/** |
||||
|
* 计划开始时间 |
||||
|
*/ |
||||
|
@NotNull(message = "计划开始时间不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date scheduleStartDate; |
||||
|
|
||||
|
/** |
||||
|
* 计划结束时间 |
||||
|
*/ |
||||
|
@NotNull(message = "计划结束时间不能为空", groups = { AddGroup.class, EditGroup.class }) |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date scheduleEndDate; |
||||
|
|
||||
|
/** |
||||
|
* 实际完成时间 |
||||
|
*/ |
||||
|
private Date finishDate; |
||||
|
|
||||
|
/** |
||||
|
* 巡检点位 |
||||
|
*/ |
||||
|
private String pointName; |
||||
|
|
||||
|
/** |
||||
|
* 当前状态 |
||||
|
*/ |
||||
|
//@NotNull(message = "当前状态不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
|
private Long status; |
||||
|
|
||||
|
/** |
||||
|
* 处理人 |
||||
|
*/ |
||||
|
private String handler; |
||||
|
|
||||
|
/** |
||||
|
* 审批人 |
||||
|
*/ |
||||
|
//@NotBlank(message = "审批人不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
|
private String approver; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
package org.dromara.platform.domain.dto; |
||||
|
|
||||
|
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.List; |
||||
|
|
||||
|
@Data |
||||
|
public class RoutineInspectionDto { |
||||
|
private String projectName; |
||||
|
private String contractName; |
||||
|
private String description; |
||||
|
private String serviceProject; |
||||
|
private String ioCompany; |
||||
|
private String pointName; |
||||
|
private List<RoutineInspectionInfoBo> finishStatus; |
||||
|
} |
@ -0,0 +1,118 @@ |
|||||
|
package org.dromara.platform.domain.vo; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import org.dromara.platform.domain.RoutineInspectionInfo; |
||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||
|
import org.dromara.common.excel.annotation.ExcelDictFormat; |
||||
|
import org.dromara.common.excel.convert.ExcelDictConvert; |
||||
|
import io.github.linpeilie.annotations.AutoMapper; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serial; |
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 日常巡检-计划视图对象 routine_inspection_info |
||||
|
* |
||||
|
* @author gejunhao |
||||
|
* @date 2025-04-15 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ExcelIgnoreUnannotated |
||||
|
@AutoMapper(target = RoutineInspectionInfo.class) |
||||
|
public class RoutineInspectionInfoVo implements Serializable { |
||||
|
|
||||
|
@Serial |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 记录唯一标识符 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "记录唯一标识符") |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 项目名称 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "项目名称") |
||||
|
private String projectName; |
||||
|
|
||||
|
/** |
||||
|
* 所属合同 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "所属合同") |
||||
|
private String contractName; |
||||
|
|
||||
|
/** |
||||
|
* 计划描述 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "计划描述") |
||||
|
private String description; |
||||
|
|
||||
|
/** |
||||
|
* 服务项目 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "服务项目") |
||||
|
private String serviceProject; |
||||
|
|
||||
|
/** |
||||
|
* 代码 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "代码") |
||||
|
private String code; |
||||
|
|
||||
|
/** |
||||
|
* 运维单位 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "运维单位") |
||||
|
private String ioCompany; |
||||
|
|
||||
|
/** |
||||
|
* 计划开始时间 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "计划开始时间") |
||||
|
private Date scheduleStartDate; |
||||
|
|
||||
|
/** |
||||
|
* 计划结束时间 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "计划结束时间") |
||||
|
private Date scheduleEndDate; |
||||
|
|
||||
|
/** |
||||
|
* 实际完成时间 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "实际完成时间") |
||||
|
private Date finishDate; |
||||
|
|
||||
|
/** |
||||
|
* 巡检点位 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "巡检点位") |
||||
|
private String pointName; |
||||
|
|
||||
|
/** |
||||
|
* 当前状态 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "当前状态") |
||||
|
private Long status; |
||||
|
|
||||
|
/** |
||||
|
* 处理人 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "处理人") |
||||
|
private String handler; |
||||
|
|
||||
|
/** |
||||
|
* 审批人 |
||||
|
*/ |
||||
|
@ExcelProperty(value = "审批人") |
||||
|
private String approver; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
package org.dromara.platform.mapper; |
||||
|
|
||||
|
import org.dromara.platform.domain.RoutineInspectionInfo; |
||||
|
import org.dromara.platform.domain.vo.RoutineInspectionInfoVo; |
||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; |
||||
|
|
||||
|
/** |
||||
|
* 日常巡检-计划Mapper接口 |
||||
|
* |
||||
|
* @author gejunhao |
||||
|
* @date 2025-04-15 |
||||
|
*/ |
||||
|
public interface RoutineInspectionInfoMapper extends BaseMapperPlus<RoutineInspectionInfo, RoutineInspectionInfoVo> { |
||||
|
|
||||
|
} |
@ -0,0 +1,73 @@ |
|||||
|
package org.dromara.platform.service; |
||||
|
|
||||
|
import org.dromara.platform.domain.InspectionPlanInfo; |
||||
|
import org.dromara.platform.domain.vo.RoutineInspectionInfoVo; |
||||
|
import org.dromara.platform.domain.bo.RoutineInspectionInfoBo; |
||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
|
||||
|
import java.util.Collection; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 日常巡检-计划Service接口 |
||||
|
* |
||||
|
* @author gejunhao |
||||
|
* @date 2025-04-15 |
||||
|
*/ |
||||
|
public interface IRoutineInspectionInfoService { |
||||
|
|
||||
|
/** |
||||
|
* 查询日常巡检-计划 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
* @return 日常巡检-计划 |
||||
|
*/ |
||||
|
RoutineInspectionInfoVo queryById(String id); |
||||
|
|
||||
|
/** |
||||
|
* 分页查询日常巡检-计划列表 |
||||
|
* |
||||
|
* @param bo 查询条件 |
||||
|
* @param pageQuery 分页参数 |
||||
|
* @return 日常巡检-计划分页列表 |
||||
|
*/ |
||||
|
TableDataInfo<RoutineInspectionInfoVo> queryPageList(RoutineInspectionInfoBo bo, PageQuery pageQuery); |
||||
|
|
||||
|
/** |
||||
|
* 查询符合条件的日常巡检-计划列表 |
||||
|
* |
||||
|
* @param bo 查询条件 |
||||
|
* @return 日常巡检-计划列表 |
||||
|
*/ |
||||
|
List<RoutineInspectionInfoVo> queryList(RoutineInspectionInfoBo bo); |
||||
|
|
||||
|
/** |
||||
|
* 新增日常巡检-计划 |
||||
|
* |
||||
|
* @param bo 日常巡检-计划 |
||||
|
* @return 是否新增成功 |
||||
|
*/ |
||||
|
Boolean insertByBo(RoutineInspectionInfoBo bo); |
||||
|
|
||||
|
/** |
||||
|
* 修改日常巡检-计划 |
||||
|
* |
||||
|
* @param bo 日常巡检-计划 |
||||
|
* @return 是否修改成功 |
||||
|
*/ |
||||
|
Boolean updateByBo(RoutineInspectionInfoBo bo); |
||||
|
|
||||
|
/** |
||||
|
* 校验并批量删除日常巡检-计划信息 |
||||
|
* |
||||
|
* @param ids 待删除的主键集合 |
||||
|
* @param isValid 是否进行有效性校验 |
||||
|
* @return 是否删除成功 |
||||
|
*/ |
||||
|
Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid); |
||||
|
|
||||
|
void createRoutineInspection(List<RoutineInspectionInfoBo> finishStatus,String projectName, |
||||
|
String contractName,String description,String serviceProject, |
||||
|
String ioCompany,String pointName); |
||||
|
} |
@ -0,0 +1,167 @@ |
|||||
|
package org.dromara.platform.service.impl; |
||||
|
|
||||
|
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; |
||||
|
import org.dromara.common.mybatis.core.page.PageQuery; |
||||
|
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.InspectionPlanInfo; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.dromara.platform.domain.bo.RoutineInspectionInfoBo; |
||||
|
import org.dromara.platform.domain.vo.RoutineInspectionInfoVo; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* 日常巡检-计划Service业务层处理 |
||||
|
* |
||||
|
* @author gejunhao |
||||
|
* @date 2025-04-15 |
||||
|
*/ |
||||
|
@RequiredArgsConstructor |
||||
|
@Service |
||||
|
@Slf4j |
||||
|
public class RoutineInspectionInfoServiceImpl implements IRoutineInspectionInfoService { |
||||
|
|
||||
|
private final RoutineInspectionInfoMapper baseMapper; |
||||
|
|
||||
|
/** |
||||
|
* 查询日常巡检-计划 |
||||
|
* |
||||
|
* @param id 主键 |
||||
|
* @return 日常巡检-计划 |
||||
|
*/ |
||||
|
@Override |
||||
|
public RoutineInspectionInfoVo queryById(String id){ |
||||
|
return baseMapper.selectVoById(id); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 分页查询日常巡检-计划列表 |
||||
|
* |
||||
|
* @param bo 查询条件 |
||||
|
* @param pageQuery 分页参数 |
||||
|
* @return 日常巡检-计划分页列表 |
||||
|
*/ |
||||
|
@Override |
||||
|
public TableDataInfo<RoutineInspectionInfoVo> queryPageList(RoutineInspectionInfoBo bo, PageQuery pageQuery) { |
||||
|
LambdaQueryWrapper<RoutineInspectionInfo> lqw = buildQueryWrapper(bo); |
||||
|
Page<RoutineInspectionInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
||||
|
return TableDataInfo.build(result); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询符合条件的日常巡检-计划列表 |
||||
|
* |
||||
|
* @param bo 查询条件 |
||||
|
* @return 日常巡检-计划列表 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<RoutineInspectionInfoVo> queryList(RoutineInspectionInfoBo bo) { |
||||
|
LambdaQueryWrapper<RoutineInspectionInfo> lqw = buildQueryWrapper(bo); |
||||
|
return baseMapper.selectVoList(lqw); |
||||
|
} |
||||
|
|
||||
|
private LambdaQueryWrapper<RoutineInspectionInfo> buildQueryWrapper(RoutineInspectionInfoBo bo) { |
||||
|
Map<String, Object> params = bo.getParams(); |
||||
|
LambdaQueryWrapper<RoutineInspectionInfo> lqw = Wrappers.lambdaQuery(); |
||||
|
lqw.like(StringUtils.isNotBlank(bo.getProjectName()), RoutineInspectionInfo::getProjectName, bo.getProjectName()); |
||||
|
lqw.like(StringUtils.isNotBlank(bo.getContractName()), RoutineInspectionInfo::getContractName, bo.getContractName()); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getDescription()), RoutineInspectionInfo::getDescription, bo.getDescription()); |
||||
|
lqw.eq(bo.getServiceProject() != null, RoutineInspectionInfo::getServiceProject, bo.getServiceProject()); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getCode()), RoutineInspectionInfo::getCode, bo.getCode()); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getIoCompany()), RoutineInspectionInfo::getIoCompany, bo.getIoCompany()); |
||||
|
lqw.eq(bo.getScheduleStartDate() != null, RoutineInspectionInfo::getScheduleStartDate, bo.getScheduleStartDate()); |
||||
|
lqw.eq(bo.getScheduleEndDate() != null, RoutineInspectionInfo::getScheduleEndDate, bo.getScheduleEndDate()); |
||||
|
lqw.eq(bo.getFinishDate() != null, RoutineInspectionInfo::getFinishDate, bo.getFinishDate()); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getPointName()), RoutineInspectionInfo::getPointName, bo.getPointName()); |
||||
|
lqw.eq(bo.getStatus() != null, RoutineInspectionInfo::getStatus, bo.getStatus()); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getHandler()), RoutineInspectionInfo::getHandler, bo.getHandler()); |
||||
|
lqw.eq(StringUtils.isNotBlank(bo.getApprover()), RoutineInspectionInfo::getApprover, bo.getApprover()); |
||||
|
return lqw; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增日常巡检-计划 |
||||
|
* |
||||
|
* @param bo 日常巡检-计划 |
||||
|
* @return 是否新增成功 |
||||
|
*/ |
||||
|
@Override |
||||
|
public Boolean insertByBo(RoutineInspectionInfoBo bo) { |
||||
|
RoutineInspectionInfo add = MapstructUtils.convert(bo, RoutineInspectionInfo.class); |
||||
|
validEntityBeforeSave(add); |
||||
|
boolean flag = baseMapper.insert(add) > 0; |
||||
|
if (flag) { |
||||
|
bo.setId(add.getId()); |
||||
|
} |
||||
|
return flag; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改日常巡检-计划 |
||||
|
* |
||||
|
* @param bo 日常巡检-计划 |
||||
|
* @return 是否修改成功 |
||||
|
*/ |
||||
|
@Override |
||||
|
public Boolean updateByBo(RoutineInspectionInfoBo bo) { |
||||
|
RoutineInspectionInfo update = MapstructUtils.convert(bo, RoutineInspectionInfo.class); |
||||
|
validEntityBeforeSave(update); |
||||
|
return baseMapper.updateById(update) > 0; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 保存前的数据校验 |
||||
|
*/ |
||||
|
private void validEntityBeforeSave(RoutineInspectionInfo entity){ |
||||
|
//TODO 做一些数据校验,如唯一约束
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 校验并批量删除日常巡检-计划信息 |
||||
|
* |
||||
|
* @param ids 待删除的主键集合 |
||||
|
* @param isValid 是否进行有效性校验 |
||||
|
* @return 是否删除成功 |
||||
|
*/ |
||||
|
@Override |
||||
|
public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) { |
||||
|
if(isValid){ |
||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
|
} |
||||
|
return baseMapper.deleteByIds(ids) > 0; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void createRoutineInspection(List<RoutineInspectionInfoBo> finishStatus,String projectName, |
||||
|
String contractName,String description,String serviceProject,String ioCompany,String pointName) { |
||||
|
List<RoutineInspectionInfo> addList = new ArrayList<>(); |
||||
|
|
||||
|
for (RoutineInspectionInfoBo item : finishStatus) { |
||||
|
RoutineInspectionInfo routineInspectionInfo = new RoutineInspectionInfo(); |
||||
|
routineInspectionInfo.setProjectName(projectName); |
||||
|
routineInspectionInfo.setContractName(contractName); |
||||
|
routineInspectionInfo.setDescription(description); |
||||
|
routineInspectionInfo.setServiceProject(serviceProject); |
||||
|
routineInspectionInfo.setIoCompany(ioCompany); |
||||
|
routineInspectionInfo.setPointName(pointName); |
||||
|
routineInspectionInfo.setScheduleStartDate(item.getScheduleStartDate()); |
||||
|
routineInspectionInfo.setScheduleEndDate(item.getScheduleEndDate()); |
||||
|
routineInspectionInfo.setStatus(item.getStatus()); |
||||
|
addList.add(routineInspectionInfo); |
||||
|
} |
||||
|
baseMapper.insert(addList); |
||||
|
log.info("添加日常巡检-任务成功!"); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue