heheng
2025-09-12 3b109477ba6bd8dce0f61eb75248e603e584d8af
功能改造
已添加1个文件
已修改11个文件
154 ■■■■■ 文件已修改
gkhy-admin/src/main/java/com/gkhy/web/controller/safety/DailySafetyInspectionController.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gkhy-admin/src/main/java/com/gkhy/web/controller/system/SysDeptController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gkhy-system/src/main/java/com/gkhy/system/domain/DailySafetyInspection.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gkhy-system/src/main/java/com/gkhy/system/domain/vo/DeptVo.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gkhy-system/src/main/java/com/gkhy/system/mapper/DailySafetyInspectionMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gkhy-system/src/main/java/com/gkhy/system/mapper/SysDeptMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gkhy-system/src/main/java/com/gkhy/system/service/DailySafetyInspectionService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gkhy-system/src/main/java/com/gkhy/system/service/ISysDeptService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gkhy-system/src/main/java/com/gkhy/system/service/impl/DailySafetyInspectionServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gkhy-system/src/main/java/com/gkhy/system/service/impl/SysDeptServiceImpl.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gkhy-system/src/main/resources/mapper/system/SysDeptMapper.xml 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gkhy-admin/src/main/java/com/gkhy/web/controller/safety/DailySafetyInspectionController.java
@@ -70,4 +70,12 @@
        return toAjax(dailySafetyInspectionService.deleteDailySafetyInspection(id));
    }
    @GetMapping("/getCheckCount")
    @ApiOperation(value = "25号之后查询是否提交安全检查大于0提交")
    public AjaxResult getCheckCount()
    {
        return AjaxResult.success(dailySafetyInspectionService.getCheckCount());
    }
}
gkhy-admin/src/main/java/com/gkhy/web/controller/system/SysDeptController.java
@@ -1,6 +1,10 @@
package com.gkhy.web.controller.system;
import java.util.Date;
import java.util.List;
import com.gkhy.system.domain.vo.DeptVo;
import io.swagger.annotations.*;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -29,6 +33,7 @@
 */
@RestController
@RequestMapping("/system/dept")
@Api(tags = "部门管理")
public class SysDeptController extends BaseController
{
    @Autowired
@@ -57,6 +62,17 @@
        return success(depts);
    }
    @GetMapping("/getDeptCheckData")
    @ApiOperation(value = "部门统计安全检查数据")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "searchDate", dataType = "date", required = false, value = "searchDate"),
    })
    public AjaxResult getDeptData(Date searchDate)
    {
        List<DeptVo> deptData = deptService.selectDeptData(searchDate);
        return success(deptData);
    }
    /**
     * 根据部门编号获取详细信息
     */
gkhy-system/src/main/java/com/gkhy/system/domain/DailySafetyInspection.java
@@ -7,6 +7,7 @@
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
@@ -62,6 +63,12 @@
    @ApiModelProperty("被检查部门/研究组名称")
    private String researchGroupName;
    @ApiModelProperty(value = "检查类型 1综合检查、2部门检查、3实验室自查、4专项检查",required = true)
    @TableField("check_type")
    @NotNull(message = "检查类型不能为空")
    private Integer checkType;
    @ApiModelProperty(value = "检查内容",required = true)
    @TableField("check_content")
    @NotBlank(message = "检查内容不能为空")
@@ -77,20 +84,23 @@
    @NotBlank(message = "整改措施不能为空")
    private String rectificationMeasures;
    @ApiModelProperty("复查结果")
    @ApiModelProperty(value = "复查结果",required = true)
    @TableField("examination_results")
    @NotBlank(message = "复查结果不能为空")
    private String examinationResults;
    @ApiModelProperty("复查人员id")
    @ApiModelProperty(value = "复查人员id",required = true)
    @TableField("re_check_user_id")
    @NotNull(message = "复查人员id不能为空")
    private Long reCheckUserId;
    @ApiModelProperty("复查人员")
    @TableField("re_check_user")
    private String reCheckUser;
    @ApiModelProperty("复查时间")
    @ApiModelProperty(value = "复查时间",required = true)
    @TableField("re_check_date")
    @NotNull(message = "复查时间不能为空")
    private LocalDate reCheckDate;
    @ApiModelProperty("备注")
