xuhy
2025-06-18 41e0caedb42b1220f7c89cea43c127985c0c2fb3
bug修改
3个文件已修改
79 ■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TExperimentSchemeController.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TProjectProposalController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TProjectTeamController.java 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TExperimentSchemeController.java
@@ -249,23 +249,6 @@
        TExperimentSchemeVO experimentSchemeVO = new TExperimentSchemeVO();
        BeanUtils.copyProperties(experimentScheme, experimentSchemeVO);
        // 查询实验调度信息
        TExperimentDispatch experimentDispatch = experimentDispatchService.getById(experimentSchemeVO.getDispatchId());
        if(Objects.nonNull(experimentDispatch)){
            // 查询课题方案名称
            TProjectProposal projectProposal = projectProposalService.getById(experimentDispatch.getProposalId());
            if(Objects.nonNull(projectProposal)){
                experimentDispatch.setProjectName(projectProposal.getProjectName());
                experimentDispatch.setProjectCode(projectProposal.getProjectCode());
            }
        }
        experimentSchemeVO.setExperimentDispatch(experimentDispatch);
        // 查询组别
        List<TExperimentDispatchParticipants> list = experimentDispatchParticipantsService.list(Wrappers.lambdaQuery(TExperimentDispatchParticipants.class)
                .eq(TExperimentDispatchParticipants::getDispatchId, experimentSchemeVO.getDispatchId()));
        experimentSchemeVO.setExperimentDispatchParticipants(list);
        // 获取实验人员
        List<TExperimentSchemePerson> experimentSchemePersons = experimentSchemePersonService.list(Wrappers.lambdaQuery(TExperimentSchemePerson.class)
                .eq(TExperimentSchemePerson::getSchemeId, id));
@@ -278,6 +261,29 @@
            });
        });
        experimentSchemeVO.setExperimentSchemePersons(experimentSchemePersons);
        // 查询实验调度信息
        TExperimentDispatch experimentDispatch = experimentDispatchService.getById(experimentSchemeVO.getDispatchId());
        if(Objects.nonNull(experimentDispatch)){
            // 查询课题方案名称
            TProjectProposal projectProposal = projectProposalService.getById(experimentDispatch.getProposalId());
            if(Objects.nonNull(projectProposal)){
                experimentDispatch.setProjectName(projectProposal.getProjectName());
                experimentDispatch.setProjectCode(projectProposal.getProjectCode());
            }
            // 查询参与人员
            List<TExperimentDispatchParticipants> tExperimentDispatchParticipants = experimentDispatchParticipantsService.list(Wrappers.lambdaQuery(TExperimentDispatchParticipants.class)
                    .eq(TExperimentDispatchParticipants::getDispatchId, experimentDispatch.getId()));
            List<Long> userIds1 = tExperimentDispatchParticipants.stream().map(TExperimentDispatchParticipants::getUserId).distinct().collect(Collectors.toList());
            List<SysUser> sysUsers1 = sysUserMapper.selectUserByIds(userIds1);
            String participantsName = sysUsers1.stream().map(SysUser::getNickName).collect(Collectors.joining(";"));
            experimentDispatch.setParticipantsName(participantsName);
        }
        experimentSchemeVO.setExperimentDispatch(experimentDispatch);
        // 查询组别
        List<TExperimentDispatchParticipants> list = experimentDispatchParticipantsService.list(Wrappers.lambdaQuery(TExperimentDispatchParticipants.class)
                .eq(TExperimentDispatchParticipants::getDispatchId, experimentSchemeVO.getDispatchId()));
        experimentSchemeVO.setExperimentDispatchParticipants(list);
        // 查询审核人姓名
        SysUser sysUser = sysUserService.selectUserById(experimentScheme.getAuditPersonId());
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TProjectProposalController.java
@@ -100,6 +100,7 @@
                .like(StringUtils.hasLength(projectName),TProjectProposal::getProjectName, projectName)
                .like(StringUtils.hasLength(projectCode),TProjectProposal::getProjectCode, projectCode)
                .eq(TProjectProposal::getCommitUserId, user.getUserId())
                .eq(TProjectProposal::getAuditStatus, 2)
                .orderByDesc(TProjectProposal::getCreateTime));
        return R.ok(list);
    }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TProjectTeamController.java
