| | |
| | | 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; |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | // 查询村社数组 |
| | | QueryWrapper<CtUnit> ctUnitQueryWrapper = new QueryWrapper<>(); |
| | | ctUnitQueryWrapper.eq("parent_id", superiorUnit.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){ |
| | |
| | | throw new ServiceException("CtUnitService.getParentZzzx", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取本级综治中心 |
| | | * @param unitId 当前单位编号 |
| | | * @return |
| | | */ |
| | | public CtUnitDTO getBjZzzx(String unitId){ |
| | | try{ |
| | | CtUnitDTO ctUnitDTO = new CtUnitDTO(); |
| | | // 查询自己是否是综治中心 |
| | | CtUnit loginCtUnit = mapper.selectById(unitId); |
| | | if (UserBaseConsts.UNIT_TYPE_1 == loginCtUnit.getUnitType()){ |
| | | BeanUtils.copyProperties(loginCtUnit, ctUnitDTO); |
| | | }else { |
| | | // 查询当前单位的上级综治中心 |
| | | QueryWrapper<CtUnit> ctUnitQueryWrapper = new QueryWrapper<>(); |
| | | ctUnitQueryWrapper.eq("id", loginCtUnit.getParentId()).eq("unit_type", UserBaseConsts.UNIT_TYPE_1); |
| | | CtUnit zzzxCtUnit = mapper.selectOne(ctUnitQueryWrapper); |
| | | BeanUtils.copyProperties(zzzxCtUnit, ctUnitDTO); |
| | | } |
| | | return ctUnitDTO; |
| | | }catch (Exception e){ |
| | | log.error("[CtUnitService.getParentZzzx]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("CtUnitService.getParentZzzx", e); |
| | | } |
| | | } |
| | | |
| | | public CtUnit selectUnitByGridId(String gridUnitId){ |
| | | return mapper.selectUnitByGridId(gridUnitId); |
| | | } |
| | | } |