安全、质量

This commit is contained in:
lcj
2025-09-13 22:10:24 +08:00
parent f0f30ce841
commit 4c536ca269
9 changed files with 62 additions and 78 deletions

View File

@ -55,7 +55,7 @@ public class QltQualityInspectionVo implements Serializable {
private String inspectionType;
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "inspectionType",other = "quality_inspection_check_type")
@Translation(type = TransConstant.DICT_TYPE_TO_LABEL, mapper = "inspectionType", other = "quality_inspection_check_type")
private String inspectionTypeName;
/**
@ -115,6 +115,7 @@ public class QltQualityInspectionVo implements Serializable {
/**
* 整改人姓名
*/
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "correctorId")
private String correctorName;
/**
@ -187,6 +188,7 @@ public class QltQualityInspectionVo implements Serializable {
/**
* 创建者名称
*/
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "createBy")
private String createByName;
/**

View File

@ -38,7 +38,6 @@ import org.dromara.quality.mapper.QltQualityInspectionMapper;
import org.dromara.quality.service.IQltQualityInspectionService;
import org.dromara.system.domain.vo.SysDictDataVo;
import org.dromara.system.domain.vo.SysOssVo;
import org.dromara.system.domain.vo.SysUserVo;
import org.dromara.system.service.ISysDictDataService;
import org.dromara.system.service.ISysDictTypeService;
import org.dromara.system.service.ISysOssService;
@ -56,7 +55,6 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.zip.ZipOutputStream;
/**
@ -268,23 +266,6 @@ public class QltQualityInspectionServiceImpl extends ServiceImpl<QltQualityInspe
return qualityInspectionVo;
}
BeanUtils.copyProperties(qualityInspection, qualityInspectionVo);
// 关联项目信息
Long projectId = qualityInspection.getProjectId();
if (projectId != null) {
qualityInspectionVo.setProjectName(projectService.getById(projectId).getProjectName());
}
// 关联创建用户信息
Long createBy = qualityInspection.getCreateBy();
if (createBy != null) {
SysUserVo sysUserVo = userService.selectUserById(createBy);
qualityInspectionVo.setCreateByName(sysUserVo.getNickName());
}
// 关联整改人信息
Long correctorId = qualityInspection.getCorrectorId();
if (correctorId != null) {
SysUserVo user = userService.selectUserById(correctorId);
qualityInspectionVo.setCorrectorName(user.getNickName());
}
// 关联附件信息
String inspectionFile = qualityInspection.getInspectionFile();
if (StringUtils.isNotBlank(inspectionFile)) {
@ -365,13 +346,6 @@ public class QltQualityInspectionServiceImpl extends ServiceImpl<QltQualityInspe
if (CollUtil.isEmpty(qualityInspectionList)) {
return qualityInspectionVoPage;
}
// 获取整改人、创建用户信息
List<Long> userIdList = Stream.concat(
qualityInspectionList.stream().map(QltQualityInspection::getCorrectorId),
qualityInspectionList.stream().map(QltQualityInspection::getCreateBy)
).distinct().toList();
List<SysUserVo> userVoList = userService.selectUserByIds(userIdList, null);
Map<Long, String> userMap = userVoList.stream().collect(Collectors.toMap(SysUserVo::getUserId, SysUserVo::getNickName));
// 获取附件信息
List<Long> ossInspectionFileIdList = qualityInspectionList.stream().map(QltQualityInspection::getInspectionFile).filter(StringUtils::isNotBlank)
.flatMap(fileId -> Arrays.stream(fileId.split(",")).map(Long::parseLong)).distinct().toList();
@ -395,20 +369,6 @@ public class QltQualityInspectionServiceImpl extends ServiceImpl<QltQualityInspe
List<QltQualityInspectionVo> qualityInspectionVoList = qualityInspectionList.stream().map(qualityInspection -> {
QltQualityInspectionVo qualityInspectionVo = new QltQualityInspectionVo();
BeanUtils.copyProperties(qualityInspection, qualityInspectionVo);
// 关联整改人信息
Long correctorId = qualityInspection.getCorrectorId();
String correctorName = null;
if (userMap.containsKey(correctorId)) {
correctorName = userMap.get(correctorId);
}
qualityInspectionVo.setCorrectorName(correctorName);
// 关联创建用户信息
Long createBy = qualityInspection.getCreateBy();
String createByName = null;
if (userMap.containsKey(createBy)) {
createByName = userMap.get(createBy);
}
qualityInspectionVo.setCreateByName(createByName);
// 关联附件信息
String inspectionFile = qualityInspection.getInspectionFile();
List<SysOssVo> inspectionFileList = new ArrayList<>();

View File

@ -20,6 +20,11 @@ public class HseSafetyInspectionQueryReq implements Serializable {
*/
private Long projectId;
/**
* 检查项目
*/
private String checkProject;
/**
* 检查类型
*/

