heheng
2025-10-17 506c54af9412e0aeeab3e73d52c7cafe1cca0d00
功能改造
已修改3个文件
40 ■■■■■ 文件已修改
gkhy-system/src/main/java/com/gkhy/system/domain/DailySafetyInspection.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gkhy-system/src/main/java/com/gkhy/system/service/impl/DailySafetyInspectionServiceImpl.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gkhy-system/src/main/java/com/gkhy/system/domain/DailySafetyInspection.java
@@ -118,6 +118,10 @@
    @TableField("create_by")
    private String createBy;
    @ApiModelProperty("创建者id")
    @TableField("create_by_id")
    private Long createById;
    @ApiModelProperty("创建时间")
    @TableField("create_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@@ -127,6 +131,10 @@
    @TableField("update_by")
    private String updateBy;
    @ApiModelProperty("更新者id")
    @TableField("update_by_id")
    private Long updateById;
    @ApiModelProperty("更新时间")
    @TableField("update_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
gkhy-system/src/main/java/com/gkhy/system/service/impl/DailySafetyInspectionServiceImpl.java
@@ -49,6 +49,14 @@
    @Override
    public List<DailySafetyInspection> selectDailySafetyInspectionList(DailySafetyInspection inspection) {
        boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId());
        if (!admin){
            boolean sysAdmin = SecurityUtils.hasRole(Constants.SYS_ADMIN);
            boolean placeSafetyOfficer = SecurityUtils.hasRole(Constants.PLACE_SAFETY_OFFICER);
            if (!(sysAdmin || placeSafetyOfficer)) {
                inspection.setCreateById(SecurityUtils.getUserId());
            }
        }
        return dailySafetyInspectionMapper.getDailySafetyInspectionList(inspection);
    }
@@ -72,10 +80,12 @@
        if (inspection.getId() == null) {
            inspection.setCreateTime(LocalDateTime.now());
            inspection.setCreateBy(SecurityUtils.getUsername());
            inspection.setCreateById(SecurityUtils.getUserId());
            i = dailySafetyInspectionMapper.insert(inspection);
        } else {
            inspection.setUpdateTime(LocalDateTime.now());
            inspection.setUpdateBy(SecurityUtils.getUsername());
            inspection.setUpdateById(SecurityUtils.getUserId());
            i = dailySafetyInspectionMapper.updateById(inspection);
        }
        if (i > 0){
@@ -115,7 +125,7 @@
        return dailySafetyInspectionMapper.update(new DailySafetyInspection(),
                new LambdaUpdateWrapper<DailySafetyInspection>().eq(DailySafetyInspection::getId, id)
                        .set(DailySafetyInspection::getDelFlag, Constants.FAIL).set(DailySafetyInspection::getUpdateTime, LocalDateTime.now())
                        .set(DailySafetyInspection::getUpdateBy, SecurityUtils.getUsername()));
                        .set(DailySafetyInspection::getUpdateBy, SecurityUtils.getUsername()).set(DailySafetyInspection::getUpdateById, SecurityUtils.getUserId()));
    }
    @Override
@@ -131,4 +141,21 @@
        }
        return dailySafetyInspectionMapper.getCheckCount(deptId);
    }
    private void checkPer(){
        boolean admin = SecurityUtils.isAdmin(SecurityUtils.getUserId());
        if (!admin){
            boolean sysAdmin = SecurityUtils.hasRole(Constants.SYS_ADMIN);
            if (!sysAdmin){
                throw new RuntimeException("没有权限");
            }
            boolean placeSafetyOfficer = SecurityUtils.hasRole(Constants.PLACE_SAFETY_OFFICER);
            if (!placeSafetyOfficer){
                throw new RuntimeException("没有权限");
            }
        }
    }
}
gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml
@@ -66,6 +66,9 @@
<!--        <if test="researchGroup != null ">-->
<!--            and a.research_group = #{researchGroup}-->
<!--        </if>-->
        <if test="createById != null ">
            and a.create_by_id = #{createById}
        </if>
        <if test="checkType != null ">
            and a.check_type = #{checkType}
        </if>