heheng
2025-03-10 c0ae989839d8323974048b71f7dadc29a20a4b15
专家多选功能
已修改17个文件
已添加12个文件
821 ■■■■■ 文件已修改
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 3 ●●●●● 补丁 | 查看 | 原始文档 | 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 281 ●●●● 补丁 | 查看 | 原始文档 | 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,10 +227,13 @@
            if (!ObjectUtils.isEmpty(assessPlanByExperimentId)){
                for (AssessPlanQueryDTO assessPlan : assessPlanByExperimentId) {
                    if (assessPlan.getEvaluateTime() != null){
                    if (reportQueryDTO.getEvaluateTime().isBefore(assessPlan.getEvaluateTime())){
                        reportQueryDTO.setEvaluateTime(assessPlan.getEvaluateTime());
                    }
                }
                }
            }
            if (!ObjectUtils.isEmpty(riskSourceByReportId)){
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,6 +48,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
@@ -74,6 +80,12 @@
    private RiskAssessPlanIdentificationPhaService phaService;
    @Autowired
    private RiskAssessPlanIdentificationSclService sclService;
    @Autowired
    private RiskAssessPlanIdentificationUserService planIdentificationUserService;
    @Autowired
    private RiskAssessPlanEvaluateUserService evaluateUserService;
    @Autowired
    private RiskAssessPlanEvaluateLecService lecService;
@@ -122,6 +134,9 @@
        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())){
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(), "风险单元不存在或已被删除");
@@ -161,22 +176,40 @@
        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(), "辨识专家");
        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());
@@ -198,16 +231,20 @@
        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)){
@@ -230,6 +267,40 @@
        PlanInsertDTO planInsertDTO = BeanCopyUtils.copyBean(saveResult, PlanInsertDTO.class);
        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);
    }
    /**
@@ -302,15 +373,20 @@
                if (queryParam.getExperimentId() != null){
                    predicateList.add(criteriaBuilder.equal(root.get("experimentId"),queryParam.getExperimentId()));
                }
                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)
                            )
                    );
                }
                query.groupBy(root.get("id"));
                predicateList.add(criteriaBuilder.equal(root.get("deleteStatus"),StatusEnum.DELETE_NOT.getCode()));
                return criteriaBuilder.and(predicateList.toArray(new Predicate[0]));
            }
@@ -340,6 +416,28 @@
                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);
            }
        }
@@ -421,22 +519,46 @@
        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(), "辨识专家");
        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);
@@ -607,7 +735,9 @@
        if (ObjectUtils.isEmpty(assessPlanById)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "要辨识的计划不存在或已被删除");
        }
        if (!assessPlanById.getIdentificationUserId().equals(currentUserId)){
        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){
@@ -622,7 +752,10 @@
        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(), "您不是辨识人,无法进行辨识");
        }
@@ -670,7 +803,10 @@
        }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(), "您不是辨识人,无法进行辨识结果提交");
        }
        // 没有进行任何辨识,无法提交
@@ -762,7 +898,8 @@
        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(), "您不是评价人,无法进行评价");
        }
        //设置必要参数
@@ -829,7 +966,8 @@
        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(), "您不是评价人,无法进行评价");
        }
        //设置必要参数
@@ -873,8 +1011,9 @@
        }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);
@@ -1048,15 +1187,25 @@
                    predicateList.add(criteriaBuilder.in(root.get("id")).value(planIds));
                }
                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)
//                            )
//                    );
                }
                query.groupBy(root.get("id"));
                predicateList.add(criteriaBuilder.equal(root.get("deleteStatus"),StatusEnum.DELETE_NOT.getCode()));
                return criteriaBuilder.and(predicateList.toArray(new Predicate[0]));
            }
@@ -1091,11 +1240,32 @@
        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()){
                        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<>();
@@ -1715,7 +1885,9 @@
        if (ObjectUtils.isEmpty(assessPlanById)){
            throw new BusinessException(this.getClass(), ResultCode.BUSINESS_ERROR.getCode(), "辨识计划不存在,或已被删除");
        }
        if (!assessPlanById.getIdentificationUserId().equals(currentUserId)){
        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())){
@@ -1877,6 +2049,7 @@
        List<RiskAssessPlan> assessPlanList = assessPlanRepository.getAssessPlanByExperimentId(experimentId);
        return BeanCopyUtils.copyBeanList(assessPlanList, AssessPlanQueryDTO.class);
    }
    /**
     * 评估计划 - 查询已派发
     */
@@ -1888,6 +2061,7 @@
        }
        return BeanCopyUtils.copyBeanList(riskAssessPlans, RiskAssessPlanListAppDTO.class);
    }
    /**
     * 评估计划 - 修改任务派发状态
     */
@@ -1907,6 +2081,7 @@
        return tag;
    }
    /**
     * 风险评估计划 - 辨识专家拒绝
     */
@@ -1944,7 +2119,8 @@
        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())){
@@ -1997,7 +2173,10 @@
        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());
@@ -2025,7 +2204,8 @@
        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());
@@ -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;
    }
}