zhangfeng
2023-07-19 2019d3ea4088eae51b5d52a2f6245841deb26781
用户以及要素部分修改
已修改13个文件
316 ■■■■ 文件已修改
src/main/java/com/gk/hotwork/Controller/SafetyInspectionItemController.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Controller/UserController.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Domain/SafetyInspectionItem.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Domain/SafetySelfInspectionItem.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Domain/UserInfo.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Domain/Vo/UserVo.java 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/SafetyInspectionItemMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyInspectionItemMapper.xml 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/mybatis/SafetySelfInspectionMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/mybatis/UserInfoMapper.xml 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/SafetyInspectionItemService.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetyInspectionItemImpl.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetySelfInspectionImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Controller/SafetyInspectionItemController.java
@@ -42,6 +42,19 @@
        IPage page = safetyInspectionItemService.selectPage(new Page<>(pageIndex, pageSize), filterObject.getFilter(), getUser());
        return success(page);
    }
    @ApiOperation("根据B级要素id获取分页数据")
    @PostMapping("/page/c")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageIndex",value = "当前页码"),
            @ApiImplicitParam(name = "pageSize",value = "每页行数"),
            @ApiImplicitParam(name = "element_c",value = "B要素的id"),
    })
    public Msg selectCPage(@RequestBody FilterObject filterObject) {
        Integer pageIndex = filterObject.getPageIndex();
        Integer pageSize = filterObject.getPageSize();
        IPage page = safetyInspectionItemService.selectCPage(new Page<>(pageIndex, pageSize), filterObject.getFilter(), getUser());
        return success(page);
    }
    @ApiOperation("/A级要素下面的检查项")
    @PostMapping("/infoElementA")
@@ -60,6 +73,7 @@
    @ApiImplicitParams({
            @ApiImplicitParam(name = "elementA",value = "A级要素id"),
            @ApiImplicitParam(name = "elementB",value = "B级要素id"),
            @ApiImplicitParam(name = "elementC",value = "C级要素id"),
            @ApiImplicitParam(name = "standardization_requirements",value = "标准化要求"),
            @ApiImplicitParam(name = "enterprise_standard",value = "企业达标标准"),
            @ApiImplicitParam(name = "review_method",value = "评审方法"),
@@ -77,6 +91,7 @@
            @ApiImplicitParam(name = "id",value = "id"),
            @ApiImplicitParam(name = "elementA",value = "A级要素id"),
            @ApiImplicitParam(name = "elementB",value = "B级要素id"),
            @ApiImplicitParam(name = "elementC",value = "C级要素id"),
            @ApiImplicitParam(name = "standardization_requirements",value = "标准化要求"),
            @ApiImplicitParam(name = "enterprise_standard",value = "企业达标标准"),
            @ApiImplicitParam(name = "review_method",value = "评审方法"),
src/main/java/com/gk/hotwork/Controller/UserController.java
@@ -141,7 +141,7 @@
        return msg;
    }
    @GetMapping("/company/user/list")
    @ApiOperation(value = "获取企业用户数据",response = Msg.class)
    @ApiOperation(value = "获取企业用户数据-分页",response = Msg.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageIndex",value = "当前页码"),
            @ApiImplicitParam(name = "pageSize",value = "每页行数"),
@@ -181,14 +181,14 @@
            condition.put("job",job.trim());
        }
        condition.put("roleId",35l);
        pageInfo.setCondition(condition);
        userService.selectCompanyUserDataGrid(pageInfo);
        msg.setResult(pageInfo);
        return msg;
    }
    @GetMapping("/supervise/user/list")
    @ApiOperation(value = "获取监管用户数据",response = Msg.class)
    @ApiOperation(value = "获取监管用户数据-分页",response = Msg.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageIndex",value = "当前页码"),
            @ApiImplicitParam(name = "pageSize",value = "每页行数"),
@@ -233,7 +233,7 @@
        if(StringUtils.isNotBlank(userInfoCurrent.getCounty())){
            condition.put("county", userInfoCurrent.getCounty());
        }
        condition.put("roleId",38l);
        pageInfo.setCondition(condition);
        userService.selectSuperviseUserDataGrid(pageInfo);
        msg.setResult(pageInfo);
@@ -241,7 +241,7 @@
    }
    @GetMapping("/expert/user/list")
    @ApiOperation(value = "获取监管用户数据",response = Msg.class)
    @ApiOperation(value = "获取专家用户数据-分页",response = Msg.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageIndex",value = "当前页码"),
            @ApiImplicitParam(name = "pageSize",value = "每页行数"),
@@ -276,7 +276,7 @@
            condition.put("idcard",idcard.trim());
        }
        condition.put("roleId",36l);
        pageInfo.setCondition(condition);
        userService.selectExpertUserDataGrid(pageInfo);
        msg.setResult(pageInfo);