View File

@ -25,6 +25,16 @@ public class HseSafetyLogQueryReq implements Serializable {
*/
private String dateOfOccurrence;
/**
* 进展
*/
private String progress;
/**
* 作业内容
*/
private String jobContent;
/**
* 创建人
*/

View File

@ -77,6 +77,7 @@ public class HseSafetyInspectionVo implements Serializable {
/**
* 整改人名字
*/
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "correctorId")
private String correctorName;
/**
@ -169,11 +170,12 @@ public class HseSafetyInspectionVo implements Serializable {
/**
* 创建人id
*/
private Long creatorId;
private Long createBy;
/**
* 创建人名字
*/
@Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "createBy")
private String creatorName;
}

View File

@ -42,6 +42,9 @@ public class HseTeamMeetingVo implements Serializable {
@ExcelProperty(value = "项目id")
private Long projectId;
@Translation(type = TransConstant.PROJECT_ID_TO_NAME, mapper = "projectId")
private String projectName;
/**
* 班组id
*/

View File

@ -46,6 +46,7 @@ import org.dromara.system.domain.vo.SysUserVo;
import org.dromara.system.service.ISysDictDataService;
import org.dromara.system.service.ISysOssService;
import org.dromara.system.service.ISysUserService;
import org.dromara.websocket.ChatServerHandler;
import org.springframework.beans.BeanUtils;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
@ -94,6 +95,9 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
@Resource
private IHseTeamMeetingService teamMeetingService;
@Resource
private ChatServerHandler chatServerHandler;
/**
* 查询安全巡检工单
*
@ -207,6 +211,15 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
if (!save) {
throw new ServiceException("新增安全巡检工单信息失败,数据库异常", HttpStatus.ERROR);
}
// 向整改人发送消息
Long correctorId = req.getCorrectorId();
if (correctorId != null) {
String title = "您有新的安全巡检工单,请及时查看!";
if (req.getIsReply().equals("1")) {
title = "您有新的安全巡检工单需要整改,请及时处理!";
}
chatServerHandler.sendSystemMessageToUser(correctorId, title);
}
// 返回新写入的数据
return safetyInspection.getId();
}
@ -286,19 +299,6 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
safetyInspectionVo.setRectificationName(team.getTeamName());
}
}
// 关联整改人信息
Long correctorId = safetyInspection.getCorrectorId();
if (correctorId != null) {
SysUserVo constructionUser = userService.selectUserById(correctorId);
safetyInspectionVo.setCorrectorName(constructionUser.getUserName());
}
// 关联创建用户信息
Long createBy = safetyInspection.getCreateBy();
if (createBy != null) {
SysUserVo createUser = userService.selectUserById(createBy);
safetyInspectionVo.setCreatorId(createUser.getUserId());
safetyInspectionVo.setCreatorName(createUser.getNickName());
}
return safetyInspectionVo;
}
@ -315,6 +315,7 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
return lqw;
}
Long projectId = req.getProjectId();
String checkProject = req.getCheckProject();
String checkType = req.getCheckType();
String violationType = req.getViolationType();
String rectificationUnit = req.getRectificationUnit();
@ -323,6 +324,7 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
String reviewType = req.getReviewType();
// 精准查询
lqw.eq(ObjectUtils.isNotEmpty(projectId), HseSafetyInspection::getProjectId, projectId);
lqw.like(StringUtils.isNotBlank(checkProject), HseSafetyInspection::getCheckProject, checkProject);
lqw.eq(ObjectUtils.isNotEmpty(rectificationId), HseSafetyInspection::getRectificationId, rectificationId);
lqw.eq(StringUtils.isNotBlank(checkType), HseSafetyInspection::getCheckType, checkType);
lqw.eq(StringUtils.isNotBlank(violationType), HseSafetyInspection::getViolationType, violationType);
@ -367,20 +369,6 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
List<HseSafetyInspectionVo> safetyInspectionVoList = safetyInspectionList.stream().map(inspection -> {
HseSafetyInspectionVo qualityInspectionVo = new HseSafetyInspectionVo();
BeanUtils.copyProperties(inspection, qualityInspectionVo);
// 关联整改人信息
Long correctorId = inspection.getCorrectorId();
String correctorName = null;
if (userMap.containsKey(correctorId)) {
correctorName = userMap.get(correctorId);
}
qualityInspectionVo.setCorrectorName(correctorName);
// 关联创建用户信息
Long createBy = inspection.getCreateBy();
String createByName = null;
if (userMap.containsKey(createBy)) {
createByName = userMap.get(createBy);
}
qualityInspectionVo.setCreatorName(createByName);
return qualityInspectionVo;
}).toList();
safetyInspectionVoPage.setRecords(safetyInspectionVoList);
@ -480,6 +468,10 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
}*/
HseSafetyInspection updateInspection = new HseSafetyInspection();
BeanUtils.copyProperties(req, updateInspection);
if (safetyInspection.getCreateBy() != null && safetyInspection.getIsReply().equals("1")) {
chatServerHandler.sendSystemMessageToUser(safetyInspection.getCreateBy(),
"安全巡检工单【" + safetyInspection.getCheckProject() + "】已整改,请及时复查!");
}
// 填充默认值
updateInspection.setId(id);
updateInspection.setRectificationTime(new Date());
@ -501,6 +493,10 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
if (safetyInspection == null) {
throw new ServiceException("安全巡检工单信息不存在", HttpStatus.NOT_FOUND);
}
// 校验是否需要复查
if (!safetyInspection.getIsReply().equals("2")) {
throw new ServiceException("该安全巡检工单仅通知", HttpStatus.BAD_REQUEST);
}
// 校验是否已整改
if (!safetyInspection.getStatus().equals(HseSafetyInspectionStatusEnum.RECTIFICATION.getValue())) {
throw new ServiceException("该安全巡检工单信息未整改,无法进行复查", HttpStatus.BAD_REQUEST);

View File

@ -200,6 +200,8 @@ public class HseSafetyLogServiceImpl extends ServiceImpl<HseSafetyLogMapper, Hse
}
Long projectId = req.getProjectId();
String dateOfOccurrence = req.getDateOfOccurrence();
String progress = req.getProgress();
String jobContent = req.getJobContent();
String creatorName = req.getCreatorName();
// 联表查询
if (StringUtils.isNotBlank(creatorName)) {
@ -211,6 +213,9 @@ public class HseSafetyLogServiceImpl extends ServiceImpl<HseSafetyLogMapper, Hse
lqw.in(HseSafetyLog::getCreateBy, userIds);
}
}
// 模糊查询
lqw.like(StringUtils.isNotBlank(progress), HseSafetyLog::getProgress, progress);
lqw.like(StringUtils.isNotBlank(jobContent), HseSafetyLog::getJobContent, jobContent);
// 精确查询
lqw.eq(ObjectUtils.isNotEmpty(projectId), HseSafetyLog::getProjectId, projectId);
lqw.eq(ObjectUtils.isNotEmpty(dateOfOccurrence), HseSafetyLog::getDateOfOccurrence, dateOfOccurrence);