@@ -7,12 +7,12 @@
import com.ruoyi.common.basic.PageInfo;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.dto.TProjectTeamDTO;
import com.ruoyi.system.dto.UpAndDownDTO;
import com.ruoyi.system.model.TProjectTeam;
import com.ruoyi.system.model.TProjectTeamStaff;
import com.ruoyi.system.query.TProjectProposalQuery;
import com.ruoyi.system.query.TProjectTeamQuery;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.service.TProjectTeamService;
@@ -22,8 +22,6 @@
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@@ -72,9 +70,22 @@
    @PostMapping(value = "/api/t-project-team/add")
    public R<Boolean> add(@RequestBody String param) {
        TProjectTeamDTO dto = JSON.parseObject(param,TProjectTeamDTO.class);
        List<TProjectTeamStaff> staffs = dto.getStaffs();
        // 判断工艺工程师是否存在其他项目组中
        staffs.stream().filter(staff -> staff.getRoleType() == 3).forEach(staff -> {
            long count = projectTeamStaffService.count(Wrappers.lambdaQuery(TProjectTeamStaff.class).eq(TProjectTeamStaff::getUserId, staff.getUserId()));
            if(count > 0){
                throw new ServiceException("该工艺工程师已存在项目组");
            }
        });
        staffs.stream().filter(staff -> staff.getRoleType() == 2).forEach(staff -> {
            long count = projectTeamStaffService.count(Wrappers.lambdaQuery(TProjectTeamStaff.class).eq(TProjectTeamStaff::getUserId, staff.getUserId()));
            if(count > 0){
                throw new ServiceException("该审批人已存在项目组");
            }
        });
        projectTeamService.save(dto);
        // 保存项目组成员
        List<TProjectTeamStaff> staffs = dto.getStaffs();
        for (TProjectTeamStaff staff : staffs) {
            staff.setTeamId(dto.getId());
        }
@@ -91,11 +102,28 @@
    @PostMapping(value = "/api/t-project-team/update")
    public R<Boolean> update(@RequestBody String param) {
        TProjectTeamDTO dto = JSON.parseObject(param,TProjectTeamDTO.class);
        List<TProjectTeamStaff> staffs = dto.getStaffs();
        // 判断工艺工程师是否存在其他项目组中
        staffs.stream().filter(staff -> staff.getRoleType() == 3).forEach(staff -> {
            long count = projectTeamStaffService.count(Wrappers.lambdaQuery(TProjectTeamStaff.class)
                    .ne(TProjectTeamStaff::getTeamId, dto.getId())
                    .eq(TProjectTeamStaff::getUserId, staff.getUserId()));
            if(count > 0){
                throw new ServiceException("该工艺工程师已存在项目组");
            }
        });
        staffs.stream().filter(staff -> staff.getRoleType() == 2).forEach(staff -> {
            long count = projectTeamStaffService.count(Wrappers.lambdaQuery(TProjectTeamStaff.class)
                    .ne(TProjectTeamStaff::getTeamId, dto.getId())
                    .eq(TProjectTeamStaff::getUserId, staff.getUserId()));
            if(count > 0){
                throw new ServiceException("该工艺工程师已存在项目组");
            }
        });
        projectTeamService.updateById(dto);
        // 删除项目组成员
        projectTeamStaffService.remove(Wrappers.lambdaQuery(TProjectTeamStaff.class).eq(TProjectTeamStaff::getTeamId, dto.getId()));
        // 保存项目组成员
        List<TProjectTeamStaff> staffs = dto.getStaffs();
        for (TProjectTeamStaff staff : staffs) {
            staff.setTeamId(dto.getId());
        }