@@ -128,5 +138,15 @@
    @ApiModelProperty("参与检查人员id查询条件")
    private Long searchCheckUserId;
    @TableField(exist = false)
    @ApiModelProperty("查询条件检查开始时间")
    private Date checkBeginDate;
    @TableField(exist = false)
    @ApiModelProperty("查询条件检查结束时间")
    private Date checkEndDate;
    @ApiModelProperty(value = "是否存在隐患 0否1是")
    @TableField(exist = false)
    private Integer haveMainHazard;
}
gkhy-system/src/main/java/com/gkhy/system/domain/vo/DeptVo.java
对比新文件
@@ -0,0 +1,23 @@
package com.gkhy.system.domain.vo;
import com.gkhy.common.core.domain.entity.SysDept;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "部门安全检查统计")
public class DeptVo extends SysDept {
    @ApiModelProperty(value = "部门安全检查数量")
    private Integer checkCount;
    public Integer getCheckCount() {
        return checkCount;
    }
    public void setCheckCount(Integer checkCount) {
        this.checkCount = checkCount;
    }
}
gkhy-system/src/main/java/com/gkhy/system/mapper/DailySafetyInspectionMapper.java
@@ -20,4 +20,6 @@
    List<DailySafetyInspection> getDailySafetyInspectionList(DailySafetyInspection dailySafetyInspection);
    int getCheckCount(Long deptId);
}
gkhy-system/src/main/java/com/gkhy/system/mapper/SysDeptMapper.java
@@ -1,6 +1,9 @@
package com.gkhy.system.mapper;
import java.util.Date;
import java.util.List;
import com.gkhy.system.domain.vo.DeptVo;
import org.apache.ibatis.annotations.Param;
import com.gkhy.common.core.domain.entity.SysDept;
@@ -19,6 +22,8 @@
     */
    public List<SysDept> selectDeptList(SysDept dept);
    List<DeptVo> selectDeptData (Date beginDate);
    /**
     * 根据角色ID查询部门树信息
     * 
gkhy-system/src/main/java/com/gkhy/system/service/DailySafetyInspectionService.java
@@ -23,4 +23,6 @@
    int saveDailySafetyInspection(DailySafetyInspection  inspection);
    int deleteDailySafetyInspection(Long id);
    int getCheckCount();
}
gkhy-system/src/main/java/com/gkhy/system/service/ISysDeptService.java
@@ -1,8 +1,10 @@
package com.gkhy.system.service;
import java.util.Date;
import java.util.List;
import com.gkhy.common.core.domain.TreeSelect;
import com.gkhy.common.core.domain.entity.SysDept;
import com.gkhy.system.domain.vo.DeptVo;
/**
 * 部门管理 服务层
@@ -19,6 +21,9 @@
     */
    public List<SysDept> selectDeptList(SysDept dept);
    List<DeptVo> selectDeptData (Date beginDate);
    /**
     * 查询部门树结构信息
     * 
gkhy-system/src/main/java/com/gkhy/system/service/impl/DailySafetyInspectionServiceImpl.java
@@ -85,4 +85,10 @@
                        .set(DailySafetyInspection::getDelFlag, Constants.FAIL).set(DailySafetyInspection::getUpdateTime, LocalDateTime.now())
                        .set(DailySafetyInspection::getUpdateBy, SecurityUtils.getUsername()));
    }
    @Override
    public int getCheckCount() {
        Long deptId = SecurityUtils.getDeptId();
        return dailySafetyInspectionMapper.getCheckCount(deptId);
    }
}
gkhy-system/src/main/java/com/gkhy/system/service/impl/SysDeptServiceImpl.java
@@ -1,9 +1,10 @@
package com.gkhy.system.service.impl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import cn.hutool.core.date.DateUtil;
import com.gkhy.system.domain.vo.DeptVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gkhy.common.annotation.DataScope;
@@ -49,6 +50,20 @@
    }
    /**
     * 统计安全检查数据
     * @param beginDate
     * @return
     */
    @Override
    public List<DeptVo> selectDeptData(Date beginDate) {
        if (beginDate == null){
            beginDate = new Date();
        }
        List<DeptVo> deptVos = deptMapper.selectDeptData(beginDate);
        return deptVos;
    }
    /**
     * 查询部门树结构信息
     * 
     * @param dept 部门信息
gkhy-system/src/main/resources/mapper/system/DailySafetyInspectionMapper.xml
@@ -23,6 +23,7 @@
        <result column="create_time" property="createTime" />
        <result column="update_by" property="updateBy" />
        <result column="update_time" property="updateTime" />
        <result column="check_type" property="checkType" />
        <collection  property="dailySafetyInspectionUsers"   ofType="com.gkhy.system.domain.DailySafetyInspectionUser"  column="id = id" select="selectDailySafetyInspectionUsers" />
@@ -48,9 +49,29 @@
        <if test="researchGroup != null ">
            and a.research_group = #{researchGroup}
        </if>
        <if test="checkType != null ">
            and a.check_type = #{checkType}
        </if>
        <if test="checkBeginDate != null "><!-- 开始时间检索 -->
            AND date_format(a.check_date,'%Y%m%d') &gt;= date_format(#{checkBeginDate},'%Y%m%d')
        </if>
        <if test="checkEndDate != null "><!-- 结束时间检索 -->
            AND date_format(a.check_date,'%Y%m%d') &lt;= date_format(#{checkEndDate},'%Y%m%d')
        </if>
        <if test="haveMainHazard != null and haveMainHazard == 0 ">
            and (main_hazard = '无' or main_hazard = ' ')
        </if>
        <if test="haveMainHazard != null and haveMainHazard == 1 ">
            and (main_hazard != '无' and main_hazard != ' ')
        </if>
        <if test="searchCheckUserId != null ">
            and a.id in (select daily_safety_inspection_id from daily_safety_inspection_user where check_user_id = #{searchCheckUserId})
        </if>
        order by a.create_time desc
    </select>
    <select id="getCheckCount" parameterType="long" resultType="int">
        select count(*) from daily_safety_inspection where del_flag = 0 and research_group = #{deptId} and date_format(check_date,'%Y%m') = date_format(now(),'%Y%m')
    </select>
</mapper>
gkhy-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -22,6 +22,10 @@
        <result property="updateTime" column="update_time" />
    </resultMap>
    
    <resultMap id="SysDeptDataResult" type="com.gkhy.system.domain.vo.DeptVo" extends="SysDeptResult">
        <result property="checkCount" column="check_count" />
    </resultMap>
    <sql id="selectDeptVo">
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time 
        from sys_dept d
@@ -47,6 +51,21 @@
        order by d.parent_id, d.order_num
    </select>
    
    <select id="selectDeptData" parameterType="Date" resultMap="SysDeptDataResult">
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone,
               d.email, d.status, d.del_flag, d.create_by, d.create_time ,
               ( select count(*) from daily_safety_inspection where del_flag = 0 and research_group = dept_id and date_format(check_date,'%Y%m') = date_format(#{beginDate},'%Y%m')) check_count
        from sys_dept d
        where d.del_flag = '0'
        order by d.parent_id, d.order_num
    </select>
    <select id="selectDeptListByRoleId" resultType="Long">
        select d.dept_id
        from sys_dept d