heheng
2025-03-10 c0ae989839d8323974048b71f7dadc29a20a4b15
专家多选功能
已修改17个文件
已添加12个文件
1565 ■■■■ 文件已修改
src/main/java/com/gkhy/labRiskManage/api/controller/riskReport/RiskAssessPlanController.java 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/api/controller/riskReport/dto/repDto/AppointUserTypeReBO.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/api/controller/riskReport/dto/repDto/IdentificationUserInsertReqBO.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/api/controller/riskReport/dto/repDto/RiskAssessPlanInsertReqBO.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/api/controller/riskReport/dto/repDto/RiskAssessPlanUpdateReqBO.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/api/controller/riskReport/dto/respDto/RiskAssessQueryRespDTO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/application/account/dto/respDto/UserEvaluateRespDTO.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/application/account/dto/respDto/UserIdentityRespDTO.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/application/riskReport/dto/bo/RiskAssessPlanAppInsertBO.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/application/riskReport/dto/dto/RiskAssessAppQueryDTO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/application/riskReport/dto/dto/RiskAssessPlanAppQueryDTO.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/account/repository/jpa/UserRepository.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/account/service/UserDomainService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/account/service/impl/UserDomainServiceImpl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/riskReport/entity/RiskAssessPlan.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/riskReport/entity/RiskAssessPlanEvaluateUser.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/riskReport/entity/RiskAssessPlanIdentificationUser.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/riskReport/model/dto/AssessPlanQueryDTO.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/riskReport/model/dto/AssessQueryDTO.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/riskReport/model/dto/RiskAssessPlanQueryDTO.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/riskReport/repository/jpa/RiskAssessPlanEvaluateUserRepository.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/riskReport/repository/jpa/RiskAssessPlanIdentificationUserRepository.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/riskReport/service/RiskAssessPlanEvaluateUserService.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/riskReport/service/RiskAssessPlanIdentificationUserService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/riskReport/service/RiskAssessPlanService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/riskReport/service/impl/ReportRiskAssessInfoServiceImpl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/riskReport/service/impl/RiskAssessPlanEvaluateUserServiceImpl.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/riskReport/service/impl/RiskAssessPlanIdentificationUserServiceImpl.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/domain/riskReport/service/impl/RiskAssessPlanServiceImpl.java 1021 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/labRiskManage/api/controller/riskReport/RiskAssessPlanController.java
@@ -14,6 +14,7 @@
import com.gkhy.labRiskManage.commons.utils.BeanCopyUtils;
import com.gkhy.labRiskManage.domain.riskReport.model.dto.AssessPlanUpdateDTO;
import com.gkhy.labRiskManage.domain.riskReport.model.dto.FactorQueryDTO;
import com.gkhy.labRiskManage.domain.riskReport.service.RiskAssessPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
@@ -30,6 +31,9 @@
    @Autowired
    private RiskAccessAppService riskAccessAppService;
    @Autowired
    private RiskAssessPlanService riskAssessPlanService;;
    /**
     * 风险评估计划 - 插入
@@ -68,6 +72,24 @@
        result.setTotal(queryResult.getTotal());
        result.setCount(queryResult.getTotal().intValue());
        return result;
    }
    @PostMapping("/update/appoint")
    public Result appoint(@RequestBody AppointUserReBO appointUserReBO){
        Result result = new Result();
        result.setCode(ResultCode.OK);
        result.setMsg("已经重新指定专家");
        AssessPlanUpdateDTO assessPlanUpdateDTO = riskAccessAppService.appoint(getCurrentUserId(), appointUserReBO);
        if (ObjectUtils.isEmpty(assessPlanUpdateDTO)){
            result.setCode(ResultCode.NOT_OK);
            result.setMsg("重新指定专家失败");
            return result;
        }
        return result;
    }
@@ -354,15 +376,15 @@
    /**
     * 风险评估计划 - 重新指定专家
     */
    @PostMapping("/update/appoint")
    public Result appoint(@RequestBody AppointUserReBO appointUserReBO){
    @PostMapping("/update/appointNew")
    public Result appointNew(@RequestBody AppointUserTypeReBO appointUserReBO){
        Result result = new Result();
        result.setCode(ResultCode.OK);
        result.setMsg("已经重新指定专家");
        AssessPlanUpdateDTO assessPlanUpdateDTO = riskAccessAppService.appoint(getCurrentUserId(), appointUserReBO);
        if (ObjectUtils.isEmpty(assessPlanUpdateDTO)){
        int i = riskAssessPlanService.appointNew(getCurrentUserId(), appointUserReBO);
        if (i < 1){
            result.setCode(ResultCode.NOT_OK);
            result.setMsg("重新指定专家失败");
            return result;
@@ -370,6 +392,9 @@
        return result;
    }
    /**
     * 风险辨识与评价 - 查询
     */
src/main/java/com/gkhy/labRiskManage/api/controller/riskReport/dto/repDto/AppointUserTypeReBO.java
对比新文件
@@ -0,0 +1,19 @@
package com.gkhy.labRiskManage.api.controller.riskReport.dto.repDto;
import lombok.Data;
import java.util.List;
@Data
public class AppointUserTypeReBO {
    private Long riskAssessPlanId;
    /**
     * 1辨识专家2评价专家
     */
    private String userType;
    private List<Long> userIds;
}
src/main/java/com/gkhy/labRiskManage/api/controller/riskReport/dto/repDto/IdentificationUserInsertReqBO.java
对比新文件
@@ -0,0 +1,15 @@
package com.gkhy.labRiskManage.api.controller.riskReport.dto.repDto;
import lombok.Data;
@Data
public class IdentificationUserInsertReqBO {
    /**
     * 辨识专家
     */
    private String identificationUser;
    /**
     * 辨识专家id
     */
    private Long identificationUserId;
}
src/main/java/com/gkhy/labRiskManage/api/controller/riskReport/dto/repDto/RiskAssessPlanInsertReqBO.java
@@ -3,6 +3,7 @@
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
/**
 *
@@ -52,5 +53,18 @@
     */
    private Byte identificationMethod;
    /**
     * 辨识类型1线上专家2现场专家3线上+现场
     */
    private Byte identificationType;
    /**
     * 辨识专家
     */
    private List<Long> identificationUserInsert;
    /**
     * 评价专家
     */
    private List<Long> evaluateUserInsert;
}
src/main/java/com/gkhy/labRiskManage/api/controller/riskReport/dto/repDto/RiskAssessPlanUpdateReqBO.java
@@ -3,6 +3,7 @@
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
/**
 *
@@ -52,6 +53,14 @@
     */
    private Long evaluateUserId;
    /**
     * 辨识专家
     */
    private List<Long> identificationUserInsert;
    /**
     * 评价专家
     */
    private List<Long> evaluateUserInsert;
}
src/main/java/com/gkhy/labRiskManage/api/controller/riskReport/dto/respDto/RiskAssessQueryRespDTO.java
@@ -1,6 +1,8 @@
package com.gkhy.labRiskManage.api.controller.riskReport.dto.respDto;
import com.gkhy.labRiskManage.application.account.dto.respDto.UserEvaluateRespDTO;
import com.gkhy.labRiskManage.application.account.dto.respDto.UserIdentityRespDTO;
import com.gkhy.labRiskManage.domain.riskReport.model.dto.FactorQueryDTO;
import lombok.Data;
@@ -123,5 +125,7 @@
    private List<FactorQueryDTO> factorQueryDTOList;
    private List<UserEvaluateRespDTO> evaluateUsers;
    private List<UserIdentityRespDTO> identityUsers;
}
src/main/java/com/gkhy/labRiskManage/application/account/dto/respDto/UserEvaluateRespDTO.java
对比新文件
@@ -0,0 +1,21 @@
package com.gkhy.labRiskManage.application.account.dto.respDto;
import lombok.Data;
/**
 * @email 1603559716@qq.com
 * @author: zf
 * @date: 2023/5/4
 * @time: 10:16
 */
@Data
public class UserEvaluateRespDTO {
    /**
     * 评价专家id
     */
    private Long evaluateUserId;
    /**
     * 评价专家
     */
    private String evaluateUser;
}
src/main/java/com/gkhy/labRiskManage/application/account/dto/respDto/UserIdentityRespDTO.java
对比新文件
@@ -0,0 +1,21 @@
package com.gkhy.labRiskManage.application.account.dto.respDto;
import lombok.Data;
/**
 * @email 1603559716@qq.com
 * @author: zf
 * @date: 2023/5/4
 * @time: 10:16
 */
@Data
public class UserIdentityRespDTO {
    /**
     * 辨识专家
     */
    private String identificationUser;
    /**
     * 辨识专家id
     */
    private Long identificationUserId;
}
src/main/java/com/gkhy/labRiskManage/application/riskReport/dto/bo/RiskAssessPlanAppInsertBO.java
@@ -1,10 +1,12 @@
package com.gkhy.labRiskManage.application.riskReport.dto.bo;
import com.gkhy.labRiskManage.api.controller.riskReport.dto.repDto.IdentificationUserInsertReqBO;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
 *
@@ -55,5 +57,17 @@
     */
    private Byte identificationMethod;
    /**
     * 辨识类型1线上专家2现场专家3线上+现场
     */
    private Byte identificationType;
    private List<Long> identificationUserInsert;
    /**
     * 评价专家
     */
    private List<Long> evaluateUserInsert;
}
src/main/java/com/gkhy/labRiskManage/application/riskReport/dto/dto/RiskAssessAppQueryDTO.java
@@ -1,5 +1,7 @@
package com.gkhy.labRiskManage.application.riskReport.dto.dto;
import com.gkhy.labRiskManage.application.account.dto.respDto.UserEvaluateRespDTO;
import com.gkhy.labRiskManage.application.account.dto.respDto.UserIdentityRespDTO;
import com.gkhy.labRiskManage.domain.riskReport.model.dto.FactorQueryDTO;
import lombok.Data;
@@ -123,5 +125,7 @@
    private List<FactorQueryDTO> factorQueryDTOList;
    private List<UserEvaluateRespDTO> evaluateUsers;
    private List<UserIdentityRespDTO> identityUsers;
}
src/main/java/com/gkhy/labRiskManage/application/riskReport/dto/dto/RiskAssessPlanAppQueryDTO.java
@@ -1,6 +1,9 @@
package com.gkhy.labRiskManage.application.riskReport.dto.dto;
import com.gkhy.labRiskManage.application.account.dto.respDto.UserEvaluateRespDTO;
import com.gkhy.labRiskManage.application.account.dto.respDto.UserIdentityRespDTO;
import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentAndType;
import com.gkhy.labRiskManage.domain.riskReport.entity.RiskAssessPlanIdentificationUser;
import lombok.Data;
import java.math.BigDecimal;
@@ -168,8 +171,14 @@
     */
    private String process;
    /**
     * 辨识类型1线上专家2现场专家3线上+现场
     */
    private Byte identificationType;
    private List<UserEvaluateRespDTO> evaluateUsers;
    private List<UserIdentityRespDTO> identityUsers;
}
src/main/java/com/gkhy/labRiskManage/domain/account/repository/jpa/UserRepository.java
@@ -59,6 +59,10 @@
     */
    @Query(value = "select * from sys_user  where id = :evaluateUserId and status in (1,2)", nativeQuery = true)
    User getUserInfoByIdAndSellInfo(Long evaluateUserId);
    @Query(value = "select u from User u where u.id in :uidList and u.status in (1,2)")
    List<User> getUserInfoByIds(List<Long> uidList);
    @Query(value = "select u from User u where u.id = :uid and u.status in (1,2)")
    User getById(Long uid);
src/main/java/com/gkhy/labRiskManage/domain/account/service/UserDomainService.java
@@ -120,6 +120,9 @@
     */
    UserInfoDomainDTO getUserInfoByIdAndSellInfo(Long evaluateUserId, String info);
    List<UserInfoDomainDTO> getUserInfoByIds(List<Long> evaluateUserIds, String info);
    /**
     * 用户列表
     * @param pageQuery
src/main/java/com/gkhy/labRiskManage/domain/account/service/impl/UserDomainServiceImpl.java
@@ -626,6 +626,20 @@
        return BeanCopyUtils.copyBean(userInfo, UserInfoDomainDTO.class);
    }
    @Override
    public List<UserInfoDomainDTO> getUserInfoByIds(List<Long> evaluateUserIds, String info) {
        if (ObjectUtils.isEmpty(evaluateUserIds)){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "请求参数不能为空");
        }
        List<User> userInfoByIds = userRepository.getUserInfoByIds(evaluateUserIds);
        if (ObjectUtils.isEmpty(userInfoByIds)){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), info + "不存在,请检查是否输入有误或人员已被删除");
        }
        return BeanCopyUtils.copyBeanList(userInfoByIds, UserInfoDomainDTO.class);
    }
    /**
     * 清除REDIS缓存的用户数据
src/main/java/com/gkhy/labRiskManage/domain/riskReport/entity/RiskAssessPlan.java
@@ -2,6 +2,8 @@
import com.gkhy.labRiskManage.domain.basic.entity.BasicTip;
import lombok.Data;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.Where;
import javax.persistence.*;
@@ -9,6 +11,7 @@
import java.time.LocalDateTime;
import java.util.Date;
import java.io.Serializable;
import java.util.List;
/**
 *
@@ -96,6 +99,11 @@
     * 辨识方法:1-PHA;2-JHA;3-SCL;4-HAZOP;5-类比法
     */
    private Byte identificationMethod;
    /**
     * 辨识类型1线上专家2现场专家3线上+现场
     */
    private Byte identificationType;
    /**
     * 辨识专家
     */
@@ -161,7 +169,15 @@
     */
    private Byte manageLevel;
    @OneToMany(fetch = FetchType.EAGER,cascade = {CascadeType.REFRESH})
    @Fetch(FetchMode.SUBSELECT)
    @JoinColumn(name = "riskAssessPlanId",referencedColumnName = "id",insertable =false ,updatable = false)
    private List<RiskAssessPlanIdentificationUser> riskAssessPlanIdentificationUsers;
    @OneToMany(fetch = FetchType.EAGER,cascade = {CascadeType.REFRESH})
    @Fetch(FetchMode.SUBSELECT)
    @JoinColumn(name = "riskAssessPlanId",referencedColumnName = "id",insertable =false ,updatable = false)
    private List<RiskAssessPlanEvaluateUser> riskAssessPlanEvaluateUsers;
}
src/main/java/com/gkhy/labRiskManage/domain/riskReport/entity/RiskAssessPlanEvaluateUser.java
对比新文件
@@ -0,0 +1,58 @@
package com.gkhy.labRiskManage.domain.riskReport.entity;
import lombok.Data;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * 风险评估报告-评估专家
 */
@EntityListeners(AuditingEntityListener.class)
@Entity
@Table(name = "risk_assess_plan_evaluate_user")
@Data
@Where(clause = "delete_status = 0")
public class RiskAssessPlanEvaluateUser implements Serializable {
    private static final long serialVersionUID = -34775201914468215L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    /**
     * 报告id
     */
    private Long riskAssessPlanId;
    /**
     * 新建时间
     */
    private LocalDateTime createTime;
    /**
     * 修改时间
     */
    private LocalDateTime updateTime;
    /**
     * 最后修改人
     */
    private Long updateByUserId;
    /**
     * 新建人
     */
    private Long createByUserId;
    /**
     * 删除状态:0-正常;1-已删除
     */
    private Byte deleteStatus;
    /**
     * 评价专家id
     */
    private Long evaluateUserId;
    /**
     * 评价专家
     */
    private String evaluateUser;
}
src/main/java/com/gkhy/labRiskManage/domain/riskReport/entity/RiskAssessPlanIdentificationUser.java
对比新文件
@@ -0,0 +1,59 @@
package com.gkhy.labRiskManage.domain.riskReport.entity;
import lombok.Data;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * 风险评估报告-评估专家
 */
