2f30a1eef17fc47851bf1c412ba127d0eaa12ce6..5b190f997a5d04cc09f38becb5447cdf6babc473
2023-07-19 zhangfeng
Merge branch 'master' of https://sinanoaq.cn:8888/r/hazardInvestigationSyst...
5b190f 对比 | 目录
2023-07-19 zhangfeng
用户以及要素部分修改
2019d3 对比 | 目录
2023-07-19 郑永安
params
a70a85 对比 | 目录
2023-07-18 郑永安
要素树
196431 对比 | 目录
已修改20个文件
530 ■■■■ 文件已修改
src/main/java/com/gk/hotwork/Controller/ElementManagementController.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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/ElementManagement.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Domain/ElementTree.java 23 ●●●●● 补丁 | 查看 | 原始文档 | 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/ElementManagementMapper.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/SafetyInspectionItemMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/mybatis/ElementManagementMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | 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/ElementManagementService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/SafetyInspectionItemService.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/ServiceImpl/ElementManagementImpl.java 120 ●●●● 补丁 | 查看 | 原始文档 | 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/ElementManagementController.java
@@ -57,6 +57,33 @@
        List<ElementTree> elementTreeList = elementManagementService.getElementTree();
        return success(elementTreeList);
    }
    @ApiOperation("获取检查导则要素树")
    @PostMapping("/getMenuType1Tree")
    public Msg getMenuType1Tree() {
        List<ElementTree> elementTreeList = elementManagementService.getMenuType1Tree();
        return success(elementTreeList);
    }
    @ApiOperation("获取安全标准化要素树")
    @PostMapping("/getMenuType2Tree")
    public Msg getMenuType2Tree() {
        List<ElementTree> elementTreeList = elementManagementService.getMenuType2Tree();
        return success(elementTreeList);
    }
    @ApiOperation("根据所选要素级别获取上级要素列表")
    @ApiImplicitParams({ @ApiImplicitParam(name = "type",value = "当前要素级别")})
    @PostMapping("/getSuperElement")
    public Msg getSuperElement(@RequestBody JSONObject jsonObject) {
        Integer type = Integer.valueOf(jsonObject.get("type")==null?"0":jsonObject.get("type").toString());
        List<ElementManagement> list = elementManagementService.getSuperElement(type-1);
        return success(list);
    }
    @ApiOperation("/新增")
    @PostMapping("/add")