View File

@ -33,6 +33,7 @@ import org.dromara.safety.service.IHseViolationLevelService;
import org.dromara.safety.service.IHseViolationRecordService;
import org.dromara.system.domain.vo.SysUserVo;
import org.dromara.system.service.ISysUserService;
import org.dromara.websocket.ChatServerHandler;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@ -70,6 +71,9 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
@Resource
private SseProperties sseProperties;
@Resource
private ChatServerHandler chatServerHandler;
/**
* 查询违规记录
*
@ -224,10 +228,8 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
}
String processType = req.getProcessType();
HseViolationRecord violationRecord = new HseViolationRecord();
if (Objects.equals(processType, "0")) {
// 仅通知
violationRecord.setProcessType(processType);
} else if (Objects.equals(processType, "1")) {
BeanUtils.copyProperties(req, violationRecord);
if (Objects.equals(processType, "1")) {
// 判断字段是否为空
if (StringUtils.isBlank(req.getRectificationUnit()) || req.getRectificationId() == null) {
throw new ServiceException("整改单位信息不能为空", HttpStatus.BAD_REQUEST);
@ -242,11 +244,10 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
if (user == null) {
throw new ServiceException("处理人信息不存在", HttpStatus.NOT_FOUND);
}
violationRecord.setId(id);
violationRecord.setCorrectorId(correctorId);
violationRecord.setDisposeDeadline(disposeDeadline);
violationRecord.setProcessType(processType);
violationRecord.setRemark(req.getRemark());
}
if (req.getCorrectorId() != null) {
chatServerHandler.sendSystemMessageToUser(req.getCorrectorId(),
"您有一份新的违章工单,请及时处理!工单号为:" + violationRecord.getId());
}
boolean result = this.updateById(violationRecord);
if (!result) {