@EntityListeners(AuditingEntityListener.class)
@Entity
@Table(name = "risk_assess_plan_identification_user")
@Data
@Where(clause = "delete_status = 0")
public class RiskAssessPlanIdentificationUser implements Serializable {
    private static final long serialVersionUID = -34775201914468215L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    /**
     * 报告id
     */
    private Long riskAssessPlanId;
    /**
     * 新建时间
     */
    private LocalDateTime createTime;
    /**
     * 修改时间
     */
    private LocalDateTime updateTime;
    /**
     * 最后修改人
     */
    private Long updateByUserId;
    /**
     * 新建人
     */
    private Long createByUserId;
    /**
     * 删除状态:0-正常;1-已删除
     */
    private Byte deleteStatus;
    /**
     * 辨识专家
     */
    private String identificationUser;
    /**
     * 辨识专家id
     */
    private Long identificationUserId;
}
src/main/java/com/gkhy/labRiskManage/domain/riskReport/model/dto/AssessPlanQueryDTO.java
@@ -1,10 +1,14 @@
package com.gkhy.labRiskManage.domain.riskReport.model.dto;
import com.gkhy.labRiskManage.api.controller.account.dto.resp.UserIdentityBindApiDTO;
import com.gkhy.labRiskManage.application.account.dto.respDto.UserEvaluateRespDTO;
import com.gkhy.labRiskManage.application.account.dto.respDto.UserIdentityRespDTO;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
/**
 *
@@ -90,6 +94,10 @@
     */
    private String identificationUser;
    /**
     * 辨识类型1线上专家2现场专家3线上+现场
     */
    private Byte identificationType;
    /**
     * 辨识专家id
     */
    private Long identificationUserId;
@@ -162,7 +170,9 @@
     */
    private String planUserName;
    private List<UserEvaluateRespDTO> evaluateUsers;
    private List<UserIdentityRespDTO> identityUsers;
}
src/main/java/com/gkhy/labRiskManage/domain/riskReport/model/dto/AssessQueryDTO.java
@@ -1,5 +1,7 @@
package com.gkhy.labRiskManage.domain.riskReport.model.dto;
import com.gkhy.labRiskManage.application.account.dto.respDto.UserEvaluateRespDTO;
import com.gkhy.labRiskManage.application.account.dto.respDto.UserIdentityRespDTO;
import lombok.Data;
import java.math.BigDecimal;
@@ -122,4 +124,8 @@
    private List<FactorQueryDTO> factorQueryDTOList;
    private List<UserEvaluateRespDTO> evaluateUsers;
    private List<UserIdentityRespDTO> identityUsers;
}
src/main/java/com/gkhy/labRiskManage/domain/riskReport/model/dto/RiskAssessPlanQueryDTO.java
@@ -1,9 +1,14 @@
package com.gkhy.labRiskManage.domain.riskReport.model.dto;
import com.gkhy.labRiskManage.application.account.dto.respDto.UserEvaluateRespDTO;
import com.gkhy.labRiskManage.application.account.dto.respDto.UserIdentityRespDTO;
import com.gkhy.labRiskManage.domain.riskReport.entity.RiskAssessPlanEvaluateUser;
import com.gkhy.labRiskManage.domain.riskReport.entity.RiskAssessPlanIdentificationUser;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
/**
 *
@@ -80,6 +85,10 @@
     * 评估计划时间状态:1-未开始;2-评估中;3-已超期
     */
    private Byte planTimeStatus;
    /**
     * 辨识类型1线上专家2现场专家3线上+现场
     */
    private Byte identificationType;
    /**
     * 辨识方法:1-PHA;2-JHA;3-SCL;4-HAZOP;5-类比法
     */
@@ -160,6 +169,15 @@
     * 计划制定人人姓名
     */
    private String planUserName;
    /**
     * 辨识专家
     */
    private List<RiskAssessPlanIdentificationUser> riskAssessPlanIdentificationUsers;
    private List<RiskAssessPlanEvaluateUser> riskAssessPlanEvaluateUsers;
    private List<UserEvaluateRespDTO> evaluateUsers;
    private List<UserIdentityRespDTO> identityUsers;
}
src/main/java/com/gkhy/labRiskManage/domain/riskReport/repository/jpa/RiskAssessPlanEvaluateUserRepository.java
对比新文件
@@ -0,0 +1,31 @@
package com.gkhy.labRiskManage.domain.riskReport.repository.jpa;
import com.gkhy.labRiskManage.domain.riskReport.entity.RiskAssessPlanEvaluateUser;
import com.gkhy.labRiskManage.domain.riskReport.entity.RiskAssessPlanIdentificationUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import javax.transaction.Transactional;
import java.time.LocalDateTime;
import java.util.List;
/**
 * 评价
 */
@Repository
public interface RiskAssessPlanEvaluateUserRepository extends JpaRepository<RiskAssessPlanEvaluateUser, Long>, JpaSpecificationExecutor<RiskAssessPlanEvaluateUser> {
    @Modifying
    @Transactional
    @Query(value = "update risk_assess_plan_evaluate_user set delete_status = 1,update_time = :date where risk_assess_plan_id = :id and delete_status = 0", nativeQuery = true)
    int deleteByPlanId(Long id, LocalDateTime date);
    @Query(value = "select t from RiskAssessPlanEvaluateUser t where t.riskAssessPlanId = :planId and t.evaluateUserId = :userId and t.deleteStatus = 0")
    List<RiskAssessPlanEvaluateUser> getAssessPlanEvaluateUserPlanId(Long planId, Long userId);
}
src/main/java/com/gkhy/labRiskManage/domain/riskReport/repository/jpa/RiskAssessPlanIdentificationUserRepository.java
对比新文件
@@ -0,0 +1,33 @@
package com.gkhy.labRiskManage.domain.riskReport.repository.jpa;
import com.gkhy.labRiskManage.domain.riskReport.entity.RiskAssessPlan;
import com.gkhy.labRiskManage.domain.riskReport.entity.RiskAssessPlanIdentificationScl;
import com.gkhy.labRiskManage.domain.riskReport.entity.RiskAssessPlanIdentificationUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import javax.transaction.Transactional;
import java.time.LocalDateTime;
import java.util.List;
/**
 * 辨识方法-Scl
 */
@Repository
public interface RiskAssessPlanIdentificationUserRepository extends JpaRepository<RiskAssessPlanIdentificationUser, Long>, JpaSpecificationExecutor<RiskAssessPlanIdentificationUser> {
    @Modifying
    @Transactional
    @Query(value = "update risk_assess_plan_identification_user set delete_status = 1,update_time = :date where risk_assess_plan_id = :id and delete_status = 0", nativeQuery = true)
    int deletePlanId(Long id, LocalDateTime date);
    @Query(value = "select t from RiskAssessPlanIdentificationUser t where t.riskAssessPlanId = :planId and t.identificationUserId = :userId and t.deleteStatus = 0")
    List<RiskAssessPlanIdentificationUser> getAssessPlanIdentificationUserPlanId(Long planId, Long userId);
}
src/main/java/com/gkhy/labRiskManage/domain/riskReport/service/RiskAssessPlanEvaluateUserService.java
对比新文件
@@ -0,0 +1,27 @@
package com.gkhy.labRiskManage.domain.riskReport.service;
import com.gkhy.labRiskManage.api.controller.riskReport.dto.repDto.RiskAssessPlanEvaluateDeleteReqBO;
import com.gkhy.labRiskManage.domain.riskReport.entity.RiskAssessPlanEvaluateRs;
import com.gkhy.labRiskManage.domain.riskReport.entity.RiskAssessPlanEvaluateUser;
import com.gkhy.labRiskManage.domain.riskReport.model.bo.AssessRsInsertBO;
import com.gkhy.labRiskManage.domain.riskReport.model.dto.EvaluateMethodDeleteDTO;
import com.gkhy.labRiskManage.domain.riskReport.model.dto.RsInsertDTO;
import com.gkhy.labRiskManage.domain.riskReport.model.dto.RsQueryDTO;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/**
 * 评价方法RS
 */
public interface RiskAssessPlanEvaluateUserService {
    int InsertEvaluate(List<RiskAssessPlanEvaluateUser> saveList);
    int deleteRsByPlan(Long id, LocalDateTime date);
    List<RiskAssessPlanEvaluateUser> getAssessPlanEvaluateUserPlanId(Long planId, Long userId);
}
src/main/java/com/gkhy/labRiskManage/domain/riskReport/service/RiskAssessPlanIdentificationUserService.java
对比新文件
@@ -0,0 +1,25 @@
package com.gkhy.labRiskManage.domain.riskReport.service;
import com.gkhy.labRiskManage.domain.riskReport.entity.RiskAssessPlanIdentificationJha;
import com.gkhy.labRiskManage.domain.riskReport.entity.RiskAssessPlanIdentificationUser;
import com.gkhy.labRiskManage.domain.riskReport.model.bo.AssessRsInsertBO;
import com.gkhy.labRiskManage.domain.riskReport.model.dto.IdentificationMethodDeleteDTO;
import com.gkhy.labRiskManage.domain.riskReport.model.dto.JhaInsertDTO;
import com.gkhy.labRiskManage.domain.riskReport.model.dto.JhaQueryDTO;
import com.gkhy.labRiskManage.domain.riskReport.model.dto.RsInsertDTO;
import java.time.LocalDateTime;
import java.util.List;
/**
 * 辨识方法-Jha
 */