@@ -65,7 +92,9 @@
            @ApiImplicitParam(name = "type",value = "要素级别"),
            @ApiImplicitParam(name = "parentId",value = "父级要素"),
            @ApiImplicitParam(name = "remark",value = "要素备注"),
            @ApiImplicitParam(name = "menuType",value = "检查导则"),
            @ApiImplicitParam(name = "point",value = "得分"),
            @ApiImplicitParam(name = "weight",value = "权重")
    })
    public Msg add(@RequestBody ElementManagement param) {
        elementManagementService.addOne(param, getUser());
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/ElementManagement.java
@@ -7,7 +7,6 @@
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@TableName("element_management")
public class ElementManagement implements Serializable {
@@ -17,10 +16,14 @@
    /** 要素名称  name **/
    private String name;
    /** 要素级别  type  0:A级要素 1:B级要素**/
    /** 要素级别  type  0:一级要素,1:二级要素,2:三级要素**/
    private Integer type;
    /** 导则类型  menu_type(1:检查导则(标准)管理;2: 安全标准化管理) **/
    private Integer menuType;
    /** 父要素id  parent_id **/
    /** 父要素id  parent_id **/
    private Long parentId;
    /** 要素备注  remark **/
@@ -117,6 +120,14 @@
    }
    public Integer getMenuType() {
        return menuType;
    }
    public void setMenuType(Integer menuType) {
        this.menuType = menuType;
    }
    public String getName() {
        return name;
    }
src/main/java/com/gk/hotwork/Domain/ElementTree.java
@@ -19,14 +19,35 @@
    /** 标签  label **/
    private String label;
    /** 是否是叶节点 **/
    private boolean isLeaf;
    /** 值  value **/
    private Long value;
    /** 父级ID **/
    private Long pid;
    /** 子节点 **/
    private List<ElementTree> children;
    public Long getPid() {
        return pid;
    }
    public String getLabel() {
    public void setPid(Long pid) {
        this.pid = pid;
    }
    public boolean isLeaf() {
        return isLeaf;
    }
    public void setLeaf(boolean isLeaf) {
        this.isLeaf = isLeaf;
    }
    public String getLabel() {
        return label;
    }
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/ElementManagementMapper.java
@@ -13,10 +13,12 @@
@Repository
public interface ElementManagementMapper extends BaseMapper<ElementManagement> {
    IPage<ElementManagement> selectPages(Page<ElementManagement> page, Map<String, Object> params);
    IPage<ElementManagement> selectPages(Page<ElementManagement> page,@Param("params") Map<String, Object> params);
    List<ElementManagement> getParentElement();
    List<ElementManagement> getElementByType(@Param("type") Integer type);
    List<Map<String,Object>> getElementTree();
}
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/ElementManagementMapper.xml
@@ -17,7 +17,7 @@
    <result column="remark" property="remark" jdbcType="VARCHAR" />
    <result column="point" property="point" jdbcType="VARCHAR" />
    <result column="weight" property="weight" />
    <result column="menu_type" property="menuType" jdbcType="VARCHAR"/>
  </resultMap>
  <select id="selectPages" resultMap="BaseResultMap">
    select a.*,
@@ -37,5 +37,14 @@
  <select id="getElementByType" resultMap="BaseResultMap">
    select *  from element_management where valid_flag = 1 and type = #{type}
  </select>
  <select id="getElementTree" resultType="java.util.Map">
      select DISTINCT t.label,t.mt,t.type,t.pid,t.value,(case when (t.keyw is null and t.type>0) then  1 else  0 end ) as isLeaf from(
    select t1.mt,t1.label,t1.type,t1.value,t1.pid,t2.label as keyw
    from (select name as label,menu_type as mt,type,id as value,parent_id as pid from element_management WHERE valid_flag=1) t1  left join (select name as label,type,id as value,      parent_id as pid from element_management WHERE valid_flag=1) t2
    on t1.value=t2.pid) t
  </select>
</mapper>
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/ElementManagementService.java
@@ -42,4 +42,12 @@
    List<ElementTree> getElementTree();
    List<ElementManagement> getSuperElement(Integer type);
    List<ElementTree> getMenuType1Tree();
    List<ElementTree> getMenuType2Tree();
}
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/ElementManagementImpl.java
@@ -37,7 +37,6 @@
        return elementManagementMapper.selectPages(page,filter);
    }
    /**
    * @Description: 新增
    */