@@ -566,7 +566,7 @@
        userInfo.setProfessionalLevel(professionalLevel);
        userInfo.setJob(jsonObject.getString("job"));
        userInfo.setStatus((byte)1);
        userInfo.setType(3);
        userInfo.setType(4);
        userInfo.setCreatedby(getUser().getRealname());
        userInfo.setRealname(realname);
        userInfo.setCreateddate(new Date());
@@ -630,12 +630,14 @@
        }
        String password = jsonObject.getString("password");
        String PW_PATTERN = "(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[~!@#$%^&*_.]).{8,}";
        if (!password.matches(PW_PATTERN)){
            msg.setCode(ErrorCode.ERROR_10004.getCode());
            msg.setMessage("密码必须8位以上,并且包含大小写字母、数字、特殊符号三种以上");
            return msg;
        }else {
            userInfo.setPassword(MD5Utils.encode(password));
        if (StringUtils.isNotBlank(password)){
            if (!password.matches(PW_PATTERN)){
                msg.setCode(ErrorCode.ERROR_10004.getCode());
                msg.setMessage("密码必须8位以上,并且包含大小写字母、数字、特殊符号三种以上");
                return msg;
            }else {
                userInfo.setPassword(MD5Utils.encode(password));
            }
        }
        String username = jsonObject.getString("username");
        if (StringUtils.isNotBlank(username) && username.length() == 11){
@@ -688,6 +690,12 @@
            msg.setMessage("专业不存在");
            return msg;
        }
        List<UserInfo> userInfoExist = userService.selectUserInfo(userInfo.getId(),userInfo.getUsername());
        if (userInfoExist.size() > 0){
            msg.setCode(ErrorCode.ERROR_10004.getCode());
            msg.setMessage("用户名重复");
            return msg;
        }
        userInfo.setCompany(jsonObject.getString("company"));
        userInfo.setEmail(jsonObject.getString("email"));
@@ -695,7 +703,6 @@
        userInfo.setProfessionalLevel(professionalLevel);
        userInfo.setJob(jsonObject.getString("job"));
        userInfo.setStatus((byte)1);
        userInfo.setType(3);
        userInfo.setCreatedby(getUser().getRealname());
        userInfo.setRealname(realname);
        userInfo.setCreateddate(new Date());
@@ -703,19 +710,14 @@
        userInfo.setLastmodifieddate(new Date());
        userInfo.setIsdel((byte)0);
        userInfo.setIsupload((byte)0);
        List<UserInfo> userInfoExist = userService.selectUserInfo(null,userInfo.getUsername());
        if (userInfoExist.size() > 0){
            msg.setCode(ErrorCode.ERROR_10004.getCode());
            msg.setMessage("用户名重复");
            return msg;
        }
        int userSize = userService.selectUserSize();
        int sli = (userSize + 1) % sliceSize;
        userInfo.setSlice(sli + "");
        if (sli == 0)
            userInfo.setSlice(sliceSize + "");
        userService.save(userInfo);
        userService.updateById(userInfo);
        return msg;
    }
    /**
@@ -976,6 +978,7 @@
            msg.setMessage("省(自治区)不能为空");
            return msg;
        }
        String city = jsonObject.getString("city");
        if (executiveLevel == 2 && StringUtils.isBlank(city)){
            msg.setCode(ErrorCode.ERROR_10004.getCode());
@@ -992,8 +995,13 @@
        }else {
            userInfo.setCounty(county);
        }
        //非超管 或者 管理员
        if(!userInfoCurrent.getType().equals(1) && !userInfoCurrent.getType().equals(2)){
        if(userInfoCurrent.getType().equals(3) || userInfoCurrent.getType().equals(4)){
            msg.setCode(ErrorCode.ERROR_70001.getCode());
            msg.setMessage("专家或企业用户无权限新增监管用户信息");
            return msg;
        }
        //管理员(监管)
        if(userInfoCurrent.getType().equals(2)){
            //判断当前用户是否有权限新增其管辖下监管机构用户
            Integer currentUserExLevl = userInfoCurrent.getExecutiveLevel();
            if(currentUserExLevl < executiveLevel){
@@ -1074,7 +1082,7 @@
        userInfo.setCompany(companyName);
        userInfo.setJob(jsonObject.getString("job"));
        userInfo.setStatus((byte)1);
        userInfo.setType(3);
        userInfo.setType(2);
        userInfo.setCreatedby(getUser().getRealname());
        userInfo.setRealname(realname);
        userInfo.setCreateddate(new Date());
@@ -1109,11 +1117,11 @@
     * @return
     */
    @PostMapping("/put/supervise/user")
    @ApiOperation(value = "修改企业用户数据",response = Msg.class)
    @ApiOperation(value = "修改监管用户数据",response = Msg.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "用户id",required = true),
            @ApiImplicitParam(name = "username",value = "手机号",required = true),
            @ApiImplicitParam(name = "password",value = "密码",required = true),
            @ApiImplicitParam(name = "password",value = "密码"),
            @ApiImplicitParam(name = "email",value = "邮箱"),
            @ApiImplicitParam(name = "job",value = "职务"),
            @ApiImplicitParam(name = "realname",value = "姓名"),