public interface RiskAssessPlanIdentificationUserService {
    int InsertData(List<RiskAssessPlanIdentificationUser> saveList);
    int deleteByPlanId(Long id, LocalDateTime date);
    List<RiskAssessPlanIdentificationUser> getAssessPlanIdentificationUserPlanId(Long planId, Long userId);
}
src/main/java/com/gkhy/labRiskManage/domain/riskReport/service/RiskAssessPlanService.java
@@ -108,4 +108,7 @@
     */
    AssessPlanUpdateDTO appoint(Long currentUserId, AppointUserReBO appointUserReBO);
    int appointNew(Long currentUserId, AppointUserTypeReBO appointUserReBO);
}
src/main/java/com/gkhy/labRiskManage/domain/riskReport/service/impl/ReportRiskAssessInfoServiceImpl.java
@@ -227,9 +227,12 @@
            if (!ObjectUtils.isEmpty(assessPlanByExperimentId)){
                for (AssessPlanQueryDTO assessPlan : assessPlanByExperimentId) {
                    if (reportQueryDTO.getEvaluateTime().isBefore(assessPlan.getEvaluateTime())){
                        reportQueryDTO.setEvaluateTime(assessPlan.getEvaluateTime());
                    if (assessPlan.getEvaluateTime() != null){
                        if (reportQueryDTO.getEvaluateTime().isBefore(assessPlan.getEvaluateTime())){
                            reportQueryDTO.setEvaluateTime(assessPlan.getEvaluateTime());
                        }
                    }
                }
            }
src/main/java/com/gkhy/labRiskManage/domain/riskReport/service/impl/RiskAssessPlanEvaluateUserServiceImpl.java
对比新文件
@@ -0,0 +1,34 @@
package com.gkhy.labRiskManage.domain.riskReport.service.impl;
import com.gkhy.labRiskManage.domain.riskReport.entity.RiskAssessPlanEvaluateUser;
import com.gkhy.labRiskManage.domain.riskReport.repository.jpa.RiskAssessPlanEvaluateUserRepository;
import com.gkhy.labRiskManage.domain.riskReport.service.RiskAssessPlanEvaluateUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
@Service
public class RiskAssessPlanEvaluateUserServiceImpl implements RiskAssessPlanEvaluateUserService {
    @Autowired
    private RiskAssessPlanEvaluateUserRepository planEvaluateUserRepository;
    @Override
    public int InsertEvaluate(List<RiskAssessPlanEvaluateUser> saveList) {
        planEvaluateUserRepository.saveAll(saveList);
        return 0;
    }
    @Override
    public int deleteRsByPlan(Long id, LocalDateTime date) {
        return planEvaluateUserRepository.deleteByPlanId(id,date);
    }
    @Override
    public List<RiskAssessPlanEvaluateUser> getAssessPlanEvaluateUserPlanId(Long planId, Long userId) {
        return planEvaluateUserRepository.getAssessPlanEvaluateUserPlanId(planId, userId);
    }
}
src/main/java/com/gkhy/labRiskManage/domain/riskReport/service/impl/RiskAssessPlanIdentificationUserServiceImpl.java
对比新文件
@@ -0,0 +1,33 @@
package com.gkhy.labRiskManage.domain.riskReport.service.impl;
import com.gkhy.labRiskManage.domain.riskReport.entity.RiskAssessPlanIdentificationUser;
import com.gkhy.labRiskManage.domain.riskReport.repository.jpa.RiskAssessPlanIdentificationUserRepository;
import com.gkhy.labRiskManage.domain.riskReport.service.RiskAssessPlanIdentificationUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
@Service
public class RiskAssessPlanIdentificationUserServiceImpl implements RiskAssessPlanIdentificationUserService {
    @Autowired
    private RiskAssessPlanIdentificationUserRepository planIdentificationUserRepository;
    @Override
    public int InsertData(List<RiskAssessPlanIdentificationUser> saveList) {
        planIdentificationUserRepository.saveAll(saveList);
        return 0;
    }
    @Override
    public int deleteByPlanId(Long id, LocalDateTime date) {
        planIdentificationUserRepository.deletePlanId(id, date);
        return 1;
    }
    @Override
    public List<RiskAssessPlanIdentificationUser> getAssessPlanIdentificationUserPlanId(Long planId, Long userId) {
        return planIdentificationUserRepository.getAssessPlanIdentificationUserPlanId(planId, userId);
    }
}
src/main/java/com/gkhy/labRiskManage/domain/riskReport/service/impl/RiskAssessPlanServiceImpl.java
@@ -1,6 +1,8 @@
package com.gkhy.labRiskManage.domain.riskReport.service.impl;
import com.gkhy.labRiskManage.api.controller.riskReport.dto.repDto.*;
import com.gkhy.labRiskManage.application.account.dto.respDto.UserEvaluateRespDTO;
import com.gkhy.labRiskManage.application.account.dto.respDto.UserIdentityRespDTO;
import com.gkhy.labRiskManage.application.riskReport.dto.bo.*;
import com.gkhy.labRiskManage.application.riskReport.dto.dto.RiskAssessAppQueryDTO;
import com.gkhy.labRiskManage.application.riskReport.dto.dto.RiskAssessAppQueryDTO_0223bak;
@@ -18,11 +20,14 @@
import com.gkhy.labRiskManage.domain.basic.service.BasicExperimentPersonService;
import com.gkhy.labRiskManage.domain.basic.service.BasicRiskUnitService;
import com.gkhy.labRiskManage.domain.basic.service.BasicRiskUnitTypeService;
import com.gkhy.labRiskManage.domain.experiment.entity.ExperimentInfo;
import com.gkhy.labRiskManage.domain.experiment.model.dto.ExperimentInfoDTO;
import com.gkhy.labRiskManage.domain.experiment.service.ExperimentInfoService;
import com.gkhy.labRiskManage.domain.riskReport.entity.*;
import com.gkhy.labRiskManage.domain.riskReport.model.bo.*;
import com.gkhy.labRiskManage.domain.riskReport.model.dto.*;
import com.gkhy.labRiskManage.domain.riskReport.repository.jpa.RiskAssessPlanEvaluateUserRepository;
import com.gkhy.labRiskManage.domain.riskReport.repository.jpa.RiskAssessPlanIdentificationUserRepository;
import com.gkhy.labRiskManage.domain.riskReport.repository.jpa.RiskAssessPlanRepository;
import com.gkhy.labRiskManage.domain.riskReport.service.*;
import com.gkhy.labRiskManage.domain.riskReport.utils.EvaluateAndIdentificationUtils;
@@ -43,13 +48,14 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
 * 风险评估计划
 */
@Service
public class RiskAssessPlanServiceImpl implements RiskAssessPlanService  {
public class RiskAssessPlanServiceImpl implements RiskAssessPlanService {
    @Autowired
    private RiskAssessPlanRepository assessPlanRepository;
@@ -76,6 +82,12 @@
    private RiskAssessPlanIdentificationSclService sclService;
    @Autowired
    private RiskAssessPlanIdentificationUserService planIdentificationUserService;
    @Autowired
    private RiskAssessPlanEvaluateUserService evaluateUserService;
    @Autowired
    private RiskAssessPlanEvaluateLecService lecService;
    @Autowired
    private RiskAssessPlanEvaluateLsService lsService;
@@ -94,8 +106,8 @@
    @Override
    public PlanInsertDTO insertAssessPlan(Long currentUserId, RiskAssessPlanAppInsertBO insertParam) {
        if (currentUserId < 0){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆");
        if (currentUserId < 0) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆");
        }
        // 检查是否是实验管理者
        int roleTag = 0;
@@ -109,74 +121,95 @@
//        if (roleTag ==0 ){
//            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权添加实验评估计划");
//        }
        if (ObjectUtils.isEmpty(user)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除");
        if (ObjectUtils.isEmpty(user)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除");
        }
        //参数校验
        if (ObjectUtils.isEmpty(insertParam)){
        if (ObjectUtils.isEmpty(insertParam)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "请求参数为空");
        }
        if (ObjectUtils.isEmpty(insertParam.getRiskUnitId())){
        if (ObjectUtils.isEmpty(insertParam.getRiskUnitId())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险单元不能为空");
        }
        if (ObjectUtils.isEmpty(insertParam.getRiskType())){
        if (ObjectUtils.isEmpty(insertParam.getRiskType())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险单元类型不能为空");
        }
        if (ObjectUtils.isEmpty(insertParam.getIdentificationType())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识类型不能为空");
        }
        RiskUnitQueryDTO riskUnitById = riskUnitService.getRiskUnitById(insertParam.getRiskUnitId());
        if (ObjectUtils.isEmpty(riskUnitById.getId())){
        if (ObjectUtils.isEmpty(riskUnitById.getId())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险单元不存在或已被删除");
        }
        List<RiskAssessPlan> assessPlanByUnitId = assessPlanRepository.getAssessPlanByUnitId(insertParam.getRiskUnitId());
        if (assessPlanByUnitId.size() >= 1){
        if (assessPlanByUnitId.size() >= 1) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "该单元已有评估计划");
        }
        ExperimentInfoDTO experimentById = experimentInfoService.getExperimentById(riskUnitById.getExperimentId());
        if (ObjectUtils.isEmpty(experimentById)){
        if (ObjectUtils.isEmpty(experimentById)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "实验不存在或已被删除");
        }
        if (experimentById.getStatus() == 1){
        if (experimentById.getStatus() == 1) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "实验未被批准,无法进行评估");
        }
        if (ObjectUtils.isEmpty(insertParam.getAssessPlanName())){
        if (ObjectUtils.isEmpty(insertParam.getAssessPlanName())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估计划名称不能为空");
        }
        RiskAssessPlan assessPlanByName = assessPlanRepository.getAssessPlanByName(insertParam.getAssessPlanName());
        if (!ObjectUtils.isEmpty(assessPlanByName)){
        if (!ObjectUtils.isEmpty(assessPlanByName)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "评估计划名称已被使用");
        }
        if (ObjectUtils.isEmpty(insertParam.getAssessStartTime())){
        if (ObjectUtils.isEmpty(insertParam.getAssessStartTime())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估开始时间不能为空");
        }
        if (ObjectUtils.isEmpty(insertParam.getAssessEndTime())){
        if (ObjectUtils.isEmpty(insertParam.getAssessEndTime())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估结束时间不能为空");
        }
        if (insertParam.getAssessEndTime().isBefore(insertParam.getAssessStartTime())){
        if (insertParam.getAssessEndTime().isBefore(insertParam.getAssessStartTime())) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "评估结束时间必须在评估开始时间之后");
        }
        //   计划制定人?
        if (ObjectUtils.isEmpty(insertParam.getPlanUserId())){
        if (ObjectUtils.isEmpty(insertParam.getPlanUserId())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "计划制定人不能为空");
        }
        UserInfoDomainDTO planUser = userDomainService.getUserInfoByIdAndSellInfo(insertParam.getPlanUserId(),"计划指定人");
        if (ObjectUtils.isEmpty(planUser)){
        UserInfoDomainDTO planUser = userDomainService.getUserInfoByIdAndSellInfo(insertParam.getPlanUserId(), "计划指定人");
        if (ObjectUtils.isEmpty(planUser)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "计划制定人不存在或已被删除");
        }
        List<Long> identificationUserInsert = insertParam.getIdentificationUserInsert();
        // 辨识专家
        if (ObjectUtils.isEmpty(insertParam.getIdentificationUserId())){
        if (ObjectUtils.isEmpty(identificationUserInsert)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识专家不能为空");
        }
        UserInfoDomainDTO identificationUser = userDomainService.getUserInfoByIdAndSellInfo(insertParam.getIdentificationUserId(), "辨识专家");
        if (ObjectUtils.isEmpty(identificationUser)){
        List<UserInfoDomainDTO> identificationUser = userDomainService.getUserInfoByIds(identificationUserInsert, "辨识专家");
        if (ObjectUtils.isEmpty(identificationUser)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "辨识专家不存在或已被删除");
        }
        if (identificationUser.size() != identificationUserInsert.size()) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "存在选中辨识专家不存在或已被删除");
        }
        List<Long> evaluateUserInsert = insertParam.getEvaluateUserInsert();
        // 评价专家
        if (ObjectUtils.isEmpty(insertParam.getEvaluateUserId())){
        if (ObjectUtils.isEmpty(evaluateUserInsert)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价专家不能为空");
        }
        UserInfoDomainDTO evaluateUser = userDomainService.getUserInfoByIdAndSellInfo(insertParam.getEvaluateUserId(), "评价专家");
        if (ObjectUtils.isEmpty(evaluateUser)){
        List<UserInfoDomainDTO> evaluateUserUser = userDomainService.getUserInfoByIds(evaluateUserInsert, "评价专家");
        if (ObjectUtils.isEmpty(evaluateUserUser)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "评价专家不存在或已被删除");
        }
        if (evaluateUserUser.size() != evaluateUserInsert.size()) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "存在选中评价专家不存在或已被删除");
        }
//        // 评价专家
//        if (ObjectUtils.isEmpty(insertParam.getEvaluateUserId())){
//            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价专家不能为空");
//        }
//        UserInfoDomainDTO evaluateUser = userDomainService.getUserInfoByIdAndSellInfo(insertParam.getEvaluateUserId(), "评价专家");
//        if (ObjectUtils.isEmpty(evaluateUser)){
//            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "评价专家不存在或已被删除");
//        }
        BasicRiskUnitType riskUnitTypeById = riskUnitTypeService.getRiskUnitTypeById(riskUnitById.getRiskUnitTypeId());
@@ -186,7 +219,7 @@
        //获取需要的参数
        LocalDateTime date = LocalDateTime.now();
        //  如果是实验风险,添加实验id
        if (insertParam.getRiskType() == StatusEnum.EXPERIMENT_RISK.getCode().byteValue()){
        if (insertParam.getRiskType() == StatusEnum.EXPERIMENT_RISK.getCode().byteValue()) {
            riskAssessPlan.setExperimentId(riskUnitById.getExperimentId());//
        }
        riskAssessPlan.setCreateTime(date);
@@ -198,30 +231,34 @@
        riskAssessPlan.setPlanSellStatus(StatusEnum.PLAN_SELL_NOT.getCode().byteValue());//计划未派发
        riskAssessPlan.setPlanExecStatus(StatusEnum.PLAN_EXEC_NOT_START.getCode().byteValue());//计划执行未开始(执行阶段)
//        riskAssessPlan.setPlanTimeStatus(StatusEnum.PLAN_STATUS_NOT_START.getCode().byteValue());//计划状态未开始
        riskAssessPlan.setIdentificationUserId(insertParam.getIdentificationUserId());//辨识专家id
        riskAssessPlan.setIdentificationUser(identificationUser.getRealName());//辨识专家
        riskAssessPlan.setEvaluateUserId(insertParam.getEvaluateUserId());//评价专家id
        riskAssessPlan.setEvaluateUser(evaluateUser.getRealName());//评价专家
//        riskAssessPlan.setIdentificationUserId(insertParam.getIdentificationUserId());//辨识专家id
//        riskAssessPlan.setIdentificationUser(identificationUser.getRealName());//辨识专家
//        riskAssessPlan.setEvaluateUserId(insertParam.getEvaluateUserId());//评价专家id
//        riskAssessPlan.setEvaluateUser(evaluateUser.getRealName());//评价专家
        riskAssessPlan.setIdentificationMethod(MethodEnum.IDENTIFICATION_METHOD_PHA.getCode());//辨识方法
        riskAssessPlan.setEvaluateMethod(MethodEnum.EVALUATE_METHOD_LEC.getCode());//评价方法
        RiskAssessPlan saveResult = assessPlanRepository.save(riskAssessPlan);
        //处理辨识专家
        saveIdentificationUser(saveResult.getId(), identificationUser, date, user.getId());
        //处理评价专家
        saveEvaUser(saveResult.getId(), evaluateUserUser, date, user.getId());
        //修改实验状态为评估中
        ExperimentInfoDTO experimentInfoDTO = experimentInfoService.updateExperimentStage(experimentById.getId(), StatusEnum.EXPERIMENT_STATUS_START.getCode().byteValue());
        if (ObjectUtils.isEmpty(experimentInfoDTO)){
        if (ObjectUtils.isEmpty(experimentInfoDTO)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "实验状态修改失败");
        }
        //修改风险单元为已有评估计划
        if (insertParam.getRiskType() == StatusEnum.EXPERIMENT_RISK.getCode().byteValue()){
        if (insertParam.getRiskType() == StatusEnum.EXPERIMENT_RISK.getCode().byteValue()) {
            RiskUnit riskUnit = riskUnitService.updateRiskUnitStatus(insertParam.getRiskUnitId(), StatusEnum.EVALUATE_WAIT.getCode());
            if (ObjectUtils.isEmpty(riskUnit)){
            if (ObjectUtils.isEmpty(riskUnit)) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "风险单元状态修改失败");
            }
        }else if (insertParam.getRiskType() == StatusEnum.INHERENT_RISK.getCode().byteValue()){
        } else if (insertParam.getRiskType() == StatusEnum.INHERENT_RISK.getCode().byteValue()) {
            RiskUnitUpdateDTO riskUnitUpdateDTO = basicRiskUnitService.updateRiskUnitStatus(insertParam.getRiskUnitId(), StatusEnum.EVALUATE_WAIT.getCode());
            if (ObjectUtils.isEmpty(riskUnitUpdateDTO)){
            if (ObjectUtils.isEmpty(riskUnitUpdateDTO)) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "风险单元状态修改失败");
            }
        }
@@ -232,6 +269,40 @@
        return planInsertDTO;
    }
    private void saveIdentificationUser(Long id, List<UserInfoDomainDTO> identificationUser, LocalDateTime date, Long userId) {
        // 处理辨识专家
        List<RiskAssessPlanIdentificationUser> saveList = new ArrayList<>();
        for (UserInfoDomainDTO userInfo : identificationUser) {
            RiskAssessPlanIdentificationUser planIdentificationUser = new RiskAssessPlanIdentificationUser();
            planIdentificationUser.setRiskAssessPlanId(id);
            planIdentificationUser.setIdentificationUserId(userInfo.getId());
            planIdentificationUser.setIdentificationUser(userInfo.getRealName());
            planIdentificationUser.setCreateTime(date);
            planIdentificationUser.setCreateByUserId(userId);
            planIdentificationUser.setDeleteStatus((byte)0);
            saveList.add(planIdentificationUser);
        }
        planIdentificationUserService.InsertData(saveList);
    }
    private void saveEvaUser(Long id, List<UserInfoDomainDTO> identificationUser, LocalDateTime date, Long userId) {
        // 处理辨识专家
        List<RiskAssessPlanEvaluateUser> saveList = new ArrayList<>();
        for (UserInfoDomainDTO userInfo : identificationUser) {
            RiskAssessPlanEvaluateUser planIdentificationUser = new RiskAssessPlanEvaluateUser();
            planIdentificationUser.setRiskAssessPlanId(id);
            planIdentificationUser.setEvaluateUserId(userInfo.getId());
            planIdentificationUser.setEvaluateUser(userInfo.getRealName());
            planIdentificationUser.setCreateTime(date);
            planIdentificationUser.setCreateByUserId(userId);
            planIdentificationUser.setDeleteStatus((byte)0);
            saveList.add(planIdentificationUser);
        }
        evaluateUserService.InsertEvaluate(saveList);
    }
    /**
     * 风险评估计划 - 查询
     */
@@ -240,29 +311,29 @@
        //校验参数
        if (ObjectUtils.isEmpty(queryParamBO.getPageSize())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"分页信息不能为空");
        if (ObjectUtils.isEmpty(queryParamBO.getPageSize())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "分页信息不能为空");
        }
        if (ObjectUtils.isEmpty(queryParamBO.getPageIndex())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"分页信息不能为空");
        if (ObjectUtils.isEmpty(queryParamBO.getPageIndex())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "分页信息不能为空");
        }
        if (queryParamBO.getRiskUnitName() == "null"){
        if (queryParamBO.getRiskUnitName() == "null") {
            queryParamBO.setRiskUnitName(null);
        }
        if (queryParamBO.getAssessPlanName() == "null"){
        if (queryParamBO.getAssessPlanName() == "null") {
            queryParamBO.setAssessPlanName(null);
        }
        // 检查是否是实验管理者
        UserInfoDomainDTO user = userDomainService.getUserById(currentUserId);
        if (ObjectUtils.isEmpty(user)){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"用户不存在");
        if (ObjectUtils.isEmpty(user)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "用户不存在");
        }
        int roleTag = GetRoleTagUtils.GetRoleTagUtils(user);
        List<Long> ids = new ArrayList<>();
        if (!ObjectUtils.isEmpty(queryParamBO.getRiskUnitName())){
            List<RiskUnitQueryDTO> riskUnitList= riskUnitService.getRiskUnitByName(queryParamBO.getRiskUnitName());
            if (riskUnitList.size() < 1){
        if (!ObjectUtils.isEmpty(queryParamBO.getRiskUnitName())) {
            List<RiskUnitQueryDTO> riskUnitList = riskUnitService.getRiskUnitByName(queryParamBO.getRiskUnitName());
            if (riskUnitList.size() < 1) {
                throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险单元不存在或已被删除");
            }
            for (RiskUnitQueryDTO riskUnit : riskUnitList) {
@@ -274,13 +345,13 @@
        List<Long> experimentIdList = new ArrayList<>();
        experimentIdList.add(0L);
        if (!ObjectUtils.isEmpty(experimentByList)){
        if (!ObjectUtils.isEmpty(experimentByList)) {
            for (ExperimentInfoDTO experimentInfo : experimentByList) {
                experimentIdList.add(experimentInfo.getId());
            }
        }
        RiskAssessPlanQueryBO  queryParam = BeanCopyUtils.copyBean(queryParamBO, RiskAssessPlanQueryBO.class);
        RiskAssessPlanQueryBO queryParam = BeanCopyUtils.copyBean(queryParamBO, RiskAssessPlanQueryBO.class);
        queryParam.setRiskUnitIds(ids);
        SearchResult searchResult = new SearchResult<>();
        searchResult.setPageIndex(queryParam.getPageIndex());
@@ -292,26 +363,31 @@
            @Override
            public Predicate toPredicate(Root<RiskAssessPlan> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
                List<Predicate> predicateList = new ArrayList<>();
                if (queryParam.getAssessPlanName() != null && !queryParam.getAssessPlanName().equals("")){
                    predicateList.add(criteriaBuilder.like(root.get("assessPlanName"),"%"+queryParam.getAssessPlanName()+"%"));
                if (queryParam.getAssessPlanName() != null && !queryParam.getAssessPlanName().equals("")) {
                    predicateList.add(criteriaBuilder.like(root.get("assessPlanName"), "%" + queryParam.getAssessPlanName() + "%"));
                }
                //in
                if (queryParam.getRiskUnitIds().size() >= 1){
                if (queryParam.getRiskUnitIds().size() >= 1) {
                    predicateList.add(criteriaBuilder.in(root.get("riskUnitId")).value(ids));
                }
                if (queryParam.getExperimentId() != null){
                    predicateList.add(criteriaBuilder.equal(root.get("experimentId"),queryParam.getExperimentId()));
                if (queryParam.getExperimentId() != null) {
                    predicateList.add(criteriaBuilder.equal(root.get("experimentId"), queryParam.getExperimentId()));
                }
                if (roleTag == UserTagEnum.USER_TAG_0.getCode()){
                Join<RiskAssessPlan, RiskAssessPlanIdentificationUser> identificationUserJoin = root.join("riskAssessPlanIdentificationUsers", JoinType.LEFT);
                Join<RiskAssessPlan, RiskAssessPlanEvaluateUser> evaluateUserJoin = root.join("riskAssessPlanEvaluateUsers", JoinType.LEFT);
                if (roleTag == UserTagEnum.USER_TAG_0.getCode()) {
                    //此处应有谁能查询:辨识专家,评价专家,实验负责人(此处未存相关信息,以实验id为条件查询)
                    predicateList.add(criteriaBuilder.or(
                            criteriaBuilder.equal(root.get("identificationUserId"), currentUserId),
                            criteriaBuilder.equal(root.get("evaluateUserId"), currentUserId),
                            criteriaBuilder.in(root.get("experimentId")).value(experimentIdList)
                                    criteriaBuilder.equal(identificationUserJoin.get("identificationUserId"), currentUserId),
                                    criteriaBuilder.equal(evaluateUserJoin.get("evaluateUserId"), currentUserId),
                                    criteriaBuilder.in(root.get("experimentId")).value(experimentIdList)
                            )
                    );
                }
                predicateList.add(criteriaBuilder.equal(root.get("deleteStatus"),StatusEnum.DELETE_NOT.getCode()));
                query.groupBy(root.get("id"));
                predicateList.add(criteriaBuilder.equal(root.get("deleteStatus"), StatusEnum.DELETE_NOT.getCode()));
                return criteriaBuilder.and(predicateList.toArray(new Predicate[0]));
            }
        };
@@ -326,20 +402,42 @@
        List<UserInfoDomainDTO> userList = userDomainService.getUserList();
        for (RiskAssessPlanQueryDTO assessPlanQueryDTO : assessPlanQueryDTOS) {
            for (UserInfoDomainDTO userInfo : userList) {
                if (userInfo.getId() == assessPlanQueryDTO.getCreateByUserId()){
                if (userInfo.getId() == assessPlanQueryDTO.getCreateByUserId()) {
                    assessPlanQueryDTO.setCreateByUserName(userInfo.getRealName());
                }
                if (userInfo.getId() == assessPlanQueryDTO.getUpdateByUserId()){
                if (userInfo.getId() == assessPlanQueryDTO.getUpdateByUserId()) {
                    assessPlanQueryDTO.setUpdateByUserName(userInfo.getRealName());
                }
                if (userInfo.getId() == assessPlanQueryDTO.getPlanUserId()){
                if (userInfo.getId() == assessPlanQueryDTO.getPlanUserId()) {
                    assessPlanQueryDTO.setPlanUserName(userInfo.getRealName());
                }
            }
            for (RiskUnitListAppQueryDTO riskUnit : riskUnitListAppQueryDTOS) {
                if (riskUnit.getId() == assessPlanQueryDTO.getRiskUnitId()){
                if (riskUnit.getId() == assessPlanQueryDTO.getRiskUnitId()) {
                    assessPlanQueryDTO.setRiskUnitName(riskUnit.getRiskName());
                }
            }
            //todo 处理数据
            List<RiskAssessPlanIdentificationUser> riskAssessPlanIdentificationUsers = assessPlanQueryDTO.getRiskAssessPlanIdentificationUsers();
            if (!ObjectUtils.isEmpty(riskAssessPlanIdentificationUsers)) {
                String identificationUsersString = riskAssessPlanIdentificationUsers.stream()
                        .map(RiskAssessPlanIdentificationUser::getIdentificationUser)
                        .collect(Collectors.joining(","));
                assessPlanQueryDTO.setIdentificationUser(identificationUsersString);
                List<UserIdentityRespDTO> userIdentityRespDTOS = BeanCopyUtils.copyBeanList(riskAssessPlanIdentificationUsers, UserIdentityRespDTO.class);
                assessPlanQueryDTO.setIdentityUsers(userIdentityRespDTOS);
                assessPlanQueryDTO.setRiskAssessPlanIdentificationUsers(null);
            }
            List<RiskAssessPlanEvaluateUser> riskAssessPlanEvaluateUsers = assessPlanQueryDTO.getRiskAssessPlanEvaluateUsers();
            if (!ObjectUtils.isEmpty(riskAssessPlanEvaluateUsers)) {
                String identificationUsersString = riskAssessPlanEvaluateUsers.stream()
                        .map(RiskAssessPlanEvaluateUser::getEvaluateUser)
                        .collect(Collectors.joining(","));
                assessPlanQueryDTO.setEvaluateUser(identificationUsersString);
                List<UserEvaluateRespDTO> userEvaluateRespDTOS = BeanCopyUtils.copyBeanList(riskAssessPlanEvaluateUsers, UserEvaluateRespDTO.class);
                assessPlanQueryDTO.setEvaluateUsers(userEvaluateRespDTOS);
                assessPlanQueryDTO.setRiskAssessPlanEvaluateUsers(null);
            }
        }
@@ -355,12 +453,12 @@
    public AssessPlanUpdateDTO updateAssessPlan(Long currentUserId, RiskAssessPlanUpdateReqBO updateParam) {
        if (currentUserId < 0){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆");
        if (currentUserId < 0) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆");
        }
        UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId);
        if (ObjectUtils.isEmpty(userInfoById)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除");
        if (ObjectUtils.isEmpty(userInfoById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除");
        }
        // 检查是否是实验管理者
        int roleTag = 0;
@@ -375,68 +473,92 @@
//            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权修改实验评估计划");
//        }
        //参数校验
        if (ObjectUtils.isEmpty(updateParam)){
        if (ObjectUtils.isEmpty(updateParam)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "要求改的参数为空");
        }
        RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(updateParam.getId());
        if (assessPlanById.getPlanSellStatus() == 2){
        if (assessPlanById.getPlanSellStatus() == 2) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划已经派发,无法修改");
        }
        if (ObjectUtils.isEmpty(assessPlanById)){
        if (ObjectUtils.isEmpty(assessPlanById)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估计划不存在或已被删除");
        }
        if (ObjectUtils.isEmpty(updateParam.getRiskUnitId())){
        if (ObjectUtils.isEmpty(updateParam.getRiskUnitId())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险单元参数不能为空");
        }
        if (ObjectUtils.isEmpty(updateParam.getAssessStartTime())){
        if (ObjectUtils.isEmpty(updateParam.getAssessStartTime())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估开始时间不能为空");
        }
        if (ObjectUtils.isEmpty(updateParam.getAssessEndTime())){
        if (ObjectUtils.isEmpty(updateParam.getAssessEndTime())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估结束时间不能为空");
        }
        if (updateParam.getAssessEndTime().isBefore(updateParam.getAssessStartTime())){
        if (updateParam.getAssessEndTime().isBefore(updateParam.getAssessStartTime())) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "评估结束时间必须在评估开始时间之后");
        }
        RiskUnitQueryDTO riskUnitById = riskUnitService.getRiskUnitById(updateParam.getRiskUnitId());
        if (ObjectUtils.isEmpty(riskUnitById.getId())){
        if (ObjectUtils.isEmpty(riskUnitById.getId())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险单元不存在或已被删除");
        }
        ExperimentInfoDTO experimentById = experimentInfoService.getExperimentById(riskUnitById.getExperimentId());
        if (ObjectUtils.isEmpty(experimentById)){
        if (ObjectUtils.isEmpty(experimentById)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "实验不存在或已被删除");
        }
        if (ObjectUtils.isEmpty(updateParam.getAssessPlanName())){
        if (ObjectUtils.isEmpty(updateParam.getAssessPlanName())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估计划名称不能为空");
        }
        RiskAssessPlan assessPlanByName = assessPlanRepository.getAssessPlanByName(updateParam.getAssessPlanName());
        if (!ObjectUtils.isEmpty(assessPlanByName) && !assessPlanByName.getId().equals(updateParam.getId())){
        if (!ObjectUtils.isEmpty(assessPlanByName) && !assessPlanByName.getId().equals(updateParam.getId())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估计划已存在,请换一个计划名称");
        }
        // 计划制定人
        if (ObjectUtils.isEmpty(updateParam.getPlanUserId())){
        if (ObjectUtils.isEmpty(updateParam.getPlanUserId())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "计划制定人不能为空");
        }
        UserInfoDomainDTO planUser = userDomainService.getUserInfoByIdAndSellInfo(updateParam.getPlanUserId(), "计划制定人");
        if (ObjectUtils.isEmpty(planUser)){
        if (ObjectUtils.isEmpty(planUser)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "计划制定人不存在或已被删除");
        }
        List<Long> identificationUserInsert = updateParam.getIdentificationUserInsert();
        // 辨识专家
        if (ObjectUtils.isEmpty(updateParam.getIdentificationUserId())){
        if (ObjectUtils.isEmpty(identificationUserInsert)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识专家不能为空");
        }
        UserInfoDomainDTO identificationUser = userDomainService.getUserInfoByIdAndSellInfo(updateParam.getIdentificationUserId(), "辨识专家");
        if (ObjectUtils.isEmpty(identificationUser)){
        List<UserInfoDomainDTO> identificationUser = userDomainService.getUserInfoByIds(identificationUserInsert, "辨识专家");
        if (ObjectUtils.isEmpty(identificationUser)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "辨识专家不存在或已被删除");
        }
        if (identificationUser.size() != identificationUserInsert.size()) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "存在选中辨识专家不存在或已被删除");
        }
//        // 辨识专家
//        if (ObjectUtils.isEmpty(updateParam.getIdentificationUserId())){
//            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识专家不能为空");
//        }
//        UserInfoDomainDTO identificationUser = userDomainService.getUserInfoByIdAndSellInfo(updateParam.getIdentificationUserId(), "辨识专家");
//        if (ObjectUtils.isEmpty(identificationUser)){
//            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "辨识专家不存在或已被删除");
//        }
        // 评价专家
        if (ObjectUtils.isEmpty(updateParam.getEvaluateUserId())){
        List<Long> evaluateUserInsert = updateParam.getEvaluateUserInsert();
        // 评价专家
        if (ObjectUtils.isEmpty(evaluateUserInsert)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价专家不能为空");
        }
        UserInfoDomainDTO evaluateUser = userDomainService.getUserInfoByIdAndSellInfo(updateParam.getEvaluateUserId(), "评价专家");
        if (ObjectUtils.isEmpty(evaluateUser)){
        List<UserInfoDomainDTO> evaluateUserUser = userDomainService.getUserInfoByIds(evaluateUserInsert, "评价专家");
        if (ObjectUtils.isEmpty(evaluateUserUser)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "评价专家不存在或已被删除");
        }
        if (evaluateUserUser.size() != evaluateUserInsert.size()) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "存在选中评价专家不存在或已被删除");
        }
//        if (ObjectUtils.isEmpty(updateParam.getEvaluateUserId())){
//            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价专家不能为空");
//        }
//        UserInfoDomainDTO evaluateUser = userDomainService.getUserInfoByIdAndSellInfo(updateParam.getEvaluateUserId(), "评价专家");
//        if (ObjectUtils.isEmpty(evaluateUser)){
//            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "评价专家不存在或已被删除");
//        }
        //获取需要的参数
        LocalDateTime date = LocalDateTime.now();
@@ -449,12 +571,18 @@
        assessPlanById.setAssessStartTime(updateParam.getAssessStartTime());
        assessPlanById.setAssessEndTime(updateParam.getAssessEndTime());
//        assessPlanById.setIdentificationMethod(updateParam.getIdentificationMethod());//辨识方法
        assessPlanById.setIdentificationUserId(updateParam.getIdentificationUserId());//辨识专家id
        assessPlanById.setIdentificationUser(identificationUser.getRealName());//辨识专家
//        assessPlanById.setIdentificationUserId(updateParam.getIdentificationUserId());//辨识专家id
//        assessPlanById.setIdentificationUser(identificationUser.getRealName());//辨识专家
//        assessPlanById.setEvaluateMethod(updateParam.getEvaluateMethod());//评价方法
        assessPlanById.setEvaluateUserId(updateParam.getEvaluateUserId());//评价专家id
        assessPlanById.setEvaluateUser(evaluateUser.getRealName());//评价专家
//        assessPlanById.setEvaluateUserId(updateParam.getEvaluateUserId());//评价专家id
//        assessPlanById.setEvaluateUser(evaluateUser.getRealName());//评价专家
        //处理风险数据
        planIdentificationUserService.deleteByPlanId(assessPlanById.getId(), date);
        saveIdentificationUser(assessPlanById.getId(), identificationUser, date, userInfoById.getId());
        //处理评价专家
        evaluateUserService.deleteRsByPlan(assessPlanById.getId(), date);
        saveEvaUser(assessPlanById.getId(), evaluateUserUser, date, user.getId());
        RiskAssessPlan saveResult = assessPlanRepository.save(assessPlanById);
@@ -469,8 +597,8 @@
    @Override
    public AssessPlanDeleteDTO deleteAssessPlan(Long currentUserId, Long id) {
        if (currentUserId < 0){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆");
        if (currentUserId < 0) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆");
        }
        // 检查是否是实验管理者
        int roleTag = 0;
@@ -485,17 +613,17 @@
//            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权删除实验评估计划");
//        }
        UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId);
        if (ObjectUtils.isEmpty(userInfoById)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除");
        if (ObjectUtils.isEmpty(userInfoById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除");
        }
        if (ObjectUtils.isEmpty(id)){
        if (ObjectUtils.isEmpty(id)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "删除的内容不能为空");
        }
        RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(id);
        if (ObjectUtils.isEmpty(assessPlanById)){
        if (ObjectUtils.isEmpty(assessPlanById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除的内容不存在或已被删除");
        }
        if (assessPlanById.getPlanSellStatus() == 2){
        if (assessPlanById.getPlanSellStatus() == 2) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划已经派发,无法删除");
        }
        //设置必要参数
@@ -518,37 +646,37 @@
    @Override
    public AssessPlanUpdateDTO sellAssessPlan(Long currentUserId, Long id) {
        if (currentUserId < 0){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆");
        if (currentUserId < 0) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆");
        }
        UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId);
        if (ObjectUtils.isEmpty(userInfoById)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除");
        if (ObjectUtils.isEmpty(userInfoById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除");
        }
        // 检查是否是实验管理者
        int roleTag = 0;
        UserInfoDomainDTO user = userDomainService.getUserById(currentUserId);
        for (SysUserRoleBindDomainDTO role : user.getRoles()) {
            if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()){
            if (role.getRoleId() == UserRoleEnum.USER_ROLE_4.getCode().byteValue()) {
                roleTag = 1;
            }
        }
        if (roleTag ==0 ){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无权派发任务");
        if (roleTag == 0) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无权派发任务");
        }
        LocalDateTime date = LocalDateTime.now();
        if (ObjectUtils.isEmpty(id)){
        if (ObjectUtils.isEmpty(id)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "选择的内容不能为空");
        }
        RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(id);
        if (ObjectUtils.isEmpty(assessPlanById)){
        if (ObjectUtils.isEmpty(assessPlanById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "要派发的计划不存在或已被删除");
        }
        if (assessPlanById.getPlanSellStatus() == 2){
        if (assessPlanById.getPlanSellStatus() == 2) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划已经派发");
        }
        if (assessPlanById.getAssessEndTime().isBefore(date)){
        if (assessPlanById.getAssessEndTime().isBefore(date)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "任务派发必须在评估结束时间之前");
        }
//        if (!assessPlanById.getPlanUserId().equals(userInfoById.getId())){
@@ -572,19 +700,19 @@
    @Override
    public AssessPlanIdentificationDTO identification(Long currentUserId, RiskAssessPlanAppIdentificationBO identificationParam) {
        if (currentUserId < 0){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆");
        if (currentUserId < 0) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆");
        }
        UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId);
        if (ObjectUtils.isEmpty(userInfoById)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除");
        if (ObjectUtils.isEmpty(userInfoById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除");
        }
        LocalDateTime date = LocalDateTime.now();
        if (ObjectUtils.isEmpty(identificationParam)){
        if (ObjectUtils.isEmpty(identificationParam)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识的内容不能为空");
        }
        if (ObjectUtils.isEmpty(identificationParam.getIdentificationMethod())){
        if (ObjectUtils.isEmpty(identificationParam.getIdentificationMethod())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "选择的辨识方法不存在");
        }
//        if (ObjectUtils.isEmpty(identificationParam.getManageMeasure())){
@@ -604,25 +732,30 @@
//        }
        RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(identificationParam.getId());
        if (ObjectUtils.isEmpty(assessPlanById)){
        if (ObjectUtils.isEmpty(assessPlanById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "要辨识的计划不存在或已被删除");
        }
        if (!assessPlanById.getIdentificationUserId().equals(currentUserId)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"不是辨识专家,无法操作");
        List<RiskAssessPlanIdentificationUser> assessPlanIdentificationUserPlanId = planIdentificationUserService.getAssessPlanIdentificationUserPlanId(assessPlanById.getId(), currentUserId);
        if (ObjectUtils.isEmpty(assessPlanIdentificationUserPlanId)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "不是辨识专家,无法操作");
        }
        if (assessPlanById.getPlanSellStatus() == 1){
        if (assessPlanById.getPlanSellStatus() == 1) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划尚未派发,无法辨识");
        }
        if (assessPlanById.getPlanExecStatus() != 2){
        if (assessPlanById.getPlanExecStatus() != 2) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划不处在辨识阶段,无法辨识");
        }
        if (date.isAfter(assessPlanById.getAssessEndTime())){
        if (date.isAfter(assessPlanById.getAssessEndTime())) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "风险辨识必须在评估结束时间之前");
        }
        if (date.isBefore(assessPlanById.getAssessStartTime())){
        if (date.isBefore(assessPlanById.getAssessStartTime())) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "未到辨识时间");
        }
        if (!assessPlanById.getIdentificationUserId().equals(userInfoById.getId())){
        List<RiskAssessPlanIdentificationUser> assessPlanIdentificationUser =
                planIdentificationUserService.getAssessPlanIdentificationUserPlanId(assessPlanById.getId(), userInfoById.getId());
        if (ObjectUtils.isEmpty(assessPlanIdentificationUser)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "您不是辨识人,无法进行辨识");
        }
@@ -651,59 +784,62 @@
    @Override
    public AssessPlanUpdateDTO identificationSubmit(Long currentUserId, Long id) {
        if (currentUserId < 0){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆");
        if (currentUserId < 0) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆");
        }
        UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId);
        if (ObjectUtils.isEmpty(userInfoById)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除");
        if (ObjectUtils.isEmpty(userInfoById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除");
        }
        if (ObjectUtils.isEmpty(id)){
        if (ObjectUtils.isEmpty(id)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "所选辨识不能为空");
        }
        RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(id);
        if (ObjectUtils.isEmpty(assessPlanById)){
        if (ObjectUtils.isEmpty(assessPlanById)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "所选辨识为空或已被删除");
        }
        if (assessPlanById.getPlanExecStatus() < StatusEnum.PLAN_EXEC_IDENTIFICATION.getCode().byteValue()){
        if (assessPlanById.getPlanExecStatus() < StatusEnum.PLAN_EXEC_IDENTIFICATION.getCode().byteValue()) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "不在辨识阶段,无法提交");
        }else if (assessPlanById.getPlanExecStatus() > StatusEnum.PLAN_EXEC_IDENTIFICATION.getCode().byteValue()){
        } else if (assessPlanById.getPlanExecStatus() > StatusEnum.PLAN_EXEC_IDENTIFICATION.getCode().byteValue()) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识已完成,无需重复提交");
        }
        if (!assessPlanById.getIdentificationUserId().equals(userInfoById.getId())){
        List<RiskAssessPlanIdentificationUser> assessPlanIdentificationUser =
                planIdentificationUserService.getAssessPlanIdentificationUserPlanId(assessPlanById.getId(), userInfoById.getId());
        if (ObjectUtils.isEmpty(assessPlanIdentificationUser)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "您不是辨识人,无法进行辨识结果提交");
        }
        // 没有进行任何辨识,无法提交
        if (assessPlanById.getIdentificationMethod() == 1){
        if (assessPlanById.getIdentificationMethod() == 1) {
            List<PhaQueryDTO> phaQueryDTOS = phaService.listPhaByPlanId(assessPlanById.getId());
            if (phaQueryDTOS.size() < 1){
            if (phaQueryDTOS.size() < 1) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "您未做任何辨识,无法提交");
            }
            //辨识方法 2-JHA;
        }else if (assessPlanById.getIdentificationMethod() == 2){
        } else if (assessPlanById.getIdentificationMethod() == 2) {
            List<JhaQueryDTO> jhaQueryDTOS = jhaService.listJhaByPlanId(assessPlanById.getId());
            if (jhaQueryDTOS.size() < 1){
            if (jhaQueryDTOS.size() < 1) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "您未做任何辨识,无法提交");
            }
            //辨识方法 3-SCL;
        }else if (assessPlanById.getIdentificationMethod() == 3){
        } else if (assessPlanById.getIdentificationMethod() == 3) {
            List<SclQueryDTO> sclQueryDTOS = sclService.listSclByPlanId(assessPlanById.getId());
            if (sclQueryDTOS.size() < 1){
            if (sclQueryDTOS.size() < 1) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "您未做任何辨识,无法提交");
            }
            //辨识方法 4-HAZOP;
        }else if (assessPlanById.getIdentificationMethod() == 4){
        } else if (assessPlanById.getIdentificationMethod() == 4) {
            List<HazopQueryDTO> hazopQueryDTOS = hazopService.listHazopByPlanId(assessPlanById.getId());
            if (hazopQueryDTOS.size() < 1){
            if (hazopQueryDTOS.size() < 1) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "您未做任何辨识,无法提交");
            }
            //5-类比法 analogy;
        }else if (assessPlanById.getIdentificationMethod() == 5){
        } else if (assessPlanById.getIdentificationMethod() == 5) {
            List<AnalogyQueryDTO> analogyQueryDTOS = analogyService.listAnalogyByPlanId(assessPlanById.getId());
            if (analogyQueryDTOS.size() < 1){
            if (analogyQueryDTOS.size() < 1) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "您未做任何辨识,无法提交");
            }
        }else {
        } else {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "辨识方法参数错误");
        }
@@ -721,48 +857,49 @@
    @Override
    public AssessPlanEvaluateDTO evaluate(Long currentUserId, RiskAssessPlanAppEvaluateBO evaluateParam) {
        if (currentUserId < 0){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆");
        if (currentUserId < 0) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆");
        }
        UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId);
        if (ObjectUtils.isEmpty(userInfoById)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除");
        if (ObjectUtils.isEmpty(userInfoById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除");
        }
        LocalDateTime date = LocalDateTime.now();
        if (ObjectUtils.isEmpty(evaluateParam)){
        if (ObjectUtils.isEmpty(evaluateParam)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价的内容不能为空");
        }
        if (ObjectUtils.isEmpty(evaluateParam.getRiskValue())){
        if (ObjectUtils.isEmpty(evaluateParam.getRiskValue())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险数值不能为空");
        }
        if (ObjectUtils.isEmpty(evaluateParam.getRiskLevelValue())){
        if (ObjectUtils.isEmpty(evaluateParam.getRiskLevelValue())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险等级值不能为空");
        }
        if (ObjectUtils.isEmpty(evaluateParam.getRiskLevel())){
        if (ObjectUtils.isEmpty(evaluateParam.getRiskLevel())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险级别不能为空");
        }
        if (ObjectUtils.isEmpty(evaluateParam.getRiskColor())){
        if (ObjectUtils.isEmpty(evaluateParam.getRiskColor())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险色不能为空");
        }
        if (ObjectUtils.isEmpty(evaluateParam.getManageLevel())){
        if (ObjectUtils.isEmpty(evaluateParam.getManageLevel())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "管理层级不能为空");
        }
        RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(evaluateParam.getId());
        if (ObjectUtils.isEmpty(assessPlanById)){
        if (ObjectUtils.isEmpty(assessPlanById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "要评价的计划不存在或已被删除");
        }
        if (assessPlanById.getPlanSellStatus() == 1){
        if (assessPlanById.getPlanSellStatus() == 1) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划尚未派发,无法辨识");
        }
        if (assessPlanById.getPlanExecStatus() != 3){
        if (assessPlanById.getPlanExecStatus() != 3) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划不处待评价阶段,无法评价");
        }
        if (assessPlanById.getAssessEndTime().isBefore(date)){
        if (assessPlanById.getAssessEndTime().isBefore(date)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "风险评价必须在评估结束时间之前");
        }
        if (!assessPlanById.getEvaluateUserId().equals(userInfoById.getId())){
        List<RiskAssessPlanEvaluateUser> assessPlanEvaluateUserPlanId = evaluateUserService.getAssessPlanEvaluateUserPlanId(assessPlanById.getId(), userInfoById.getId());
        if (ObjectUtils.isEmpty(assessPlanEvaluateUserPlanId)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "您不是评价人,无法进行评价");
        }
        //设置必要参数
@@ -788,48 +925,49 @@
    @Override
    public AssessPlanEvaluateDTO evaluateUpdate(Long currentUserId, RiskAssessPlanAppEvaluateBO evaluateParam) {
        if (currentUserId < 0){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆");
        if (currentUserId < 0) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆");
        }
        UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId);
        if (ObjectUtils.isEmpty(userInfoById)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除");
        if (ObjectUtils.isEmpty(userInfoById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除");
        }
        LocalDateTime date = LocalDateTime.now();
        if (ObjectUtils.isEmpty(evaluateParam)){
        if (ObjectUtils.isEmpty(evaluateParam)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价的内容不能为空");
        }
        if (ObjectUtils.isEmpty(evaluateParam.getRiskValue())){
        if (ObjectUtils.isEmpty(evaluateParam.getRiskValue())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险数值不能为空");
        }
        if (ObjectUtils.isEmpty(evaluateParam.getRiskLevelValue())){
        if (ObjectUtils.isEmpty(evaluateParam.getRiskLevelValue())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险等级值不能为空");
        }
        if (ObjectUtils.isEmpty(evaluateParam.getRiskLevel())){
        if (ObjectUtils.isEmpty(evaluateParam.getRiskLevel())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险级别不能为空");
        }
        if (ObjectUtils.isEmpty(evaluateParam.getRiskColor())){
        if (ObjectUtils.isEmpty(evaluateParam.getRiskColor())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险色不能为空");
        }
        if (ObjectUtils.isEmpty(evaluateParam.getManageLevel())){
        if (ObjectUtils.isEmpty(evaluateParam.getManageLevel())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "管理层级不能为空");
        }
        RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(evaluateParam.getId());
        if (ObjectUtils.isEmpty(assessPlanById)){
        if (ObjectUtils.isEmpty(assessPlanById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "要评价的计划不存在或已被删除");
        }
        if (assessPlanById.getPlanSellStatus() == 1){
        if (assessPlanById.getPlanSellStatus() == 1) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划尚未派发,无法辨识");
        }
        if (assessPlanById.getPlanExecStatus() != 3){
        if (assessPlanById.getPlanExecStatus() != 3) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "该计划不处待评价阶段,无法评价");
        }
        if (assessPlanById.getAssessEndTime().isBefore(date)){
        if (assessPlanById.getAssessEndTime().isBefore(date)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "风险评价必须在评估结束时间之前");
        }
        if (!assessPlanById.getEvaluateUserId().equals(userInfoById.getId())){
        List<RiskAssessPlanEvaluateUser> assessPlanEvaluateUserPlanId = evaluateUserService.getAssessPlanEvaluateUserPlanId(assessPlanById.getId(), userInfoById.getId());
        if (ObjectUtils.isEmpty(assessPlanEvaluateUserPlanId)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "您不是评价人,无法进行评价");
        }
        //设置必要参数
@@ -854,27 +992,28 @@
    @Override
    public AssessPlanUpdateDTO evaluateSubmit(Long currentUserId, Long id) {
        if (currentUserId < 0){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆");
        if (currentUserId < 0) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆");
        }
        UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId);
        if (ObjectUtils.isEmpty(userInfoById)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除");
        if (ObjectUtils.isEmpty(userInfoById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除");
        }
        if (ObjectUtils.isEmpty(id)){
        if (ObjectUtils.isEmpty(id)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "所选评价不能为空");
        }
        RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(id);
        if (ObjectUtils.isEmpty(assessPlanById)){
        if (ObjectUtils.isEmpty(assessPlanById)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "所选评价为空或已被删除");
        }
        if (assessPlanById.getPlanExecStatus() < StatusEnum.PLAN_EXEC_EVALUATE.getCode().byteValue()){
        if (assessPlanById.getPlanExecStatus() < StatusEnum.PLAN_EXEC_EVALUATE.getCode().byteValue()) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "不在评价阶段,无法提交");
        }else if (assessPlanById.getPlanExecStatus() > StatusEnum.PLAN_EXEC_EVALUATE.getCode().byteValue()){
        } else if (assessPlanById.getPlanExecStatus() > StatusEnum.PLAN_EXEC_EVALUATE.getCode().byteValue()) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价已完成,无需重复提交");
        }
        if (!assessPlanById.getEvaluateUserId().equals(userInfoById.getId())){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "您不是评价人,无法进行评价结果提交");
        List<RiskAssessPlanEvaluateUser> assessPlanEvaluateUserPlanId = evaluateUserService.getAssessPlanEvaluateUserPlanId(assessPlanById.getId(), userInfoById.getId());
        if (ObjectUtils.isEmpty(assessPlanEvaluateUserPlanId)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "您不是评价人,无法进行评价");
        }
//        ExecStatusSubmitBO execStatusSubmitBO = new ExecStatusSubmitBO();
//        execStatusSubmitBO.setId(id);
@@ -885,14 +1024,14 @@
        assessPlanById.setPlanExecStatus(StatusEnum.PLAN_EXEC_OVER.getCode().byteValue());
        assessPlanById.setEvaluateTime(LocalDateTime.now());
        //修改风险单元评价状态
        RiskUnit riskUnit = riskUnitService.updateRiskUnitStatus(assessPlanById.getRiskUnitId(),StatusEnum.EVALUATE.getCode());
        if (ObjectUtils.isEmpty(riskUnit)){
        RiskUnit riskUnit = riskUnitService.updateRiskUnitStatus(assessPlanById.getRiskUnitId(), StatusEnum.EVALUATE.getCode());
        if (ObjectUtils.isEmpty(riskUnit)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "修改风险单元状态失败");
        }
        //  1-检查该计划的所有辨识项,是否全部完成评价,否则无法提交
        int result = EvaluateCheckUtils.evaluateCheckUtils(assessPlanById);
        if (result == 1){
        if (result == 1) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "有辨识项未评价,无法提交");
        }
@@ -901,48 +1040,48 @@
        int tag = 0;
        for (RiskAssessPlan riskAssessPlan : assessPlanByExperimentId) {
            // todo - 之前检查使用评价计划的status,存在编写完但未提交的计划。 先加上评估计划执行状态判断。   --- 需要测试是否能避免问题
            if (assessPlanById.getPlanExecStatus() != StatusEnum.PLAN_EXEC_OVER.getCode().byteValue()){
            if (assessPlanById.getPlanExecStatus() != StatusEnum.PLAN_EXEC_OVER.getCode().byteValue()) {
                tag = 1;
            }
            if (assessPlanById.getEvaluateMethod() == 1){
            if (assessPlanById.getEvaluateMethod() == 1) {
                List<LecQueryDTO> lecQueryDTOS = lecService.listLecByPlanId(riskAssessPlan.getId());
                for (LecQueryDTO lec : lecQueryDTOS) {
                    if (lec.getStatus() != 1){
                    if (lec.getStatus() != 1) {
                        tag = 1;
                    }
                }
                //辨识方法2 - LS
            }else if (assessPlanById.getEvaluateMethod() == 2){
            } else if (assessPlanById.getEvaluateMethod() == 2) {
                List<LsQueryDTO> lsQueryDTOS = lsService.listLsByPlanId(riskAssessPlan.getId());
                for (LsQueryDTO ls : lsQueryDTOS) {
                    if (ls.getStatus() != 1){
                    if (ls.getStatus() != 1) {
                        tag = 1;
                    }
                }
                //辨识方法3 - MES
            }else if (assessPlanById.getEvaluateMethod() == 3){
            } else if (assessPlanById.getEvaluateMethod() == 3) {
                List<MesQueryDTO> mesQueryDTOS = mesService.listMesByPlanId(riskAssessPlan.getId());
                for (MesQueryDTO mes : mesQueryDTOS) {
                    if (mes.getStatus() != 1){
                    if (mes.getStatus() != 1) {
                        tag = 1;
                    }
                }
                //辨识方法4 - RS
            }else if (assessPlanById.getEvaluateMethod() == 4){
            } else if (assessPlanById.getEvaluateMethod() == 4) {
                List<RsQueryDTO> rsQueryDTOS = rsService.listRsByPlanId(riskAssessPlan.getId());
                for (RsQueryDTO rs : rsQueryDTOS) {
                    if (rs.getStatus() != 1){
                    if (rs.getStatus() != 1) {
                        tag = 1;
                    }
                }
            }
        }
        //所有评估计划完成,设置实验为评估完成状态。
        if (tag == 0){
        if (tag == 0) {
            //修改实验 为 评估完成
            ExperimentInfoDTO experimentInfoDTO = experimentInfoService.updateExperimentStage(assessPlanById.getExperimentId(), StatusEnum.EXPERIMENT_STATUS_FINISH.getCode().byteValue());
            if (ObjectUtils.isEmpty(experimentInfoDTO)){
                throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"实验状态修改失败");
            if (ObjectUtils.isEmpty(experimentInfoDTO)) {
                throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "实验状态修改失败");
            }
        }
@@ -959,43 +1098,43 @@
    public SearchResult<RiskAssessAppQueryDTO> selectAssessPage(Long currentUserId, RiskAssessAppQueryBO queryBO) {
        //校验参数
        if (ObjectUtils.isEmpty(queryBO.getPageSize())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"分页信息不能为空");
        if (ObjectUtils.isEmpty(queryBO.getPageSize())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "分页信息不能为空");
        }
        if (ObjectUtils.isEmpty(queryBO.getPageIndex())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"分页信息不能为空");
        if (ObjectUtils.isEmpty(queryBO.getPageIndex())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "分页信息不能为空");
        }
        // 检查是否是实验管理者
        UserInfoDomainDTO userInfo = userDomainService.getUserById(currentUserId);
        if (ObjectUtils.isEmpty(userInfo)){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"用户不存在");
        if (ObjectUtils.isEmpty(userInfo)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "用户不存在");
        }
        if (queryBO.getAssessPlanName() == "null"){
        if (queryBO.getAssessPlanName() == "null") {
            queryBO.setAssessPlanName(null);
        }
        if (queryBO.getExperimentName() == "null"){
        if (queryBO.getExperimentName() == "null") {
            queryBO.setExperimentName(null);
        }
        AssessQueryBO queryParam = BeanCopyUtils.copyBean(queryBO, AssessQueryBO.class);
        if (!ObjectUtils.isEmpty(queryBO.getExperimentName())){
        if (!ObjectUtils.isEmpty(queryBO.getExperimentName())) {
            ExperimentInfoDTO experimentByName = experimentInfoService.getExperimentByName(queryBO.getExperimentName());
            if (ObjectUtils.isEmpty(experimentByName)){
                throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode() ,"分页信息不能为空");
            if (ObjectUtils.isEmpty(experimentByName)) {
                throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "分页信息不能为空");
            }
            queryParam.setExperimentId(experimentByName.getId());
        }
        // 拿到所有的固有风险单元 ,遍历
        List<Long> planIds = new ArrayList<>();
        List<RiskUnit> riskUnits = riskUnitService.listInherentRiskUnit();
        if (ObjectUtils.isEmpty(riskUnits)){
        if (ObjectUtils.isEmpty(riskUnits)) {
            for (RiskUnit riskUnit : riskUnits) {
                // 拿到所有固有风险的评估计划
                List<RiskAssessPlan> assessPlanByInherentUnit = assessPlanRepository.getAssessPlanByInherentUnit(riskUnit.getBasicRiskUnitId());
                if (assessPlanByInherentUnit.size() > 0){
                if (assessPlanByInherentUnit.size() > 0) {
                    // 遍历固有风险评估计划,如果当前用户属于对应实验的负责人,新增,修改人
                    for (RiskAssessPlan inherentRiskAssessPlan : assessPlanByInherentUnit) {
                        if (riskUnit.getExperimentId().equals(currentUserId) || riskUnit.getCreateByUserId().equals(currentUserId)  || riskUnit.getUpdateByUserId().equals(currentUserId)){
                        if (riskUnit.getExperimentId().equals(currentUserId) || riskUnit.getCreateByUserId().equals(currentUserId) || riskUnit.getUpdateByUserId().equals(currentUserId)) {
                            planIds.add(inherentRiskAssessPlan.getId());
                        }
                    }
@@ -1006,7 +1145,7 @@
        List<ExperimentInfoDTO> experimentByList = experimentInfoService.getExperimentByUser(currentUserId);
        List<Long> experimentIdList = new ArrayList<>();
        experimentIdList.add(0L);
        if (!ObjectUtils.isEmpty(experimentByList)){
        if (!ObjectUtils.isEmpty(experimentByList)) {
            for (ExperimentInfoDTO experimentInfo : experimentByList) {
                experimentIdList.add(experimentInfo.getId());
            }
@@ -1022,42 +1161,52 @@
            @Override
            public Predicate toPredicate(Root<RiskAssessPlan> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
                List<Predicate> predicateList = new ArrayList<>();
                if (queryParam.getAssessPlanName() != null && !queryParam.getAssessPlanName().equals("")){
                    predicateList.add(criteriaBuilder.like(root.get("assessPlanName"),"%"+queryParam.getAssessPlanName()+"%"));
                if (queryParam.getAssessPlanName() != null && !queryParam.getAssessPlanName().equals("")) {
                    predicateList.add(criteriaBuilder.like(root.get("assessPlanName"), "%" + queryParam.getAssessPlanName() + "%"));
                }
                if (queryParam.getExperimentId() != null && !queryParam.getExperimentId().equals("")){
                if (queryParam.getExperimentId() != null && !queryParam.getExperimentId().equals("")) {
                    predicateList.add(criteriaBuilder.equal(root.get("experimentId"), queryParam.getExperimentId()));
                }
                if (queryParam.getAssessPlanId() != null && !queryParam.getAssessPlanId().equals("")){
                if (queryParam.getAssessPlanId() != null && !queryParam.getAssessPlanId().equals("")) {
                    predicateList.add(criteriaBuilder.equal(root.get("id"), queryParam.getAssessPlanId()));
                }
                if (!ObjectUtils.isEmpty(queryParam.getPlanExecStatus())){
                    if (queryParam.getPlanExecStatus() == 5){
                if (!ObjectUtils.isEmpty(queryParam.getPlanExecStatus())) {
                    if (queryParam.getPlanExecStatus() == 5) {
                        predicateList.add(criteriaBuilder.ge(root.get("planExecStatus"), 3));
                    }else {
                    } else {
                        predicateList.add(criteriaBuilder.equal(root.get("planExecStatus"), queryParam.getPlanExecStatus()));
                    }
                }
                if (queryParam.getTag() == 2){
                if (queryParam.getTag() == 2) {
                    predicateList.add(criteriaBuilder.isNotNull(root.get("identificationTime")));
                }
                if (queryParam.getTag() == 3){
                if (queryParam.getTag() == 3) {
                    predicateList.add(criteriaBuilder.isNotNull(root.get("evaluateTime")));
                }
                if (planIds.size() > 0){
                if (planIds.size() > 0) {
                    predicateList.add(criteriaBuilder.in(root.get("id")).value(planIds));
                }
                if (roleTag == UserTagEnum.USER_TAG_0.getCode()){
                Join<RiskAssessPlan, RiskAssessPlanIdentificationUser> identificationUserJoin = root.join("riskAssessPlanIdentificationUsers", JoinType.LEFT);
                Join<RiskAssessPlan, RiskAssessPlanEvaluateUser> evaluateUserJoin = root.join("riskAssessPlanEvaluateUsers", JoinType.LEFT);
                if (roleTag == UserTagEnum.USER_TAG_0.getCode()) {
                    //此处应有谁能查询:辨识专家,评价专家,实验负责人(此处未存相关信息,以实验id为条件查询)
                    predicateList.add(criteriaBuilder.or(
                                    criteriaBuilder.equal(root.get("identificationUserId"), currentUserId),
                                    criteriaBuilder.equal(root.get("evaluateUserId"), currentUserId),
                                    criteriaBuilder.equal(identificationUserJoin.get("identificationUserId"), currentUserId),
                                    criteriaBuilder.equal(evaluateUserJoin.get("evaluateUserId"), currentUserId),
                                    criteriaBuilder.in(root.get("experimentId")).value(experimentIdList)
                            )
                    );
//                    predicateList.add(criteriaBuilder.or(
//                                    criteriaBuilder.equal(root.get("identificationUserId"), currentUserId),
//                                    criteriaBuilder.equal(root.get("evaluateUserId"), currentUserId),
//                                    criteriaBuilder.in(root.get("experimentId")).value(experimentIdList)
//                            )
//                    );
                }
                predicateList.add(criteriaBuilder.equal(root.get("deleteStatus"),StatusEnum.DELETE_NOT.getCode()));
                query.groupBy(root.get("id"));
                predicateList.add(criteriaBuilder.equal(root.get("deleteStatus"), StatusEnum.DELETE_NOT.getCode()));
                return criteriaBuilder.and(predicateList.toArray(new Predicate[0]));
            }
        };
@@ -1089,13 +1238,34 @@
//            }
//        }
        if (pageResult.getContent().size() > 0){
        if (pageResult.getContent().size() > 0) {
            for (RiskAssessPlan riskAssessPlan : pageResult.getContent()) {
                AssessQueryDTO assessQueryDTO = BeanCopyUtils.copyBean(riskAssessPlan, AssessQueryDTO.class);
                for (RiskUnitListAppQueryDTO riskUnit : riskUnitListAppQueryDTOS) {
                    if (riskUnit.getId() == assessQueryDTO.getRiskUnitId()){
                    if (riskUnit.getId() == assessQueryDTO.getRiskUnitId()) {
                        assessQueryDTO.setRiskUnitName(riskUnit.getRiskName());
                    }
                }
                List<RiskAssessPlanIdentificationUser> riskAssessPlanIdentificationUsers = riskAssessPlan.getRiskAssessPlanIdentificationUsers();
                if (!ObjectUtils.isEmpty(riskAssessPlanIdentificationUsers)) {
                    String identificationUsersString = riskAssessPlanIdentificationUsers.stream()
                            .map(RiskAssessPlanIdentificationUser::getIdentificationUser)
                            .collect(Collectors.joining(","));
                    assessQueryDTO.setIdentificationUser(identificationUsersString);
                    List<UserIdentityRespDTO> userIdentityRespDTOS = BeanCopyUtils.copyBeanList(riskAssessPlanIdentificationUsers, UserIdentityRespDTO.class);
                    assessQueryDTO.setIdentityUsers(userIdentityRespDTOS);
                }
                List<RiskAssessPlanEvaluateUser> riskAssessPlanEvaluateUsers = riskAssessPlan.getRiskAssessPlanEvaluateUsers();
                if (!ObjectUtils.isEmpty(riskAssessPlanEvaluateUsers)) {
                    String identificationUsersString = riskAssessPlanEvaluateUsers.stream()
                            .map(RiskAssessPlanEvaluateUser::getEvaluateUser)
                            .collect(Collectors.joining(","));
                    assessQueryDTO.setEvaluateUser(identificationUsersString);
                    List<UserEvaluateRespDTO> userEvaluateRespDTOS = BeanCopyUtils.copyBeanList(riskAssessPlanEvaluateUsers, UserEvaluateRespDTO.class);
                    assessQueryDTO.setEvaluateUsers(userEvaluateRespDTOS);
                }
                List<FactorQueryDTO> factorQueryDTOList = new ArrayList<>();
                List<PhaQueryDTO> phaList = new ArrayList<>();
@@ -1105,28 +1275,28 @@
                List<AnalogyQueryDTO> analogyList = new ArrayList<>();
                //辨识方法 1-PHA;
                if (assessQueryDTO.getIdentificationMethod() == 1){
                if (assessQueryDTO.getIdentificationMethod() == 1) {
                    phaList = phaService.listPhaByPlanId(riskAssessPlan.getId());
                    //辨识方法 2-JHA;
                }else if (assessQueryDTO.getIdentificationMethod() == 2){
                } else if (assessQueryDTO.getIdentificationMethod() == 2) {
                    jhaList = jhaService.listJhaByPlanId(riskAssessPlan.getId());
                    //辨识方法 3-SCL;
                }else if (assessQueryDTO.getIdentificationMethod() == 3){
                } else if (assessQueryDTO.getIdentificationMethod() == 3) {
                    sclList = sclService.listSclByPlanId(riskAssessPlan.getId());
                    //辨识方法 4-HAZOP;
                }else if (assessQueryDTO.getIdentificationMethod() == 4){
                } else if (assessQueryDTO.getIdentificationMethod() == 4) {
                    hazopList = hazopService.listHazopByPlanId(riskAssessPlan.getId());
                    //5-类比法 analogy;
                }else if (assessQueryDTO.getIdentificationMethod() == 5){
                } else if (assessQueryDTO.getIdentificationMethod() == 5) {
                    analogyList = analogyService.listAnalogyByPlanId(riskAssessPlan.getId());
                }else {
                } else {
                    throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "辨识方法参数错误");
                }
                //评价方法1 - LEC
                if (assessQueryDTO.getEvaluateMethod() == 1){
                if (assessQueryDTO.getEvaluateMethod() == 1) {
                    List<LecQueryDTO> lecList = lecService.listLecByPlanId(riskAssessPlan.getId());
                    if (assessQueryDTO.getIdentificationMethod() == 1){
                    if (assessQueryDTO.getIdentificationMethod() == 1) {
                        for (PhaQueryDTO pha : phaList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(pha, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1134,7 +1304,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(pha.getUpdateTime());
                            for (LecQueryDTO lec : lecList) {
                                if (lec.getIdentificationId() == pha.getId()){
                                if (lec.getIdentificationId() == pha.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.lecMatchPha(pha, lec);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1144,16 +1314,16 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
                            factorQueryDTOList.add(factorQueryDTO);
                        }
                    }else if (assessQueryDTO.getIdentificationMethod() == 2){
                    } else if (assessQueryDTO.getIdentificationMethod() == 2) {
                        for (JhaQueryDTO jha : jhaList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(jha, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1161,7 +1331,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(jha.getUpdateTime());
                            for (LecQueryDTO lec : lecList) {
                                if (lec.getIdentificationId() == jha.getId()){
                                if (lec.getIdentificationId() == jha.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.lecMatchJha(jha, lec);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1171,16 +1341,16 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
                            factorQueryDTOList.add(factorQueryDTO);
                        }
                    }else if (assessQueryDTO.getIdentificationMethod() == 3){
                    } else if (assessQueryDTO.getIdentificationMethod() == 3) {
                        for (SclQueryDTO scl : sclList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(scl, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1188,7 +1358,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(scl.getUpdateTime());
                            for (LecQueryDTO lec : lecList) {
                                if (lec.getIdentificationId() == scl.getId()){
                                if (lec.getIdentificationId() == scl.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.lecMatchScl(scl, lec);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1198,16 +1368,16 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
                            factorQueryDTOList.add(factorQueryDTO);
                        }
                    }else if (assessQueryDTO.getIdentificationMethod() == 4){
                    } else if (assessQueryDTO.getIdentificationMethod() == 4) {
                        for (HazopQueryDTO hazop : hazopList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(hazop, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1215,7 +1385,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(hazop.getUpdateTime());
                            for (LecQueryDTO lec : lecList) {
                                if (lec.getIdentificationId() == hazop.getId()){
                                if (lec.getIdentificationId() == hazop.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.lecMatchHazop(hazop, lec);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1224,17 +1394,17 @@
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                                }
                                for (UserInfoDomainDTO user : userList) {
                                    if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                    if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                        assessQueryDTO.setCreateByUserName(user.getRealName());
                                    }
                                    if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                    if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                        assessQueryDTO.setUpdateByUserName(user.getRealName());
                                    }
                                }
                                factorQueryDTOList.add(factorQueryDTO);
                            }
                        }
                    }else if (assessQueryDTO.getIdentificationMethod() == 5){
                    } else if (assessQueryDTO.getIdentificationMethod() == 5) {
                        for (AnalogyQueryDTO analogy : analogyList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(analogy, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1242,7 +1412,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(analogy.getUpdateTime());
                            for (LecQueryDTO lec : lecList) {
                                if (lec.getIdentificationId() == analogy.getId()){
                                if (lec.getIdentificationId() == analogy.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.lecMatchAnalogy(analogy, lec);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1252,10 +1422,10 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
@@ -1264,9 +1434,9 @@
                    }
                    //评价方法2 - LS
                }else if (assessQueryDTO.getEvaluateMethod() == 2){
                } else if (assessQueryDTO.getEvaluateMethod() == 2) {
                    List<LsQueryDTO> lsList = lsService.listLsByPlanId(riskAssessPlan.getId());
                    if (assessQueryDTO.getIdentificationMethod() == 1){
                    if (assessQueryDTO.getIdentificationMethod() == 1) {
                        for (PhaQueryDTO pha : phaList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(pha, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1274,7 +1444,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(pha.getUpdateTime());
                            for (LsQueryDTO ls : lsList) {
                                if (ls.getIdentificationId() == pha.getId()){
                                if (ls.getIdentificationId() == pha.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.lsMatchPha(pha, ls);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1284,16 +1454,16 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
                            factorQueryDTOList.add(factorQueryDTO);
                        }
                    }else if (assessQueryDTO.getIdentificationMethod() == 2){
                    } else if (assessQueryDTO.getIdentificationMethod() == 2) {
                        for (JhaQueryDTO jha : jhaList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(jha, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1301,7 +1471,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(jha.getUpdateTime());
                            for (LsQueryDTO ls : lsList) {
                                if (ls.getIdentificationId() == jha.getId()){
                                if (ls.getIdentificationId() == jha.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.lsMatchJha(jha, ls);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1311,16 +1481,16 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
                            factorQueryDTOList.add(factorQueryDTO);
                        }
                    }else if (assessQueryDTO.getIdentificationMethod() == 3){
                    } else if (assessQueryDTO.getIdentificationMethod() == 3) {
                        for (SclQueryDTO scl : sclList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(scl, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1328,7 +1498,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(scl.getUpdateTime());
                            for (LsQueryDTO ls : lsList) {
                                if (ls.getIdentificationId() == scl.getId()){
                                if (ls.getIdentificationId() == scl.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.lsMatchScl(scl, ls);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1338,16 +1508,16 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
                            factorQueryDTOList.add(factorQueryDTO);
                        }
                    }else if (assessQueryDTO.getIdentificationMethod() == 4){
                    } else if (assessQueryDTO.getIdentificationMethod() == 4) {
                        for (HazopQueryDTO hazop : hazopList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(hazop, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1355,7 +1525,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(hazop.getUpdateTime());
                            for (LsQueryDTO ls : lsList) {
                                if (ls.getIdentificationId() == hazop.getId()){
                                if (ls.getIdentificationId() == hazop.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.lsMatchHazop(hazop, ls);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1365,16 +1535,16 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
                            factorQueryDTOList.add(factorQueryDTO);
                        }
                    }else if (assessQueryDTO.getIdentificationMethod() == 5){
                    } else if (assessQueryDTO.getIdentificationMethod() == 5) {
                        for (AnalogyQueryDTO analogy : analogyList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(analogy, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1382,7 +1552,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(analogy.getUpdateTime());
                            for (LsQueryDTO ls : lsList) {
                                if (ls.getIdentificationId() == analogy.getId()){
                                if (ls.getIdentificationId() == analogy.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.lsMatchAnalogy(analogy, ls);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1392,10 +1562,10 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
@@ -1403,9 +1573,9 @@
                        }
                    }
                    //评价方法3 - MES
                }else if (assessQueryDTO.getEvaluateMethod() == 3){
                } else if (assessQueryDTO.getEvaluateMethod() == 3) {
                    List<MesQueryDTO> mesList = mesService.listMesByPlanId(riskAssessPlan.getId());
                    if (assessQueryDTO.getIdentificationMethod() == 1){
                    if (assessQueryDTO.getIdentificationMethod() == 1) {
                        for (PhaQueryDTO pha : phaList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(pha, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1413,7 +1583,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(pha.getUpdateTime());
                            for (MesQueryDTO mes : mesList) {
                                if (mes.getIdentificationId() == pha.getId()){
                                if (mes.getIdentificationId() == pha.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.mesMatchPha(pha, mes);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1423,16 +1593,16 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
                            factorQueryDTOList.add(factorQueryDTO);
                        }
                    }else if (assessQueryDTO.getIdentificationMethod() == 2){
                    } else if (assessQueryDTO.getIdentificationMethod() == 2) {
                        for (JhaQueryDTO jha : jhaList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(jha, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1440,7 +1610,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(jha.getUpdateTime());
                            for (MesQueryDTO mes : mesList) {
                                if (mes.getIdentificationId() == jha.getId()){
                                if (mes.getIdentificationId() == jha.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.mesMatchJha(jha, mes);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1450,16 +1620,16 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
                            factorQueryDTOList.add(factorQueryDTO);
                        }
                    }else if (assessQueryDTO.getIdentificationMethod() == 3){
                    } else if (assessQueryDTO.getIdentificationMethod() == 3) {
                        for (SclQueryDTO scl : sclList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(scl, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1467,7 +1637,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(scl.getUpdateTime());
                            for (MesQueryDTO mes : mesList) {
                                if (mes.getIdentificationId() == scl.getId()){
                                if (mes.getIdentificationId() == scl.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.mesMatchScl(scl, mes);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1477,16 +1647,16 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
                            factorQueryDTOList.add(factorQueryDTO);
                        }
                    }else if (assessQueryDTO.getIdentificationMethod() == 4){
                    } else if (assessQueryDTO.getIdentificationMethod() == 4) {
                        for (HazopQueryDTO hazop : hazopList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(hazop, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1494,7 +1664,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(hazop.getUpdateTime());
                            for (MesQueryDTO mes : mesList) {
                                if (mes.getIdentificationId() == hazop.getId()){
                                if (mes.getIdentificationId() == hazop.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.mesMatchHazop(hazop, mes);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1504,16 +1674,16 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
                            factorQueryDTOList.add(factorQueryDTO);
                        }
                    }else if (assessQueryDTO.getIdentificationMethod() == 5){
                    } else if (assessQueryDTO.getIdentificationMethod() == 5) {
                        for (AnalogyQueryDTO analogy : analogyList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(analogy, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1521,7 +1691,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(analogy.getUpdateTime());
                            for (MesQueryDTO mes : mesList) {
                                if (mes.getIdentificationId() == analogy.getId()){
                                if (mes.getIdentificationId() == analogy.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.mesMatchAnalogy(analogy, mes);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1531,10 +1701,10 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
@@ -1542,9 +1712,9 @@
                        }
                    }
                    //评价方法4 - RS
                }else if (assessQueryDTO.getEvaluateMethod() == 4){
                } else if (assessQueryDTO.getEvaluateMethod() == 4) {
                    List<RsQueryDTO> rsList = rsService.listRsByPlanId(riskAssessPlan.getId());
                    if (assessQueryDTO.getIdentificationMethod() == 1){
                    if (assessQueryDTO.getIdentificationMethod() == 1) {
                        for (PhaQueryDTO pha : phaList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(pha, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1552,7 +1722,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(pha.getUpdateTime());
                            for (RsQueryDTO rs : rsList) {
                                if (rs.getIdentificationId() == pha.getId()){
                                if (rs.getIdentificationId() == pha.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.rsMatchPha(pha, rs);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1562,16 +1732,16 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
                            factorQueryDTOList.add(factorQueryDTO);
                        }
                    }else if (assessQueryDTO.getIdentificationMethod() == 2){
                    } else if (assessQueryDTO.getIdentificationMethod() == 2) {
                        for (JhaQueryDTO jha : jhaList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(jha, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1579,7 +1749,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(jha.getUpdateTime());
                            for (RsQueryDTO rs : rsList) {
                                if (rs.getIdentificationId() == jha.getId()){
                                if (rs.getIdentificationId() == jha.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.rsMatchJha(jha, rs);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1589,16 +1759,16 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
                            factorQueryDTOList.add(factorQueryDTO);
                        }
                    }else if (assessQueryDTO.getIdentificationMethod() == 3){
                    } else if (assessQueryDTO.getIdentificationMethod() == 3) {
                        for (SclQueryDTO scl : sclList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(scl, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1606,7 +1776,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(scl.getUpdateTime());
                            for (RsQueryDTO rs : rsList) {
                                if (rs.getIdentificationId() == scl.getId()){
                                if (rs.getIdentificationId() == scl.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.rsMatchScl(scl, rs);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1616,16 +1786,16 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
                            factorQueryDTOList.add(factorQueryDTO);
                        }
                    }else if (assessQueryDTO.getIdentificationMethod() == 4){
                    } else if (assessQueryDTO.getIdentificationMethod() == 4) {
                        for (HazopQueryDTO hazop : hazopList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(hazop, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1633,7 +1803,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(hazop.getUpdateTime());
                            for (RsQueryDTO rs : rsList) {
                                if (rs.getIdentificationId() == hazop.getId()){
                                if (rs.getIdentificationId() == hazop.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.rsMatchHazop(hazop, rs);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1643,16 +1813,16 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
                            factorQueryDTOList.add(factorQueryDTO);
                        }
                    }else if (assessQueryDTO.getIdentificationMethod() == 5){
                    } else if (assessQueryDTO.getIdentificationMethod() == 5) {
                        for (AnalogyQueryDTO analogy : analogyList) {
                            FactorQueryDTO factorQueryDTO = BeanCopyUtils.copyBean(analogy, FactorQueryDTO.class);
                            factorQueryDTO.setId(riskAssessPlan.getId());
@@ -1660,7 +1830,7 @@
                            factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
                            factorQueryDTO.setItemIdentificationTime(analogy.getUpdateTime());
                            for (RsQueryDTO rs : rsList) {
                                if (rs.getIdentificationId() == analogy.getId()){
                                if (rs.getIdentificationId() == analogy.getId()) {
                                    EvaluateAndIdentificationUtils evaluateAndIdentificationUtils = new EvaluateAndIdentificationUtils();
                                    factorQueryDTO = evaluateAndIdentificationUtils.rsMatchAnalogy(analogy, rs);
                                    factorQueryDTO.setEvaluateMethod(riskAssessPlan.getEvaluateMethod());
@@ -1670,17 +1840,17 @@
                                }
                            }
                            for (UserInfoDomainDTO user : userList) {
                                if (user.getId() == assessQueryDTO.getCreateByUserId()){
                                if (user.getId() == assessQueryDTO.getCreateByUserId()) {
                                    assessQueryDTO.setCreateByUserName(user.getRealName());
                                }
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()){
                                if (user.getId() == assessQueryDTO.getUpdateByUserId()) {
                                    assessQueryDTO.setUpdateByUserName(user.getRealName());
                                }
                            }
                            factorQueryDTOList.add(factorQueryDTO);
                        }
                    }
                }else {
                } else {
                    throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "评价方法参数错误");
                }
                assessQueryDTO.setFactorQueryDTOList(factorQueryDTOList);
@@ -1701,27 +1871,29 @@
    @Override
    public AssessPlanUpdateDTO deleteIdentification(Long currentUserId, RiskAssessPlanIdentificationDeleteReqBO deleteReqBO) {
        if (currentUserId < 0){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆");
        if (currentUserId < 0) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆");
        }
        UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId);
        if (ObjectUtils.isEmpty(userInfoById)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除");
        if (ObjectUtils.isEmpty(userInfoById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除");
        }
        if (ObjectUtils.isEmpty(deleteReqBO.getId())){
        if (ObjectUtils.isEmpty(deleteReqBO.getId())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "要删除的辨识项目不能为空");
        }
        RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(deleteReqBO.getId());
        if (ObjectUtils.isEmpty(assessPlanById)){
        if (ObjectUtils.isEmpty(assessPlanById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "辨识计划不存在,或已被删除");
        }
        if (!assessPlanById.getIdentificationUserId().equals(currentUserId)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"不是辨识专家,无法操作");
        List<RiskAssessPlanIdentificationUser> assessPlanIdentificationUserPlanId = planIdentificationUserService.getAssessPlanIdentificationUserPlanId(assessPlanById.getId(), currentUserId);
        if (ObjectUtils.isEmpty(assessPlanIdentificationUserPlanId)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "不是辨识专家,无法操作");
        }
        if (ObjectUtils.isEmpty(assessPlanById.getIdentificationMethod())){
        if (ObjectUtils.isEmpty(assessPlanById.getIdentificationMethod())) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "要删除的辨识项目为空,或已被删除");
        }
        if (assessPlanById.getPlanExecStatus() != StatusEnum.PLAN_EXEC_IDENTIFICATION.getCode().byteValue()){
        if (assessPlanById.getPlanExecStatus() != StatusEnum.PLAN_EXEC_IDENTIFICATION.getCode().byteValue()) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "辨识已提交,无法删除");
        }
//        if (!assessPlanById.getPlanUserId().equals(userInfoById.getId())){
@@ -1730,41 +1902,41 @@
        //处理辨识表
        //辨识方法 1-PHA;
        int tag = 0;
        if (assessPlanById.getIdentificationMethod() == 1){
        if (assessPlanById.getIdentificationMethod() == 1) {
            IdentificationMethodDeleteDTO deleteIdentificationResult = phaService.deletePhaByPlanId(currentUserId, deleteReqBO.getPhaId());
            if (deleteIdentificationResult.getResult() < 1){
            if (deleteIdentificationResult.getResult() < 1) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除辨识项目失败");
            }
            tag = 1;
            //辨识方法 2-JHA;
        }else if (assessPlanById.getIdentificationMethod() == 2){
        } else if (assessPlanById.getIdentificationMethod() == 2) {
            IdentificationMethodDeleteDTO deleteIdentificationResult = jhaService.deleteJhaByPlanId(currentUserId, deleteReqBO.getJhaId());
            if (deleteIdentificationResult.getResult() < 1){
            if (deleteIdentificationResult.getResult() < 1) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除辨识项目失败");
            }
            tag = 1;
            //辨识方法 3-SCL;
        }else if (assessPlanById.getIdentificationMethod() == 3){
            IdentificationMethodDeleteDTO deleteIdentificationResult =sclService.deleteSclByPlanId(currentUserId, deleteReqBO.getSclId());
            if (deleteIdentificationResult.getResult() < 1){
        } else if (assessPlanById.getIdentificationMethod() == 3) {
            IdentificationMethodDeleteDTO deleteIdentificationResult = sclService.deleteSclByPlanId(currentUserId, deleteReqBO.getSclId());
            if (deleteIdentificationResult.getResult() < 1) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除辨识项目失败");
            }
            tag = 1;
            //辨识方法 4-HAZOP;
        }else if (assessPlanById.getIdentificationMethod() == 4){
        } else if (assessPlanById.getIdentificationMethod() == 4) {
            IdentificationMethodDeleteDTO deleteIdentificationResult = hazopService.deleteHazopByPlanId(currentUserId, deleteReqBO.getHazopId());
            if (deleteIdentificationResult.getResult() < 1){
            if (deleteIdentificationResult.getResult() < 1) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除辨识项目失败");
            }
            tag = 1;
            //5-类比法 analogy;
        }else if (assessPlanById.getIdentificationMethod() == 5){
            IdentificationMethodDeleteDTO deleteIdentificationResult= analogyService.deleteAnalogyByPlanId(currentUserId, deleteReqBO.getAnalogyId());
            if (deleteIdentificationResult.getResult() < 1){
        } else if (assessPlanById.getIdentificationMethod() == 5) {
            IdentificationMethodDeleteDTO deleteIdentificationResult = analogyService.deleteAnalogyByPlanId(currentUserId, deleteReqBO.getAnalogyId());
            if (deleteIdentificationResult.getResult() < 1) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除辨识项目失败");
            }
            tag = 1;
        }else {
        } else {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "辨识方法参数错误");
        }
        //处理计划表 , 清除辨识时间
@@ -1772,7 +1944,7 @@
        //todo 需要进行判断,如果没有辨识,清空时间,如果有,重置时间
        assessPlanById.setIdentificationTime(null);
        RiskAssessPlan deleteResult = assessPlanRepository.save(assessPlanById);
        if (ObjectUtils.isEmpty(deleteResult)){
        if (ObjectUtils.isEmpty(deleteResult)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "辨识方法删除失败");
        }
@@ -1786,54 +1958,54 @@
    @Override
    public AssessPlanUpdateDTO deleteEvaluate(Long currentUserId, RiskAssessPlanEvaluateDeleteReqBO deleteReqBO) {
        if (currentUserId < 0){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户无效,请重新登陆");
        if (currentUserId < 0) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户无效,请重新登陆");
        }
        UserInfoDomainDTO userInfoById = userDomainService.getUserInfoById(currentUserId);
        if (ObjectUtils.isEmpty(userInfoById)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode() ,"当前用户不存在或已被删除");
        if (ObjectUtils.isEmpty(userInfoById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_NOT_ALLOWED.getCode(), "当前用户不存在或已被删除");
        }
        if (ObjectUtils.isEmpty(deleteReqBO.getId())){
        if (ObjectUtils.isEmpty(deleteReqBO.getId())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "要删除的评价项目不能为空");
        }
        RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(deleteReqBO.getId());
        if (ObjectUtils.isEmpty(assessPlanById)){
        if (ObjectUtils.isEmpty(assessPlanById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "评价计划不存在,或已被删除");
        }
        if (ObjectUtils.isEmpty(assessPlanById.getEvaluateMethod())){
        if (ObjectUtils.isEmpty(assessPlanById.getEvaluateMethod())) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "要删除的评价项目为空,或已被删除");
        }
        if (assessPlanById.getPlanExecStatus() != StatusEnum.PLAN_EXEC_EVALUATE.getCode().byteValue()){
        if (assessPlanById.getPlanExecStatus() != StatusEnum.PLAN_EXEC_EVALUATE.getCode().byteValue()) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "评价已提交,无法删除");
        }
        if (!assessPlanById.getPlanUserId().equals(userInfoById.getId())){
        if (!assessPlanById.getPlanUserId().equals(userInfoById.getId())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "您不是计划制定者,无法删除");
        }
        //辨识方法1 - LEC
        if (assessPlanById.getEvaluateMethod() == 1){
        if (assessPlanById.getEvaluateMethod() == 1) {
            EvaluateMethodDeleteDTO deleteEvaluateResult = lecService.deleteLecByPlanId(currentUserId, deleteReqBO);
            if (deleteEvaluateResult.getResult() < 1){
            if (deleteEvaluateResult.getResult() < 1) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除评价项目失败");
            }
            //辨识方法2 - LS
        }else if (assessPlanById.getEvaluateMethod() == 2){
        } else if (assessPlanById.getEvaluateMethod() == 2) {
            EvaluateMethodDeleteDTO deleteEvaluateResult = lsService.deleteLsByPlanId(currentUserId, deleteReqBO);
            if (deleteEvaluateResult.getResult() < 1){
            if (deleteEvaluateResult.getResult() < 1) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除评价项目失败");
            }
            //辨识方法3 - MES
        }else if (assessPlanById.getEvaluateMethod() == 3){
        } else if (assessPlanById.getEvaluateMethod() == 3) {
            EvaluateMethodDeleteDTO deleteEvaluateResult = mesService.deleteMesByPlanId(currentUserId, deleteReqBO);
            if (deleteEvaluateResult.getResult() < 1){
            if (deleteEvaluateResult.getResult() < 1) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除评价项目失败");
            }
            //辨识方法4 - RS
        }else if (assessPlanById.getEvaluateMethod() == 4){
        } else if (assessPlanById.getEvaluateMethod() == 4) {
            EvaluateMethodDeleteDTO deleteEvaluateResult = rsService.deleteRsByPlanId(currentUserId, deleteReqBO);
            if (deleteEvaluateResult.getResult() < 1){
            if (deleteEvaluateResult.getResult() < 1) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "删除评价项目失败");
            }
        }else {
        } else {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR.getCode(), "评价方法参数错误");
        }
@@ -1841,7 +2013,7 @@
//        RiskAssessPlan deleteResult = assessPlanRepository.deleteEvaluate(id, LocalDateTime.now());
        assessPlanById.setIdentificationTime(null);
        RiskAssessPlan deleteResult = assessPlanRepository.save(assessPlanById);
        if (ObjectUtils.isEmpty(deleteResult)){
        if (ObjectUtils.isEmpty(deleteResult)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "评价方法删除失败");
        }
@@ -1854,12 +2026,12 @@
    @Override
    public AssessPlanQueryDTO getAssessPlanById(Long id) {
        if (ObjectUtils.isEmpty(id)){
        if (ObjectUtils.isEmpty(id)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估计划不能为空");
        }
        RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(id);
        if (ObjectUtils.isEmpty(assessPlanById)){
        if (ObjectUtils.isEmpty(assessPlanById)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "评估计划不存在");
        }
        return BeanCopyUtils.copyBean(assessPlanById, AssessPlanQueryDTO.class);
@@ -1871,23 +2043,25 @@
    @Override
    public List<AssessPlanQueryDTO> getAssessPlanByExperimentId(Long experimentId) {
        if (ObjectUtils.isEmpty(experimentId)){
        if (ObjectUtils.isEmpty(experimentId)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估计划不能为空");
        }
        List<RiskAssessPlan> assessPlanList = assessPlanRepository.getAssessPlanByExperimentId(experimentId);
        return BeanCopyUtils.copyBeanList(assessPlanList, AssessPlanQueryDTO.class);
    }
    /**
     * 评估计划 - 查询已派发
     */
    @Override
    public List<RiskAssessPlanListAppDTO> listAssessPlan(Byte status) {
        List<RiskAssessPlan> riskAssessPlans = assessPlanRepository.listAssessPlan(status);
        if (riskAssessPlans.size() < 1){
        if (riskAssessPlans.size() < 1) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "没有可以辨识的评估计划");
        }
        return BeanCopyUtils.copyBeanList(riskAssessPlans, RiskAssessPlanListAppDTO.class);
    }
    /**
     * 评估计划 - 修改任务派发状态
     */
@@ -1900,29 +2074,30 @@
        for (RiskAssessPlan riskAssessPlan : assessPlanByExperimentId) {
            riskAssessPlan.setPlanSellStatus(status);
            RiskAssessPlan save = assessPlanRepository.save(riskAssessPlan);
            if (ObjectUtils.isEmpty(save)){
            if (ObjectUtils.isEmpty(save)) {
                tag = 0;
            }
        }
        return tag;
    }
    /**
     * 风险评估计划 - 辨识专家拒绝
     */
    @Override
    public AssessPlanUpdateDTO identificationRefuse(Long currentUserId, Long id) {
        if (ObjectUtils.isEmpty(id)){
        if (ObjectUtils.isEmpty(id)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "请选择正确的评估计划");
        }
        UserInfoDomainDTO user = userDomainService.getUserById(currentUserId);
        RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(id);
        if (!currentUserId.equals(assessPlanById.getIdentificationUserId())){
        if (!currentUserId.equals(assessPlanById.getIdentificationUserId())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "不能拒绝其他专家的辨识任务");
        }
        if (assessPlanById.getPlanExecStatus().equals(StatusEnum.PLAN_EXEC_EVALUATE.getCode())){
        if (assessPlanById.getPlanExecStatus().equals(StatusEnum.PLAN_EXEC_EVALUATE.getCode())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识结果已提交,无法拒绝任务");
        }
        assessPlanById.setIdentificationUser(null);
@@ -1938,39 +2113,40 @@
    @Transactional
    @Override
    public AssessPlanUpdateDTO evaluateRefuse(Long currentUserId, Long id) {
        if (ObjectUtils.isEmpty(id)){
        if (ObjectUtils.isEmpty(id)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "请选择正确的评估计划");
        }
        UserInfoDomainDTO user = userDomainService.getUserById(currentUserId);
        RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(id);
        if (!currentUserId.equals(assessPlanById.getEvaluateUserId())){
        List<RiskAssessPlanEvaluateUser> assessPlanEvaluateUserPlanId = evaluateUserService.getAssessPlanEvaluateUserPlanId(id, currentUserId);
        if (ObjectUtils.isEmpty(assessPlanEvaluateUserPlanId)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "不能拒绝其他专家的评价任务");
        }
        if (assessPlanById.getPlanExecStatus().equals(StatusEnum.PLAN_EXEC_OVER.getCode())){
        if (assessPlanById.getPlanExecStatus().equals(StatusEnum.PLAN_EXEC_OVER.getCode())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评估已完成,无法拒绝任务");
        }
        assessPlanById.setEvaluateUser(null);
        assessPlanById.setEvaluateUserId(null);
        if (assessPlanById.getEvaluateTime() != null){
            if (assessPlanById.getEvaluateMethod().equals(MethodEnum.EVALUATE_METHOD_LEC.getCode())){
        if (assessPlanById.getEvaluateTime() != null) {
            if (assessPlanById.getEvaluateMethod().equals(MethodEnum.EVALUATE_METHOD_LEC.getCode())) {
                int result = lecService.deleteLecByAssessPlanId(id);
                if (result == 1){
                if (result == 1) {
                    throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "删除评价信息失败");
                }
            }else if (assessPlanById.getEvaluateMethod().equals(MethodEnum.EVALUATE_METHOD_LS.getCode())){
            } else if (assessPlanById.getEvaluateMethod().equals(MethodEnum.EVALUATE_METHOD_LS.getCode())) {
                int result = lsService.deleteLsByAssessPlanId(id);
                if (result == 1){
                if (result == 1) {
                    throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "删除评价信息失败");
                }
            }else if (assessPlanById.getEvaluateMethod().equals(MethodEnum.EVALUATE_METHOD_MES.getCode())){
            } else if (assessPlanById.getEvaluateMethod().equals(MethodEnum.EVALUATE_METHOD_MES.getCode())) {
                int result = mesService.deleteMesByAssessPlanId(id);
                if (result == 1){
                if (result == 1) {
                    throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "删除评价信息失败");
                }
            }else if (assessPlanById.getEvaluateMethod().equals(MethodEnum.EVALUATE_METHOD_RS.getCode())){
            } else if (assessPlanById.getEvaluateMethod().equals(MethodEnum.EVALUATE_METHOD_RS.getCode())) {
                int result = rsService.deleteRsByAssessPlanId(id);
                if (result == 1){
                if (result == 1) {
                    throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "删除评价信息失败");
                }
            }
@@ -1987,17 +2163,20 @@
    @Override
    public AssessPlanUpdateDTO identificationUpdateMethod(Long currentUserId, MethodUpdateReqDTO updateReqDTO) {
        if (ObjectUtils.isEmpty(updateReqDTO.getId())){
        if (ObjectUtils.isEmpty(updateReqDTO.getId())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "请选择正确的评估计划");
        }
        if (ObjectUtils.isEmpty(updateReqDTO.getIdentificationMethodId())){
        if (ObjectUtils.isEmpty(updateReqDTO.getIdentificationMethodId())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "请选择正确的辨识方法");
        }
        RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(updateReqDTO.getId());
        if (ObjectUtils.isEmpty(assessPlanById)){
        if (ObjectUtils.isEmpty(assessPlanById)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "辨识任务不存在");
        }
        if (!assessPlanById.getIdentificationUserId().equals(currentUserId)){
        List<RiskAssessPlanIdentificationUser> assessPlanIdentificationUser =
                planIdentificationUserService.getAssessPlanIdentificationUserPlanId(assessPlanById.getId(), currentUserId);
        if (ObjectUtils.isEmpty(assessPlanIdentificationUser)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "只能修改自己的辨识任务");
        }
        assessPlanById.setIdentificationMethod(updateReqDTO.getIdentificationMethodId());
@@ -2015,17 +2194,18 @@
    @Override
    public AssessPlanUpdateDTO evaluateUpdateMethod(Long currentUserId, MethodUpdateReqDTO updateReqDTO) {
        if (ObjectUtils.isEmpty(updateReqDTO.getId())){
        if (ObjectUtils.isEmpty(updateReqDTO.getId())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "请选择正确的评估计划");
        }
        if (ObjectUtils.isEmpty(updateReqDTO.getEvaluateMethodId())){
        if (ObjectUtils.isEmpty(updateReqDTO.getEvaluateMethodId())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "请选择正确的评价方法");
        }
        RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(updateReqDTO.getId());
        if (ObjectUtils.isEmpty(assessPlanById)){
        if (ObjectUtils.isEmpty(assessPlanById)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "评价任务不存在");
        }
        if (!assessPlanById.getEvaluateUserId().equals(currentUserId)){
        List<RiskAssessPlanEvaluateUser> assessPlanEvaluateUserPlanId = evaluateUserService.getAssessPlanEvaluateUserPlanId(assessPlanById.getId(), currentUserId);
        if (ObjectUtils.isEmpty(assessPlanEvaluateUserPlanId)) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "只能修改自己的评价任务");
        }
        assessPlanById.setEvaluateMethod(updateReqDTO.getEvaluateMethodId());
@@ -2033,24 +2213,24 @@
        assessPlanById.setUpdateByUserId(currentUserId);
        assessPlanById.setEvaluateTime(null);
        if (updateReqDTO.getEvaluateMethodId() == 1){
        if (updateReqDTO.getEvaluateMethodId() == 1) {
            int result = lecService.deleteLecByPlan(updateReqDTO.getId());
            if (result == StatusEnum.FAIL.getCode()){
            if (result == StatusEnum.FAIL.getCode()) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "修改评价方法失败");
            }
        }else if (updateReqDTO.getEvaluateMethodId() == 2){
        } else if (updateReqDTO.getEvaluateMethodId() == 2) {
            int result = lsService.deleteLsByPlan(updateReqDTO.getId());
            if (result == StatusEnum.FAIL.getCode()){
            if (result == StatusEnum.FAIL.getCode()) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "修改评价方法失败");
            }
        }else if (updateReqDTO.getEvaluateMethodId() == 3){
        } else if (updateReqDTO.getEvaluateMethodId() == 3) {
            int result = mesService.deleteMesByPlan(updateReqDTO.getId());
            if (result == StatusEnum.FAIL.getCode()){
            if (result == StatusEnum.FAIL.getCode()) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "修改评价方法失败");
            }
        }else if (updateReqDTO.getEvaluateMethodId() == 4){
        } else if (updateReqDTO.getEvaluateMethodId() == 4) {
            int result = rsService.deleteRsByPlan(updateReqDTO.getId());
            if (result == StatusEnum.FAIL.getCode()){
            if (result == StatusEnum.FAIL.getCode()) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "修改评价方法失败");
            }
        }
@@ -2065,23 +2245,23 @@
    @Override
    public AssessPlanUpdateDTO appoint(Long currentUserId, AppointUserReBO appointUserReBO) {
        if (ObjectUtils.isEmpty(appointUserReBO.getId())){
        if (ObjectUtils.isEmpty(appointUserReBO.getId())) {
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "请选择正确的评估计划");
        }
        UserInfoDomainDTO user = userDomainService.getUserById(currentUserId);
        RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(appointUserReBO.getId());
        if (!ObjectUtils.isEmpty(appointUserReBO.getIdentificationUserId())){
        if (!ObjectUtils.isEmpty(appointUserReBO.getIdentificationUserId())) {
            UserInfoDomainDTO identificationUser = userDomainService.getUserById(appointUserReBO.getIdentificationUserId());
            if (ObjectUtils.isEmpty(identificationUser)){
            if (ObjectUtils.isEmpty(identificationUser)) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "所选的辨识专家不存在");
            }
            assessPlanById.setIdentificationUserId(identificationUser.getId());
            assessPlanById.setIdentificationUser(identificationUser.getRealName());
        }
        if (!ObjectUtils.isEmpty(appointUserReBO.getEvaluateUserId())){
        if (!ObjectUtils.isEmpty(appointUserReBO.getEvaluateUserId())) {
            UserInfoDomainDTO evaluateUser = userDomainService.getUserById(appointUserReBO.getEvaluateUserId());
            if (ObjectUtils.isEmpty(evaluateUser)){
            if (ObjectUtils.isEmpty(evaluateUser)) {
                throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "所选的评价专家不存在");
            }
            assessPlanById.setEvaluateUserId(evaluateUser.getId());
@@ -2096,5 +2276,40 @@
        return BeanCopyUtils.copyBean(save, AssessPlanUpdateDTO.class);
    }
    @Override
    public int appointNew(Long currentUserId, AppointUserTypeReBO appointUserReBO) {
        if (appointUserReBO == null){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "数据错误");
        }
        List<Long> userIds = appointUserReBO.getUserIds();
        if (ObjectUtils.isEmpty(userIds)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "数据错误");
        }
        RiskAssessPlan assessPlanById = assessPlanRepository.getAssessPlanById(appointUserReBO.getRiskAssessPlanId());
        if (ObjectUtils.isEmpty(assessPlanById)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "评价计划不存在");
        }
        String userType = appointUserReBO.getUserType();
        String userTypeName = userType == "1" ? "辨识专家" : "评价专家";
        List<UserInfoDomainDTO> identificationUser = userDomainService.getUserInfoByIds(userIds, userTypeName);
        if (ObjectUtils.isEmpty(identificationUser)) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), userTypeName+"不存在或已被删除");
        }
        if (identificationUser.size() != userIds.size()) {
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR_DATA_NOT_EXISIST.getCode(), "存在选中"+userTypeName+"不存在或已被删除");
        }
        if (userType == "1"){
            planIdentificationUserService.deleteByPlanId(assessPlanById.getId(), LocalDateTime.now());
            saveIdentificationUser(assessPlanById.getId(), identificationUser, LocalDateTime.now(), currentUserId);
        }else {
            //处理评价专家
            evaluateUserService.deleteRsByPlan(assessPlanById.getId(), LocalDateTime.now());
            saveEvaUser(assessPlanById.getId(), identificationUser, LocalDateTime.now(), currentUserId);
        }
        return 1;
    }
}