施工产值,隐患整改
This commit is contained in:
@ -231,7 +231,7 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
|
|||||||
.select(SubConstructionUser::getId, SubConstructionUser::getSysUserId,
|
.select(SubConstructionUser::getId, SubConstructionUser::getSysUserId,
|
||||||
SubConstructionUser::getUserName, SubConstructionUser::getSfzNumber)
|
SubConstructionUser::getUserName, SubConstructionUser::getSfzNumber)
|
||||||
.eq(SubConstructionUser::getProjectId, projectId)
|
.eq(SubConstructionUser::getProjectId, projectId)
|
||||||
.eq( SubConstructionUser::getUserRole, "0")
|
.eq(SubConstructionUser::getUserRole, "0")
|
||||||
.list();
|
.list();
|
||||||
if (CollUtil.isEmpty(allUserList)) {
|
if (CollUtil.isEmpty(allUserList)) {
|
||||||
throw new ServiceException("项目下无施工人员");
|
throw new ServiceException("项目下无施工人员");
|
||||||
@ -271,7 +271,7 @@ public class SubConstructionUserFileServiceImpl extends ServiceImpl<SubConstruct
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CollUtil.isEmpty(constructionUserFileList)) {
|
if (CollUtil.isEmpty(constructionUserFileList)) {
|
||||||
return true;
|
throw new ServiceException("未找到施工人员文件");
|
||||||
}
|
}
|
||||||
// 9. 判断是否已经存在
|
// 9. 判断是否已经存在
|
||||||
List<Long> userIdList = constructionUserFileList.stream().map(SubConstructionUserFile::getUserId).toList();
|
List<Long> userIdList = constructionUserFileList.stream().map(SubConstructionUserFile::getUserId).toList();
|
||||||
|
|||||||
@ -230,7 +230,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
|||||||
try {
|
try {
|
||||||
decrypt = idCardEncryptorUtil.decrypt(decrypt);
|
decrypt = idCardEncryptorUtil.decrypt(decrypt);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("身份证解密失败");
|
log.warn("身份证解密失败:{}", vo.getUserName(), e);
|
||||||
}
|
}
|
||||||
subConstructionUserVo.setSfzNumber(decrypt);
|
subConstructionUserVo.setSfzNumber(decrypt);
|
||||||
return subConstructionUserVo;
|
return subConstructionUserVo;
|
||||||
@ -665,7 +665,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
|||||||
|
|
||||||
userProjectRelevancyService.deleteByUserId(constructionUser.getSysUserId());
|
userProjectRelevancyService.deleteByUserId(constructionUser.getSysUserId());
|
||||||
|
|
||||||
roleService.deleteRoleByUserIdAndProjectId(constructionUser.getSysUserId(),req.getProjectId());
|
roleService.deleteRoleByUserIdAndProjectId(constructionUser.getSysUserId(), req.getProjectId());
|
||||||
|
|
||||||
return this.update(lambdaUpdate);
|
return this.update(lambdaUpdate);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package org.dromara.out.domain.vo.outconstructionvalue;
|
package org.dromara.out.domain.vo.outconstructionvalue;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
@ -12,6 +13,7 @@ import java.math.BigDecimal;
|
|||||||
* @date 2025-12-01 10:09
|
* @date 2025-12-01 10:09
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
public class OutConstructionValueMatrixVo {
|
public class OutConstructionValueMatrixVo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package org.dromara.out.domain.vo.outconstructionvalue;
|
package org.dromara.out.domain.vo.outconstructionvalue;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
@ -12,6 +13,7 @@ import java.math.BigDecimal;
|
|||||||
* @date 2025-12-01 10:08
|
* @date 2025-12-01 10:08
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
public class OutConstructionValueProjectVo {
|
public class OutConstructionValueProjectVo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package org.dromara.out.domain.vo.outconstructionvalue;
|
package org.dromara.out.domain.vo.outconstructionvalue;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
@ -12,6 +13,7 @@ import java.math.BigDecimal;
|
|||||||
* @date 2025-12-01 10:08
|
* @date 2025-12-01 10:08
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
public class OutConstructionValueSubProjectVo {
|
public class OutConstructionValueSubProjectVo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package org.dromara.out.domain.vo.outconstructionvaluerange;
|
package org.dromara.out.domain.vo.outconstructionvaluerange;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
@ -12,6 +13,7 @@ import java.math.BigDecimal;
|
|||||||
* @date 2025-12-01 11:31
|
* @date 2025-12-01 11:31
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
public class OutConstructionValueRangeMatrixVo {
|
public class OutConstructionValueRangeMatrixVo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package org.dromara.out.domain.vo.outconstructionvaluerange;
|
package org.dromara.out.domain.vo.outconstructionvaluerange;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
@ -12,6 +13,7 @@ import java.math.BigDecimal;
|
|||||||
* @date 2025-12-01 11:30
|
* @date 2025-12-01 11:30
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
public class OutConstructionValueRangeProjectVo {
|
public class OutConstructionValueRangeProjectVo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package org.dromara.out.domain.vo.outconstructionvaluerange;
|
package org.dromara.out.domain.vo.outconstructionvaluerange;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
@ -12,6 +13,7 @@ import java.math.BigDecimal;
|
|||||||
* @date 2025-12-01 11:30
|
* @date 2025-12-01 11:30
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
public class OutConstructionValueRangeSubProjectVo {
|
public class OutConstructionValueRangeSubProjectVo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -333,21 +333,17 @@ public class OutConstructionValueServiceImpl extends ServiceImpl<OutConstruction
|
|||||||
lqw.le(bo.getEndDate() != null, OutConstructionValue::getReportDate, bo.getEndDate());
|
lqw.le(bo.getEndDate() != null, OutConstructionValue::getReportDate, bo.getEndDate());
|
||||||
lqw.eq(bo.getCreateBy() != null, OutConstructionValue::getCreateBy, bo.getCreateBy());
|
lqw.eq(bo.getCreateBy() != null, OutConstructionValue::getCreateBy, bo.getCreateBy());
|
||||||
// 新增根据 unit_type 查询的条件
|
// 新增根据 unit_type 查询的条件
|
||||||
if (StringUtils.isNotBlank(bo.getUnitType())) {
|
if (StringUtils.isNotBlank(bo.getUnitType()) || StringUtils.isNotBlank(bo.getProjectType())) {
|
||||||
LambdaQueryWrapper<PgsProgressCategory> categoryLqw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<PgsProgressCategory> categoryLqw = new LambdaQueryWrapper<>();
|
||||||
categoryLqw.select(PgsProgressCategory::getId);
|
categoryLqw.select(PgsProgressCategory::getId);
|
||||||
categoryLqw.eq(PgsProgressCategory::getUnitType, bo.getUnitType());
|
categoryLqw.eq(StringUtils.isNotBlank(bo.getUnitType()), PgsProgressCategory::getUnitType, bo.getUnitType());
|
||||||
categoryLqw.eq(bo.getMatrixId() != null, PgsProgressCategory::getMatrixId, bo.getMatrixId());
|
categoryLqw.eq(bo.getMatrixId() != null, PgsProgressCategory::getMatrixId, bo.getMatrixId());
|
||||||
categoryLqw.in(CollUtil.isNotEmpty(ids), PgsProgressCategory::getProjectId, ids);
|
categoryLqw.in(CollUtil.isNotEmpty(ids), PgsProgressCategory::getProjectId, ids);
|
||||||
if (StringUtils.isNotBlank(bo.getProjectType())) {
|
if (StringUtils.isNotBlank(bo.getProjectType())) {
|
||||||
if (bo.getProjectType().equals("1")) {
|
categoryLqw.in(bo.getProjectType().equals("1"), PgsProgressCategory::getRelevancyStructure,
|
||||||
categoryLqw.in(PgsProgressCategory::getRelevancyStructure,
|
PgsRelevancyStructureEnum.SUB_PROJECT.getValue(), PgsRelevancyStructureEnum.MATRIX.getValue());
|
||||||
PgsRelevancyStructureEnum.SUB_PROJECT.getValue(), PgsRelevancyStructureEnum.MATRIX.getValue());
|
categoryLqw.eq(bo.getProjectType().equals("2"), PgsProgressCategory::getRelevancyStructure, PgsRelevancyStructureEnum.MATRIX.getValue());
|
||||||
} else if (bo.getProjectType().equals("2")) {
|
|
||||||
categoryLqw.eq(PgsProgressCategory::getRelevancyStructure, PgsRelevancyStructureEnum.MATRIX.getValue());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
categoryLqw.eq(StringUtils.isNotBlank(bo.getProjectType()), PgsProgressCategory::getRelevancyStructure, bo.getProjectType());
|
|
||||||
List<PgsProgressCategory> progressCategories = pgsProgressCategoryService.list(categoryLqw);
|
List<PgsProgressCategory> progressCategories = pgsProgressCategoryService.list(categoryLqw);
|
||||||
if (CollUtil.isNotEmpty(progressCategories)) {
|
if (CollUtil.isNotEmpty(progressCategories)) {
|
||||||
List<Long> categoryIds = progressCategories.stream().map(PgsProgressCategory::getId).toList();
|
List<Long> categoryIds = progressCategories.stream().map(PgsProgressCategory::getId).toList();
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import jakarta.validation.constraints.NotNull;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
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.excel.utils.ExcelUtil;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
@ -17,6 +16,8 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
import org.dromara.safety.domain.bo.HazardHiddenDangerBo;
|
import org.dromara.safety.domain.bo.HazardHiddenDangerBo;
|
||||||
import org.dromara.safety.domain.bo.HazardHiddenDangerRectifyBo;
|
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.HazardHiddenDangerRectifyVo;
|
||||||
import org.dromara.safety.domain.vo.HazardHiddenDangerVo;
|
import org.dromara.safety.domain.vo.HazardHiddenDangerVo;
|
||||||
import org.dromara.safety.service.IHazardHiddenDangerRectifyService;
|
import org.dromara.safety.service.IHazardHiddenDangerRectifyService;
|
||||||
@ -83,14 +84,25 @@ public class HazardHiddenDangerRectifyController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改隐患整改情况
|
* 隐患整改
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("safety:hiddenDangerRectify:edit")
|
@SaCheckPermission("safety:hiddenDangerRectify:edit")
|
||||||
@Log(title = "隐患整改情况", businessType = BusinessType.UPDATE)
|
@Log(title = "隐患整改情况", businessType = BusinessType.UPDATE)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PutMapping()
|
@PutMapping("/rectification")
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody HazardHiddenDangerRectifyBo bo) {
|
public R<Void> rectification(@Validated @RequestBody HazardHiddenDangerRectifyRectificationReq req) {
|
||||||
return toAjax(hazardHiddenDangerRectifyService.updateByBo(bo));
|
return toAjax(hazardHiddenDangerRectifyService.rectification(req));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隐患复查
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("safety:hiddenDangerRectify:edit")
|
||||||
|
@Log(title = "隐患整改情况", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping("/review")
|
||||||
|
public R<Void> review(@Validated @RequestBody HazardHiddenDangerRectifyReviewReq req) {
|
||||||
|
return toAjax(hazardHiddenDangerRectifyService.review(req));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -37,7 +37,7 @@ public class HazardHiddenDangerRectify extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 整改次数
|
* 整改次数
|
||||||
*/
|
*/
|
||||||
private Long rectifyCount;
|
private Integer rectifyCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 整改人ID
|
* 整改人ID
|
||||||
@ -80,7 +80,7 @@ public class HazardHiddenDangerRectify extends BaseEntity {
|
|||||||
private LocalDateTime reviewTime;
|
private LocalDateTime reviewTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 复查状态(1待复查 2复查通过 3复查不通过)
|
* 复查状态(0待复查 1复查通过 2复查不通过)
|
||||||
*/
|
*/
|
||||||
private String reviewStatus;
|
private String reviewStatus;
|
||||||
|
|
||||||
|
|||||||
@ -38,12 +38,6 @@ public class HazardHiddenDangerRectifyBo extends BaseEntity {
|
|||||||
@NotNull(message = "关联隐患ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
@NotNull(message = "关联隐患ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||||
private Long hiddenDangerId;
|
private Long hiddenDangerId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 整改次数
|
|
||||||
*/
|
|
||||||
@NotNull(message = "整改次数不能为空", groups = {AddGroup.class, EditGroup.class})
|
|
||||||
private Long rectifyCount;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 整改人ID
|
* 整改人ID
|
||||||
*/
|
*/
|
||||||
@ -86,7 +80,7 @@ public class HazardHiddenDangerRectifyBo extends BaseEntity {
|
|||||||
private LocalDateTime reviewTime;
|
private LocalDateTime reviewTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 复查状态(1待复查 2复查通过 3复查不通过)
|
* 复查状态(0待复查 1复查通过 2复查不通过)
|
||||||
*/
|
*/
|
||||||
private String reviewStatus;
|
private String reviewStatus;
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import lombok.Data;
|
|||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lilemy
|
* @author lilemy
|
||||||
@ -40,8 +41,13 @@ public class HazardHiddenDangerRectifyReviewReq implements Serializable {
|
|||||||
private String reviewFiles;
|
private String reviewFiles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 复查状态(1待复查 2复查通过 3复查不通过)
|
* 复查状态(0待复查 1复查通过 2复查不通过)
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "请选择复查状态")
|
@NotBlank(message = "请选择复查状态")
|
||||||
private String reviewStatus;
|
private String reviewStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 整改期限
|
||||||
|
*/
|
||||||
|
private LocalDateTime rectificationDeadline;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,7 +45,7 @@ public class HazardHiddenDangerRectifyVo implements Serializable {
|
|||||||
* 整改次数
|
* 整改次数
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "整改次数")
|
@ExcelProperty(value = "整改次数")
|
||||||
private Long rectifyCount;
|
private Integer rectifyCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 整改人ID
|
* 整改人ID
|
||||||
@ -113,9 +113,9 @@ public class HazardHiddenDangerRectifyVo implements Serializable {
|
|||||||
private LocalDateTime reviewTime;
|
private LocalDateTime reviewTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 复查状态(1待复查 2复查通过 3复查不通过)
|
* 复查状态(0待复查 1复查通过 2复查不通过)
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "复查状态(1待复查 2复查通过 3复查不通过)", converter = ExcelDictConvert.class)
|
@ExcelProperty(value = "复查状态(0待复查 1复查通过 2复查不通过)", converter = ExcelDictConvert.class)
|
||||||
@ExcelDictFormat(dictType = "hazard_review_status")
|
@ExcelDictFormat(dictType = "hazard_review_status")
|
||||||
private String reviewStatus;
|
private String reviewStatus;
|
||||||
|
|
||||||
|
|||||||
@ -10,23 +10,29 @@ import org.dromara.common.core.utils.MapstructUtils;
|
|||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.safety.domain.HazardHiddenDanger;
|
import org.dromara.safety.domain.HazardHiddenDanger;
|
||||||
import org.dromara.safety.domain.HazardHiddenDangerRectify;
|
import org.dromara.safety.domain.HazardHiddenDangerRectify;
|
||||||
import org.dromara.safety.domain.bo.HazardHiddenDangerBo;
|
import org.dromara.safety.domain.bo.HazardHiddenDangerBo;
|
||||||
import org.dromara.safety.domain.bo.HazardHiddenDangerRectifyBo;
|
import org.dromara.safety.domain.bo.HazardHiddenDangerRectifyBo;
|
||||||
import org.dromara.safety.domain.dto.hiddendangerrectify.HazardHiddenDangerRectifyRectificationReq;
|
import org.dromara.safety.domain.dto.hiddendangerrectify.HazardHiddenDangerRectifyRectificationReq;
|
||||||
import org.dromara.safety.domain.dto.hiddendangerrectify.HazardHiddenDangerRectifyReviewReq;
|
import org.dromara.safety.domain.dto.hiddendangerrectify.HazardHiddenDangerRectifyReviewReq;
|
||||||
|
import org.dromara.safety.domain.enums.HseSafetyInspectionReviewTypeEnum;
|
||||||
import org.dromara.safety.domain.vo.HazardHiddenDangerRectifyVo;
|
import org.dromara.safety.domain.vo.HazardHiddenDangerRectifyVo;
|
||||||
import org.dromara.safety.domain.vo.HazardHiddenDangerVo;
|
import org.dromara.safety.domain.vo.HazardHiddenDangerVo;
|
||||||
import org.dromara.safety.domain.vo.RectifyTimesVo;
|
import org.dromara.safety.domain.vo.RectifyTimesVo;
|
||||||
import org.dromara.safety.mapper.HazardHiddenDangerRectifyMapper;
|
import org.dromara.safety.mapper.HazardHiddenDangerRectifyMapper;
|
||||||
import org.dromara.safety.service.IHazardHiddenDangerRectifyService;
|
import org.dromara.safety.service.IHazardHiddenDangerRectifyService;
|
||||||
import org.dromara.safety.service.IHazardHiddenDangerService;
|
import org.dromara.safety.service.IHazardHiddenDangerService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 隐患整改情况Service业务层处理
|
* 隐患整改情况Service业务层处理
|
||||||
@ -101,7 +107,6 @@ public class HazardHiddenDangerRectifyServiceImpl extends ServiceImpl<HazardHidd
|
|||||||
LambdaQueryWrapper<HazardHiddenDangerRectify> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<HazardHiddenDangerRectify> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.orderByDesc(HazardHiddenDangerRectify::getId);
|
lqw.orderByDesc(HazardHiddenDangerRectify::getId);
|
||||||
lqw.eq(bo.getHiddenDangerId() != null, HazardHiddenDangerRectify::getHiddenDangerId, bo.getHiddenDangerId());
|
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(bo.getRectifyUserId() != null, HazardHiddenDangerRectify::getRectifyUserId, bo.getRectifyUserId());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getRectifyDesc()), HazardHiddenDangerRectify::getRectifyDesc, bo.getRectifyDesc());
|
lqw.eq(StringUtils.isNotBlank(bo.getRectifyDesc()), HazardHiddenDangerRectify::getRectifyDesc, bo.getRectifyDesc());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getRectifyFiles()), HazardHiddenDangerRectify::getRectifyFiles, bo.getRectifyFiles());
|
lqw.eq(StringUtils.isNotBlank(bo.getRectifyFiles()), HazardHiddenDangerRectify::getRectifyFiles, bo.getRectifyFiles());
|
||||||
@ -151,13 +156,50 @@ public class HazardHiddenDangerRectifyServiceImpl extends ServiceImpl<HazardHidd
|
|||||||
* @return 是否整改成功
|
* @return 是否整改成功
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean rectification(HazardHiddenDangerRectifyRectificationReq req) {
|
public Boolean rectification(HazardHiddenDangerRectifyRectificationReq req) {
|
||||||
Long id = req.getId();
|
Long id = req.getId();
|
||||||
HazardHiddenDangerRectify oldRectify = this.getById(id);
|
HazardHiddenDangerRectify oldRectify = this.getById(id);
|
||||||
if (oldRectify == null) {
|
if (oldRectify == null) {
|
||||||
throw new ServiceException("未找到该数据");
|
throw new ServiceException("未找到该数据");
|
||||||
}
|
}
|
||||||
return null;
|
Long userId = LoginHelper.getUserId();
|
||||||
|
if (!oldRectify.getRectifyUserId().equals(userId)) {
|
||||||
|
throw new ServiceException("您没有权限修改该数据");
|
||||||
|
}
|
||||||
|
if (!oldRectify.getReviewStatus().equals(HseSafetyInspectionReviewTypeEnum.NOT_REVIEW.getValue())) {
|
||||||
|
throw new ServiceException("该数据已审核,请勿重复操作");
|
||||||
|
}
|
||||||
|
Long hiddenDangerId = oldRectify.getHiddenDangerId();
|
||||||
|
HazardHiddenDanger hiddenDanger = hazardHiddenDangerService.getById(hiddenDangerId);
|
||||||
|
if (hiddenDanger == null) {
|
||||||
|
throw new ServiceException("未找到该数据");
|
||||||
|
}
|
||||||
|
// 判断是否为最新的一条
|
||||||
|
Integer maxCount = this.lambdaQuery()
|
||||||
|
.eq(HazardHiddenDangerRectify::getHiddenDangerId, hiddenDangerId)
|
||||||
|
.select(HazardHiddenDangerRectify::getRectifyCount)
|
||||||
|
.orderByDesc(HazardHiddenDangerRectify::getRectifyCount)
|
||||||
|
.last("limit 1")
|
||||||
|
.one()
|
||||||
|
.getRectifyCount();
|
||||||
|
if (!Objects.equals(maxCount, oldRectify.getRectifyCount())) {
|
||||||
|
throw new ServiceException("请修改最新的一条整改记录");
|
||||||
|
}
|
||||||
|
HazardHiddenDangerRectify rectify = new HazardHiddenDangerRectify();
|
||||||
|
BeanUtils.copyProperties(req, rectify);
|
||||||
|
rectify.setRectifyTime(LocalDateTime.now());
|
||||||
|
boolean update = this.updateById(rectify);
|
||||||
|
if (!update) {
|
||||||
|
throw new ServiceException("数据修改失败");
|
||||||
|
}
|
||||||
|
// 修改隐患状态
|
||||||
|
hiddenDanger.setStatus(HazardHiddenDanger.REVIEW);
|
||||||
|
boolean update1 = hazardHiddenDangerService.updateById(hiddenDanger);
|
||||||
|
if (!update1) {
|
||||||
|
throw new ServiceException("数据修改失败");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -167,8 +209,77 @@ public class HazardHiddenDangerRectifyServiceImpl extends ServiceImpl<HazardHidd
|
|||||||
* @return 是否审核成功
|
* @return 是否审核成功
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean review(HazardHiddenDangerRectifyReviewReq req) {
|
public Boolean review(HazardHiddenDangerRectifyReviewReq req) {
|
||||||
return null;
|
Long id = req.getId();
|
||||||
|
String reviewStatus = req.getReviewStatus();
|
||||||
|
Long rectifyUserId = req.getRectifyUserId();
|
||||||
|
if (!reviewStatus.equals(HseSafetyInspectionReviewTypeEnum.PASS.getValue())
|
||||||
|
&& !reviewStatus.equals(HseSafetyInspectionReviewTypeEnum.UNPASS.getValue())) {
|
||||||
|
throw new ServiceException("请选择复查状态");
|
||||||
|
}
|
||||||
|
HazardHiddenDangerRectify oldRectify = this.getById(id);
|
||||||
|
if (oldRectify == null) {
|
||||||
|
throw new ServiceException("未找到该数据");
|
||||||
|
}
|
||||||
|
Long userId = LoginHelper.getUserId();
|
||||||
|
if (!oldRectify.getReviewUserId().equals(userId)) {
|
||||||
|
throw new ServiceException("您没有权限审核该数据");
|
||||||
|
}
|
||||||
|
Long hiddenDangerId = oldRectify.getHiddenDangerId();
|
||||||
|
// 判断是否为最新的一条
|
||||||
|
Integer maxCount = this.lambdaQuery()
|
||||||
|
.eq(HazardHiddenDangerRectify::getHiddenDangerId, hiddenDangerId)
|
||||||
|
.select(HazardHiddenDangerRectify::getRectifyCount)
|
||||||
|
.orderByDesc(HazardHiddenDangerRectify::getRectifyCount)
|
||||||
|
.last("limit 1")
|
||||||
|
.one()
|
||||||
|
.getRectifyCount();
|
||||||
|
if (!Objects.equals(maxCount, oldRectify.getRectifyCount())) {
|
||||||
|
throw new ServiceException("请审核最新的一条整改记录");
|
||||||
|
}
|
||||||
|
HazardHiddenDanger hiddenDanger = hazardHiddenDangerService.getById(hiddenDangerId);
|
||||||
|
if (hiddenDanger == null) {
|
||||||
|
throw new ServiceException("未找到该数据");
|
||||||
|
}
|
||||||
|
HazardHiddenDangerRectify rectify = new HazardHiddenDangerRectify();
|
||||||
|
BeanUtils.copyProperties(req, rectify);
|
||||||
|
rectify.setReviewTime(LocalDateTime.now());
|
||||||
|
synchronized (("hd_" + hiddenDangerId).intern()) {
|
||||||
|
boolean update = this.updateById(rectify);
|
||||||
|
if (!update) {
|
||||||
|
throw new ServiceException("数据修改失败");
|
||||||
|
}
|
||||||
|
// 修改隐患状态
|
||||||
|
if (reviewStatus.equals(HseSafetyInspectionReviewTypeEnum.PASS.getValue())) {
|
||||||
|
// 修改状态
|
||||||
|
hiddenDanger.setStatus(HazardHiddenDanger.CLOSED);
|
||||||
|
} else {
|
||||||
|
// 修改状态
|
||||||
|
hiddenDanger.setStatus(HazardHiddenDanger.RECTIFY);
|
||||||
|
LocalDateTime rectificationDeadline = req.getRectificationDeadline();
|
||||||
|
if (rectificationDeadline == null) {
|
||||||
|
throw new ServiceException("请选择整改期限");
|
||||||
|
}
|
||||||
|
// 设置新的整改期限
|
||||||
|
hiddenDanger.setRectifyTime(rectificationDeadline);
|
||||||
|
// 生成新的整改
|
||||||
|
HazardHiddenDangerRectify newRectify = new HazardHiddenDangerRectify();
|
||||||
|
newRectify.setHiddenDangerId(hiddenDangerId);
|
||||||
|
newRectify.setRectifyCount(maxCount + 1);
|
||||||
|
newRectify.setReviewUserId(rectify.getReviewUserId());
|
||||||
|
newRectify.setRectifyUserId(rectifyUserId != null ? rectifyUserId : oldRectify.getRectifyUserId());
|
||||||
|
boolean save = this.save(newRectify);
|
||||||
|
if (!save) {
|
||||||
|
throw new ServiceException("数据保存失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
boolean update1 = hazardHiddenDangerService.updateById(hiddenDanger);
|
||||||
|
if (!update1) {
|
||||||
|
throw new ServiceException("数据修改失败");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -70,12 +70,12 @@ public class HazardRuleNotifyObjectServiceImpl extends ServiceImpl<HazardRuleNot
|
|||||||
for (Map.Entry<String, List<HazardRuleNotifyObject>> entry : map.entrySet()) {
|
for (Map.Entry<String, List<HazardRuleNotifyObject>> entry : map.entrySet()) {
|
||||||
String key = entry.getKey();
|
String key = entry.getKey();
|
||||||
List<HazardRuleNotifyObject> value = entry.getValue();
|
List<HazardRuleNotifyObject> value = entry.getValue();
|
||||||
|
List<Long> ids = value.stream()
|
||||||
|
.map(HazardRuleNotifyObject::getNotifyId)
|
||||||
|
.toList();
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case "1": {
|
case "1" -> {
|
||||||
List<Long> userIds = value.stream()
|
List<SysUserVo> userVos = userService.selectUserByIds(ids, null);
|
||||||
.map(HazardRuleNotifyObject::getNotifyId)
|
|
||||||
.toList();
|
|
||||||
List<SysUserVo> userVos = userService.selectUserByIds(userIds, null);
|
|
||||||
Map<Long, String> userNameMap = userVos.stream()
|
Map<Long, String> userNameMap = userVos.stream()
|
||||||
.collect(Collectors.toMap(SysUserVo::getUserId, SysUserVo::getNickName, (k, v) -> k));
|
.collect(Collectors.toMap(SysUserVo::getUserId, SysUserVo::getNickName, (k, v) -> k));
|
||||||
List<HazardRuleNotifyObjectVo> vos = value.stream().map(v -> {
|
List<HazardRuleNotifyObjectVo> vos = value.stream().map(v -> {
|
||||||
@ -88,11 +88,8 @@ public class HazardRuleNotifyObjectServiceImpl extends ServiceImpl<HazardRuleNot
|
|||||||
}).toList();
|
}).toList();
|
||||||
voList.addAll(vos);
|
voList.addAll(vos);
|
||||||
}
|
}
|
||||||
case "2": {
|
case "2" -> {
|
||||||
List<Long> roleIds = value.stream()
|
List<SysRoleVo> roleVos = roleService.selectRoleByIds(ids);
|
||||||
.map(HazardRuleNotifyObject::getNotifyId)
|
|
||||||
.toList();
|
|
||||||
List<SysRoleVo> roleVos = roleService.selectRoleByIds(roleIds);
|
|
||||||
Map<Long, String> roleNameMap = roleVos.stream()
|
Map<Long, String> roleNameMap = roleVos.stream()
|
||||||
.collect(Collectors.toMap(SysRoleVo::getRoleId, SysRoleVo::getRoleName, (k, v) -> k));
|
.collect(Collectors.toMap(SysRoleVo::getRoleId, SysRoleVo::getRoleName, (k, v) -> k));
|
||||||
List<HazardRuleNotifyObjectVo> vos = value.stream().map(v -> {
|
List<HazardRuleNotifyObjectVo> vos = value.stream().map(v -> {
|
||||||
@ -105,11 +102,8 @@ public class HazardRuleNotifyObjectServiceImpl extends ServiceImpl<HazardRuleNot
|
|||||||
}).toList();
|
}).toList();
|
||||||
voList.addAll(vos);
|
voList.addAll(vos);
|
||||||
}
|
}
|
||||||
case "3": {
|
case "3" -> {
|
||||||
List<Long> deptIds = value.stream()
|
List<SysDeptVo> deptVos = deptService.selectDeptByIds(ids);
|
||||||
.map(HazardRuleNotifyObject::getNotifyId)
|
|
||||||
.toList();
|
|
||||||
List<SysDeptVo> deptVos = deptService.selectDeptByIds(deptIds);
|
|
||||||
Map<Long, String> deptNameMap = deptVos.stream()
|
Map<Long, String> deptNameMap = deptVos.stream()
|
||||||
.collect(Collectors.toMap(SysDeptVo::getDeptId, SysDeptVo::getDeptName, (k, v) -> k));
|
.collect(Collectors.toMap(SysDeptVo::getDeptId, SysDeptVo::getDeptName, (k, v) -> k));
|
||||||
List<HazardRuleNotifyObjectVo> vos = value.stream().map(v -> {
|
List<HazardRuleNotifyObjectVo> vos = value.stream().map(v -> {
|
||||||
@ -122,11 +116,8 @@ public class HazardRuleNotifyObjectServiceImpl extends ServiceImpl<HazardRuleNot
|
|||||||
}).toList();
|
}).toList();
|
||||||
voList.addAll(vos);
|
voList.addAll(vos);
|
||||||
}
|
}
|
||||||
case "4": {
|
case "4" -> {
|
||||||
List<Long> postIds = value.stream()
|
List<SysPostVo> postVos = postService.selectPostByIds(ids);
|
||||||
.map(HazardRuleNotifyObject::getNotifyId)
|
|
||||||
.toList();
|
|
||||||
List<SysPostVo> postVos = postService.selectPostByIds(postIds);
|
|
||||||
Map<Long, String> postNameMap = postVos.stream()
|
Map<Long, String> postNameMap = postVos.stream()
|
||||||
.collect(Collectors.toMap(SysPostVo::getPostId, SysPostVo::getPostName, (k, v) -> k));
|
.collect(Collectors.toMap(SysPostVo::getPostId, SysPostVo::getPostName, (k, v) -> k));
|
||||||
List<HazardRuleNotifyObjectVo> vos = value.stream().map(v -> {
|
List<HazardRuleNotifyObjectVo> vos = value.stream().map(v -> {
|
||||||
@ -139,8 +130,6 @@ public class HazardRuleNotifyObjectServiceImpl extends ServiceImpl<HazardRuleNot
|
|||||||
}).toList();
|
}).toList();
|
||||||
voList.addAll(vos);
|
voList.addAll(vos);
|
||||||
}
|
}
|
||||||
case null, default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return voList;
|
return voList;
|
||||||
|
|||||||
@ -169,6 +169,26 @@ public class HazardRuleServiceImpl extends ServiceImpl<HazardRuleMapper, HazardR
|
|||||||
*/
|
*/
|
||||||
private void validEntityBeforeSave(HazardRule entity) {
|
private void validEntityBeforeSave(HazardRule entity) {
|
||||||
//TODO 做一些数据校验,如唯一约束
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
Long id = entity.getId();
|
||||||
|
Long projectId = entity.getProjectId();
|
||||||
|
Integer hazardWeight = entity.getHazardWeight();
|
||||||
|
String hazardLevel = entity.getHazardLevel();
|
||||||
|
Long count = this.lambdaQuery()
|
||||||
|
.ne(id != null, HazardRule::getId, id)
|
||||||
|
.eq(HazardRule::getHazardWeight, hazardWeight)
|
||||||
|
.eq(HazardRule::getProjectId, projectId)
|
||||||
|
.count();
|
||||||
|
if (count > 0) {
|
||||||
|
throw new ServiceException("权重已存在", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
|
Long count1 = this.lambdaQuery()
|
||||||
|
.ne(id != null, HazardRule::getId, id)
|
||||||
|
.eq(HazardRule::getHazardLevel, hazardLevel)
|
||||||
|
.eq(HazardRule::getProjectId, projectId)
|
||||||
|
.count();
|
||||||
|
if (count1 > 0) {
|
||||||
|
throw new ServiceException("等级已存在", HttpStatus.ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user