| | |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrBase.district.qo.DistrictQO; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaClient; |
| | | import com.dy.pipIrrGlobal.pojoBa.BaDistrict; |
| | | import com.dy.pipIrrGlobal.util.DistrictLevel; |
| | | import com.dy.pipIrrGlobal.voBa.VoDistrict; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | |
| | | @GetMapping(path = "all") |
| | | @SsoAop() |
| | | public BaseResponse<List<BaDistrict>> all() { |
| | | List<BaDistrict> list = this.sv.selectAllByLevel(DistrictLevel.City.code); |
| | | List<BaDistrict> list = this.sv.selectAllByLevel(DistrictLevel.Province.code); |
| | | return BaseResponseUtils.buildSuccess(list); |
| | | } |
| | | |
| | |
| | | List<Map<String, Object>> list_towns = Optional.ofNullable(sv.getDistrictsBySupperId(countyId)).orElse(new ArrayList<>()); |
| | | if (list_towns.size() > 0) { |
| | | array_towns = JSONArray.parseArray(JSON.toJSONString(list_towns)); |
| | | job_county.put("children", array_towns); |
| | | // 遍历每一个镇,将镇下村列表加到镇的子集 |
| | | for (int j = 0; j < array_towns.size(); j++) { |
| | | JSONObject job_town = array_towns.getJSONObject(j); |
| | |
| | | //System.out.println("----" + array_towns); |
| | | } |
| | | // 镇村组装完毕,将镇村加到县下 |
| | | job_county.put("children", array_towns); |
| | | // job_county.put("children", array_towns); |
| | | } |
| | | // 县组装完毕 |
| | | //String a = array_counties.toJSONString(); |
| | |
| | | |
| | | //return BaseResponseUtils.buildSuccess(); |
| | | } |
| | | |
| | | /** |
| | | * 根据区划代码查询指定级别行政区划 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "/districts") |
| | | @SsoAop() |
| | | public BaseResponse<List<VoDistrict>> getDistrictS(DistrictQO qo) { |
| | | String aredCode = qo.getAredCode(); |
| | | Integer level = qo.getLevel(); |
| | | |
| | | if((aredCode.trim().length() == 6 && level == 4) || (aredCode.trim().length() == 9 && level == 5)) { |
| | | try { |
| | | return BaseResponseUtils.buildSuccess(sv.getDistrictS(qo)); |
| | | } catch (Exception e) { |
| | | log.error("获取开卡记录异常", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | }else { |
| | | return BaseResponseUtils.buildErrorMsg("行政区划位数与级别不匹配"); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |