puzhibing
6 天以前 082bddee7df8a05ca95f473ec2643701d41a5213
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TPedigreeChartController.java
@@ -171,7 +171,7 @@
                count.setPedigreeChartId(parent.getId());
                count.setId(null);
                if (parent.getStatus()==1){
                    count.setAuditStatus(0);
                    count.setAuditStatus(1);
                }else{
                    count.setAuditStatus(1);
                }
@@ -206,12 +206,12 @@
                            TPedigreeChartParentTwoCountDTO childCount = count1List.get(0);
                            childCount.setType(2);
                            if (parent.getStatus()==1){
                                count.setAuditStatus(0);
                                childCount.setAuditStatus(1);
                            }else{
                                count.setAuditStatus(1);
                                childCount.setAuditStatus(1);
                            }
                            count.setVaccinateId(loginUser.getUserId()+"");
                            count.setVaccinateTime(LocalDateTime.now());
                            childCount.setVaccinateId(loginUser.getUserId()+"");
                            childCount.setVaccinateTime(LocalDateTime.now());
                            childCount.setParentId(tPedigreeChartParentTwoDTO.getId());
                            childCount.setPedigreeChartId(parent.getId());
                            childCount.setStatus(1);
@@ -317,7 +317,7 @@
        Integer status = parent.getStatus();
        TPedigreeChart pedigreeChart = pedigreeChartService.getById(parent.getId());
        if (pedigreeChart.getStatus() == 2){
            parent.setStatus(2);
            return R.fail("谱系图已提交,不可编辑");
        }
        pedigreeChartService.updateById(parent);
        parent.setStatus( status);
@@ -371,7 +371,7 @@
                count.setStatus(1);
                if (count.getId()==null){
                    if (parent.getStatus()==1){
                        count.setAuditStatus(0);
                        count.setAuditStatus(1);
                        count.setCodeStatus(parent.getStatus());
                    }else{
                        count.setAuditStatus(1);
@@ -447,7 +447,7 @@
                            childCount.setType(2);
                            if (childCount.getId()==null){
                                if (parent.getStatus()==1){
                                    childCount.setAuditStatus(0);
                                    childCount.setAuditStatus(1);
                                    childCount.setCodeStatus(parent.getStatus());
                                }else{
                                    childCount.setAuditStatus(1);
@@ -543,7 +543,7 @@
                    .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();
                    .eq(TProjectTeamStaff::getTeamId, team.getId()).eq(TProjectTeamStaff::getRoleType, 2).one();
            tNotice.setCommitId(tokenService.getLoginUser().getUserId()+"");
            tNotice.setUserId(projectTeamStaff.getUserId());
            tNotice.setStatus(1);
@@ -692,7 +692,21 @@
    public R<TPedigreeChart> getDetailInfoById(@RequestParam String id) {
        List<TPedigreeChartParentOneDTO> tPedigreeChartParentOneDTOS = new ArrayList<>();
        TPedigreeChart pedigreeChart = pedigreeChartService.getById(id);
        List<TPedigreeChartDetail> details = pedigreeChartDetailService.lambdaQuery().eq(TPedigreeChartDetail::getPedigreeChartId, id).list();
        if (pedigreeChart == null) {
            return R.fail("谱系图不存在或已删除");
        }
        List<TPedigreeChartDetail> details = new ArrayList<>(pedigreeChartDetailService.lambdaQuery()
                .eq(TPedigreeChartDetail::getPedigreeChartId, id)
                .orderByDesc(TPedigreeChartDetail::getUpdateTime)
                .orderByDesc(TPedigreeChartDetail::getCreateTime)
                .list().stream()
                .filter(detail -> StringUtils.isNotEmpty(detail.getId()))
                .collect(Collectors.toMap(
                        TPedigreeChartDetail::getId,
                        detail -> detail,
                        (first, duplicate) -> first,
                        LinkedHashMap::new
                )).values());
        TPedigreeChartParentAllDetailDTO tPedigreeChartParentAllDetailDTO = new TPedigreeChartParentAllDetailDTO();
        // 祖代
        TPedigreeChartDetail pedigreeChartDetail = details.stream().filter(e -> e.getParentId().equals("0")
@@ -714,7 +728,6 @@
                List<TPedigreeChartDetail> childs = details.stream().filter(e -> e.getParentId().equals(tPedigreeChartParentOneCountDTO.getId())
                        && e.getType() == 1).collect(Collectors.toList());
                List<TPedigreeChartParentTwoDTO> tPedigreeChartParentTwoDTOS = new ArrayList<>();
                List<TPedigreeChartParentThreeDTO> tPedigreeChartParentThreeDTOS = new ArrayList<>();
                for (TPedigreeChartDetail tPedigreeChartDetail : childs) {
                    TPedigreeChartParentTwoDTO tPedigreeChartParentTwoDTO = new TPedigreeChartParentTwoDTO();
                    BeanUtils.copyProperties(tPedigreeChartDetail,tPedigreeChartParentTwoDTO);
@@ -725,6 +738,7 @@
                        ArrayList<TPedigreeChartParentTwoCountDTO> tPedigreeChartParentTwoCountDTOS = new ArrayList<>();
                        TPedigreeChartParentTwoCountDTO tPedigreeChartParentTwoCountDTO = new TPedigreeChartParentTwoCountDTO();
                        BeanUtils.copyProperties(childCountChild,tPedigreeChartParentTwoCountDTO);
                        List<TPedigreeChartParentThreeDTO> tPedigreeChartParentThreeDTOS = new ArrayList<>();
                        List<TPedigreeChartDetail> childChilds = details.stream().filter(e -> e.getParentId().equals(tPedigreeChartParentTwoCountDTO.getId())
                                && e.getType() == 1).collect(Collectors.toList());
                        for (TPedigreeChartDetail chartDetail : childChilds) {
@@ -818,11 +832,7 @@
        pedigreeChartDetail1.setType(2);
        pedigreeChartDetail1.setCodeStatus(dto.getCodeStatus());
        if (dto.getCodeStatus()==1){
            pedigreeChartDetail1.setAuditStatus(0);
        }else{
            pedigreeChartDetail1.setAuditStatus(1);
        }
        pedigreeChartDetailService.save(pedigreeChartDetail1);
        return R.ok();
    }