Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@ -0,0 +1,108 @@
|
||||
package org.dromara.safety.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.safety.domain.bo.HazardHiddenDangerBo;
|
||||
import org.dromara.safety.domain.bo.HazardHiddenDangerRectifyBo;
|
||||
import org.dromara.safety.domain.vo.HazardHiddenDangerRectifyVo;
|
||||
import org.dromara.safety.domain.vo.HazardHiddenDangerVo;
|
||||
import org.dromara.safety.service.IHazardHiddenDangerRectifyService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 隐患整改情况
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/safety/hiddenDangerRectify")
|
||||
public class HazardHiddenDangerRectifyController extends BaseController {
|
||||
|
||||
private final IHazardHiddenDangerRectifyService hazardHiddenDangerRectifyService;
|
||||
|
||||
/**
|
||||
* 查询隐患整改情况列表
|
||||
*/
|
||||
@SaCheckPermission("safety:hiddenDangerRectify:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<HazardHiddenDangerVo> list(HazardHiddenDangerBo bo, PageQuery pageQuery) {
|
||||
return hazardHiddenDangerRectifyService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出隐患整改情况列表
|
||||
*/
|
||||
@SaCheckPermission("safety:hiddenDangerRectify:export")
|
||||
@Log(title = "隐患整改情况", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HazardHiddenDangerRectifyBo bo, HttpServletResponse response) {
|
||||
List<HazardHiddenDangerRectifyVo> list = hazardHiddenDangerRectifyService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "隐患整改情况", HazardHiddenDangerRectifyVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取隐患整改情况详细信息
|
||||
*
|
||||
* @param hiddenDangerId 主键
|
||||
*/
|
||||
@SaCheckPermission("safety:hiddenDangerRectify:query")
|
||||
@GetMapping("/{hiddenDangerId}")
|
||||
public R<HazardHiddenDangerVo> getInfo(@NotNull(message = "隐患主键不能为空")
|
||||
@PathVariable Long hiddenDangerId) {
|
||||
return R.ok(hazardHiddenDangerRectifyService.queryById(hiddenDangerId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增隐患整改情况
|
||||
*/
|
||||
@SaCheckPermission("safety:hiddenDangerRectify:add")
|
||||
@Log(title = "隐患整改情况", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody HazardHiddenDangerRectifyBo bo) {
|
||||
return toAjax(hazardHiddenDangerRectifyService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改隐患整改情况
|
||||
*/
|
||||
@SaCheckPermission("safety:hiddenDangerRectify:edit")
|
||||
@Log(title = "隐患整改情况", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody HazardHiddenDangerRectifyBo bo) {
|
||||
return toAjax(hazardHiddenDangerRectifyService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除隐患整改情况
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("safety:hiddenDangerRectify:remove")
|
||||
@Log(title = "隐患整改情况", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(hazardHiddenDangerRectifyService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,10 @@
|
||||
package org.dromara.safety.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.time.LocalDateTime;
|
||||
@ -32,7 +33,7 @@ public class HazardHiddenDanger extends BaseEntity {
|
||||
public static final String CLOSED = "4";
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
@ -40,7 +41,7 @@ public class HazardHiddenDanger extends BaseEntity {
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
private Long projectId;
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 隐患编号
|
||||
|
||||
@ -0,0 +1,92 @@
|
||||
package org.dromara.safety.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 隐患整改情况对象 hazard_hidden_danger_rectify
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("hazard_hidden_danger_rectify")
|
||||
public class HazardHiddenDangerRectify extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 关联隐患ID
|
||||
*/
|
||||
private Long hiddenDangerId;
|
||||
|
||||
/**
|
||||
* 整改次数
|
||||
*/
|
||||
private Long rectifyCount;
|
||||
|
||||
/**
|
||||
* 整改人ID
|
||||
*/
|
||||
private Long rectifyUserId;
|
||||
|
||||
/**
|
||||
* 整改说明
|
||||
*/
|
||||
private String rectifyDesc;
|
||||
|
||||
/**
|
||||
* 整改附件
|
||||
*/
|
||||
private String rectifyFiles;
|
||||
|
||||
/**
|
||||
* 完成整改时间
|
||||
*/
|
||||
private LocalDateTime rectifyTime;
|
||||
|
||||
/**
|
||||
* 复查人ID
|
||||
*/
|
||||
private Long reviewUserId;
|
||||
|
||||
/**
|
||||
* 复查说明
|
||||
*/
|
||||
private String reviewDesc;
|
||||
|
||||
/**
|
||||
* 复查附件
|
||||
*/
|
||||
private String reviewFiles;
|
||||
|
||||
/**
|
||||
* 复查时间
|
||||
*/
|
||||
private LocalDateTime reviewTime;
|
||||
|
||||
/**
|
||||
* 复查状态(1待复查 2复查通过 3复查不通过)
|
||||
*/
|
||||
private String reviewStatus;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@ -0,0 +1,99 @@
|
||||
package org.dromara.safety.domain.bo;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.safety.domain.HazardHiddenDangerRectify;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 隐患整改情况业务对象 hazard_hidden_danger_rectify
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = HazardHiddenDangerRectify.class, reverseConvertGenerate = false)
|
||||
public class HazardHiddenDangerRectifyBo extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -211811062254843066L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 关联隐患ID
|
||||
*/
|
||||
@NotNull(message = "关联隐患ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long hiddenDangerId;
|
||||
|
||||
/**
|
||||
* 整改次数
|
||||
*/
|
||||
@NotNull(message = "整改次数不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long rectifyCount;
|
||||
|
||||
/**
|
||||
* 整改人ID
|
||||
*/
|
||||
@NotNull(message = "整改人ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long rectifyUserId;
|
||||
|
||||
/**
|
||||
* 整改说明
|
||||
*/
|
||||
private String rectifyDesc;
|
||||
|
||||
/**
|
||||
* 整改附件
|
||||
*/
|
||||
private String rectifyFiles;
|
||||
|
||||
/**
|
||||
* 完成整改时间
|
||||
*/
|
||||
private LocalDateTime rectifyTime;
|
||||
|
||||
/**
|
||||
* 复查人ID
|
||||
*/
|
||||
private Long reviewUserId;
|
||||
|
||||
/**
|
||||
* 复查说明
|
||||
*/
|
||||
private String reviewDesc;
|
||||
|
||||
/**
|
||||
* 复查附件
|
||||
*/
|
||||
private String reviewFiles;
|
||||
|
||||
/**
|
||||
* 复查时间
|
||||
*/
|
||||
private LocalDateTime reviewTime;
|
||||
|
||||
/**
|
||||
* 复查状态(1待复查 2复查通过 3复查不通过)
|
||||
*/
|
||||
private String reviewStatus;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package org.dromara.safety.domain.dto.hiddendangerrectify;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025-12-04 14:58
|
||||
*/
|
||||
@Data
|
||||
public class HazardHiddenDangerRectifyRectificationReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 3378774493193429015L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 整改说明
|
||||
*/
|
||||
@NotBlank(message = "整改说明不能为空")
|
||||
private String rectifyDesc;
|
||||
|
||||
/**
|
||||
* 整改附件
|
||||
*/
|
||||
private String rectifyFiles;
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package org.dromara.safety.domain.dto.hiddendangerrectify;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025-12-04 15:07
|
||||
*/
|
||||
@Data
|
||||
public class HazardHiddenDangerRectifyReviewReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 6999133950832111753L;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,128 @@
|
||||
package org.dromara.safety.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import org.dromara.common.translation.annotation.Translation;
|
||||
import org.dromara.common.translation.constant.TransConstant;
|
||||
import org.dromara.safety.domain.HazardHiddenDangerRectify;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
/**
|
||||
* 隐患整改情况视图对象 hazard_hidden_danger_rectify
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = HazardHiddenDangerRectify.class)
|
||||
public class HazardHiddenDangerRectifyVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ExcelProperty(value = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 关联隐患ID
|
||||
*/
|
||||
@ExcelProperty(value = "关联隐患ID")
|
||||
private Long hiddenDangerId;
|
||||
|
||||
/**
|
||||
* 整改次数
|
||||
*/
|
||||
@ExcelProperty(value = "整改次数")
|
||||
private Long rectifyCount;
|
||||
|
||||
/**
|
||||
* 整改人ID
|
||||
*/
|
||||
@ExcelProperty(value = "整改人ID")
|
||||
private Long rectifyUserId;
|
||||
|
||||
/**
|
||||
* 整改人名字
|
||||
*/
|
||||
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "rectifyUserId")
|
||||
private String rectifyUserName;
|
||||
|
||||
/**
|
||||
* 整改说明
|
||||
*/
|
||||
@ExcelProperty(value = "整改说明")
|
||||
private String rectifyDesc;
|
||||
|
||||
/**
|
||||
* 整改附件
|
||||
*/
|
||||
@ExcelProperty(value = "整改附件")
|
||||
private String rectifyFiles;
|
||||
|
||||
/**
|
||||
* 整改附件Url
|
||||
*/
|
||||
@Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "rectifyFiles")
|
||||
private String rectifyFilesUrl;
|
||||
|
||||
/**
|
||||
* 完成整改时间
|
||||
*/
|
||||
@ExcelProperty(value = "完成整改时间")
|
||||
private LocalDateTime rectifyTime;
|
||||
|
||||
/**
|
||||
* 复查人ID
|
||||
*/
|
||||
@ExcelProperty(value = "复查人ID")
|
||||
private Long reviewUserId;
|
||||
|
||||
/**
|
||||
* 复查说明
|
||||
*/
|
||||
@ExcelProperty(value = "复查说明")
|
||||
private String reviewDesc;
|
||||
|
||||
/**
|
||||
* 复查附件
|
||||
*/
|
||||
@ExcelProperty(value = "复查附件")
|
||||
private String reviewFiles;
|
||||
|
||||
/**
|
||||
* 复查附件Url
|
||||
*/
|
||||
@Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "reviewFiles")
|
||||
private String reviewFilesUrl;
|
||||
/**
|
||||
* 复查时间
|
||||
*/
|
||||
@ExcelProperty(value = "复查时间")
|
||||
private LocalDateTime reviewTime;
|
||||
|
||||
/**
|
||||
* 复查状态(1待复查 2复查通过 3复查不通过)
|
||||
*/
|
||||
@ExcelProperty(value = "复查状态(1待复查 2复查通过 3复查不通过)", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(dictType = "hazard_review_status")
|
||||
private String reviewStatus;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@ -1,20 +1,19 @@
|
||||
package org.dromara.safety.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import org.dromara.common.translation.annotation.Translation;
|
||||
import org.dromara.common.translation.constant.TransConstant;
|
||||
import org.dromara.safety.domain.HazardHiddenDanger;
|
||||
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.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@ -32,15 +31,15 @@ public class HazardHiddenDangerVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
* id
|
||||
*/
|
||||
@ExcelProperty(value = "角色ID")
|
||||
@ExcelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
private Long projectId;
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 隐患编号
|
||||
@ -116,7 +115,7 @@ public class HazardHiddenDangerVo implements Serializable {
|
||||
@ExcelProperty(value = "评估人")
|
||||
private Long evaluator;
|
||||
|
||||
/**
|
||||
/**
|
||||
* 评估人名字
|
||||
*/
|
||||
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "evaluator")
|
||||
@ -195,6 +194,13 @@ public class HazardHiddenDangerVo implements Serializable {
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 最新整改次数
|
||||
*/
|
||||
private Integer latestRectifyTimes;
|
||||
|
||||
|
||||
/**
|
||||
* 整改信息列表
|
||||
*/
|
||||
private List<HazardHiddenDangerRectifyVo> rectifyList;
|
||||
}
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
package org.dromara.safety.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RectifyTimesVo {
|
||||
|
||||
/**
|
||||
* 隐患ID
|
||||
*/
|
||||
private Long hiddenDangerId;
|
||||
|
||||
/**
|
||||
* 最新整改次数
|
||||
*/
|
||||
private Integer latestRectifyTimes;
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package org.dromara.safety.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.safety.domain.HazardHiddenDangerRectify;
|
||||
import org.dromara.safety.domain.vo.HazardHiddenDangerRectifyVo;
|
||||
import org.dromara.safety.domain.vo.RectifyTimesVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 隐患整改情况Mapper接口
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
public interface HazardHiddenDangerRectifyMapper extends BaseMapperPlus<HazardHiddenDangerRectify, HazardHiddenDangerRectifyVo> {
|
||||
|
||||
/**
|
||||
* 获取最近一次整改时间
|
||||
*
|
||||
* @param ids 隐患ID
|
||||
* @return 最近一次整改时间
|
||||
*/
|
||||
List<RectifyTimesVo> getLatestRectifyTimes(@Param("ids") List<Long> ids);
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package org.dromara.safety.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.safety.domain.HazardHiddenDangerRectify;
|
||||
import org.dromara.safety.domain.bo.HazardHiddenDangerBo;
|
||||
import org.dromara.safety.domain.bo.HazardHiddenDangerRectifyBo;
|
||||
import org.dromara.safety.domain.dto.hiddendangerrectify.HazardHiddenDangerRectifyRectificationReq;
|
||||
import org.dromara.safety.domain.dto.hiddendangerrectify.HazardHiddenDangerRectifyReviewReq;
|
||||
import org.dromara.safety.domain.vo.HazardHiddenDangerRectifyVo;
|
||||
import org.dromara.safety.domain.vo.HazardHiddenDangerVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 隐患整改情况Service接口
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
public interface IHazardHiddenDangerRectifyService extends IService<HazardHiddenDangerRectify> {
|
||||
|
||||
/**
|
||||
* 查询隐患整改情况
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 隐患整改情况
|
||||
*/
|
||||
HazardHiddenDangerVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询隐患整改情况列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 隐患整改情况分页列表
|
||||
*/
|
||||
TableDataInfo<HazardHiddenDangerVo> queryPageList(HazardHiddenDangerBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的隐患整改情况列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 隐患整改情况列表
|
||||
*/
|
||||
List<HazardHiddenDangerRectifyVo> queryList(HazardHiddenDangerRectifyBo bo);
|
||||
|
||||
/**
|
||||
* 新增隐患整改情况
|
||||
*
|
||||
* @param bo 隐患整改情况
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(HazardHiddenDangerRectifyBo bo);
|
||||
|
||||
/**
|
||||
* 修改隐患整改情况
|
||||
*
|
||||
* @param bo 隐患整改情况
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(HazardHiddenDangerRectifyBo bo);
|
||||
|
||||
/**
|
||||
* 隐患整改
|
||||
*
|
||||
* @param req 隐患整改参数
|
||||
* @return 是否整改成功
|
||||
*/
|
||||
Boolean rectification(HazardHiddenDangerRectifyRectificationReq req);
|
||||
|
||||
/**
|
||||
* 隐患复查
|
||||
*
|
||||
* @param req 隐患复查参数
|
||||
* @return 是否审核成功
|
||||
*/
|
||||
Boolean review(HazardHiddenDangerRectifyReviewReq req);
|
||||
|
||||
/**
|
||||
* 校验并批量删除隐患整改情况信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -1,16 +1,14 @@
|
||||
package org.dromara.safety.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.safety.domain.HazardHiddenDanger;
|
||||
import org.dromara.safety.domain.bo.HazardHiddenDangerBo;
|
||||
import org.dromara.safety.domain.dto.EvaluateDto;
|
||||
import org.dromara.safety.domain.vo.HazardHiddenDangerVo;
|
||||
import org.dromara.safety.domain.bo.HazardHiddenDangerBo;
|
||||
import org.dromara.safety.domain.HazardHiddenDanger;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.safety.domain.vo.HiddenDangerCountVo;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -21,7 +19,7 @@ import java.util.List;
|
||||
* @author Lion Li
|
||||
* @date 2025-12-03
|
||||
*/
|
||||
public interface IHazardHiddenDangerService extends IService<HazardHiddenDanger>{
|
||||
public interface IHazardHiddenDangerService extends IService<HazardHiddenDanger> {
|
||||
|
||||
/**
|
||||
* 查询隐患信息
|
||||
@ -40,6 +38,15 @@ public interface IHazardHiddenDangerService extends IService<HazardHiddenDanger>
|
||||
*/
|
||||
TableDataInfo<HazardHiddenDangerVo> queryPageList(HazardHiddenDangerBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 分页查询隐患信息列表
|
||||
*
|
||||
* @param lqw 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 隐患信息分页列表
|
||||
*/
|
||||
TableDataInfo<HazardHiddenDangerVo> queryPageList(LambdaQueryWrapper<HazardHiddenDanger> lqw, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的隐患信息列表
|
||||
*
|
||||
@ -48,6 +55,14 @@ public interface IHazardHiddenDangerService extends IService<HazardHiddenDanger>
|
||||
*/
|
||||
List<HazardHiddenDangerVo> queryList(HazardHiddenDangerBo bo);
|
||||
|
||||
/**
|
||||
* 构建查询条件
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 查询条件
|
||||
*/
|
||||
LambdaQueryWrapper<HazardHiddenDanger> buildQueryWrapper(HazardHiddenDangerBo bo);
|
||||
|
||||
/**
|
||||
* 新增隐患信息
|
||||
*
|
||||
|
||||
@ -0,0 +1,190 @@
|
||||
package org.dromara.safety.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.safety.domain.HazardHiddenDanger;
|
||||
import org.dromara.safety.domain.HazardHiddenDangerRectify;
|
||||
import org.dromara.safety.domain.bo.HazardHiddenDangerBo;
|
||||
import org.dromara.safety.domain.bo.HazardHiddenDangerRectifyBo;
|
||||
import org.dromara.safety.domain.dto.hiddendangerrectify.HazardHiddenDangerRectifyRectificationReq;
|
||||
import org.dromara.safety.domain.dto.hiddendangerrectify.HazardHiddenDangerRectifyReviewReq;
|
||||
import org.dromara.safety.domain.vo.HazardHiddenDangerRectifyVo;
|
||||
import org.dromara.safety.domain.vo.HazardHiddenDangerVo;
|
||||
import org.dromara.safety.domain.vo.RectifyTimesVo;
|
||||
import org.dromara.safety.mapper.HazardHiddenDangerRectifyMapper;
|
||||
import org.dromara.safety.service.IHazardHiddenDangerRectifyService;
|
||||
import org.dromara.safety.service.IHazardHiddenDangerService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 隐患整改情况Service业务层处理
|
||||
*
|
||||
* @author lilemy
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class HazardHiddenDangerRectifyServiceImpl extends ServiceImpl<HazardHiddenDangerRectifyMapper, HazardHiddenDangerRectify>
|
||||
implements IHazardHiddenDangerRectifyService {
|
||||
|
||||
private final IHazardHiddenDangerService hazardHiddenDangerService;
|
||||
|
||||
/**
|
||||
* 查询隐患整改情况
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 隐患整改情况
|
||||
*/
|
||||
@Override
|
||||
public HazardHiddenDangerVo queryById(Long id) {
|
||||
HazardHiddenDangerVo dangerVo = hazardHiddenDangerService.queryById(id);
|
||||
if (dangerVo == null) {
|
||||
throw new ServiceException("未找到该数据");
|
||||
}
|
||||
List<HazardHiddenDangerRectifyVo> dangerRectifyVos = baseMapper.selectVoList(new LambdaQueryWrapper<>(HazardHiddenDangerRectify.class)
|
||||
.eq(HazardHiddenDangerRectify::getHiddenDangerId, id)
|
||||
.orderByAsc(HazardHiddenDangerRectify::getRectifyCount));
|
||||
dangerVo.setRectifyList(dangerRectifyVos);
|
||||
return dangerVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询隐患整改情况列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 隐患整改情况分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<HazardHiddenDangerVo> queryPageList(HazardHiddenDangerBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<HazardHiddenDanger> lqw = hazardHiddenDangerService.buildQueryWrapper(bo);
|
||||
lqw.ne(HazardHiddenDanger::getStatus, HazardHiddenDanger.EVALUATE);
|
||||
TableDataInfo<HazardHiddenDangerVo> result = hazardHiddenDangerService.queryPageList(lqw, pageQuery);
|
||||
List<HazardHiddenDangerVo> rows = result.getRows();
|
||||
if (CollUtil.isNotEmpty(rows)) {
|
||||
List<Long> ids = rows.stream().map(HazardHiddenDangerVo::getId).toList();
|
||||
List<RectifyTimesVo> rectifyTimes = baseMapper.getLatestRectifyTimes(ids);
|
||||
rows.forEach(row -> rectifyTimes.stream()
|
||||
.filter(rectifyTimesVo -> rectifyTimesVo.getHiddenDangerId().equals(row.getId()))
|
||||
.findFirst()
|
||||
.ifPresent(rectifyTime -> row.setLatestRectifyTimes(rectifyTime.getLatestRectifyTimes())));
|
||||
}
|
||||
return TableDataInfo.build(rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的隐患整改情况列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 隐患整改情况列表
|
||||
*/
|
||||
@Override
|
||||
public List<HazardHiddenDangerRectifyVo> queryList(HazardHiddenDangerRectifyBo bo) {
|
||||
LambdaQueryWrapper<HazardHiddenDangerRectify> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<HazardHiddenDangerRectify> buildQueryWrapper(HazardHiddenDangerRectifyBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<HazardHiddenDangerRectify> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByDesc(HazardHiddenDangerRectify::getId);
|
||||
lqw.eq(bo.getHiddenDangerId() != null, HazardHiddenDangerRectify::getHiddenDangerId, bo.getHiddenDangerId());
|
||||
lqw.eq(bo.getRectifyCount() != null, HazardHiddenDangerRectify::getRectifyCount, bo.getRectifyCount());
|
||||
lqw.eq(bo.getRectifyUserId() != null, HazardHiddenDangerRectify::getRectifyUserId, bo.getRectifyUserId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getRectifyDesc()), HazardHiddenDangerRectify::getRectifyDesc, bo.getRectifyDesc());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getRectifyFiles()), HazardHiddenDangerRectify::getRectifyFiles, bo.getRectifyFiles());
|
||||
lqw.eq(bo.getRectifyTime() != null, HazardHiddenDangerRectify::getRectifyTime, bo.getRectifyTime());
|
||||
lqw.eq(bo.getReviewUserId() != null, HazardHiddenDangerRectify::getReviewUserId, bo.getReviewUserId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getReviewDesc()), HazardHiddenDangerRectify::getReviewDesc, bo.getReviewDesc());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getReviewFiles()), HazardHiddenDangerRectify::getReviewFiles, bo.getReviewFiles());
|
||||
lqw.eq(bo.getReviewTime() != null, HazardHiddenDangerRectify::getReviewTime, bo.getReviewTime());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getReviewStatus()), HazardHiddenDangerRectify::getReviewStatus, bo.getReviewStatus());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增隐患整改情况
|
||||
*
|
||||
* @param bo 隐患整改情况
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(HazardHiddenDangerRectifyBo bo) {
|
||||
HazardHiddenDangerRectify add = MapstructUtils.convert(bo, HazardHiddenDangerRectify.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改隐患整改情况
|
||||
*
|
||||
* @param bo 隐患整改情况
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(HazardHiddenDangerRectifyBo bo) {
|
||||
HazardHiddenDangerRectify update = MapstructUtils.convert(bo, HazardHiddenDangerRectify.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐患整改
|
||||
*
|
||||
* @param req 隐患整改参数
|
||||
* @return 是否整改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean rectification(HazardHiddenDangerRectifyRectificationReq req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐患复查
|
||||
*
|
||||
* @param req 隐患复查参数
|
||||
* @return 是否审核成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean review(HazardHiddenDangerRectifyReviewReq req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(HazardHiddenDangerRectify entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除隐患整改情况信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -3,30 +3,30 @@ package org.dromara.safety.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
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 com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.safety.domain.HazardRule;
|
||||
import org.dromara.safety.domain.dto.EvaluateDto;
|
||||
import org.dromara.safety.domain.vo.HiddenDangerCountVo;
|
||||
import org.dromara.safety.service.IHazardRuleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.safety.domain.bo.HazardHiddenDangerBo;
|
||||
import org.dromara.safety.domain.vo.HazardHiddenDangerVo;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.safety.domain.HazardHiddenDanger;
|
||||
import org.dromara.safety.domain.HazardRule;
|
||||
import org.dromara.safety.domain.bo.HazardHiddenDangerBo;
|
||||
import org.dromara.safety.domain.dto.EvaluateDto;
|
||||
import org.dromara.safety.domain.vo.HazardHiddenDangerVo;
|
||||
import org.dromara.safety.domain.vo.HiddenDangerCountVo;
|
||||
import org.dromara.safety.mapper.HazardHiddenDangerMapper;
|
||||
import org.dromara.safety.service.IHazardHiddenDangerService;
|
||||
import org.dromara.safety.service.IHazardRuleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 隐患信息Service业务层处理
|
||||
@ -50,7 +50,7 @@ public class HazardHiddenDangerServiceImpl extends ServiceImpl<HazardHiddenDange
|
||||
* @return 隐患信息
|
||||
*/
|
||||
@Override
|
||||
public HazardHiddenDangerVo queryById(Long id){
|
||||
public HazardHiddenDangerVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
@ -68,6 +68,19 @@ public class HazardHiddenDangerServiceImpl extends ServiceImpl<HazardHiddenDange
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询隐患信息列表
|
||||
*
|
||||
* @param lqw 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 隐患信息分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<HazardHiddenDangerVo> queryPageList(LambdaQueryWrapper<HazardHiddenDanger> lqw, PageQuery pageQuery) {
|
||||
Page<HazardHiddenDangerVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的隐患信息列表
|
||||
*
|
||||
@ -80,11 +93,18 @@ public class HazardHiddenDangerServiceImpl extends ServiceImpl<HazardHiddenDange
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<HazardHiddenDanger> buildQueryWrapper(HazardHiddenDangerBo bo) {
|
||||
/**
|
||||
* 构建查询条件
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 查询条件
|
||||
*/
|
||||
@Override
|
||||
public LambdaQueryWrapper<HazardHiddenDanger> buildQueryWrapper(HazardHiddenDangerBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<HazardHiddenDanger> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByDesc(HazardHiddenDanger::getId);
|
||||
lqw.eq(bo.getProjectId()!=null, HazardHiddenDanger::getProjectId, bo.getProjectId());
|
||||
lqw.eq(bo.getProjectId() != null, HazardHiddenDanger::getProjectId, bo.getProjectId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDangerType()), HazardHiddenDanger::getDangerType, bo.getDangerType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDangerCode()), HazardHiddenDanger::getDangerCode, bo.getDangerCode());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDangerName()), HazardHiddenDanger::getDangerName, bo.getDangerName());
|
||||
@ -117,7 +137,7 @@ public class HazardHiddenDangerServiceImpl extends ServiceImpl<HazardHiddenDange
|
||||
validEntityBeforeSave(add);
|
||||
Snowflake snowflake = IdUtil.getSnowflake(1, 1);
|
||||
long id = snowflake.nextId();
|
||||
add.setDangerCode("YH-"+id);
|
||||
add.setDangerCode("YH-" + id);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
@ -141,7 +161,7 @@ public class HazardHiddenDangerServiceImpl extends ServiceImpl<HazardHiddenDange
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(HazardHiddenDanger entity){
|
||||
private void validEntityBeforeSave(HazardHiddenDanger entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@ -154,7 +174,7 @@ public class HazardHiddenDangerServiceImpl extends ServiceImpl<HazardHiddenDange
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
@ -169,15 +189,15 @@ public class HazardHiddenDangerServiceImpl extends ServiceImpl<HazardHiddenDange
|
||||
count.setWaitRectify(list.stream().filter(item -> item.getStatus().equals(HazardHiddenDanger.RECTIFY)).count());
|
||||
count.setWaitReview(list.stream().filter(item -> item.getStatus().equals(HazardHiddenDanger.REVIEW)).count());
|
||||
count.setClosed(list.stream().filter(item -> item.getStatus().equals(HazardHiddenDanger.CLOSED)).count());
|
||||
count.setOverdue(list.stream().filter(item ->item.getRectifyTime()!=null && item.getRectifyTime().isBefore(LocalDateTime.now())
|
||||
&& item.getStatus().equals(HazardHiddenDanger.RECTIFY)).count());
|
||||
count.setOverdue(list.stream().filter(item -> item.getRectifyTime() != null && item.getRectifyTime().isBefore(LocalDateTime.now())
|
||||
&& item.getStatus().equals(HazardHiddenDanger.RECTIFY)).count());
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean evaluate(EvaluateDto dto) {
|
||||
HazardHiddenDanger hazardHiddenDanger = baseMapper.selectById(dto.getId());
|
||||
BeanUtil.copyProperties(dto,hazardHiddenDanger);
|
||||
BeanUtil.copyProperties(dto, hazardHiddenDanger);
|
||||
HazardRule byId = hazardRuleService.getById(hazardHiddenDanger.getDangerLevelId());
|
||||
String responseUnit = byId.getResponseUnit();
|
||||
hazardHiddenDanger.setStatus(HazardHiddenDanger.RECTIFY);
|
||||
|
||||
@ -8,7 +8,13 @@ import org.dromara.safety.domain.vo.HazardRuleNotifyObjectVo;
|
||||
import org.dromara.safety.domain.vo.HazardRuleVo;
|
||||
import org.dromara.safety.mapper.HazardRuleNotifyObjectMapper;
|
||||
import org.dromara.safety.service.IHazardRuleNotifyObjectService;
|
||||
import org.dromara.system.domain.vo.SysDeptVo;
|
||||
import org.dromara.system.domain.vo.SysPostVo;
|
||||
import org.dromara.system.domain.vo.SysRoleVo;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
import org.dromara.system.service.ISysDeptService;
|
||||
import org.dromara.system.service.ISysPostService;
|
||||
import org.dromara.system.service.ISysRoleService;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -30,6 +36,12 @@ public class HazardRuleNotifyObjectServiceImpl extends ServiceImpl<HazardRuleNot
|
||||
|
||||
private final ISysUserService userService;
|
||||
|
||||
private final ISysRoleService roleService;
|
||||
|
||||
private final ISysDeptService deptService;
|
||||
|
||||
private final ISysPostService postService;
|
||||
|
||||
/**
|
||||
* 根据规则查询通知对象
|
||||
*
|
||||
@ -76,6 +88,57 @@ public class HazardRuleNotifyObjectServiceImpl extends ServiceImpl<HazardRuleNot
|
||||
}).toList();
|
||||
voList.addAll(vos);
|
||||
}
|
||||
case "2": {
|
||||
List<Long> roleIds = value.stream()
|
||||
.map(HazardRuleNotifyObject::getNotifyId)
|
||||
.toList();
|
||||
List<SysRoleVo> roleVos = roleService.selectRoleByIds(roleIds);
|
||||
Map<Long, String> roleNameMap = roleVos.stream()
|
||||
.collect(Collectors.toMap(SysRoleVo::getRoleId, SysRoleVo::getRoleName, (k, v) -> k));
|
||||
List<HazardRuleNotifyObjectVo> vos = value.stream().map(v -> {
|
||||
HazardRuleNotifyObjectVo vo = new HazardRuleNotifyObjectVo();
|
||||
vo.setRuleId(v.getRuleId());
|
||||
vo.setNotifyId(v.getNotifyId());
|
||||
vo.setNotifyName(roleNameMap.getOrDefault(v.getNotifyId(), ""));
|
||||
vo.setNotifyType(key);
|
||||
return vo;
|
||||
}).toList();
|
||||
voList.addAll(vos);
|
||||
}
|
||||
case "3": {
|
||||
List<Long> deptIds = value.stream()
|
||||
.map(HazardRuleNotifyObject::getNotifyId)
|
||||
.toList();
|
||||
List<SysDeptVo> deptVos = deptService.selectDeptByIds(deptIds);
|
||||
Map<Long, String> deptNameMap = deptVos.stream()
|
||||
.collect(Collectors.toMap(SysDeptVo::getDeptId, SysDeptVo::getDeptName, (k, v) -> k));
|
||||
List<HazardRuleNotifyObjectVo> vos = value.stream().map(v -> {
|
||||
HazardRuleNotifyObjectVo vo = new HazardRuleNotifyObjectVo();
|
||||
vo.setRuleId(v.getRuleId());
|
||||
vo.setNotifyId(v.getNotifyId());
|
||||
vo.setNotifyName(deptNameMap.getOrDefault(v.getNotifyId(), ""));
|
||||
vo.setNotifyType(key);
|
||||
return vo;
|
||||
}).toList();
|
||||
voList.addAll(vos);
|
||||
}
|
||||
case "4": {
|
||||
List<Long> postIds = value.stream()
|
||||
.map(HazardRuleNotifyObject::getNotifyId)
|
||||
.toList();
|
||||
List<SysPostVo> postVos = postService.selectPostByIds(postIds);
|
||||
Map<Long, String> postNameMap = postVos.stream()
|
||||
.collect(Collectors.toMap(SysPostVo::getPostId, SysPostVo::getPostName, (k, v) -> k));
|
||||
List<HazardRuleNotifyObjectVo> vos = value.stream().map(v -> {
|
||||
HazardRuleNotifyObjectVo vo = new HazardRuleNotifyObjectVo();
|
||||
vo.setRuleId(v.getRuleId());
|
||||
vo.setNotifyId(v.getNotifyId());
|
||||
vo.setNotifyName(postNameMap.getOrDefault(v.getNotifyId(), ""));
|
||||
vo.setNotifyType(key);
|
||||
return vo;
|
||||
}).toList();
|
||||
voList.addAll(vos);
|
||||
}
|
||||
case null, default:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.safety.mapper.HazardHiddenDangerRectifyMapper">
|
||||
|
||||
<select id="getLatestRectifyTimes" resultType="org.dromara.safety.domain.vo.RectifyTimesVo">
|
||||
SELECT
|
||||
hidden_danger_id,
|
||||
COALESCE(MAX(rectify_count), 0) AS latest_rectify_times
|
||||
FROM hazard_hidden_danger_rectify
|
||||
WHERE hidden_danger_id IN
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
GROUP BY hidden_danger_id
|
||||
</select>
|
||||
</mapper>
|
||||
@ -2039,34 +2039,70 @@ values (1996139632219136006, '隐患分级通知规则导出', 19961396322191360
|
||||
|
||||
|
||||
-- 隐患整改情况表
|
||||
DROP TABLE IF EXISTS hazard_hidden_danger_rectify;
|
||||
create table hazard_hidden_danger_rectify
|
||||
(
|
||||
`id` bigint not null auto_increment comment '主键',
|
||||
hidden_danger_id bigint not null comment '关联隐患ID',
|
||||
rectify_times int not null comment '整改次数',
|
||||
id bigint not null auto_increment comment '主键',
|
||||
hidden_danger_id bigint not null comment '关联隐患ID',
|
||||
rectify_count int not null comment '整改次数',
|
||||
|
||||
rectify_desc text null comment '整改说明',
|
||||
rectify_files varchar(1000) null comment '整改凭证附件',
|
||||
rectify_finish_time datetime null comment '完成整改时间',
|
||||
rectify_deadline datetime not null comment '整改期限',
|
||||
rectify_user_id bigint not null comment '整改人ID',
|
||||
rectify_desc text null comment '整改说明',
|
||||
rectify_files varchar(1024) null comment '整改附件',
|
||||
rectify_time datetime null comment '完成整改时间',
|
||||
|
||||
review_user_id bigint null comment '复查人ID',
|
||||
review_opinion text null comment '复查意见',
|
||||
review_files varchar(1000) null comment '复查凭证附件',
|
||||
review_time datetime null comment '复查时间',
|
||||
review_user_id bigint null comment '复查人ID',
|
||||
review_desc text null comment '复查说明',
|
||||
review_files varchar(1024) null comment '复查附件',
|
||||
review_time datetime null comment '复查时间',
|
||||
|
||||
review_status char not null default '0' comment '复查状态 0-待复查 1-复查通过 2-复查不通过',
|
||||
`remark` varchar(512) null comment '备注',
|
||||
`create_by` bigint null comment '创建者',
|
||||
`update_by` bigint null comment '更新者',
|
||||
`create_dept` bigint null comment '创建部门',
|
||||
`create_time` datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
||||
`update_time` datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
review_status char default '0' not null comment '复查状态(1待复查 2复查通过 3复查不通过)',
|
||||
`remark` varchar(512) null comment '备注',
|
||||
`create_by` bigint null comment '创建者',
|
||||
`update_by` bigint null comment '更新者',
|
||||
`create_dept` bigint null comment '创建部门',
|
||||
`create_time` datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
||||
`update_time` datetime default CURRENT_TIMESTAMP null on update CURRENT_TIMESTAMP comment '更新时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
index `idx_hidden_danger_id` (`hidden_danger_id` asc) using btree comment '关联隐患ID',
|
||||
)
|
||||
comment '隐患整改情况表' row_format = DYNAMIC;
|
||||
index `idx_hidden_danger_id` (`hidden_danger_id` asc) using btree comment '关联隐患ID'
|
||||
) comment '隐患整改情况';
|
||||
|
||||
-- 索引
|
||||
|
||||
create index idx_rectify_times
|
||||
on hazard_hidden_danger_rectify (hidden_danger_id, rectify_times);
|
||||
on hazard_hidden_danger_rectify (hidden_danger_id, rectify_count);
|
||||
|
||||
|
||||
-- 菜单 SQL
|
||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible,
|
||||
status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||
values (1996413868087308290, '隐患整改情况', '1996118434672001025', '1', 'hiddenDangerRectify',
|
||||
'safety/hiddenDangerRectify/index', 1, 0, 'C', '0', '0', 'safety:hiddenDangerRectify:list', '#', 103, 1,
|
||||
sysdate(), null, null, '隐患整改情况菜单');
|
||||
|
||||
-- 按钮 SQL
|
||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible,
|
||||
status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||
values (1996413868087308291, '隐患整改情况查询', 1996413868087308290, '1', '#', '', 1, 0, 'F', '0', '0',
|
||||
'safety:hiddenDangerRectify:query', '#', 103, 1, sysdate(), null, null, '');
|
||||
|
||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible,
|
||||
status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||
values (1996413868087308292, '隐患整改情况新增', 1996413868087308290, '2', '#', '', 1, 0, 'F', '0', '0',
|
||||
'safety:hiddenDangerRectify:add', '#', 103, 1, sysdate(), null, null, '');
|
||||
|
||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible,
|
||||
status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||
values (1996413868087308293, '隐患整改情况修改', 1996413868087308290, '3', '#', '', 1, 0, 'F', '0', '0',
|
||||
'safety:hiddenDangerRectify:edit', '#', 103, 1, sysdate(), null, null, '');
|
||||
|
||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible,
|
||||
status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||
values (1996413868087308294, '隐患整改情况删除', 1996413868087308290, '4', '#', '', 1, 0, 'F', '0', '0',
|
||||
'safety:hiddenDangerRectify:remove', '#', 103, 1, sysdate(), null, null, '');
|
||||
|
||||
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible,
|
||||
status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
|
||||
values (1996413868087308295, '隐患整改情况导出', 1996413868087308290, '5', '#', '', 1, 0, 'F', '0', '0',
|
||||
'safety:hiddenDangerRectify:export', '#', 103, 1, sysdate(), null, null, '');
|
||||
|
||||
Reference in New Issue
Block a user