@@ -1162,8 +1170,14 @@
            return msg;
        }
        userInfo.setId(id);
        //非超管、 管理员 、自己可以修改
        if((!userInfoCurrent.getType().equals(1)) && (!userInfoCurrent.getType().equals(2)) && (!id .equals(userInfoCurrent.getId()))){
        if(userInfoCurrent.getType().equals(3) || userInfoCurrent.getType().equals(4)){
            msg.setCode(ErrorCode.ERROR_70001.getCode());
            msg.setMessage("专家或企业用户无权限新增监管用户信息");
            return msg;
        }
        //监管用户 、自己要验证
        if(userInfoCurrent.getType().equals(2) && (!id .equals(userInfoCurrent.getId()))){
            //判断当前用户是否有权限新增其管辖下监管机构用户
            Integer currentUserExLevl = userInfoCurrent.getExecutiveLevel();
            if(currentUserExLevl < executiveLevel){
@@ -2644,7 +2658,7 @@
     * 获取专家用户列表
     */
    @GetMapping("/expert/list")
    @ApiOperation(value = "获取监管用户数据",response = Msg.class)
    @ApiOperation(value = "获取专家用户数据",response = Msg.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "realname",value = "姓名"),
    })
src/main/java/com/gk/hotwork/Domain/SafetyInspectionItem.java
@@ -1,9 +1,6 @@
package com.gk.hotwork.Domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import java.io.Serializable;
import java.util.Date;
@@ -19,6 +16,10 @@
    /** B级要素id  element_b  **/
    private Long elementB;
    /** B级要素id  element_c  **/
    @TableField(updateStrategy = FieldStrategy.NOT_NULL)
    private Long elementC;
    /** 标准化要求  standardization_requirements **/
    private String standardizationRequirements;
@@ -39,6 +40,10 @@
    @TableField(exist = false)
    /** B级要素名称   **/
    private String elementBName;
    @TableField(exist = false)
    /** C级要素名称   **/
    private String elementCName;
    @TableField(exist = false)
    /** 扣分项集合   **/
@@ -65,6 +70,21 @@
    /** 最后更新人  update_by **/
    private String updateBy;
    public String getElementCName() {
        return elementCName;
    }
    public void setElementCName(String elementCName) {
        this.elementCName = elementCName;
    }
    public Long getElementC() {
        return elementC;
    }
    public void setElementC(Long elementC) {
        this.elementC = elementC;
    }
    /**   主键id  id   **/
    public Long getId() {
src/main/java/com/gk/hotwork/Domain/SafetySelfInspectionItem.java
@@ -33,6 +33,13 @@
    /** B级要素名称   **/
    @TableField(exist = false)
    private String elementBName;
    /** C级要素名称   **/
    @TableField(exist = false)
    private String elementCName;
    @TableField(exist = false)
    private Long elementC;
    /** A级要素   **/
    @TableField(exist = false)
    private Integer elementA;
@@ -42,6 +49,7 @@
    /** B级要素   **/
    @TableField(exist = false)
    private Integer elementB;
    /** B级要素   **/
    @TableField(exist = false)
    private Integer point;
@@ -87,6 +95,21 @@
    /** 最后更新人  update_by **/
    private String updateBy;
    public String getElementCName() {
        return elementCName;
    }
    public void setElementCName(String elementCName) {
        this.elementCName = elementCName;
    }
    public Long getElementC() {
        return elementC;
    }
    public void setElementC(Long elementC) {
        this.elementC = elementC;
    }
    /**   主键id  id   **/
    public Long getId() {
src/main/java/com/gk/hotwork/Domain/UserInfo.java
@@ -106,7 +106,7 @@
    private Byte isdel;
    /**
     * # 1超级管理员,2管理员,3普通用户
     * # 1超级管理员,2监管用户,3企业用户,4专家用户
     **/
    private Integer type;
src/main/java/com/gk/hotwork/Domain/Vo/UserVo.java
@@ -39,10 +39,90 @@
    private String roleSign;
    private String province;
    private String city;
    private String county;
    /**
     * 行政级别 1-省(自治区) 2-地(市、州) 3-区/县
     */
    private Integer executiveLevel;
    /**
     * 专业方向id
     */
    private Long specialityId;
    /**
     * 专业等级(1初级,2中级,3高级,4其他)
     */
    private Integer professionalLevel;
    private CompanyInfo companyInfo;
    private SpecialityInfo specialityInfo;
    @Override
    public String getProvince() {
        return province;
    }
    @Override
    public void setProvince(String province) {
        this.province = province;
    }
    @Override
    public String getCity() {
        return city;
    }
    @Override
    public void setCity(String city) {
        this.city = city;
    }
    @Override
    public String getCounty() {
        return county;
    }
    @Override
    public void setCounty(String county) {
        this.county = county;
    }
    @Override
    public Long getSpecialityId() {
        return specialityId;
    }
    @Override
    public void setSpecialityId(Long specialityId) {
        this.specialityId = specialityId;
    }
    @Override
    public Integer getProfessionalLevel() {
        return professionalLevel;
    }
    @Override
    public void setProfessionalLevel(Integer professionalLevel) {
        this.professionalLevel = professionalLevel;
    }
    @Override
    public Integer getExecutiveLevel() {
        return executiveLevel;
    }
    @Override
    public void setExecutiveLevel(Integer executiveLevel) {
        this.executiveLevel = executiveLevel;
    }
    public SpecialityInfo getSpecialityInfo() {
        return specialityInfo;
    }
src/main/java/com/gk/hotwork/Mapper/SafetyInspectionItemMapper.java
@@ -18,4 +18,8 @@
    List<SafetyInspectionItem> infoElementA(@Param("id") Long id);
    SafetyInspectionItem getById(@Param("id")Long id);
    void updateSafetyInspectionItem(@Param("param") SafetyInspectionItem param);
    IPage<SafetyInspectionItem> selectCPages(Page<SafetyInspectionItem> page, Map<String, Object> params);
}
src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyInspectionItemMapper.xml
@@ -18,6 +18,7 @@
    <result column="veto" property="veto" jdbcType="VARCHAR" />
    <result column="element_a_name" property="elementAName" jdbcType="VARCHAR" />
    <result column="element_b_name" property="elementBName" jdbcType="VARCHAR" />
    <result column="element_c_name" property="elementCName" jdbcType="VARCHAR" />
  </resultMap>
  <select id="selectPages" resultMap="BaseResultMap">
@@ -29,14 +30,27 @@
    left join element_management as c on a.element_b = c.id and c.valid_flag = 1
    where a.valid_flag = 1 and a.element_b= #{params.elementB}
  </select>
  <select id="selectCPages" resultMap="BaseResultMap">
    select a.*,
           b.name element_a_name,
           c.name element_b_name,
           d.name element_c_name
    from safety_inspection_item as a
           left join element_management as b on a.element_a = b.id and b.valid_flag = 1
           left join element_management as c on a.element_b = c.id and c.valid_flag = 1
           left join element_management as d on a.element_c = d.id and d.valid_flag = 1
    where a.valid_flag = 1 and a.element_c= #{params.elementC}
  </select>
  <select id="infoElementA" resultMap="BaseResultMap">
    select a.*,
    b.name element_a_name,
    c.name element_b_name
           b.name element_a_name,
           c.name element_b_name,
           d.name element_c_name
    from safety_inspection_item as a
    left join element_management as b on a.element_a = b.id and b.valid_flag = 1
    left join element_management as c on a.element_b = c.id and c.valid_flag = 1
           left join element_management as b on a.element_a = b.id and b.valid_flag = 1
           left join element_management as c on a.element_b = c.id and c.valid_flag = 1
           left join element_management as d on a.element_c = d.id and d.valid_flag = 1
    where a.valid_flag = 1 and a.element_a= #{id}
  </select>
@@ -44,10 +58,12 @@
  <select id="getById" resultMap="BaseResultMap">
    select a.*,
    b.name element_a_name,
    c.name element_b_name
    c.name element_b_name,
    d.name element_c_name
    from safety_inspection_item as a
    left join element_management as b on a.element_a = b.id and b.valid_flag = 1
    left join element_management as c on a.element_b = c.id and c.valid_flag = 1
    left join element_management as d on a.element_c = d.id and d.valid_flag = 1
    where a.valid_flag = 1 and a.id= #{id}
  </select>
src/main/java/com/gk/hotwork/Mapper/mybatis/SafetySelfInspectionMapper.xml
@@ -25,6 +25,7 @@
    from safety_self_inspection as a
    left join user as b on a.inspector = b.id and b.isdel = 0
    LEFT JOIN userroles as c on b.id = c.userid
    left join company as co on a.checked_company_id = co.id
    where a.valid_flag = 1
    <if test="params.inspectionName != null  and params.inspectionName != ''">
      and a.inspection_name like concat("%",#{params.inspectionName},"%")
@@ -47,6 +48,15 @@
    <if test="params.inspectionEndTime != null and params.inspectionEndTime != ''" >
      and a.inspection_time <![CDATA[ <= ]]> #{params.inspectionEndTime}
    </if>
    <if test="params.province != null and params.province != ''" >
      and co.province = #{params.province}
    </if>
    <if test="params.city != null and params.city != ''" >
      and co.city = #{params.city}
    </if>
    <if test="params.area != null and params.area != ''" >
      and co.area = #{params.area}
    </if>
    order by a.create_time desc
  </select>
src/main/java/com/gk/hotwork/Mapper/mybatis/UserInfoMapper.xml
@@ -65,6 +65,11 @@
    <result column="crossy" property="crossY" jdbcType="DECIMAL" />
    <result column="issecurityofficer" property="issecurityofficer" jdbcType="TINYINT" />
    <result column="updateat" property="updateat" jdbcType="TIMESTAMP" />
    <result column="executive_level" property="executiveLevel" jdbcType="INTEGER" />
    <result column="province" property="province" jdbcType="VARCHAR" />
    <result column="city" property="city" jdbcType="VARCHAR" />
    <result column="county" property="county" jdbcType="VARCHAR" />
    <result column="professional_level" property="professionalLevel" jdbcType="INTEGER" />
    <association property="companyInfo" javaType="com.gk.hotwork.Domain.CompanyInfo">
      <result column="company_id" property="id"  />
      <result column="company" property="company"  />
@@ -187,7 +192,7 @@
    left join userroles as r on r.userid = `user`.id
    <where>
        `user`.status = 1
        and  user.type != 1
        and  user.type = 3
      <if test="record.username != null and record.username !=''">
        and user.username like concat ('%',#{record.username,jdbcType=VARCHAR},'%')
      </if>
@@ -244,7 +249,7 @@
    left join userroles as r on r.userid = `user`.id
    <where>
      `user`.status = 1
      and  user.type != 1
      and  user.type = 2
      <if test="record.username != null and record.username !=''">
        and user.username like concat ('%',#{record.username,jdbcType=VARCHAR},'%')
      </if>
@@ -314,7 +319,7 @@
    left join speciality as s on s.id = `user`.speciality_id
    <where>
      `user`.status = 1
      and  user.type != 1
      and  user.type = 4
      <if test="record.username != null and record.username !=''">
        and user.username like concat ('%',#{record.username,jdbcType=VARCHAR},'%')
      </if>
src/main/java/com/gk/hotwork/Service/SafetyInspectionItemService.java
@@ -15,7 +15,7 @@
    * @Description: 分页
    */
    IPage<SafetyInspectionItem> selectPage(Page<SafetyInspectionItem> page, Map<String, Object> filter, UserInfo user);
    IPage<SafetyInspectionItem> selectCPage(Page<SafetyInspectionItem> page, Map<String, Object> filter, UserInfo user);
    /**
    * @Description: 新增
@@ -36,4 +36,6 @@
    List<SafetyInspectionItem> infoElementA(Long id, UserInfo user);
    SafetyInspectionItem info(Long id, UserInfo user);
}
src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetyInspectionItemImpl.java
@@ -3,14 +3,12 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gk.hotwork.Domain.EmergencyPlanFile;
import com.gk.hotwork.Domain.SafetyInspectionItem;
import com.gk.hotwork.Domain.*;
import com.gk.hotwork.Domain.Exception.BusinessException;
import com.gk.hotwork.Domain.SafetyInspectionItemDeduction;
import com.gk.hotwork.Domain.UserInfo;
import com.gk.hotwork.Domain.Utils.StringUtils;
import com.gk.hotwork.Mapper.SafetyInspectionItemDeductionMapper;
import com.gk.hotwork.Mapper.SafetyInspectionItemMapper;
import com.gk.hotwork.Service.ElementManagementService;
import com.gk.hotwork.Service.SafetyInspectionItemService;
import org.apache.commons.collections4.CollectionUtils;
import org.checkerframework.checker.units.qual.C;
@@ -32,12 +30,27 @@
    @Autowired
    private SafetyInspectionItemDeductionMapper safetyInspectionItemDeductionMapper;
    @Autowired
    private ElementManagementService elementManagementService;
    /**
    * @Description: 分页
    */
    @Override
    public IPage<SafetyInspectionItem> selectPage(Page<SafetyInspectionItem> page, Map<String, Object> filter, UserInfo user) {
        IPage<SafetyInspectionItem> res = safetyInspectionItemMapper.selectPages(page,filter);
        if (CollectionUtils.isNotEmpty(res.getRecords())){
            for (int i = 0 ; i < res.getRecords().size(); i++){
                List<SafetyInspectionItemDeduction> fileList = safetyInspectionItemDeductionMapper.getBySafetyInspectionItemId(res.getRecords().get(i).getId());
                res.getRecords().get(i).setDeductionList(fileList);
            }
        }
        return res;
    }
    @Override
    public IPage<SafetyInspectionItem> selectCPage(Page<SafetyInspectionItem> page, Map<String, Object> filter, UserInfo user) {
        IPage<SafetyInspectionItem> res = safetyInspectionItemMapper.selectCPages(page,filter);
        if (CollectionUtils.isNotEmpty(res.getRecords())){
            for (int i = 0 ; i < res.getRecords().size(); i++){
                List<SafetyInspectionItemDeduction> fileList = safetyInspectionItemDeductionMapper.getBySafetyInspectionItemId(res.getRecords().get(i).getId());
@@ -90,7 +103,7 @@
        String username = user.getRealname();
        param.setUpdateTime(date);
        param.setUpdateBy(username);
        this.updateById(param);
        safetyInspectionItemMapper.updateSafetyInspectionItem(param);
        //更新扣分项表
        List<SafetyInspectionItemDeduction> oldList = safetyInspectionItemDeductionMapper.getBySafetyInspectionItemId(param.getId());
src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetySelfInspectionImpl.java
@@ -8,7 +8,9 @@
import com.gk.hotwork.Domain.Exception.BusinessException;
import com.gk.hotwork.Domain.Utils.StringUtils;
import com.gk.hotwork.Mapper.*;
import com.gk.hotwork.Service.CompanyService;
import com.gk.hotwork.Service.SafetySelfInspectionService;
import com.gk.hotwork.Service.UserService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -34,16 +36,29 @@
    private SafetySelfInspectionItemDeductionMapper safetySelfInspectionItemDeductionMapper;
    @Autowired
    private SafetyInspectionItemDeductionMapper safetyInspectionItemDeductionMapper;
    @Autowired
    private CompanyService companyService;
    /**
     * @Description: 分页
     */
    @Override
    public IPage<SafetySelfInspection> selectPage(Page<SafetySelfInspection> page, Map<String, Object> filter, UserInfo user) {
        Integer type = user.getType();
        if (!type.equals(1) || !type.equals(2)) {
        //普通用户
        if (type.equals(3)) {
            Long companyid = user.getCompanyid();
            filter.put("companyid",companyid);
        }
        //监管用户
        if (type.equals(2)) {
            Long companyid = user.getCompanyid();
            //获取企业信息
            CompanyInfo companyInfo = companyService.getById(companyid);
            filter.put("province",companyInfo.getProvince());
            filter.put("city",companyInfo.getCity());
            filter.put("area",companyInfo.getArea());
        }
        IPage<SafetySelfInspection> res = safetySelfInspectionMapper.selectPages(page, filter);
        List<SafetySelfInspection> records = res.getRecords();
        if (CollectionUtils.isNotEmpty(records)){
@@ -73,6 +88,7 @@
     * @Description: 新增
     */
    @Override
    @Transactional
    public void addOne(SafetySelfInspection param, UserInfo user) {
        requiredVerification(param);