安全隐患排查,安全检查管理
parent
2cbcd3b94d
commit
febce56f5c
|
|
@ -0,0 +1,61 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.xyt.entity.so.CommonDataPageSo;
|
||||
import com.gunshi.project.xyt.model.SafetyCheck;
|
||||
import com.gunshi.project.xyt.service.SafetyCheckService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 描述: 安全检查管理
|
||||
* author: wanyan
|
||||
* date: 2024-08-20 17:40:37
|
||||
*/
|
||||
@Tag(name = "安全检查管理")
|
||||
@RestController
|
||||
@RequestMapping(value="/safety/check")
|
||||
public class SafetyCheckController extends AbstractCommonFileController{
|
||||
|
||||
@Autowired
|
||||
private SafetyCheckService service;
|
||||
|
||||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<SafetyCheck> insert(@Validated(Insert.class) @RequestBody SafetyCheck dto) {
|
||||
return R.ok(service.saveData(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping("/update")
|
||||
public R<SafetyCheck> update(@Validated(Update.class) @RequestBody SafetyCheck dto) {
|
||||
return R.ok(service.updateData(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@GetMapping("/del/{id}")
|
||||
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
||||
return R.ok(service.delData(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页")
|
||||
@PostMapping("/page")
|
||||
public R<Page<SafetyCheck>> page(@RequestBody @Validated CommonDataPageSo page) {
|
||||
return R.ok(service.pageQuery(page));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return "safetyCheck";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.xyt.entity.so.CommonDataPageSo;
|
||||
import com.gunshi.project.xyt.model.SafetyHazardInvest;
|
||||
import com.gunshi.project.xyt.service.SafetyHazardInvestService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 描述: 安排隐患排查
|
||||
* author: wanyan
|
||||
* date: 2024-08-20 17:40:37
|
||||
*/
|
||||
@Tag(name = "安排隐患排查")
|
||||
@RestController
|
||||
@RequestMapping(value="/safety/hazard/invest")
|
||||
public class SafetyHazardInvestController extends AbstractCommonFileController{
|
||||
|
||||
@Autowired
|
||||
private SafetyHazardInvestService service;
|
||||
|
||||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<SafetyHazardInvest> insert(@Validated(Insert.class) @RequestBody SafetyHazardInvest dto) {
|
||||
return R.ok(service.saveData(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping("/update")
|
||||
public R<SafetyHazardInvest> update(@Validated(Update.class) @RequestBody SafetyHazardInvest dto) {
|
||||
return R.ok(service.updateData(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@GetMapping("/del/{id}")
|
||||
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
||||
return R.ok(service.delData(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页")
|
||||
@PostMapping("/page")
|
||||
public R<Page<SafetyHazardInvest>> page(@RequestBody @Validated CommonDataPageSo page) {
|
||||
return R.ok(service.pageQuery(page));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupId() {
|
||||
return "safetyHazardInvest";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.gunshi.project.xyt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gunshi.project.xyt.model.SafetyCheck;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SafetyCheckMapper extends BaseMapper<SafetyCheck> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.gunshi.project.xyt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gunshi.project.xyt.model.SafetyHazardInvest;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SafetyHazardInvestMapper extends BaseMapper<SafetyHazardInvest> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.gunshi.project.xyt.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 安全检查管理
|
||||
*/
|
||||
@Schema(description="安全检查管理")
|
||||
@Data
|
||||
@TableName(value = "public.safety_check")
|
||||
public class SafetyCheck implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
@Schema(description="主键")
|
||||
@NotNull(message = "主键不能为空",groups = {Update.class})
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
@TableField(value = "check_date")
|
||||
@Schema(description="检查日期")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD, timezone = "GMT+8")
|
||||
@NotNull(message = "检查日期不能为空",groups = {Insert.class,Update.class})
|
||||
private Date checkDate;
|
||||
|
||||
@TableField(value = "check_type")
|
||||
@Schema(description="检查类型(1日常检查 2年度检查 3特别检查 4临时检查)")
|
||||
private Integer checkType;
|
||||
|
||||
@TableField(value = "name")
|
||||
@Schema(description="名称")
|
||||
@NotNull(message = "名称不能为空",groups = {Insert.class,Update.class})
|
||||
private String name;
|
||||
|
||||
@TableField(value = "check_org")
|
||||
@Schema(description="检查单位")
|
||||
private String checkOrg;
|
||||
|
||||
@TableField(value = "check_user")
|
||||
@Schema(description="检查人员")
|
||||
private String checkUser;
|
||||
|
||||
@TableField(value = "check_content")
|
||||
@Schema(description="主要检查内容")
|
||||
private String checkContent;
|
||||
|
||||
@TableField(value = "main_problem")
|
||||
@Schema(description="发现的主要问题")
|
||||
private String mainProblem;
|
||||
|
||||
@TableField(value = "handle_suggestion")
|
||||
@Schema(description="处理意见与建议")
|
||||
private String handleSuggestion;
|
||||
|
||||
@TableField(value = "recity_desc")
|
||||
@Schema(description="问题整改情况")
|
||||
private String recityDesc;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "文件集合")
|
||||
private List<FileAssociations> files;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package com.gunshi.project.xyt.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 安排隐患排查
|
||||
*/
|
||||
@Schema(description="安排隐患排查")
|
||||
@Data
|
||||
@TableName(value = "public.safety_hazard_invest")
|
||||
public class SafetyHazardInvest implements Serializable {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
@Schema(description="主键")
|
||||
@NotNull(message = "主键不能为空",groups = {Update.class})
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
@TableField(value = "hazard_desc")
|
||||
@Schema(description="隐患描述")
|
||||
@NotEmpty(message = "隐患描述不可为空",groups = {Insert.class,Update.class})
|
||||
private String hazardDesc;
|
||||
|
||||
/**
|
||||
* 隐患发现日期
|
||||
*/
|
||||
@TableField(value = "hazard_date")
|
||||
@Schema(description="隐患发现日期")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD, timezone = "GMT+8")
|
||||
@NotNull(message = "隐患发现日期不能为空",groups = {Insert.class,Update.class})
|
||||
private Date hazardDate;
|
||||
|
||||
@TableField(value = "location_desc")
|
||||
@Schema(description="事件内容描述")
|
||||
private String locationDesc;
|
||||
|
||||
@TableField(value = "recity_finish_date")
|
||||
@Schema(description="整改完成时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD, timezone = "GMT+8")
|
||||
private Date recityFinishDate;
|
||||
|
||||
@TableField(value = "recity_desc")
|
||||
@Schema(description="整改完成情况")
|
||||
private String recityDesc;
|
||||
|
||||
@TableField(value = "report_user_id")
|
||||
@Schema(description="上报人id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long reportUserId;
|
||||
|
||||
@TableField(value = "report_user_name")
|
||||
@Schema(description="上报人")
|
||||
private String reportUserName;
|
||||
|
||||
@TableField(exist = false)
|
||||
@Schema(description = "文件集合")
|
||||
private List<FileAssociations> files;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
|
|
@ -19,9 +19,9 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 描述: 水库历史水位表
|
||||
* author: xusan
|
||||
* date: 2024-07-08 17:30:38
|
||||
* 描述: 工程大事记
|
||||
* author: wanyan
|
||||
* date: 2024-08-21 10:40:37
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
|
|
|
|||
|
|
@ -0,0 +1,96 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.entity.so.CommonDataPageSo;
|
||||
import com.gunshi.project.xyt.mapper.SafetyCheckMapper;
|
||||
import com.gunshi.project.xyt.model.SafetyCheck;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 描述: 安全检查管理
|
||||
* author: wanyan
|
||||
* date: 2024-08-21 10:40:37
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class SafetyCheckService extends ServiceImpl<SafetyCheckMapper, SafetyCheck> {
|
||||
|
||||
@Autowired
|
||||
private FileAssociationsService fileService;
|
||||
|
||||
public Page<SafetyCheck> pageQuery(CommonDataPageSo page) {
|
||||
LambdaQueryWrapper<SafetyCheck> query = Wrappers.lambdaQuery();
|
||||
if (ObjectUtils.isNotNull(page.getName())) {
|
||||
query.like(SafetyCheck::getName, page.getName());
|
||||
}
|
||||
if (page.getDateSo() != null && page.getDateSo().getStart() != null) {
|
||||
query.ge(SafetyCheck::getCheckDate, page.getDateSo().getStart());
|
||||
}
|
||||
if (page.getDateSo() != null && page.getDateSo().getEnd() != null) {
|
||||
query.le(SafetyCheck::getCheckDate, page.getDateSo().getEnd());
|
||||
}
|
||||
query.orderByDesc(SafetyCheck::getCheckDate);
|
||||
Page<SafetyCheck> res = this.page(page.getPageSo().toPage(), query);
|
||||
if (res.getRecords() != null) {
|
||||
fillAttach(res.getRecords());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private void fillAttach(List<SafetyCheck> ret) {
|
||||
for (SafetyCheck record : ret) {
|
||||
record.setFiles(fileService.getFiles(getGroupId(), String.valueOf(record.getId())));
|
||||
}
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return "safetyCheck";
|
||||
}
|
||||
|
||||
public SafetyCheck saveData(SafetyCheck dto) {
|
||||
dto.setId(IdWorker.getId());
|
||||
boolean result = this.save(dto);
|
||||
if (result) {
|
||||
fileService.saveFile(dto.getFiles(), getGroupId(), String.valueOf(dto.getId()));
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
public SafetyCheck updateData(SafetyCheck dto) {
|
||||
if (Objects.isNull(this.getById(dto.getId()))) {
|
||||
throw new IllegalArgumentException("当前数据不存在");
|
||||
}
|
||||
boolean result = this.updateById(dto);
|
||||
if (result) {
|
||||
fileService.saveFile(dto.getFiles(), getGroupId(), String.valueOf(dto.getId()));
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
public Boolean delData(Serializable id) {
|
||||
if (Objects.isNull(this.getById(id))) {
|
||||
throw new IllegalArgumentException("当前数据不存在");
|
||||
}
|
||||
boolean data = this.removeById(id);
|
||||
if (data) {
|
||||
fileService.deleteFile(getGroupId(), id.toString());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.entity.so.CommonDataPageSo;
|
||||
import com.gunshi.project.xyt.mapper.SafetyHazardInvestMapper;
|
||||
import com.gunshi.project.xyt.model.SafetyHazardInvest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 描述: 安排隐患排查
|
||||
* author: wanyan
|
||||
* date: 2024-08-21 10:40:37
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class SafetyHazardInvestService extends ServiceImpl<SafetyHazardInvestMapper, SafetyHazardInvest> {
|
||||
|
||||
@Autowired
|
||||
private FileAssociationsService fileService;
|
||||
|
||||
public Page<SafetyHazardInvest> pageQuery(CommonDataPageSo page) {
|
||||
LambdaQueryWrapper<SafetyHazardInvest> query = Wrappers.lambdaQuery();
|
||||
if (ObjectUtils.isNotNull(page.getName())) {
|
||||
query.like(SafetyHazardInvest::getHazardDesc, page.getName());
|
||||
}
|
||||
if (page.getDateSo() != null && page.getDateSo().getStart() != null) {
|
||||
query.ge(SafetyHazardInvest::getHazardDate, page.getDateSo().getStart());
|
||||
}
|
||||
if (page.getDateSo() != null && page.getDateSo().getEnd() != null) {
|
||||
query.le(SafetyHazardInvest::getHazardDate, page.getDateSo().getEnd());
|
||||
}
|
||||
query.orderByDesc(SafetyHazardInvest::getHazardDate);
|
||||
Page<SafetyHazardInvest> res = this.page(page.getPageSo().toPage(), query);
|
||||
if (res.getRecords() != null) {
|
||||
fillAttach(res.getRecords());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private void fillAttach(List<SafetyHazardInvest> ret) {
|
||||
for (SafetyHazardInvest record : ret) {
|
||||
record.setFiles(fileService.getFiles(getGroupId(), String.valueOf(record.getId())));
|
||||
}
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return "safetyHazardInvest";
|
||||
}
|
||||
|
||||
public SafetyHazardInvest saveData(SafetyHazardInvest dto) {
|
||||
dto.setId(IdWorker.getId());
|
||||
//todo 获取当前登录人为上报人
|
||||
boolean result = this.save(dto);
|
||||
if (result) {
|
||||
fileService.saveFile(dto.getFiles(), getGroupId(), String.valueOf(dto.getId()));
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
public SafetyHazardInvest updateData(SafetyHazardInvest dto) {
|
||||
if (Objects.isNull(this.getById(dto.getId()))) {
|
||||
throw new IllegalArgumentException("当前数据不存在");
|
||||
}
|
||||
boolean result = this.updateById(dto);
|
||||
if (result) {
|
||||
fileService.saveFile(dto.getFiles(), getGroupId(), String.valueOf(dto.getId()));
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
public Boolean delData(Serializable id) {
|
||||
if (Objects.isNull(this.getById(id))) {
|
||||
throw new IllegalArgumentException("当前数据不存在");
|
||||
}
|
||||
boolean data = this.removeById(id);
|
||||
if (data) {
|
||||
fileService.deleteFile(getGroupId(), id.toString());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue