| | |
| | | SAFE_TRAINING_DETAILS("safe_training_details"), |
| | | SAFE_TRAINING("safe_training"), |
| | | SAFE_HIDDEN_FILE("safe_hidden_file"), |
| | | SAFE_LINE_INSPECTION_RECORD("safe_line_inspection_record"), |
| | | SAFE_FACILITY_INSPECTION("safe_facility_inspection"), |
| | | SPECIAL_EQUIPMENT_RECORD("special_equipment_record"), |
| | | SPECIAL_EQUIPMENT_RECTIFICATION("special_equipment_rectification"), |
| | | SAFE_HAZARD_RECORD("safe_hazard_record"), |
| | | SAFE_HIDDEN("safe_hidden"), |
| | | SAFE_HAZARD("safe_hazard"), |
| | |
| | | if (inspection == null) { |
| | | return R.fail("巡检任务不存在"); |
| | | } |
| | | if ("已完成".equals(inspection.getStatus())) { |
| | | return R.fail("巡检任务已完成,请勿重复操作"); |
| | | } |
| | | |
| | | // 校验是否有未整改的隐患 |
| | | List<SafeLineInspectionHazard> hazards = safeLineInspectionHazardService.listByInspectionId(id); |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | |
| | | |
| | | @TableField(exist = false) |
| | | private String inspectorName; |
| | | |
| | | @Schema(description = "附件上传") |
| | | @TableField(exist = false) |
| | | private List<StorageBlobDTO> storageBlobDTOs; |
| | | |
| | | @Schema(description = "附件回显") |
| | | @TableField(exist = false) |
| | | private List<StorageBlobVO> storageBlobVOs; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long deptId; |
| | | |
| | | @Schema(description = "附件上传") |
| | | @TableField(exist = false) |
| | | private List<StorageBlobDTO> storageBlobDTOs; |
| | | |
| | | @Schema(description = "附件回显") |
| | | @TableField(exist = false) |
| | | private List<StorageBlobVO> storageBlobVOs; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.safe.pojo.SafeFacilityInspection; |
| | |
| | | private SafeFacilityLedgerService safeFacilityLedgerService; |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | @Autowired |
| | | private FileUtil fileUtil; |
| | | |
| | | @Override |
| | | public SafeFacilityInspection getById(Serializable id) { |
| | |
| | | |
| | | fillExtraInfo(result.getRecords()); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public boolean save(SafeFacilityInspection entity) { |
| | | boolean saved = super.save(entity); |
| | | syncAttachments(saved, entity); |
| | | return saved; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateById(SafeFacilityInspection entity) { |
| | | boolean updated = super.updateById(entity); |
| | | syncAttachments(updated, entity); |
| | | return updated; |
| | | } |
| | | |
| | | private void fillExtraInfo(List<SafeFacilityInspection> records) { |
| | |
| | | if (record.getInspectorId() != null) { |
| | | record.setInspectorName(userMap.getOrDefault(record.getInspectorId().longValue(), "未知用户")); |
| | | } |
| | | if (record.getId() != null) { |
| | | List<StorageBlobVO> attachments = fileUtil.getStorageBlobVOsByRecordTypeAndRecordId( |
| | | RecordTypeEnum.SAFE_FACILITY_INSPECTION, |
| | | record.getId().longValue() |
| | | ); |
| | | record.setStorageBlobVOs(attachments == null ? Collections.emptyList() : attachments); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void syncAttachments(boolean success, SafeFacilityInspection entity) { |
| | | if (!success || entity == null || entity.getId() == null || entity.getStorageBlobDTOs() == null) { |
| | | return; |
| | | } |
| | | fileUtil.saveStorageAttachment( |
| | | ApplicationTypeEnum.IMAGE, |
| | | RecordTypeEnum.SAFE_FACILITY_INSPECTION, |
| | | entity.getId().longValue(), |
| | | entity.getStorageBlobDTOs() |
| | | ); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.safe.pojo.SafeLineInspectionHazard; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.safe.mapper.SafeLineInspectionHazardMapper; |
| | | import com.ruoyi.safe.pojo.SafeLineInspectionHazard; |
| | | import com.ruoyi.safe.service.SafeLineInspectionHazardService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class SafeLineInspectionHazardServiceImpl extends ServiceImpl<SafeLineInspectionHazardMapper, SafeLineInspectionHazard> implements SafeLineInspectionHazardService { |
| | | |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Override |
| | | public IPage<SafeLineInspectionHazard> pageSafeLineInspectionHazard(Page page, SafeLineInspectionHazard safeLineInspectionHazard) { |
| | | return this.lambdaQuery() |
| | | IPage<SafeLineInspectionHazard> result = this.lambdaQuery() |
| | | .eq(safeLineInspectionHazard.getInspectionId() != null, SafeLineInspectionHazard::getInspectionId, safeLineInspectionHazard.getInspectionId()) |
| | | .like(safeLineInspectionHazard.getHazardCode() != null, SafeLineInspectionHazard::getHazardCode, safeLineInspectionHazard.getHazardCode()) |
| | | .eq(safeLineInspectionHazard.getStatus() != null, SafeLineInspectionHazard::getStatus, safeLineInspectionHazard.getStatus()) |
| | | .orderByDesc(SafeLineInspectionHazard::getCreateTime) |
| | | .page(page); |
| | | fillRectifyUserName(result.getRecords()); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<SafeLineInspectionHazard> listByInspectionId(Integer inspectionId) { |
| | | return this.lambdaQuery() |
| | | List<SafeLineInspectionHazard> records = this.lambdaQuery() |
| | | .eq(SafeLineInspectionHazard::getInspectionId, inspectionId) |
| | | .orderByDesc(SafeLineInspectionHazard::getCreateTime) |
| | | .list(); |
| | | fillRectifyUserName(records); |
| | | return records; |
| | | } |
| | | |
| | | @Override |
| | |
| | | long count = this.count() + 1; |
| | | return "YH" + String.format("%05d", count); |
| | | } |
| | | |
| | | private void fillRectifyUserName(List<SafeLineInspectionHazard> records) { |
| | | if (records == null || records.isEmpty()) { |
| | | return; |
| | | } |
| | | List<Long> userIds = records.stream() |
| | | .map(SafeLineInspectionHazard::getRectifyUserId) |
| | | .filter(Objects::nonNull) |
| | | .map(Integer::longValue) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | if (userIds.isEmpty()) { |
| | | return; |
| | | } |
| | | Map<Long, String> userMap = sysUserMapper.selectUserByIds(userIds).stream() |
| | | .collect(Collectors.toMap(SysUser::getUserId, SysUser::getNickName, (v1, v2) -> v1)); |
| | | records.forEach(record -> { |
| | | if (record.getRectifyUserId() != null) { |
| | | record.setRectifyUserName(userMap.getOrDefault(record.getRectifyUserId().longValue(), "未知用户")); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.safe.service.impl; |
| | | |
| | | import com.ruoyi.safe.pojo.SafeLineInspectionRecord; |
| | | import com.ruoyi.safe.mapper.SafeLineInspectionRecordMapper; |
| | | import com.ruoyi.safe.service.SafeLineInspectionRecordService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.safe.mapper.SafeLineInspectionRecordMapper; |
| | | import com.ruoyi.safe.pojo.SafeLineInspectionRecord; |
| | | import com.ruoyi.safe.service.SafeLineInspectionRecordService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @Service |
| | | public class SafeLineInspectionRecordServiceImpl extends ServiceImpl<SafeLineInspectionRecordMapper, SafeLineInspectionRecord> implements SafeLineInspectionRecordService { |
| | | |
| | | @Autowired |
| | | private FileUtil fileUtil; |
| | | |
| | | @Override |
| | | public List<SafeLineInspectionRecord> listByInspectionId(Integer inspectionId) { |
| | | return this.lambdaQuery() |
| | | List<SafeLineInspectionRecord> records = this.lambdaQuery() |
| | | .eq(SafeLineInspectionRecord::getInspectionId, inspectionId) |
| | | .orderByDesc(SafeLineInspectionRecord::getCheckTime) |
| | | .list(); |
| | | fillAttachments(records); |
| | | return records; |
| | | } |
| | | |
| | | @Override |
| | | public boolean save(SafeLineInspectionRecord entity) { |
| | | boolean saved = super.save(entity); |
| | | syncAttachments(saved, entity); |
| | | return saved; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateById(SafeLineInspectionRecord entity) { |
| | | boolean updated = super.updateById(entity); |
| | | syncAttachments(updated, entity); |
| | | return updated; |
| | | } |
| | | |
| | | private void syncAttachments(boolean success, SafeLineInspectionRecord entity) { |
| | | if (!success || entity == null || entity.getId() == null || entity.getStorageBlobDTOs() == null) { |
| | | return; |
| | | } |
| | | fileUtil.saveStorageAttachment( |
| | | ApplicationTypeEnum.IMAGE, |
| | | RecordTypeEnum.SAFE_LINE_INSPECTION_RECORD, |
| | | entity.getId().longValue(), |
| | | entity.getStorageBlobDTOs() |
| | | ); |
| | | } |
| | | |
| | | private void fillAttachments(List<SafeLineInspectionRecord> records) { |
| | | if (records == null || records.isEmpty()) { |
| | | return; |
| | | } |
| | | records.forEach(record -> { |
| | | if (record.getId() == null) { |
| | | return; |
| | | } |
| | | List<StorageBlobVO> attachments = fileUtil.getStorageBlobVOsByRecordTypeAndRecordId( |
| | | RecordTypeEnum.SAFE_LINE_INSPECTION_RECORD, |
| | | record.getId().longValue() |
| | | ); |
| | | record.setStorageBlobVOs(attachments == null ? Collections.emptyList() : attachments); |
| | | }); |
| | | } |
| | | } |
| | |
| | | return service.save(req) ? success() : error(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Log(title = "隐患整改-修改", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "隐患整改-修改") |
| | | public AjaxResult update(@RequestBody SpecialEquipmentRectification req) { |
| | | return service.updateById(req) ? success() : error(); |
| | | } |
| | | |
| | | @PostMapping("/close") |
| | | @Log(title = "隐患整改-闭环", businessType = BusinessType.UPDATE) |
| | | @Operation(summary = "隐患整改-闭环") |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.time.*; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @Schema(description = "特种设备检验维保记录") |
| | |
| | | @Excel(name = "附件说明") |
| | | private String attachmentRemark; |
| | | |
| | | @TableField(exist = false) |
| | | private List<StorageBlobDTO> storageBlobDTOs; |
| | | |
| | | @TableField(exist = false) |
| | | private List<StorageBlobVO> storageBlobVOs; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.basic.dto.StorageBlobDTO; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | |
| | | import java.io.Serial; |
| | | import java.io.Serializable; |
| | | import java.time.*; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @Schema(description = "特种设备隐患整改") |
| | |
| | | @Excel(name = "备注") |
| | | private String remarks; |
| | | |
| | | @TableField(exist = false) |
| | | private List<StorageBlobDTO> storageBlobDTOs; |
| | | |
| | | @TableField(exist = false) |
| | | private List<StorageBlobVO> storageBlobVOs; |
| | | |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Long createUser; |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.safe.specialequipment.mapper.SpecialEquipmentLedgerMapper; |
| | | import com.ruoyi.safe.specialequipment.mapper.SpecialEquipmentRecordMapper; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class SpecialEquipmentRecordServiceImpl extends ServiceImpl<SpecialEquipmentRecordMapper, SpecialEquipmentRecord> implements SpecialEquipmentRecordService { |
| | | private final SpecialEquipmentRecordMapper mapper; |
| | | private final SpecialEquipmentLedgerMapper ledgerMapper; |
| | | private final FileUtil fileUtil; |
| | | |
| | | public IPage<SpecialEquipmentRecord> listPage(Page page, SpecialEquipmentRecord req) { |
| | | return mapper.listPage(page, req); |
| | | IPage<SpecialEquipmentRecord> result = mapper.listPage(page, req); |
| | | fillAttachments(result.getRecords()); |
| | | return result; |
| | | } |
| | | |
| | | public boolean save(SpecialEquipmentRecord entity) { |
| | |
| | | entity.setCreateUser(SecurityUtils.getLoginUser().getUserId()); |
| | | entity.setCreateTime(LocalDateTime.now()); |
| | | boolean saved = super.save(entity); |
| | | syncAttachments(saved, entity); |
| | | syncLedgerDate(entity); |
| | | return saved; |
| | | } |
| | |
| | | @Override |
| | | public boolean updateById(SpecialEquipmentRecord entity) { |
| | | boolean updated = super.updateById(entity); |
| | | syncAttachments(updated, entity); |
| | | syncLedgerDate(entity); |
| | | return updated; |
| | | } |
| | |
| | | } |
| | | ledgerMapper.updateById(ledger); |
| | | } |
| | | |
| | | private void syncAttachments(boolean success, SpecialEquipmentRecord entity) { |
| | | if (!success || entity == null || entity.getId() == null || entity.getStorageBlobDTOs() == null) { |
| | | return; |
| | | } |
| | | fileUtil.saveStorageAttachment( |
| | | ApplicationTypeEnum.FILE, |
| | | RecordTypeEnum.SPECIAL_EQUIPMENT_RECORD, |
| | | entity.getId(), |
| | | entity.getStorageBlobDTOs() |
| | | ); |
| | | } |
| | | |
| | | private void fillAttachments(List<SpecialEquipmentRecord> records) { |
| | | if (records == null || records.isEmpty()) { |
| | | return; |
| | | } |
| | | records.forEach(record -> { |
| | | if (record.getId() == null) { |
| | | return; |
| | | } |
| | | List<StorageBlobVO> attachments = fileUtil.getStorageBlobVOsByRecordTypeAndRecordId( |
| | | RecordTypeEnum.SPECIAL_EQUIPMENT_RECORD, |
| | | record.getId() |
| | | ); |
| | | record.setStorageBlobVOs(attachments == null ? Collections.emptyList() : attachments); |
| | | }); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.dto.StorageBlobVO; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.safe.specialequipment.mapper.SpecialEquipmentRectificationMapper; |
| | | import com.ruoyi.safe.specialequipment.pojo.SpecialEquipmentRectification; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalDate; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class SpecialEquipmentRectificationServiceImpl extends ServiceImpl<SpecialEquipmentRectificationMapper, SpecialEquipmentRectification> implements SpecialEquipmentRectificationService { |
| | | private final SpecialEquipmentRectificationMapper mapper; |
| | | private final FileUtil fileUtil; |
| | | |
| | | public IPage<SpecialEquipmentRectification> listPage(Page page, SpecialEquipmentRectification req) { |
| | | return mapper.listPage(page, req); |
| | | IPage<SpecialEquipmentRectification> result = mapper.listPage(page, req); |
| | | fillAttachments(result.getRecords()); |
| | | return result; |
| | | } |
| | | |
| | | public boolean save(SpecialEquipmentRectification entity) { |
| | |
| | | entity.setCreateUser(SecurityUtils.getLoginUser().getUserId()); |
| | | entity.setCreateTime(LocalDateTime.now()); |
| | | entity.setRectificationStatus(entity.getRectificationStatus() == null ? 1 : entity.getRectificationStatus()); |
| | | return super.save(entity); |
| | | boolean saved = super.save(entity); |
| | | syncAttachments(saved, entity); |
| | | return saved; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateById(SpecialEquipmentRectification entity) { |
| | | return super.updateById(entity); |
| | | if (entity.getRectificationStatus() != null && entity.getRectificationStatus() == 4 && entity.getClosedDate() == null) { |
| | | entity.setClosedDate(LocalDate.now()); |
| | | } |
| | | boolean updated = super.updateById(entity); |
| | | syncAttachments(updated, entity); |
| | | return updated; |
| | | } |
| | | |
| | | private void syncAttachments(boolean success, SpecialEquipmentRectification entity) { |
| | | if (!success || entity == null || entity.getId() == null || entity.getStorageBlobDTOs() == null) { |
| | | return; |
| | | } |
| | | fileUtil.saveStorageAttachment( |
| | | ApplicationTypeEnum.FILE, |
| | | RecordTypeEnum.SPECIAL_EQUIPMENT_RECTIFICATION, |
| | | entity.getId(), |
| | | entity.getStorageBlobDTOs() |
| | | ); |
| | | } |
| | | |
| | | private void fillAttachments(List<SpecialEquipmentRectification> records) { |
| | | if (records == null || records.isEmpty()) { |
| | | return; |
| | | } |
| | | records.forEach(record -> { |
| | | if (record.getId() == null) { |
| | | return; |
| | | } |
| | | List<StorageBlobVO> attachments = fileUtil.getStorageBlobVOsByRecordTypeAndRecordId( |
| | | RecordTypeEnum.SPECIAL_EQUIPMENT_RECTIFICATION, |
| | | record.getId() |
| | | ); |
| | | record.setStorageBlobVOs(attachments == null ? Collections.emptyList() : attachments); |
| | | }); |
| | | } |
| | | } |
| | |
| | | <if test="req.equipmentId != null"> |
| | | and equipment_id = #{req.equipmentId} |
| | | </if> |
| | | order by id |
| | | order by id desc |
| | | </select> |
| | | |
| | | </mapper> |