| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.collections.CollectionUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | } |
| | | // 查询村社数组 |
| | | QueryWrapper<CtUnit> ctUnitQueryWrapper = new QueryWrapper<>(); |
| | | ctUnitQueryWrapper.eq("parent_id", loginUnit.getId()); |
| | | ctUnitQueryWrapper.eq("parent_id", loginUnit.getId()).eq("unit_grade", UserBaseConsts.UNIT_GRADE_4); |
| | | List<CtUnit> ctUnitList = mapper.selectList(ctUnitQueryWrapper); |
| | | List<SelectTermDTO> csList = new ArrayList<>(); |
| | | for (CtUnit ctUnit: ctUnitList){ |
| | |
| | | result.add(firstSelectTermDTO); |
| | | return result; |
| | | }else { |
| | | return new ArrayList<>(); |
| | | // todo |
| | | QueryWrapper<CtUnit> ctUnitQueryWrapper = new QueryWrapper<>(); |
| | | ctUnitQueryWrapper.eq("parent_id", loginUnit.getParentId()); |
| | | List<CtUnit> ctUnitList = mapper.selectList(ctUnitQueryWrapper); |
| | | // |
| | | List<SelectTermDTO> unitList = new ArrayList<>(); |
| | | for (CtUnit ctUnit: ctUnitList){ |
| | | SelectTermDTO unitSelectTerm = new SelectTermDTO(); |
| | | unitSelectTerm.setValue(ctUnit.getId()); |
| | | unitSelectTerm.setLabel(ctUnit.getUnitName()); |
| | | unitSelectTerm.setParentId(ctUnit.getParentId()); |
| | | unitSelectTerm.setCheckable(true); |
| | | unitList.add(unitSelectTerm); |
| | | } |
| | | return unitList; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 交办-选择组织 |
| | | * 联合处置申请-选择组织 |
| | | * @param userId |
| | | * @return |
| | | */ |
| | |
| | | CtUnit loginUnit = mapper.selectById(loginUser.getUnitId()); |
| | | QueryWrapper<CtUnit> ctUnitQueryWrapper1 = new QueryWrapper<>(); |
| | | ctUnitQueryWrapper1.eq("id", loginUnit.getParentId()); |
| | | CtUnit superiorUnit = mapper.selectOne(ctUnitQueryWrapper1); |
| | | CtUnit superiorUnit = mapper.selectById(loginUnit.getParentId()); |
| | | // 市级 |
| | | if (UserBaseConsts.UNIT_GRADE_1 == loginUnit.getUnitGrade()){ |
| | | if (UserBaseConsts.UNIT_GRADE_1 == superiorUnit.getUnitGrade()){ |
| | | QueryWrapper<CtUnit> ctUnitQueryWrapper = new QueryWrapper<>(); |
| | | ctUnitQueryWrapper.eq("parent_id", loginUnit.getId()); |
| | | ctUnitQueryWrapper.eq("parent_id", superiorUnit.getId()); |
| | | List<CtUnit> ctUnitList = mapper.selectList(ctUnitQueryWrapper); |
| | | // 定义市直部门数组 |
| | | List<SelectTermDTO> szbmList = new ArrayList<>(); |
| | |
| | | firstSelectTermDTO.setChildren(firstChildren); |
| | | result.add(firstSelectTermDTO); |
| | | return result; |
| | | }else if (UserBaseConsts.UNIT_GRADE_2 == loginUnit.getUnitGrade()){ |
| | | }else if (UserBaseConsts.UNIT_GRADE_2 == superiorUnit.getUnitGrade()){ |
| | | // 区级 |
| | | QueryWrapper<CtUnit> ctUnitQueryWrapper = new QueryWrapper<>(); |
| | | ctUnitQueryWrapper.eq("parent_id", loginUnit.getId()); |
| | | ctUnitQueryWrapper.eq("parent_id", superiorUnit.getId()); |
| | | List<CtUnit> ctUnitList = mapper.selectList(ctUnitQueryWrapper); |
| | | // 定义市区直部门数组 |
| | | List<SelectTermDTO> qzbmList = new ArrayList<>(); |
| | |
| | | firstSelectTermDTO.setChildren(firstChildren); |
| | | result.add(firstSelectTermDTO); |
| | | return result; |
| | | }else if (UserBaseConsts.UNIT_GRADE_3 == loginUnit.getUnitGrade()){ |
| | | }else if (UserBaseConsts.UNIT_GRADE_3 == superiorUnit.getUnitGrade()){ |
| | | // 镇街 |
| | | // 查询镇街部门数组 |
| | | QueryWrapper<CtDept> ctDeptQueryWrapper = new QueryWrapper<>(); |
| | | ctDeptQueryWrapper.eq("unit_id", loginUnit.getId()); |
| | | ctDeptQueryWrapper.eq("unit_id", superiorUnit.getId()); |
| | | List<CtDept> deptList = ctDeptService.list(ctDeptQueryWrapper); |
| | | List<SelectTermDTO> zjbmList = new ArrayList<>(); |
| | | for (CtDept ctDept: deptList){ |
| | | SelectTermDTO unitSelectTerm = new SelectTermDTO(); |
| | | unitSelectTerm.setValue(ctDept.getId()); |
| | | unitSelectTerm.setLabel(ctDept.getName()); |
| | | unitSelectTerm.setParentId(loginUnit.getId()); |
| | | unitSelectTerm.setParentId(superiorUnit.getId()); |
| | | unitSelectTerm.setCheckable(true); |
| | | zjbmList.add(unitSelectTerm); |
| | | } |
| | | // 查询村社数组 |
| | | QueryWrapper<CtUnit> ctUnitQueryWrapper = new QueryWrapper<>(); |
| | | ctUnitQueryWrapper.eq("parent_id", loginUnit.getId()); |
| | | ctUnitQueryWrapper.eq("parent_id", superiorUnit.getId()).eq("unit_grade", UserBaseConsts.UNIT_GRADE_4); |
| | | List<CtUnit> ctUnitList = mapper.selectList(ctUnitQueryWrapper); |
| | | List<SelectTermDTO> csList = new ArrayList<>(); |
| | | for (CtUnit ctUnit: ctUnitList){ |
| | |
| | | // 封装返回数据 |
| | | List<SelectTermDTO> result = new ArrayList<>(); |
| | | // 创建第一级 |
| | | SelectTermDTO firstSelectTermDTO = new SelectTermDTO(); |
| | | firstSelectTermDTO.setValue(loginUser.getUnitId()); |
| | | firstSelectTermDTO.setLabel(loginUser.getUnitName()); |
| | | firstSelectTermDTO.setCheckable(false); |
| | | List<SelectTermDTO> firstChildren = new ArrayList<>(); |
| | | // 村社 |
| | | SelectTermDTO zjbmSelectTermDTO = new SelectTermDTO(); |
| | |
| | | csSelectTermDTO.setChildren(csList); |
| | | firstChildren.add(csSelectTermDTO); |
| | | // 第一级子级 |
| | | firstSelectTermDTO.setChildren(firstChildren); |
| | | result.add(firstSelectTermDTO); |
| | | result.addAll(firstChildren); |
| | | return result; |
| | | }else { |
| | | return new ArrayList<>(); |
| | |
| | | throw new ServiceException("CtUnitService.getParentZzzx", e); |
| | | } |
| | | } |
| | | |
| | | public CtUnit selectUnitByGridId(String gridUnitId){ |
| | | return mapper.selectUnitByGridId(gridUnitId); |
| | | } |
| | | } |