| | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.exception.GlobalException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.*; |
| | | import com.ruoyi.system.mapper.TProjectTeamMapper; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.query.TPedigreeChartConfirmQuery; |
| | | import com.ruoyi.system.query.TPedigreeChartDetailConfirmCountDTO; |
| | | import com.ruoyi.system.query.TPedigreeChartDetailQuery; |
| | | import com.ruoyi.system.query.TPedigreeChartQuery; |
| | | import com.ruoyi.system.service.*; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.checkerframework.checker.units.qual.C; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.concurrent.locks.ReentrantLock; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | public class TPedigreeChartController { |
| | | @Resource |
| | | private TPedigreeChartDetailService pedigreeChartDetailService; |
| | | |
| | | @Resource |
| | | private TPedigreeChartService pedigreeChartService; |
| | | @Resource |
| | |
| | | |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | TPedigreeChartQuery query = JSON.parseObject(param, TPedigreeChartQuery.class); |
| | | SysUser sysUser = sysUserService.selectUserById(tokenService.getLoginUser().getUserId()); |
| | | if (sysUser.getRoleType().equals("2")){ |
| | | query.setRoleType(2); |
| | | List<String> allProjectIds = projectTeamStaffService.lambdaQuery().eq(TProjectTeamStaff::getUserId, tokenService.getLoginUser().getUserId()) |
| | | .list().stream().map(TProjectTeamStaff::getTeamId).collect(Collectors.toList()); |
| | | if (!allProjectIds.isEmpty()){ List<String> projectIds = projectTeamService.lambdaQuery().in(TProjectTeam::getId, allProjectIds) |
| | | if (!allProjectIds.isEmpty()){ |
| | | List<String> projectIds = projectTeamService.lambdaQuery().in(TProjectTeam::getId, allProjectIds) |
| | | .list().stream().map(TProjectTeam::getId).collect(Collectors.toList()); |
| | | |
| | | if (projectIds.isEmpty()){ |
| | | return R.ok(new PageInfo<>()); |
| | | } |
| | | query.setProjectIds(projectIds); |
| | | }else{ |
| | | return R.ok(new PageInfo<>()); |
| | | } |
| | | }else if (!sysUser.getRoleType().equals("1")){ |
| | | List<String> allProjectIds = projectTeamStaffService.lambdaQuery().eq(TProjectTeamStaff::getUserId, tokenService.getLoginUser().getUserId()) |
| | | .list().stream().map(TProjectTeamStaff::getTeamId).collect(Collectors.toList()); |
| | | if (!allProjectIds.isEmpty()){ List<String> projectIds = projectTeamService.lambdaQuery().in(TProjectTeam::getId, allProjectIds) |
| | | .eq(TProjectTeam::getStatus, 1).list().stream().map(TProjectTeam::getId).collect(Collectors.toList()); |
| | | query.setRoleType(3); |
| | | |
| | | if (projectIds.isEmpty()){ |
| | | if (query.getProjectIds() == null || query.getProjectIds().isEmpty()){ |
| | | List<String> allProjectIds = projectTeamStaffService.lambdaQuery().eq(TProjectTeamStaff::getUserId, tokenService.getLoginUser().getUserId()) |
| | | .list().stream().map(TProjectTeamStaff::getTeamId).collect(Collectors.toList()); |
| | | if (!allProjectIds.isEmpty()){ |
| | | List<String> projectIds = projectTeamService.lambdaQuery().in(TProjectTeam::getId, allProjectIds) |
| | | .eq(TProjectTeam::getStatus, 1).list().stream().map(TProjectTeam::getId).collect(Collectors.toList()); |
| | | if (projectIds.isEmpty()){ |
| | | return R.ok(new PageInfo<>()); |
| | | } |
| | | query.setProjectIds(projectIds); |
| | | }else{ |
| | | return R.ok(new PageInfo<>()); |
| | | } |
| | | query.setProjectIds(projectIds); |
| | | } |
| | | |
| | | }else{ |
| | | query.setRoleType(1); |
| | | } |
| | | return R.ok(pedigreeChartService.pageList(query)); |
| | | } |
| | |
| | | String child = JSON.toJSONString(dto.getOne().get(0)); |
| | | parent.setJson(child); |
| | | } |
| | | List<String> projectIds = projectTeamStaffService.lambdaQuery().eq(TProjectTeamStaff::getUserId, tokenService.getLoginUser().getUserId()) |
| | | List<String> projectIds = projectTeamStaffService.lambdaQuery().eq(TProjectTeamStaff::getUserId, |
| | | tokenService.getLoginUser().getUserId()) |
| | | .list().stream().map(TProjectTeamStaff::getTeamId).collect(Collectors.toList()); |
| | | if (!projectIds.isEmpty()){ |
| | | TProjectTeam projectTeam = projectTeamService.lambdaQuery().in(TProjectTeam::getId, projectIds) |
| | |
| | | .last("limit 1").one(); |
| | | parent.setProjectId(projectTeam.getId()); |
| | | } |
| | | |
| | | pedigreeChartService.save(parent); |
| | | if (!dto.getOne().isEmpty()){ |
| | | TPedigreeChartParentOneDTO oneLevel = dto.getOne().get(0); |
| | |
| | | oneLevel.setVaccinateSignature(oneLevel.getVaccinateSignature()); |
| | | oneLevel.setVaccinateTime(LocalDateTime.now()); |
| | | oneLevel.setId(null); |
| | | if (parent.getStatus()==1){ |
| | | oneLevel.setAuditStatus(0); |
| | | }else{ |
| | | oneLevel.setAuditStatus(1); |
| | | } |
| | | oneLevel.setCodeStatus(parent.getStatus()); |
| | | pedigreeChartDetailService.save(oneLevel); |
| | | List<TPedigreeChartParentOneCountDTO> countList = oneLevel.getChildren(); |
| | | |
| | |
| | | TPedigreeChartParentOneCountDTO count = countList.get(0); |
| | | count.setParentId(oneLevel.getId()); |
| | | count.setType(2); |
| | | count.setVaccinateId(loginUser.getUserId()+""); |
| | | count.setVaccinateTime(LocalDateTime.now()); |
| | | count.setStatus(1); |
| | | count.setPedigreeChartId(parent.getId()); |
| | | count.setId(null); |
| | | if (parent.getStatus()==1){ |
| | | count.setAuditStatus(0); |
| | | }else{ |
| | | count.setAuditStatus(1); |
| | | } |
| | | |
| | | count.setCodeStatus(parent.getStatus()); |
| | | |
| | | pedigreeChartDetailService.save(count); |
| | | if (count.getChildren()!=null){ |
| | |
| | | tPedigreeChartParentTwoDTO.setVaccinateTime(LocalDateTime.now()); |
| | | tPedigreeChartParentTwoDTO.setStorageTime(LocalDateTime.now()); |
| | | tPedigreeChartParentTwoDTO.setParentId(count.getId()); |
| | | tPedigreeChartParentTwoDTO.setPedigreeChartId(parent.getId()); |
| | | tPedigreeChartParentTwoDTO.setId(null); |
| | | |
| | | if (parent.getStatus()==1){ |
| | | tPedigreeChartParentTwoDTO.setAuditStatus(0); |
| | | }else{ |
| | | tPedigreeChartParentTwoDTO.setAuditStatus(1); |
| | | } |
| | | tPedigreeChartParentTwoDTO.setCodeStatus(parent.getStatus()); |
| | | pedigreeChartDetailService.save(tPedigreeChartParentTwoDTO); |
| | | List<TPedigreeChartParentTwoCountDTO> count1List = tPedigreeChartParentTwoDTO.getChildren(); |
| | | if (!count1List.isEmpty()){ |
| | | // 传代数 |
| | | TPedigreeChartParentTwoCountDTO childCount = count1List.get(0); |
| | | childCount.setType(2); |
| | | if (parent.getStatus()==1){ |
| | | count.setAuditStatus(0); |
| | | }else{ |
| | | count.setAuditStatus(1); |
| | | } |
| | | count.setVaccinateId(loginUser.getUserId()+""); |
| | | count.setVaccinateTime(LocalDateTime.now()); |
| | | childCount.setParentId(tPedigreeChartParentTwoDTO.getId()); |
| | | childCount.setPedigreeChartId(parent.getId()); |
| | | childCount.setStatus(1); |
| | | childCount.setId(null); |
| | | childCount.setCodeStatus(parent.getStatus()); |
| | | |
| | | pedigreeChartDetailService.save(childCount); |
| | | if (childCount.getChildren()!=null){ |
| | | for (TPedigreeChartParentThreeDTO tPedigreeChartParentThreeDTO : childCount.getChildren()) { |
| | | tPedigreeChartParentThreeDTO.setParentId(childCount.getId()); |
| | | tPedigreeChartParentThreeDTO.setPedigreeChartId(parent.getId()); |
| | | tPedigreeChartParentThreeDTO.setType(1); |
| | | tPedigreeChartParentThreeDTO.setVaccinateId(loginUser.getUserId()+""); |
| | | if (tPedigreeChartParentThreeDTO.getStatus()==null){ |
| | | tPedigreeChartParentThreeDTO.setStatus(1); |
| | | } |
| | | tPedigreeChartParentTwoDTO.setVaccinateId(loginUser.getUserId()+""); |
| | | tPedigreeChartParentTwoDTO.setVaccinateSignature(tPedigreeChartParentTwoDTO.getVaccinateSignature()); |
| | | tPedigreeChartParentTwoDTO.setVaccinateTime(LocalDateTime.now()); |
| | | tPedigreeChartParentThreeDTO.setVaccinateId(loginUser.getUserId()+""); |
| | | tPedigreeChartParentThreeDTO.setVaccinateSignature(tPedigreeChartParentTwoDTO.getVaccinateSignature()); |
| | | tPedigreeChartParentThreeDTO.setVaccinateTime(LocalDateTime.now()); |
| | | tPedigreeChartParentThreeDTO.setStorageTime(LocalDateTime.now()); |
| | | tPedigreeChartParentThreeDTO.setPedigreeChartId(parent.getId()); |
| | | tPedigreeChartParentThreeDTO.setId(null); |
| | | if (parent.getStatus()==1){ |
| | | tPedigreeChartParentThreeDTO.setAuditStatus(0); |
| | | }else{ |
| | | tPedigreeChartParentThreeDTO.setAuditStatus(1); |
| | | } |
| | | tPedigreeChartParentThreeDTO.setCodeStatus(parent.getStatus()); |
| | | pedigreeChartDetailService.save(tPedigreeChartParentThreeDTO); |
| | | } |
| | | } |
| | |
| | | String child = JSON.toJSONString(oneLevel); |
| | | parent.setJson(child); |
| | | pedigreeChartService.updateById(parent); |
| | | // 新增消息 |
| | | TNotice tNotice = new TNotice(); |
| | | List<String> allProjectIds = projectTeamStaffService.lambdaQuery().eq(TProjectTeamStaff::getUserId, tokenService.getLoginUser().getUserId()) |
| | | .eq(TProjectTeamStaff::getRoleType, 2) |
| | | .list().stream().map(TProjectTeamStaff::getTeamId).collect(Collectors.toList()); |
| | | if (!allProjectIds.isEmpty()){ |
| | | TProjectTeam team = projectTeamService.lambdaQuery().in(TProjectTeam::getId, allProjectIds) |
| | | .eq(TProjectTeam::getStatus, 1) |
| | | .orderByDesc(BaseModel::getCreateTime).last("limit 1").one(); |
| | | TProjectTeamStaff projectTeamStaff = projectTeamStaffService.lambdaQuery() |
| | | .eq(TProjectTeamStaff::getTeamId, team.getId()).eq(TProjectTeamStaff::getRoleType, 2).one(); |
| | | tNotice.setCommitId(tokenService.getLoginUser().getUserId()+""); |
| | | tNotice.setUserId(projectTeamStaff.getUserId()); |
| | | tNotice.setStatus(1); |
| | | tNotice.setNoticeContent("菌种实验员新增【1】条【菌种传代生产谱系图】操作,等待您签字确认;"); |
| | | tNotice.setDataId(parent.getId()); |
| | | tNotice.setNoticeType(4); |
| | | noticeService.save(tNotice); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | // 新增消息 |
| | | TNotice tNotice = new TNotice(); |
| | | List<String> allProjectIds = projectTeamStaffService.lambdaQuery().eq(TProjectTeamStaff::getTeamId,parent.getProjectId() ) |
| | | .eq(TProjectTeamStaff::getRoleType, 2) |
| | | .list().stream().map(TProjectTeamStaff::getTeamId).collect(Collectors.toList()); |
| | | if (!allProjectIds.isEmpty()){ |
| | | TProjectTeam team = projectTeamService.lambdaQuery().in(TProjectTeam::getId, allProjectIds) |
| | | .eq(TProjectTeam::getStatus, 1) |
| | | .orderByDesc(BaseModel::getCreateTime).last("limit 1").one(); |
| | | TProjectTeamStaff projectTeamStaff = projectTeamStaffService.lambdaQuery() |
| | | .eq(TProjectTeamStaff::getTeamId, team.getId()).eq(TProjectTeamStaff::getRoleType, 1).one(); |
| | | tNotice.setCommitId(tokenService.getLoginUser().getUserId()+""); |
| | | tNotice.setUserId(projectTeamStaff.getUserId()); |
| | | tNotice.setStatus(1); |
| | | tNotice.setNoticeContent("菌种工程师新增【1】条【菌种传代生产谱系图】操作,等待您签字确认;"); |
| | | tNotice.setDataId(parent.getId()); |
| | | tNotice.setNoticeType(4); |
| | | noticeService.save(tNotice); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | String child = JSON.toJSONString(dto.getOne().get(0)); |
| | | parent.setJson(child); |
| | | } |
| | | pedigreeChartService.updateById(parent); |
| | | // pedigreeChartDetailService.remove(new LambdaQueryWrapper<TPedigreeChartDetail>() |
| | | // .eq(TPedigreeChartDetail::getPedigreeChartId, dto.getParent().getId())); |
| | | // if (!dto.getOne().isEmpty()){ |
| | | // TPedigreeChartParentOneDTO one = dto.getOne().get(0); |
| | | // one.setParentId("0"); |
| | | // one.setType(1); |
| | | // one.setStatus(1); |
| | | // one.setPedigreeChartId(parent.getId()); |
| | | // pedigreeChartDetailService.save(one); |
| | | // List<TPedigreeChartParentOneCountDTO> countList = one.getChildren(); |
| | | // if (!countList.isEmpty()){ |
| | | // TPedigreeChartParentOneCountDTO count = countList.get(0); |
| | | // count.setParentId(one.getId()); |
| | | // count.setType(2); |
| | | // count.setStatus(1); |
| | | // count.setPedigreeChartId(parent.getId()); |
| | | // pedigreeChartDetailService.save(count); |
| | | // if (count.getChildren()!=null){ |
| | | // for (TPedigreeChartParentTwoDTO tPedigreeChartParentTwoDTO : count.getChildren()) { |
| | | // tPedigreeChartParentTwoDTO.setParentId(one.getId()); |
| | | // tPedigreeChartParentTwoDTO.setPedigreeChartId(parent.getId()); |
| | | // tPedigreeChartParentTwoDTO.setType(1); |
| | | // tPedigreeChartParentTwoDTO.setStatus(1); |
| | | // tPedigreeChartParentTwoDTO.setParentId(count.getId()); |
| | | // tPedigreeChartParentTwoDTO.setPedigreeChartId(parent.getId()); |
| | | // pedigreeChartDetailService.save(tPedigreeChartParentTwoDTO); |
| | | // List<TPedigreeChartParentTwoCountDTO> count1List = tPedigreeChartParentTwoDTO.getChildren(); |
| | | // if (!count1List.isEmpty()){ |
| | | // TPedigreeChartParentTwoCountDTO count1 = count1List.get(0); |
| | | // count1.setType(2); |
| | | // count1.setParentId(tPedigreeChartParentTwoDTO.getId()); |
| | | // count1.setPedigreeChartId(parent.getId()); |
| | | // count1.setStatus(1); |
| | | // pedigreeChartDetailService.save(count1); |
| | | // if (count1.getChildren()!=null){ |
| | | // for (TPedigreeChartParentThreeDTO tPedigreeChartParentThreeDTO : count1.getChildren()) { |
| | | // tPedigreeChartParentThreeDTO.setParentId(count1.getId()); |
| | | // tPedigreeChartParentThreeDTO.setPedigreeChartId(parent.getId()); |
| | | // tPedigreeChartParentThreeDTO.setType(1); |
| | | // tPedigreeChartParentThreeDTO.setStatus(1); |
| | | // tPedigreeChartParentThreeDTO.setParentId(tPedigreeChartParentTwoDTO.getId()); |
| | | // tPedigreeChartParentThreeDTO.setPedigreeChartId(parent.getId()); |
| | | // pedigreeChartDetailService.save(tPedigreeChartParentThreeDTO); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | // } |
| | | //不能修改别人的数据 |
| | | TPedigreeChart byId = pedigreeChartService.getById(parent.getId()); |
| | | if (!loginUser.getUser().getNickName().equals(byId.getCreateBy())) { |
| | | return R.fail("不能修改其他工程师数据"); |
| | | } |
| | | |
| | | List<String> projectIds = projectTeamStaffService.lambdaQuery().eq(TProjectTeamStaff::getUserId, |
| | | tokenService.getLoginUser().getUserId()) |
| | | .list().stream().map(TProjectTeamStaff::getTeamId).collect(Collectors.toList()); |
| | | if (!projectIds.isEmpty()){ |
| | | TProjectTeam projectTeam = projectTeamService.lambdaQuery().in(TProjectTeam::getId, projectIds) |
| | | .eq(TProjectTeam::getStatus, 1) |
| | | .orderByDesc(BaseModel::getCreateTime) |
| | | .last("limit 1").one(); |
| | | parent.setProjectId(projectTeam.getId()); |
| | | } |
| | | Integer status = parent.getStatus(); |
| | | TPedigreeChart pedigreeChart = pedigreeChartService.getById(parent.getId()); |
| | | if (pedigreeChart.getStatus() == 2){ |
| | | parent.setStatus(2); |
| | | } |
| | | pedigreeChartService.updateById(parent); |
| | | parent.setStatus( status); |
| | | |
| | | if (!dto.getOne().isEmpty()){ |
| | | TPedigreeChartParentOneDTO oneLevel = dto.getOne().get(0); |
| | | oneLevel.setParentId("0"); |
| | | oneLevel.setType(1); |
| | | oneLevel.setStatus(oneLevel.getStatus()); |
| | | oneLevel.setStorageTime(LocalDateTime.now()); |
| | | oneLevel.setPedigreeChartId(parent.getId()); |
| | | oneLevel.setVaccinateId(loginUser.getUserId()+""); |
| | | oneLevel.setVaccinateSignature(oneLevel.getVaccinateSignature()); |
| | | oneLevel.setVaccinateTime(LocalDateTime.now()); |
| | | oneLevel.setId(dto.getOne().get(0).getId()); |
| | | if (oneLevel.getId()==null){ |
| | | if (parent.getStatus()==1){ |
| | | oneLevel.setAuditStatus(0); |
| | | oneLevel.setCodeStatus(parent.getStatus()); |
| | | }else{ |
| | | oneLevel.setAuditStatus(1); |
| | | oneLevel.setCodeStatus(parent.getStatus()); |
| | | |
| | | } |
| | | }else{ |
| | | if (parent.getStatus()==2){ |
| | | switch (oneLevel.getAuditStatus()){ |
| | | case 0: |
| | | oneLevel.setAuditStatus(1); |
| | | oneLevel.setCodeStatus(parent.getStatus()); |
| | | break; |
| | | case 1: |
| | | oneLevel.setAuditStatus(1); |
| | | oneLevel.setCodeStatus(parent.getStatus()); |
| | | break; |
| | | case 2: |
| | | oneLevel.setAuditStatus(2); |
| | | oneLevel.setCodeStatus(parent.getStatus()); |
| | | } |
| | | } |
| | | } |
| | | pedigreeChartDetailService.saveOrUpdate(oneLevel); |
| | | List<TPedigreeChartParentOneCountDTO> countList = oneLevel.getChildren(); |
| | | |
| | | if (!countList.isEmpty()){ |
| | | TPedigreeChartParentOneCountDTO count = countList.get(0); |
| | | count.setParentId(oneLevel.getId()); |
| | | count.setType(2); |
| | | count.setVaccinateId(loginUser.getUserId()+""); |
| | | count.setVaccinateTime(LocalDateTime.now()); |
| | | count.setStatus(1); |
| | | if (count.getId()==null){ |
| | | if (parent.getStatus()==1){ |
| | | count.setAuditStatus(0); |
| | | count.setCodeStatus(parent.getStatus()); |
| | | }else{ |
| | | count.setAuditStatus(1); |
| | | count.setCodeStatus(parent.getStatus()); |
| | | |
| | | } |
| | | }else{ |
| | | if (parent.getStatus()==2){ |
| | | switch (count.getAuditStatus()){ |
| | | case 0: |
| | | count.setAuditStatus(1); |
| | | count.setCodeStatus(parent.getStatus()); |
| | | break; |
| | | case 1: |
| | | count.setAuditStatus(1); |
| | | count.setCodeStatus(parent.getStatus()); |
| | | break; |
| | | case 2: |
| | | count.setAuditStatus(2); |
| | | count.setCodeStatus(parent.getStatus()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | count.setPedigreeChartId(parent.getId()); |
| | | count.setId(countList.get(0).getId()); |
| | | pedigreeChartDetailService.saveOrUpdate(count); |
| | | if (count.getChildren()!=null){ |
| | | for (TPedigreeChartParentTwoDTO tPedigreeChartParentTwoDTO : count.getChildren()) { |
| | | tPedigreeChartParentTwoDTO.setParentId(oneLevel.getId()); |
| | | tPedigreeChartParentTwoDTO.setPedigreeChartId(parent.getId()); |
| | | tPedigreeChartParentTwoDTO.setType(1); |
| | | if (tPedigreeChartParentTwoDTO.getStatus()==null){ |
| | | tPedigreeChartParentTwoDTO.setStatus(1); |
| | | } |
| | | tPedigreeChartParentTwoDTO.setVaccinateId(loginUser.getUserId()+""); |
| | | tPedigreeChartParentTwoDTO.setVaccinateSignature(tPedigreeChartParentTwoDTO.getVaccinateSignature()); |
| | | tPedigreeChartParentTwoDTO.setVaccinateTime(LocalDateTime.now()); |
| | | tPedigreeChartParentTwoDTO.setStorageTime(LocalDateTime.now()); |
| | | tPedigreeChartParentTwoDTO.setParentId(count.getId()); |
| | | tPedigreeChartParentTwoDTO.setId(tPedigreeChartParentTwoDTO.getId()); |
| | | if (tPedigreeChartParentTwoDTO.getId()==null){ |
| | | if (parent.getStatus()==1){ |
| | | tPedigreeChartParentTwoDTO.setAuditStatus(0); |
| | | tPedigreeChartParentTwoDTO.setCodeStatus(parent.getStatus()); |
| | | }else{ |
| | | tPedigreeChartParentTwoDTO.setAuditStatus(1); |
| | | tPedigreeChartParentTwoDTO.setCodeStatus(parent.getStatus()); |
| | | |
| | | } |
| | | }else{ |
| | | if (parent.getStatus()==2){ |
| | | switch (tPedigreeChartParentTwoDTO.getAuditStatus()){ |
| | | case 0: |
| | | tPedigreeChartParentTwoDTO.setAuditStatus(1); |
| | | tPedigreeChartParentTwoDTO.setCodeStatus(parent.getStatus()); |
| | | break; |
| | | case 1: |
| | | tPedigreeChartParentTwoDTO.setAuditStatus(1); |
| | | tPedigreeChartParentTwoDTO.setCodeStatus(parent.getStatus()); |
| | | break; |
| | | case 2: |
| | | tPedigreeChartParentTwoDTO.setAuditStatus(2); |
| | | tPedigreeChartParentTwoDTO.setCodeStatus(parent.getStatus()); |
| | | } |
| | | } |
| | | } |
| | | pedigreeChartDetailService.saveOrUpdate(tPedigreeChartParentTwoDTO); |
| | | List<TPedigreeChartParentTwoCountDTO> count1List = tPedigreeChartParentTwoDTO.getChildren(); |
| | | if (!count1List.isEmpty()){ |
| | | // 传代数 |
| | | TPedigreeChartParentTwoCountDTO childCount = count1List.get(0); |
| | | childCount.setType(2); |
| | | if (childCount.getId()==null){ |
| | | if (parent.getStatus()==1){ |
| | | childCount.setAuditStatus(0); |
| | | childCount.setCodeStatus(parent.getStatus()); |
| | | }else{ |
| | | childCount.setAuditStatus(1); |
| | | childCount.setCodeStatus(parent.getStatus()); |
| | | |
| | | } |
| | | }else{ |
| | | if (parent.getStatus()==2){ |
| | | switch (childCount.getAuditStatus()){ |
| | | case 0: |
| | | childCount.setAuditStatus(1); |
| | | childCount.setCodeStatus(parent.getStatus()); |
| | | break; |
| | | case 1: |
| | | childCount.setAuditStatus(1); |
| | | childCount.setCodeStatus(parent.getStatus()); |
| | | break; |
| | | case 2: |
| | | childCount.setAuditStatus(2); |
| | | childCount.setCodeStatus(parent.getStatus()); |
| | | } |
| | | } |
| | | } |
| | | count.setVaccinateId(loginUser.getUserId()+""); |
| | | count.setVaccinateTime(LocalDateTime.now()); |
| | | childCount.setParentId(tPedigreeChartParentTwoDTO.getId()); |
| | | childCount.setPedigreeChartId(parent.getId()); |
| | | childCount.setStatus(1); |
| | | childCount.setId(childCount.getId()); |
| | | |
| | | pedigreeChartDetailService.saveOrUpdate(childCount); |
| | | if (childCount.getChildren()!=null){ |
| | | for (TPedigreeChartParentThreeDTO tPedigreeChartParentThreeDTO : childCount.getChildren()) { |
| | | tPedigreeChartParentThreeDTO.setParentId(childCount.getId()); |
| | | tPedigreeChartParentThreeDTO.setPedigreeChartId(parent.getId()); |
| | | tPedigreeChartParentThreeDTO.setType(1); |
| | | tPedigreeChartParentThreeDTO.setVaccinateId(loginUser.getUserId()+""); |
| | | if (tPedigreeChartParentThreeDTO.getStatus()==null){ |
| | | tPedigreeChartParentThreeDTO.setStatus(1); |
| | | } |
| | | tPedigreeChartParentThreeDTO.setVaccinateId(loginUser.getUserId()+""); |
| | | tPedigreeChartParentThreeDTO.setVaccinateSignature(tPedigreeChartParentTwoDTO.getVaccinateSignature()); |
| | | tPedigreeChartParentThreeDTO.setVaccinateTime(LocalDateTime.now()); |
| | | tPedigreeChartParentThreeDTO.setStorageTime(LocalDateTime.now()); |
| | | tPedigreeChartParentThreeDTO.setPedigreeChartId(parent.getId()); |
| | | tPedigreeChartParentThreeDTO.setId(tPedigreeChartParentThreeDTO.getId()); |
| | | if (tPedigreeChartParentThreeDTO.getId()==null){ |
| | | if (parent.getStatus()==1){ |
| | | tPedigreeChartParentThreeDTO.setAuditStatus(0); |
| | | tPedigreeChartParentThreeDTO.setCodeStatus(parent.getStatus()); |
| | | }else{ |
| | | tPedigreeChartParentThreeDTO.setAuditStatus(1); |
| | | tPedigreeChartParentThreeDTO.setCodeStatus(parent.getStatus()); |
| | | |
| | | } |
| | | }else{ |
| | | if (parent.getStatus()==2){ |
| | | switch (tPedigreeChartParentThreeDTO.getAuditStatus()){ |
| | | case 0: |
| | | tPedigreeChartParentThreeDTO.setAuditStatus(1); |
| | | tPedigreeChartParentThreeDTO.setCodeStatus(parent.getStatus()); |
| | | break; |
| | | case 1: |
| | | tPedigreeChartParentThreeDTO.setAuditStatus(1); |
| | | tPedigreeChartParentThreeDTO.setCodeStatus(parent.getStatus()); |
| | | break; |
| | | case 2: |
| | | tPedigreeChartParentThreeDTO.setAuditStatus(2); |
| | | tPedigreeChartParentThreeDTO.setCodeStatus(parent.getStatus()); |
| | | } |
| | | } |
| | | } |
| | | pedigreeChartDetailService.saveOrUpdate(tPedigreeChartParentThreeDTO); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | String child = JSON.toJSONString(oneLevel); |
| | | parent.setJson(child); |
| | | parent.setStatus(null); |
| | | pedigreeChartService.updateById(parent); |
| | | } |
| | | |
| | | // 新增消息 |
| | | TNotice tNotice = new TNotice(); |
| | | List<String> allProjectIds = projectTeamStaffService.lambdaQuery().eq(TProjectTeamStaff::getTeamId,parent.getProjectId() ) |
| | | .eq(TProjectTeamStaff::getRoleType, 2) |
| | | .list().stream().map(TProjectTeamStaff::getTeamId).collect(Collectors.toList()); |
| | | if (!allProjectIds.isEmpty()){ |
| | | TProjectTeam team = projectTeamService.lambdaQuery().in(TProjectTeam::getId, allProjectIds) |
| | | .eq(TProjectTeam::getStatus, 1) |
| | | .orderByDesc(BaseModel::getCreateTime).last("limit 1").one(); |
| | | TProjectTeamStaff projectTeamStaff = projectTeamStaffService.lambdaQuery() |
| | | .eq(TProjectTeamStaff::getTeamId, team.getId()).eq(TProjectTeamStaff::getRoleType, 1).one(); |
| | | tNotice.setCommitId(tokenService.getLoginUser().getUserId()+""); |
| | | tNotice.setUserId(projectTeamStaff.getUserId()); |
| | | tNotice.setStatus(1); |
| | | tNotice.setNoticeContent("菌种工程师新增【1】条【菌种传代生产谱系图】操作,等待您签字确认;"); |
| | | tNotice.setDataId(parent.getId()); |
| | | tNotice.setNoticeType(4); |
| | | noticeService.save(tNotice); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | @Log(title = "谱系图-谱系图-删除谱系图", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "谱系图-删除谱系图") |
| | | @Transactional |
| | | @DeleteMapping(value = "/open/t-pedigree-chart/deleteProgenitor") |
| | | public R<Boolean> deleteProgenitor(@RequestParam String id) { |
| | | pedigreeChartService.removeById(id); |
| | |
| | | @ApiOperation(value = "谱系图-删除菌种传代项",response = TPedigreeChartParentDTO.class) |
| | | @DeleteMapping(value = "/open/t-pedigree-chart/deleteProgenitorChild") |
| | | public R<Boolean> deleteProgenitorChild(@RequestParam String id) { |
| | | pedigreeChartDetailService.removeById(id); |
| | | List<TPedigreeChartDetail> children = pedigreeChartDetailService.lambdaQuery().eq(TPedigreeChartDetail::getParentId, id) |
| | | .list(); |
| | | if (!children.isEmpty()){ |
| | | return R.fail("请先删除子项"); |
| | | } |
| | | pedigreeChartDetailService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | @Log(title = "谱系图-谱系图-编辑菌种传代/传代数项", businessType = BusinessType.UPDATE) |
| | |
| | | @Log(title = "谱系图-祖代/母代新增菌种传代项", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "祖代/母代新增菌种传代项",response = TPedigreeChartDetailDTO.class) |
| | | @PostMapping(value = "/api/t-pedigree-chart/addProgenitorChild") |
| | | @Transactional |
| | | public R<Boolean> addProgenitorChild(@RequestBody String param) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if (loginUser==null){ |
| | |
| | | } |
| | | TPedigreeChartDetailDTO dto = JSON.parseObject(param, TPedigreeChartDetailDTO.class); |
| | | if (dto.getParentId().equals("0")){ |
| | | // 新增祖代 |
| | | // 新增祖/母代 |
| | | dto.setParentId("0"); |
| | | pedigreeChartDetailService.save(dto); |
| | | }else{ |
| | | String parentId = dto.getParentId(); |
| | | TPedigreeChartDetail parent = pedigreeChartDetailService.getById(parentId); |
| | | if (parent.getType()==2){ |
| | | if (parent.getAuditStatus()==1){ |
| | | return R.fail("传代计划数未审核"); |
| | | } |
| | | if (parent.getAuditStatus()==3){ |
| | | return R.fail("传代计划数审核被驳回"); |
| | | } |
| | | } |
| | | |
| | | Long count = pedigreeChartDetailService.lambdaQuery().eq(TPedigreeChartDetail::getParentId, parentId).count(); |
| | | if (count>=parent.getGenerationCount()){ |
| | | return R.fail("该谱系图已满"); |
| | | } |
| | | |
| | | String pedigreeChartId = pedigreeChartDetailService.getById(parentId).getPedigreeChartId(); |
| | | TPedigreeChart pedigreeChart = pedigreeChartService.getById(pedigreeChartId); |
| | | TPedigreeChartDetail tPedigreeChartDetail = new TPedigreeChartDetail(); |
| | |
| | | tPedigreeChartDetail.setPedigreeChartId(pedigreeChart.getId()); |
| | | tPedigreeChartDetail.setVaccinateId(loginUser.getUserId()+""); |
| | | tPedigreeChartDetail.setVaccinateTime(LocalDateTime.now()); |
| | | tPedigreeChartDetail.setCodeStatus(dto.getCodeStatus()); |
| | | if (dto.getStatus() ==2){ |
| | | tPedigreeChartDetail.setDiscardTime(LocalDateTime.now()); |
| | | } |
| | | if (dto.getCodeStatus()==2){ |
| | | tPedigreeChartDetail.setAuditStatus(1); |
| | | |
| | | }else{ |
| | | tPedigreeChartDetail.setAuditStatus(0); |
| | | } |
| | | tPedigreeChartDetail.setVaccinateSignature(dto.getVaccinateSignature()); |
| | | pedigreeChartDetailService.save(tPedigreeChartDetail); |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 0获取谱系图详情待确认传代计划数分页列表 |
| | | */ |
| | | @ApiOperation(value = "谱系图-2.0获取谱系图详情待确认传代计划数分页列表",response = TPedigreeChartDetailQuery.class) |
| | | @PostMapping(value = "/api/t-pedigree-chart/pageListCountDetail") |
| | | public R<PageInfo<TPedigreeChartDetailVO>> pageListCountDetail(@RequestBody String param) { |
| | | TPedigreeChartDetailQuery query = JSON.parseObject(param, TPedigreeChartDetailQuery.class); |
| | | return R.ok(pedigreeChartService.pageListCountDetail(query)); |
| | | } |
| | | @ApiOperation(value = "谱系图-2.0审批人确认传代计划数",response = TPedigreeChartDetailConfirmCountDTO.class) |
| | | @PostMapping(value = "/api/t-pedigree-chart/confirmCount") |
| | | public R confirmCount(@RequestBody String param) { |
| | | TPedigreeChartDetailConfirmCountDTO query = JSON.parseObject(param, TPedigreeChartDetailConfirmCountDTO.class); |
| | | |
| | | TPedigreeChartDetail pedigreeChartDetailServiceById = pedigreeChartDetailService.getById(query.getId()); |
| | | pedigreeChartDetailServiceById.setAuditStatus(2); |
| | | pedigreeChartDetailServiceById.setPreserveSignature(query.getPreserveSignature()); |
| | | pedigreeChartDetailService.updateById(pedigreeChartDetailServiceById); |
| | | return R.ok(); |
| | | } |
| | | /** |
| | | * 获取谱系图详情待入库菌种分页列表 |
| | | */ |
| | |
| | | TPedigreeChartDetailQuery query = JSON.parseObject(param, TPedigreeChartDetailQuery.class); |
| | | return R.ok(pedigreeChartService.pageListDetail(query)); |
| | | } |
| | | |
| | | @Resource |
| | | private TProjectTeamMapper tProjectTeamMapper; |
| | | |
| | | /** |
| | | * 谱系图-菌种传代生产谱系图详情 |
| | | */ |
| | |
| | | tPedigreeChartParentAllDetailDTO.setOne(tPedigreeChartParentOneDTOS); |
| | | } |
| | | pedigreeChart.setPedigreeChartParentAllDetailDTO(tPedigreeChartParentAllDetailDTO); |
| | | |
| | | if (com.ruoyi.common.utils.StringUtils.isNotEmpty(pedigreeChart.getProjectId())) { |
| | | TProjectTeam tProjectTeam = tProjectTeamMapper.selectById(pedigreeChart.getProjectId()); |
| | | if (tProjectTeam != null) { |
| | | List<TProjectTeamStaff> list = projectTeamStaffService.lambdaQuery().eq(TProjectTeamStaff::getTeamId, tProjectTeam.getId()).list(); |
| | | StringBuilder staffNames = new StringBuilder(); |
| | | for (TProjectTeamStaff tProjectTeamStaff : list) { |
| | | SysUser sysUser = sysUserService.selectUserById(Long.valueOf(tProjectTeamStaff.getUserId())); |
| | | if (sysUser!=null){ |
| | | staffNames.append(sysUser.getNickName()).append(","); |
| | | } |
| | | } |
| | | if (org.springframework.util.StringUtils.hasLength(staffNames.toString())){ |
| | | tProjectTeam.setStaff(staffNames.substring(0, staffNames.toString().length() - 1)); |
| | | } |
| | | |
| | | List<TProjectTeam> tProjectTeamList = new ArrayList<>(); |
| | | tProjectTeamList.add(tProjectTeam); |
| | | pedigreeChart.setTProjectTeamList(tProjectTeamList); |
| | | } |
| | | } |
| | | |
| | | return R.ok(pedigreeChart); |
| | | } |
| | | /** |
| | |
| | | @PostMapping(value = "/api/t-pedigree-chart/updateCount") |
| | | public R<Boolean> updateCount(@RequestBody String param) { |
| | | TPedigreeChartDetailCountDTO dto = JSON.parseObject(param, TPedigreeChartDetailCountDTO.class); |
| | | |
| | | TPedigreeChartDetail count = pedigreeChartDetailService.getById(dto.getId()); |
| | | count.setGenerationCount(dto.getGenerationCount()); |
| | | // 待审核状态 |
| | | count.setAuditStatus(1); |
| | | count.setVaccinateId(tokenService.getLoginUser().getUserId()+""); |
| | | count.setVaccinateTime(LocalDateTime.now()); |
| | | count.setVaccinateSignature(dto.getVaccinateSignature()); |
| | | pedigreeChartDetailService.updateById(count); |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation(value = "谱系图-设置传代数",response = TPedigreeChartDetailCountDTO.class) |
| | | @PostMapping(value = "/api/t-pedigree-chart/addCount") |
| | | public R<Boolean> addCount(@RequestBody String param) { |
| | | TPedigreeChartDetailCountDTO dto = JSON.parseObject(param, TPedigreeChartDetailCountDTO.class); |
| | | TPedigreeChartDetail pedigreeChartDetail1 = new TPedigreeChartDetail(); |
| | | pedigreeChartDetail1.setParentId(dto.getParentId()); |
| | | pedigreeChartDetail1.setVaccinateId(tokenService.getLoginUser().getUserId()+""); |
| | |
| | | pedigreeChartDetail1.setGenerationCount(dto.getGenerationCount()); |
| | | pedigreeChartDetail1.setPedigreeChartId(tPedigreeChartDetail.getPedigreeChartId()); |
| | | pedigreeChartDetail1.setType(2); |
| | | |
| | | pedigreeChartDetail1.setCodeStatus(dto.getCodeStatus()); |
| | | if (dto.getCodeStatus()==1){ |
| | | pedigreeChartDetail1.setAuditStatus(0); |
| | | }else{ |
| | | pedigreeChartDetail1.setAuditStatus(1); |
| | | } |
| | | pedigreeChartDetailService.save(pedigreeChartDetail1); |
| | | return R.ok(); |
| | | } |
| | |
| | | pedigreeChartDetail.setPreserveId(String.valueOf(tokenService.getLoginUser().getUserId())); |
| | | pedigreeChartDetail.setPreserveSignature(dto.getPreserveSignature()); |
| | | pedigreeChartDetail.setConfirmTime(LocalDateTime.now()); |
| | | pedigreeChartDetail.setAuditStatus(2); |
| | | pedigreeChartDetailService.updateById(pedigreeChartDetail); |
| | | return R.ok(); |
| | | } |