jinlin
2024-01-10 cdf29a8f6fb9990f82ccc1d3f47bfba48cfaf4fc
modules/mainPart/src/main/java/com/zt/life/modules/project/controller/ProjectController.java
@@ -13,6 +13,9 @@
import com.zt.common.validator.group.AddGroup;
import com.zt.common.validator.group.DefaultGroup;
import com.zt.common.validator.group.UpdateGroup;
import com.zt.core.context.UserContext;
import com.zt.core.sys.model.SysUser;
import com.zt.life.modules.project.dto.ProjectUserDto;
import com.zt.life.modules.project.model.Project;
import com.zt.life.modules.project.service.ProjectService;
import com.zt.modules.coderule.service.SysCodeRuleService;
@@ -67,10 +70,17 @@
            @ApiImplicitParam(name = "pageCode", value = "页面标识", dataType = Constant.QT.STRING),
    })
    public PageResult<Project> page(@ApiIgnore @QueryParam QueryFilter queryFilter) {
        if (queryFilter.getParams().containsValue("baseline_release")||queryFilter.getParams().containsValue("config_item_warehouse")){
            queryFilter.getParams().replace("tableName","");
        if (queryFilter.getParams().containsValue("baseline_release") || queryFilter.getParams().containsValue("config_item_warehouse") || queryFilter.getParams().containsValue("test_review_comment")) {
            queryFilter.getParams().replace("tableName", "");
        }
        List<Project> Project =projectService.page(queryFilter);
        List<Project> Project = projectService.page(queryFilter);
        for (Project project2 :Project){
            String leaderName = project2.getProjectLeader();
            if (leaderName.length()>10){
                leaderName=sysUserService.getNames(leaderName);
            }
            project2.setProjectLeader(leaderName);
        }
        return PageResult.ok(Project);
    }
@@ -78,6 +88,9 @@
    @ApiOperation("信息")
    public Result<Project> get(@PathVariable("id") Long id) {
        Project data = projectService.get(id);
        if (data.getBizDeptId() == null) {
            data.setBizDeptId(UserContext.getDeptId().toString());
        }
        return Result.ok(data);
    }
@@ -94,8 +107,6 @@
        map.put("year", year);
        project.setYear(year);
        project.setCode(sysCodeRuleService.getNewCode(map));
        String leaderName = sysUserService.getUsersName(Convert.toLong(project.getProjectLeader()));
        project.setProjectLeader(leaderName);
        projectService.insert(project);
        return Result.ok();
    }
@@ -106,8 +117,6 @@
    public Result update(@RequestBody Project project) {
        //效验数据
        ValidatorUtils.validateEntity(project, UpdateGroup.class, DefaultGroup.class);
        String leaderName = sysUserService.getUsersName(Convert.toLong(project.getProjectLeader()));
        project.setProjectLeader(leaderName);
        projectService.update(project);
        return Result.ok();
    }
@@ -123,4 +132,16 @@
        return Result.ok();
    }
    @GetMapping("getUsersLists")
    @ApiOperation("返回用户列表")
    @LogOperation("返回用户列表")
    public Result<ProjectUserDto> getUsersLists(String deptId) {
        ProjectUserDto projectUserDto = new ProjectUserDto();
        projectUserDto.setZrr(sysUserService.getUsersList("zrr", deptId));
        projectUserDto.setCsry(sysUserService.getUsersList("csry", deptId));
        projectUserDto.setShry(sysUserService.getUsersList("shry", deptId));
        projectUserDto.setPzry(sysUserService.getUsersList("pzry", deptId));
        return Result.ok(projectUserDto);
    }
}