隐患排查初版
This commit is contained in:
@@ -40,12 +40,15 @@ public class HiddenDangerCheckCallback implements IFlowCallback {
|
||||
HotHiddenDangerInspection inspection = inspectMapper.selectById(id);
|
||||
if (inspection != null) {
|
||||
if (success) {
|
||||
inspection.setStatus(3L);
|
||||
inspection.setFlowStatus("APPROVED");
|
||||
inspection.setStatus(inspection.getAuditHasDanger() != null && inspection.getAuditHasDanger() == 1L ? 6L : 3L);
|
||||
} else {
|
||||
inspection.setStatus(6L);
|
||||
inspection.setFlowStatus("REJECTED");
|
||||
inspection.setStatus(1L);
|
||||
inspection.setInstanceId(null);
|
||||
log.info("隐患排查流程被驳回或非正常结束: {}", businessId);
|
||||
}
|
||||
if (inspection.getAuditHasDanger() != null && inspection.getAuditHasDanger() == 1L) {
|
||||
if (success && inspection.getAuditHasDanger() != null && inspection.getAuditHasDanger() == 1L) {
|
||||
createHiddenDangerFlow(inspection);
|
||||
}
|
||||
inspectMapper.updateById(inspection);
|
||||
|
||||
@@ -150,4 +150,39 @@ public class HotHiddenDangerInspection extends BaseEntity {
|
||||
* 流程状态
|
||||
*/
|
||||
private String flowStatus;
|
||||
|
||||
/**
|
||||
* 提交版本号
|
||||
*/
|
||||
private Long submitVersion;
|
||||
|
||||
/**
|
||||
* 审核结果(PASS=通过 REJECT=驳回)
|
||||
*/
|
||||
private String auditResult;
|
||||
|
||||
/**
|
||||
* 驳回次数
|
||||
*/
|
||||
private Long rejectCount;
|
||||
|
||||
/**
|
||||
* 最近一次驳回原因
|
||||
*/
|
||||
private String lastRejectReason;
|
||||
|
||||
/**
|
||||
* 最近一次驳回时间
|
||||
*/
|
||||
private Date lastRejectTime;
|
||||
|
||||
/**
|
||||
* 最近一次驳回人ID
|
||||
*/
|
||||
private Long lastRejectById;
|
||||
|
||||
/**
|
||||
* 最近一次驳回人姓名
|
||||
*/
|
||||
private String lastRejectByName;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.hotwj.platform.securityManagement.hiddenDangerInspection.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
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.util.Date;
|
||||
|
||||
/**
|
||||
* 隐患排查审核驳回历史对象 hot_hidden_danger_inspection_audit_history
|
||||
*
|
||||
* @author shihongwei
|
||||
* @date 2026-05-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("hot_hidden_danger_inspection_audit_history")
|
||||
public class HotHiddenDangerInspectionAuditHistory extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 隐患排查主单ID
|
||||
*/
|
||||
private Long inspectionId;
|
||||
|
||||
/**
|
||||
* 公司ID
|
||||
*/
|
||||
private Long companyId;
|
||||
|
||||
/**
|
||||
* 计划ID
|
||||
*/
|
||||
private Long planId;
|
||||
|
||||
/**
|
||||
* 排查项目
|
||||
*/
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 排查项目ID
|
||||
*/
|
||||
private String projectId;
|
||||
|
||||
/**
|
||||
* 排查类型(1=公司 2=车辆 3=人员)
|
||||
*/
|
||||
private Long projectType;
|
||||
|
||||
/**
|
||||
* 提交版本号
|
||||
*/
|
||||
private Long submitVersion;
|
||||
|
||||
/**
|
||||
* 审核轮次
|
||||
*/
|
||||
private Long auditRound;
|
||||
|
||||
/**
|
||||
* 审核结果(REJECT)
|
||||
*/
|
||||
private String auditResult;
|
||||
|
||||
/**
|
||||
* 驳回原因
|
||||
*/
|
||||
private String rejectReason;
|
||||
|
||||
/**
|
||||
* 审核日期
|
||||
*/
|
||||
private Date auditDate;
|
||||
|
||||
/**
|
||||
* 审核人ID
|
||||
*/
|
||||
private Long approverId;
|
||||
|
||||
/**
|
||||
* 审核人姓名
|
||||
*/
|
||||
private String approverName;
|
||||
|
||||
/**
|
||||
* 审核人签名
|
||||
*/
|
||||
private String approverSignImgUrl;
|
||||
|
||||
/**
|
||||
* 审核时是否存在隐患
|
||||
*/
|
||||
private Long auditHasDanger;
|
||||
|
||||
/**
|
||||
* 当次提交快照JSON
|
||||
*/
|
||||
private String submitSnapshotJson;
|
||||
|
||||
/**
|
||||
* 排查内容JSON
|
||||
*/
|
||||
private String checkContentJson;
|
||||
|
||||
/**
|
||||
* 隐患描述
|
||||
*/
|
||||
private String dangerDesc;
|
||||
|
||||
/**
|
||||
* 附件
|
||||
*/
|
||||
private String attachmentUrl;
|
||||
|
||||
/**
|
||||
* 排查人签名
|
||||
*/
|
||||
private String signImgUrl;
|
||||
|
||||
/**
|
||||
* 排查人ID
|
||||
*/
|
||||
private String checkerId;
|
||||
|
||||
/**
|
||||
* 排查人姓名
|
||||
*/
|
||||
private String checkerName;
|
||||
|
||||
/**
|
||||
* 排查日期
|
||||
*/
|
||||
private Date checkDate;
|
||||
|
||||
/**
|
||||
* 0=正常,1=已删除
|
||||
*/
|
||||
@TableLogic
|
||||
private Long isDeleted;
|
||||
}
|
||||
@@ -159,6 +159,41 @@ public class HotHiddenDangerInspectionBo extends BaseEntity {
|
||||
*/
|
||||
private String flowStatus;
|
||||
|
||||
/**
|
||||
* 提交版本号
|
||||
*/
|
||||
private Long submitVersion;
|
||||
|
||||
/**
|
||||
* 审核结果(PASS=通过 REJECT=驳回)
|
||||
*/
|
||||
private String auditResult;
|
||||
|
||||
/**
|
||||
* 驳回次数
|
||||
*/
|
||||
private Long rejectCount;
|
||||
|
||||
/**
|
||||
* 最近一次驳回原因
|
||||
*/
|
||||
private String lastRejectReason;
|
||||
|
||||
/**
|
||||
* 最近一次驳回时间
|
||||
*/
|
||||
private Date lastRejectTime;
|
||||
|
||||
/**
|
||||
* 最近一次驳回人ID
|
||||
*/
|
||||
private Long lastRejectById;
|
||||
|
||||
/**
|
||||
* 最近一次驳回人姓名
|
||||
*/
|
||||
private String lastRejectByName;
|
||||
|
||||
|
||||
/**
|
||||
* 流程任务ID
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.hotwj.platform.securityManagement.hiddenDangerInspection.domain.vo;
|
||||
|
||||
import com.hotwj.platform.securityManagement.hiddenDangerInspection.domain.HotHiddenDangerInspectionAuditHistory;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 隐患排查审核驳回历史视图对象
|
||||
*
|
||||
* @author shihongwei
|
||||
* @date 2026-05-30
|
||||
*/
|
||||
@Data
|
||||
@AutoMapper(target = HotHiddenDangerInspectionAuditHistory.class)
|
||||
public class HotHiddenDangerInspectionAuditHistoryVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long inspectionId;
|
||||
|
||||
private Long companyId;
|
||||
|
||||
private Long planId;
|
||||
|
||||
private String projectName;
|
||||
|
||||
private String projectId;
|
||||
|
||||
private Long projectType;
|
||||
|
||||
private Long submitVersion;
|
||||
|
||||
private Long auditRound;
|
||||
|
||||
private String auditResult;
|
||||
|
||||
private String rejectReason;
|
||||
|
||||
private Date auditDate;
|
||||
|
||||
private Long approverId;
|
||||
|
||||
private String approverName;
|
||||
|
||||
private String approverSignImgUrl;
|
||||
|
||||
private Long auditHasDanger;
|
||||
|
||||
private String submitSnapshotJson;
|
||||
|
||||
private String checkContentJson;
|
||||
|
||||
private String dangerDesc;
|
||||
|
||||
private String attachmentUrl;
|
||||
|
||||
private String signImgUrl;
|
||||
|
||||
private String checkerId;
|
||||
|
||||
private String checkerName;
|
||||
|
||||
private Date checkDate;
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@@ -178,6 +179,41 @@ public class HotHiddenDangerInspectionVo implements Serializable {
|
||||
@ExcelProperty(value = "流程状态")
|
||||
private String flowStatus;
|
||||
|
||||
/**
|
||||
* 提交版本号
|
||||
*/
|
||||
private Long submitVersion;
|
||||
|
||||
/**
|
||||
* 审核结果(PASS=通过 REJECT=驳回)
|
||||
*/
|
||||
private String auditResult;
|
||||
|
||||
/**
|
||||
* 驳回次数
|
||||
*/
|
||||
private Long rejectCount;
|
||||
|
||||
/**
|
||||
* 最近一次驳回原因
|
||||
*/
|
||||
private String lastRejectReason;
|
||||
|
||||
/**
|
||||
* 最近一次驳回时间
|
||||
*/
|
||||
private Date lastRejectTime;
|
||||
|
||||
/**
|
||||
* 最近一次驳回人ID
|
||||
*/
|
||||
private Long lastRejectById;
|
||||
|
||||
/**
|
||||
* 最近一次驳回人姓名
|
||||
*/
|
||||
private String lastRejectByName;
|
||||
|
||||
/**
|
||||
* 流程任务ID
|
||||
*/
|
||||
@@ -192,4 +228,9 @@ public class HotHiddenDangerInspectionVo implements Serializable {
|
||||
private Integer todoSortGroup;
|
||||
|
||||
private String todoSortLabel;
|
||||
|
||||
/**
|
||||
* 审核不通过历史
|
||||
*/
|
||||
private List<HotHiddenDangerInspectionAuditHistoryVo> rejectHistoryList;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.hotwj.platform.securityManagement.hiddenDangerInspection.mapper;
|
||||
|
||||
import com.hotwj.platform.securityManagement.hiddenDangerInspection.domain.HotHiddenDangerInspectionAuditHistory;
|
||||
import com.hotwj.platform.securityManagement.hiddenDangerInspection.domain.vo.HotHiddenDangerInspectionAuditHistoryVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 隐患排查审核驳回历史Mapper接口
|
||||
*
|
||||
* @author shihongwei
|
||||
* @date 2026-05-30
|
||||
*/
|
||||
@Mapper
|
||||
public interface HotHiddenDangerInspectionAuditHistoryMapper
|
||||
extends BaseMapperPlus<HotHiddenDangerInspectionAuditHistory, HotHiddenDangerInspectionAuditHistoryVo> {
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.hotwj.platform.securityManagement.hiddenDangerInspection.service.impl;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -10,8 +11,11 @@ import com.hotwj.platform.integration.ocr.SignatureVerifyService;
|
||||
import com.hotwj.platform.noticeManagerment.systemNotification.domain.bo.HotSystemNotificationGroupBo;
|
||||
import com.hotwj.platform.noticeManagerment.systemNotification.service.IHotSystemNotificationService;
|
||||
import com.hotwj.platform.securityManagement.hiddenDangerInspection.domain.HotHiddenDangerInspection;
|
||||
import com.hotwj.platform.securityManagement.hiddenDangerInspection.domain.HotHiddenDangerInspectionAuditHistory;
|
||||
import com.hotwj.platform.securityManagement.hiddenDangerInspection.domain.bo.HotHiddenDangerInspectionBo;
|
||||
import com.hotwj.platform.securityManagement.hiddenDangerInspection.domain.vo.HotHiddenDangerInspectionAuditHistoryVo;
|
||||
import com.hotwj.platform.securityManagement.hiddenDangerInspection.domain.vo.HotHiddenDangerInspectionVo;
|
||||
import com.hotwj.platform.securityManagement.hiddenDangerInspection.mapper.HotHiddenDangerInspectionAuditHistoryMapper;
|
||||
import com.hotwj.platform.securityManagement.hiddenDangerInspection.mapper.HotHiddenDangerInspectionMapper;
|
||||
import com.hotwj.platform.securityManagement.hiddenDangerInspection.service.IHotHiddenDangerInspectionService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -27,6 +31,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.YearMonth;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -42,6 +48,7 @@ import java.util.Map;
|
||||
public class HotHiddenDangerInspectionServiceImpl implements IHotHiddenDangerInspectionService {
|
||||
|
||||
private final HotHiddenDangerInspectionMapper baseMapper;
|
||||
private final HotHiddenDangerInspectionAuditHistoryMapper historyMapper;
|
||||
private final ISysFlowService flowService;
|
||||
private final IHotSystemNotificationService notificationService;
|
||||
private final SignatureVerifyService signatureVerifyService;
|
||||
@@ -55,10 +62,11 @@ public class HotHiddenDangerInspectionServiceImpl implements IHotHiddenDangerIns
|
||||
@Override
|
||||
public HotHiddenDangerInspectionVo queryById(Long id) {
|
||||
HotHiddenDangerInspectionVo vo = baseMapper.selectVoById(id);
|
||||
if (vo != null && StringUtils.isNotBlank(vo.getInstanceId())) {
|
||||
String userId = LoginHelper.getBusinessUserId();
|
||||
vo.setTaskId(flowService.getTaskId(vo.getInstanceId(), userId));
|
||||
if (vo == null) {
|
||||
return null;
|
||||
}
|
||||
vo.setRejectHistoryList(queryRejectHistoryList(id));
|
||||
fillTaskId(vo, LoginHelper.getBusinessUserId());
|
||||
return vo;
|
||||
}
|
||||
|
||||
@@ -156,11 +164,11 @@ public class HotHiddenDangerInspectionServiceImpl implements IHotHiddenDangerIns
|
||||
if (vo == null) {
|
||||
continue;
|
||||
}
|
||||
if (StringUtils.isNotBlank(vo.getInstanceId())) {
|
||||
vo.setTaskId(flowService.getTaskId(vo.getInstanceId(), userId));
|
||||
}
|
||||
fillTaskId(vo, userId);
|
||||
if (StringUtils.isBlank(vo.getFlowStatus())) {
|
||||
if (vo.getStatus() == null || vo.getStatus() == 0L) {
|
||||
if ("REJECT".equalsIgnoreCase(vo.getAuditResult())) {
|
||||
vo.setFlowStatus("REJECTED");
|
||||
} else if (vo.getStatus() == null || vo.getStatus() == 0L || vo.getStatus() == 1L) {
|
||||
vo.setFlowStatus("TODO");
|
||||
} else if (vo.getStatus() == 3L || vo.getStatus() == 9L) {
|
||||
vo.setFlowStatus("DONE");
|
||||
@@ -195,36 +203,58 @@ public class HotHiddenDangerInspectionServiceImpl implements IHotHiddenDangerIns
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updateByBo(HotHiddenDangerInspectionBo bo) {
|
||||
HotHiddenDangerInspection original = baseMapper.selectById(bo.getId());
|
||||
if (original == null) {
|
||||
throw new ServiceException("排查记录不存在");
|
||||
}
|
||||
HotHiddenDangerInspection update = MapstructUtils.convert(bo, HotHiddenDangerInspection.class);
|
||||
validEntityBeforeSave(update);
|
||||
String signImgUrl = bo.getSignImgUrl();
|
||||
if (DriverLoginContextHelper.isDriverPort() && StringUtils.isNotBlank(signImgUrl)) {
|
||||
String checkerName = bo.getCheckerName();
|
||||
|
||||
if (original == null || StringUtils.isBlank(checkerName)) {
|
||||
if (StringUtils.isBlank(checkerName)) {
|
||||
throw new ServiceException("排查人姓名不能为空");
|
||||
}
|
||||
signatureVerifyService.validateSelfSignature(parseSignatureOssId(signImgUrl), checkerName);
|
||||
}
|
||||
boolean flag = baseMapper.updateById(update) > 0;
|
||||
if (flag && (original == null || StringUtils.isBlank(original.getInstanceId()))) {
|
||||
if (flag && shouldStartAuditFlow(original)) {
|
||||
String initiator = String.valueOf(LoginHelper.getBusinessUserId());
|
||||
String approverId = bo.getApproverId() != null ? String.valueOf(bo.getApproverId()) : null;
|
||||
if (StringUtils.isBlank(approverId)) {
|
||||
throw new ServiceException("请选择审核人");
|
||||
}
|
||||
Long nextSubmitVersion = buildNextSubmitVersion(original);
|
||||
String instanceId = flowService.startFlow(
|
||||
"HIDDEN_DANGER_CHECK",
|
||||
String.valueOf(update.getId()),
|
||||
update.getCompanyId(),
|
||||
String.valueOf(original.getId()),
|
||||
original.getCompanyId(),
|
||||
initiator,
|
||||
approverId
|
||||
);
|
||||
update.setInstanceId(instanceId);
|
||||
update.setFlowStatus("SUBMITTED");
|
||||
baseMapper.updateById(update);
|
||||
baseMapper.update(
|
||||
null,
|
||||
Wrappers.<HotHiddenDangerInspection>lambdaUpdate()
|
||||
.eq(HotHiddenDangerInspection::getId, original.getId())
|
||||
.set(HotHiddenDangerInspection::getStatus, 2L)
|
||||
.set(HotHiddenDangerInspection::getInstanceId, instanceId)
|
||||
.set(HotHiddenDangerInspection::getFlowStatus, "SUBMITTED")
|
||||
.set(HotHiddenDangerInspection::getSubmitVersion, nextSubmitVersion)
|
||||
.set(HotHiddenDangerInspection::getAuditDate, null)
|
||||
.set(HotHiddenDangerInspection::getAuditConclusion, null)
|
||||
.set(HotHiddenDangerInspection::getApproverSignImgUrl, null)
|
||||
.set(HotHiddenDangerInspection::getAuditHasDanger, null)
|
||||
.set(HotHiddenDangerInspection::getAuditResult, null)
|
||||
.set(HotHiddenDangerInspection::getEvaluatorId, null)
|
||||
.set(HotHiddenDangerInspection::getEvaluatorName, null)
|
||||
.set(HotHiddenDangerInspection::getLastRejectReason, null)
|
||||
.set(HotHiddenDangerInspection::getLastRejectTime, null)
|
||||
.set(HotHiddenDangerInspection::getLastRejectById, null)
|
||||
.set(HotHiddenDangerInspection::getLastRejectByName, null)
|
||||
);
|
||||
|
||||
try {
|
||||
HotSystemNotificationGroupBo bos = new HotSystemNotificationGroupBo();
|
||||
@@ -254,26 +284,176 @@ public class HotHiddenDangerInspectionServiceImpl implements IHotHiddenDangerIns
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void audit(HotHiddenDangerInspectionBo bo) {
|
||||
// 1. 校验参数
|
||||
if (bo.getTaskId() == null) {
|
||||
if (StringUtils.isBlank(bo.getTaskId())) {
|
||||
throw new ServiceException("流程任务ID不能为空");
|
||||
}
|
||||
|
||||
// 2. 更新业务数据
|
||||
HotHiddenDangerInspection update = MapstructUtils.convert(bo, HotHiddenDangerInspection.class);
|
||||
boolean flag = baseMapper.updateById(update) > 0;
|
||||
|
||||
if (flag) {
|
||||
// 4. 完成流程任务
|
||||
// 如果有隐患,我们认为流程是"驳回"的(需要整改)
|
||||
boolean auditPass = bo.getAuditHasDanger() != null && bo.getAuditHasDanger() == 0L;
|
||||
flowService.audit(
|
||||
bo.getTaskId(),
|
||||
auditPass,
|
||||
bo.getAuditConclusion(),
|
||||
LoginHelper.getBusinessUserId()
|
||||
);
|
||||
if (bo.getId() == null) {
|
||||
throw new ServiceException("排查记录ID不能为空");
|
||||
}
|
||||
HotHiddenDangerInspection original = baseMapper.selectById(bo.getId());
|
||||
if (original == null) {
|
||||
throw new ServiceException("排查记录不存在");
|
||||
}
|
||||
String auditResult = normalizeAuditResult(bo);
|
||||
String auditConclusion = StringUtils.trimToNull(bo.getAuditConclusion());
|
||||
Date auditDate = bo.getAuditDate() != null ? bo.getAuditDate() : new Date();
|
||||
if ("PASS".equals(auditResult)) {
|
||||
if (bo.getAuditHasDanger() == null) {
|
||||
throw new ServiceException("请选择是否存在隐患");
|
||||
}
|
||||
if (bo.getAuditHasDanger() == 1L && bo.getEvaluatorId() == null) {
|
||||
throw new ServiceException("请选择评估人");
|
||||
}
|
||||
baseMapper.update(
|
||||
null,
|
||||
Wrappers.<HotHiddenDangerInspection>lambdaUpdate()
|
||||
.eq(HotHiddenDangerInspection::getId, original.getId())
|
||||
.set(HotHiddenDangerInspection::getApproverId, bo.getApproverId())
|
||||
.set(HotHiddenDangerInspection::getApproverName, bo.getApproverName())
|
||||
.set(HotHiddenDangerInspection::getAuditDate, auditDate)
|
||||
.set(HotHiddenDangerInspection::getAuditConclusion, auditConclusion)
|
||||
.set(HotHiddenDangerInspection::getApproverSignImgUrl, bo.getApproverSignImgUrl())
|
||||
.set(HotHiddenDangerInspection::getAuditHasDanger, bo.getAuditHasDanger())
|
||||
.set(HotHiddenDangerInspection::getEvaluatorId, bo.getEvaluatorId())
|
||||
.set(HotHiddenDangerInspection::getEvaluatorName, bo.getEvaluatorName())
|
||||
.set(HotHiddenDangerInspection::getAuditResult, "PASS")
|
||||
);
|
||||
flowService.audit(
|
||||
bo.getTaskId(),
|
||||
true,
|
||||
auditConclusion,
|
||||
LoginHelper.getBusinessUserId()
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (StringUtils.isBlank(auditConclusion)) {
|
||||
throw new ServiceException("审核不通过原因不能为空");
|
||||
}
|
||||
|
||||
long nextRejectCount = original.getRejectCount() == null ? 1L : original.getRejectCount() + 1L;
|
||||
baseMapper.update(
|
||||
null,
|
||||
Wrappers.<HotHiddenDangerInspection>lambdaUpdate()
|
||||
.eq(HotHiddenDangerInspection::getId, original.getId())
|
||||
.set(HotHiddenDangerInspection::getApproverId, bo.getApproverId())
|
||||
.set(HotHiddenDangerInspection::getApproverName, bo.getApproverName())
|
||||
.set(HotHiddenDangerInspection::getAuditDate, auditDate)
|
||||
.set(HotHiddenDangerInspection::getAuditConclusion, auditConclusion)
|
||||
.set(HotHiddenDangerInspection::getApproverSignImgUrl, bo.getApproverSignImgUrl())
|
||||
.set(HotHiddenDangerInspection::getAuditHasDanger, null)
|
||||
.set(HotHiddenDangerInspection::getEvaluatorId, null)
|
||||
.set(HotHiddenDangerInspection::getEvaluatorName, null)
|
||||
.set(HotHiddenDangerInspection::getAuditResult, "REJECT")
|
||||
.set(HotHiddenDangerInspection::getRejectCount, nextRejectCount)
|
||||
.set(HotHiddenDangerInspection::getLastRejectReason, auditConclusion)
|
||||
.set(HotHiddenDangerInspection::getLastRejectTime, auditDate)
|
||||
.set(HotHiddenDangerInspection::getLastRejectById, bo.getApproverId())
|
||||
.set(HotHiddenDangerInspection::getLastRejectByName, bo.getApproverName())
|
||||
);
|
||||
bo.setAuditConclusion(auditConclusion);
|
||||
saveRejectHistory(original, bo, nextRejectCount, auditDate);
|
||||
flowService.audit(
|
||||
bo.getTaskId(),
|
||||
false,
|
||||
auditConclusion,
|
||||
LoginHelper.getBusinessUserId()
|
||||
);
|
||||
}
|
||||
|
||||
private boolean shouldStartAuditFlow(HotHiddenDangerInspection original) {
|
||||
if (original == null || StringUtils.isNotBlank(original.getInstanceId())) {
|
||||
return false;
|
||||
}
|
||||
Long status = original.getStatus();
|
||||
return status == null || status == 0L || status == 1L || "REJECTED".equalsIgnoreCase(original.getFlowStatus());
|
||||
}
|
||||
|
||||
private Long buildNextSubmitVersion(HotHiddenDangerInspection original) {
|
||||
if (original == null || original.getSubmitVersion() == null || original.getSubmitVersion() < 1L) {
|
||||
return 1L;
|
||||
}
|
||||
return original.getSubmitVersion() + 1L;
|
||||
}
|
||||
|
||||
private String normalizeAuditResult(HotHiddenDangerInspectionBo bo) {
|
||||
if (StringUtils.isNotBlank(bo.getAuditResult())) {
|
||||
return bo.getAuditResult().trim().toUpperCase();
|
||||
}
|
||||
if (bo.getAuditHasDanger() != null && bo.getAuditHasDanger() == 0L) {
|
||||
return "PASS";
|
||||
}
|
||||
return "REJECT";
|
||||
}
|
||||
|
||||
private void saveRejectHistory(HotHiddenDangerInspection original, HotHiddenDangerInspectionBo bo, Long auditRound, Date auditDate) {
|
||||
HotHiddenDangerInspectionAuditHistory history = new HotHiddenDangerInspectionAuditHistory();
|
||||
history.setInspectionId(original.getId());
|
||||
history.setCompanyId(original.getCompanyId());
|
||||
history.setPlanId(original.getPlanId());
|
||||
history.setProjectName(original.getProjectName());
|
||||
history.setProjectId(original.getProjectId());
|
||||
history.setProjectType(original.getProjectType());
|
||||
history.setSubmitVersion(original.getSubmitVersion() == null ? 1L : original.getSubmitVersion());
|
||||
history.setAuditRound(auditRound);
|
||||
history.setAuditResult("REJECT");
|
||||
history.setRejectReason(bo.getAuditConclusion());
|
||||
history.setAuditDate(auditDate);
|
||||
history.setApproverId(bo.getApproverId());
|
||||
history.setApproverName(bo.getApproverName());
|
||||
history.setApproverSignImgUrl(bo.getApproverSignImgUrl());
|
||||
history.setAuditHasDanger(bo.getAuditHasDanger());
|
||||
history.setSubmitSnapshotJson(buildSubmitSnapshotJson(original));
|
||||
history.setCheckContentJson(original.getCheckContentJson());
|
||||
history.setDangerDesc(original.getDangerDesc());
|
||||
history.setAttachmentUrl(original.getAttachmentUrl());
|
||||
history.setSignImgUrl(original.getSignImgUrl());
|
||||
history.setCheckerId(original.getCheckerId());
|
||||
history.setCheckerName(original.getCheckerName());
|
||||
history.setCheckDate(original.getCheckDate());
|
||||
historyMapper.insert(history);
|
||||
}
|
||||
|
||||
private String buildSubmitSnapshotJson(HotHiddenDangerInspection original) {
|
||||
Map<String, Object> snapshot = new LinkedHashMap<>();
|
||||
snapshot.put("inspectionId", original.getId());
|
||||
snapshot.put("companyId", original.getCompanyId());
|
||||
snapshot.put("planId", original.getPlanId());
|
||||
snapshot.put("projectName", original.getProjectName());
|
||||
snapshot.put("projectId", original.getProjectId());
|
||||
snapshot.put("projectType", original.getProjectType());
|
||||
snapshot.put("submitVersion", original.getSubmitVersion());
|
||||
snapshot.put("checkContentJson", original.getCheckContentJson());
|
||||
snapshot.put("dangerDesc", original.getDangerDesc());
|
||||
snapshot.put("attachmentUrl", original.getAttachmentUrl());
|
||||
snapshot.put("signImgUrl", original.getSignImgUrl());
|
||||
snapshot.put("checkerId", original.getCheckerId());
|
||||
snapshot.put("checkerName", original.getCheckerName());
|
||||
snapshot.put("checkDate", original.getCheckDate());
|
||||
return JSONUtil.toJsonStr(snapshot);
|
||||
}
|
||||
|
||||
private List<HotHiddenDangerInspectionAuditHistoryVo> queryRejectHistoryList(Long inspectionId) {
|
||||
return historyMapper.selectVoList(
|
||||
Wrappers.<HotHiddenDangerInspectionAuditHistory>lambdaQuery()
|
||||
.eq(HotHiddenDangerInspectionAuditHistory::getInspectionId, inspectionId)
|
||||
.eq(HotHiddenDangerInspectionAuditHistory::getIsDeleted, 0L)
|
||||
.orderByDesc(HotHiddenDangerInspectionAuditHistory::getAuditRound)
|
||||
.orderByDesc(HotHiddenDangerInspectionAuditHistory::getCreateTime)
|
||||
);
|
||||
}
|
||||
|
||||
private void fillTaskId(HotHiddenDangerInspectionVo vo, String userId) {
|
||||
if (vo == null || StringUtils.isBlank(userId)) {
|
||||
return;
|
||||
}
|
||||
String taskId = null;
|
||||
if (StringUtils.isNotBlank(vo.getInstanceId())) {
|
||||
taskId = flowService.getTaskId(vo.getInstanceId(), userId);
|
||||
}
|
||||
if (StringUtils.isBlank(taskId) && vo.getId() != null) {
|
||||
taskId = flowService.getTaskIdByBusinessId("HIDDEN_DANGER_CHECK", String.valueOf(vo.getId()), userId);
|
||||
}
|
||||
vo.setTaskId(taskId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user