| | |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.TQaTestItemDTO; |
| | | import com.ruoyi.system.dto.TResultWorkEvaluateDTO; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.ResultEvaluateChemistTesterQuery; |
| | | import com.ruoyi.system.query.TProjectApprovalReportQuery; |
| | | import com.ruoyi.system.query.TQaTestItemReportQuery; |
| | | import com.ruoyi.system.query.TResultWorkEvaluateQuery; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Api(tags = "实验结果工作评定管理") |
| | | @RestController |
| | | @RequestMapping("/t-result-work-evaluate") |
| | | @RequestMapping("") |
| | | public class TResultWorkEvaluateController { |
| | | @Resource |
| | | private TResultWorkEvaluateService tResultWorkEvaluateService; |
| | |
| | | private TQaProduceReportService qaProduceReportService; |
| | | @Resource |
| | | private TQaTestItemService qaTestItemService; |
| | | private final TProjectTeamService projectTeamService; |
| | | private final TProjectTeamStaffService projectTeamStaffService; |
| | | private final ISysUserService sysUserService; |
| | | |
| | | @Autowired |
| | | public TResultWorkEvaluateController(TProjectTeamService projectTeamService, TProjectTeamStaffService projectTeamStaffService, ISysUserService sysUserService) { |
| | | this.projectTeamService = projectTeamService; |
| | | this.projectTeamStaffService = projectTeamStaffService; |
| | | this.sysUserService = sysUserService; |
| | | private TProjectTeamService projectTeamService; |
| | | @Autowired |
| | | private TProjectTeamStaffService projectTeamStaffService; |
| | | @Autowired |
| | | private ISysUserService sysUserService; |
| | | @Autowired |
| | | private TExperimentDispatchParticipantsService experimentDispatchParticipantsService; |
| | | |
| | | /** |
| | | * 获取化验师工作评定分页列表 |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:resultWorkEvaluate:list')") |
| | | @ApiOperation(value = "获取化验师工作评定分页列表",response = TResultWorkEvaluateQuery.class) |
| | | @PostMapping(value = "/api/t-result-work-evaluate/chemistEvaluateList") |
| | | public R<PageInfo<TResultWorkEvaluateVO>> chemistEvaluateList(@RequestBody String param) { |
| | | TResultWorkEvaluateQuery query = JSON.parseObject(param, TResultWorkEvaluateQuery.class); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | if(roleType != 1){ |
| | | // 查询用户所在项目组 |
| | | List<TProjectTeamStaff> projectTeamStaffs = projectTeamStaffService.list(Wrappers.lambdaQuery(TProjectTeamStaff.class) |
| | | .eq(TProjectTeamStaff::getUserId, userId)); |
| | | if(projectTeamStaffs.size() > 0){ |
| | | // 查询项目组id |
| | | List<String> teamIds = projectTeamStaffs.stream().map(TProjectTeamStaff::getTeamId).distinct().collect(Collectors.toList()); |
| | | query.setTeamIds(teamIds); |
| | | } |
| | | } |
| | | return R.ok(tResultWorkEvaluateService.chemistEvaluateList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 添加QA检测项管理管理 |
| | | * 获取实验员工作评定分页列表 |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:resultWorkEvaluate:list')") |
| | | @ApiOperation(value = "获取实验员工作评定分页列表",response = TProjectApprovalReportQuery.class) |
| | | @PostMapping(value = "/api/t-result-work-evaluate/testerEvaluateList") |
| | | public R<PageInfo<TResultWorkEvaluateVO>> testerEvaluateList(@RequestBody String param) { |
| | | TResultWorkEvaluateQuery query = JSON.parseObject(param, TResultWorkEvaluateQuery.class); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | if(roleType != 1){ |
| | | // 查询用户所在项目组 |
| | | List<TProjectTeamStaff> projectTeamStaffs = projectTeamStaffService.list(Wrappers.lambdaQuery(TProjectTeamStaff.class) |
| | | .eq(TProjectTeamStaff::getUserId, userId)); |
| | | if(projectTeamStaffs.size() > 0){ |
| | | // 查询项目组id |
| | | List<String> teamIds = projectTeamStaffs.stream().map(TProjectTeamStaff::getTeamId).distinct().collect(Collectors.toList()); |
| | | query.setTeamIds(teamIds); |
| | | } |
| | | } |
| | | return R.ok(tResultWorkEvaluateService.testerEvaluateList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 新增化验师、实验员工作评定 |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:resultWorkEvaluate:add')") |
| | | @Log(title = "QA检测项管理信息-新增QA检测项管理", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加QA检测项管理", response = TQaTestItemDTO.class) |
| | | @PostMapping(value = "/api/t-qa-test-item/add") |
| | | @Log(title = "实验结果工作评定管理-新增化验师、实验员工作评定", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "新增化验师、实验员工作评定", response = TQaTestItemDTO.class) |
| | | @PostMapping(value = "/api/t-result-work-evaluate/add") |
| | | public R<Boolean> add(@RequestBody String param) { |
| | | TQaTestItemDTO dto = JSON.parseObject(param, TQaTestItemDTO.class); |
| | | // resultWorkEvaluateService.save(dto); |
| | | TResultWorkEvaluateDTO dto = JSON.parseObject(param, TResultWorkEvaluateDTO.class); |
| | | |
| | | tResultWorkEvaluateService.save(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 查询可评定的化验师 |
| | | */ |
| | | @ApiOperation(value = "查询可评定的化验师") |
| | | @GetMapping(value = "/open/t-result-work-evaluate/getEvaluateChemist") |
| | | public R<List<SysUser>> getEvaluateChemist(@RequestParam(value = "nickName",required = false) String nickName, |
| | | @RequestParam(value = "dispatchId") String dispatchId) { |
| | | // 查询参与的化验师 |
| | | List<TExperimentDispatchParticipants> experimentDispatchParticipants = experimentDispatchParticipantsService.list(Wrappers.lambdaQuery(TExperimentDispatchParticipants.class) |
| | | .eq(TExperimentDispatchParticipants::getDispatchId, dispatchId) |
| | | .eq(TExperimentDispatchParticipants::getRoleType, 4)); |
| | | List<Long> userIds = experimentDispatchParticipants.stream().map(TExperimentDispatchParticipants::getUserId).distinct().collect(Collectors.toList()); |
| | | if(StringUtils.hasLength(nickName)){ |
| | | List<SysUser> sysUsers = sysUserService.selectListByNameAndUserIds(nickName,userIds); |
| | | return R.ok(sysUsers); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | /** |
| | | * 查询可评定的实验员 |
| | | */ |
| | | @ApiOperation(value = "查询可评定的实验员") |
| | | @GetMapping(value = "/open/t-result-work-evaluate/getEvaluateTester") |
| | | public R<List<SysUser>> getEvaluateTester(@RequestParam(value = "nickName",required = false) String nickName, |
| | | @RequestParam(value = "dispatchId") String dispatchId) { |
| | | // 查询参与的化验师 |
| | | List<TExperimentDispatchParticipants> experimentDispatchParticipants = experimentDispatchParticipantsService.list(Wrappers.lambdaQuery(TExperimentDispatchParticipants.class) |
| | | .eq(TExperimentDispatchParticipants::getDispatchId, dispatchId) |
| | | .eq(TExperimentDispatchParticipants::getRoleType, 5)); |
| | | List<Long> userIds = experimentDispatchParticipants.stream().map(TExperimentDispatchParticipants::getUserId).distinct().collect(Collectors.toList()); |
| | | if(StringUtils.hasLength(nickName)){ |
| | | List<SysUser> sysUsers = sysUserService.selectListByNameAndUserIds(nickName,userIds); |
| | | return R.ok(sysUsers); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 查询化验师评定列表 |
| | | */ |
| | | @ApiOperation(value = "查询化验师评定列表-化验师使用") |
| | | @PostMapping(value = "/api/t-result-work-evaluate/getEvaluateChemistPageList") |
| | | public R<PageInfo<ResultEvaluateChemistTesterVO>> getEvaluateChemistPageList(@RequestBody String param) { |
| | | ResultEvaluateChemistTesterQuery query = JSON.parseObject(param, ResultEvaluateChemistTesterQuery.class); |
| | | // 获取当前用户id |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | query.setUserId(userId); |
| | | PageInfo<ResultEvaluateChemistTesterVO> pageInfo = tResultWorkEvaluateService.getEvaluateChemistPageList(query); |
| | | return R.ok(pageInfo); |
| | | } |
| | | /** |
| | | * 查询实验员评定列表 |
| | | */ |
| | | @ApiOperation(value = "查询实验员评定列表-实验员使用") |
| | | @PostMapping(value = "/api/t-result-work-evaluate/getEvaluateTesterPageList") |
| | | public R<PageInfo<ResultEvaluateChemistTesterVO>> getEvaluateTesterPageList(@RequestBody String param) { |
| | | ResultEvaluateChemistTesterQuery query = JSON.parseObject(param, ResultEvaluateChemistTesterQuery.class); |
| | | // 获取当前用户id |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | query.setUserId(userId); |
| | | PageInfo<ResultEvaluateChemistTesterVO> pageInfo = tResultWorkEvaluateService.getEvaluateTesterPageList(query); |
| | | return R.ok(pageInfo); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "项目组总积分分页列表", tags = "项目组总积分", response = TQaTestItemReportQuery.class) |
| | | @PostMapping(value = "/api/t-result-work-evaluate/pageList") |