@@ -88,42 +87,93 @@
        return elementManagementMapper.getElementByType(0);
    }
    public List<ElementTree> getChindrenTree(List<Map<String,Object>> list,Long pid){
        List<ElementTree> elementTreeList = new ArrayList<ElementTree>();
        for (Map<String,Object> e : list) {
            if(e.get("pid")!=null && pid.toString().equals(e.get("pid").toString())){
                ElementTree elementTree=new ElementTree();
                elementTree.setType(Integer.valueOf(e.get("type").toString()));
                elementTree.setLabel(e.get("label").toString());
                elementTree.setValue(Long.valueOf(e.get("value").toString()));
                elementTree.setLeaf(e.get("isLeaf").toString().equals("1")?true:false);
                if(elementTree.isLeaf()){
                    elementTree.setChildren(new ArrayList<ElementTree>());
                    elementTreeList.add(elementTree);
                }else{
                    elementTree.setChildren(getChindrenTree(list,elementTree.getValue()));
                    elementTreeList.add(elementTree);
                }
            }
        }
        return elementTreeList;
    }
    @Override
    public List<ElementTree> getElementTree() {
        List<ElementTree> elementTreeList = new ArrayList<>();
        List<ElementTree> returnTree = new ArrayList<>();
        List<Map<String,Object>> list = elementManagementMapper.getElementTree(); //读取元素配置
        for (Map<String, Object> map : list) {
            if(map.get("pid")==null){ //一级要素
                ElementTree elementTree=new ElementTree();
                elementTree.setType(Integer.valueOf(map.get("type").toString()));
                elementTree.setLabel(map.get("label").toString());
                elementTree.setValue(Long.valueOf(map.get("value").toString()));
                elementTree.setLeaf(map.get("isLeaf").toString().equals("1")?true:false);
                elementTree.setChildren(getChindrenTree(list,Long.valueOf(map.get("value").toString())));
                returnTree.add(elementTree);
            }else{
                continue;
            }
        }
        List<ElementManagement> list1 = elementManagementMapper.getElementByType(0);
        List<ElementManagement> list2 = elementManagementMapper.getElementByType(1);
        if (CollectionUtils.isNotEmpty(list1)){
            for (ElementManagement elementManagement : list1){
                ElementTree elementTree=new ElementTree();
                elementTree.setType(0);
                elementTree.setLabel(elementManagement.getName());
                elementTree.setValue(elementManagement.getId());
                elementTreeList.add(elementTree);
            }
        }
        if (CollectionUtils.isNotEmpty(list2)) {
            for (int i = 0; i < list2.size(); i++) {
                for (int j = 0; j < elementTreeList.size(); j++) {
                    if (list2.get(i).getParentId().equals(elementTreeList.get(j).getValue())) {
                        if (CollectionUtils.isEmpty(elementTreeList.get(j).getChildren())) {
                            //如果为空 则new一个出来
                            elementTreeList.get(j).setChildren(new ArrayList<>());
                        }
                        ElementTree elementTree = new ElementTree();
                        elementTree.setType(1);
                        elementTree.setLabel(list2.get(i).getName());
                        elementTree.setValue(list2.get(i).getId());
                        elementTreeList.get(j).getChildren().add(elementTree);
                    }
                }
            }
        }
        return elementTreeList;
        return returnTree;
    }
    @Override
    public List<ElementTree> getMenuType1Tree() {
        List<ElementTree> returnTree = new ArrayList<>();
        List<Map<String,Object>> list = elementManagementMapper.getElementTree(); //读取元素配置
        for (Map<String, Object> map : list) {
            if(map.get("pid")==null && "1".equals(map.get("mt").toString())){ //一级要素,MenuType1
                ElementTree elementTree=new ElementTree();
                elementTree.setType(Integer.valueOf(map.get("type").toString()));
                elementTree.setLabel(map.get("label").toString());
                elementTree.setValue(Long.valueOf(map.get("value").toString()));
                elementTree.setLeaf(map.get("isLeaf").toString().equals("1")?true:false);
                elementTree.setChildren(getChindrenTree(list,Long.valueOf(map.get("value").toString())));
                returnTree.add(elementTree);
            }else{
                continue;
            }
        }
        return returnTree;
    }
    @Override
    public List<ElementTree> getMenuType2Tree() {
        List<ElementTree> returnTree = new ArrayList<>();
        List<Map<String,Object>> list = elementManagementMapper.getElementTree(); //读取元素配置
        for (Map<String, Object> map : list) {
            if(map.get("pid")==null && "2".equals(map.get("mt").toString())){ //一级要素,MenuType2
                ElementTree elementTree=new ElementTree();
                elementTree.setType(Integer.valueOf(map.get("type").toString()));
                elementTree.setLabel(map.get("label").toString());
                elementTree.setValue(Long.valueOf(map.get("value").toString()));
                elementTree.setLeaf(map.get("isLeaf").toString().equals("1")?true:false);
                elementTree.setChildren(getChindrenTree(list,Long.valueOf(map.get("value").toString())));
                returnTree.add(elementTree);
            }else{
                continue;
            }
        }
        return returnTree;
    }
    /**
     * 查询验证
@@ -163,4 +213,10 @@
            if (count > 0) throw new BusinessException("当前A级要素仍然有已绑定的B级要素,无法删除");
        }
    }
    @Override
    public List<ElementManagement> getSuperElement(Integer type) {
        return elementManagementMapper.getElementByType(type);
    }
}
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);