| | |
| | | if(res.itemTotal != null && res.itemTotal > 0) { |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | }else { |
| | | return BaseResponseUtils.buildFail(ProjectResultCode.NO_DIVIDES.getMessage()); |
| | | return BaseResponseUtils.buildSuccess(ProjectResultCode.NO_DIVIDES.getMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("获取开卡记录异常", e); |
| | |
| | | // 接收村编号(主键) |
| | | Long villageId = po.getVillageId(); |
| | | |
| | | /** |
| | | * 获取5级行政区划信息 |
| | | */ |
| | | Map map_districts = Optional.ofNullable(divideSv.getDistrictsByVillageId(villageId)).orElse(new HashMap()); |
| | | if(map_districts.size() <= 0) { |
| | | return BaseResponseUtils.buildFail("区划信息有误"); |
| | | } |
| | | |
| | | PrDivide prDivide = DtoToDividePojo.INSTANCT.po2vo(po); |
| | | |
| | | Long countryId = Long.parseLong(map_districts.get("countryId").toString()); |
| | | Long townId = Long.parseLong(map_districts.get("townId").toString()); |
| | | prDivide.setCountyid(countryId); |
| | | prDivide.setTownid(townId); |
| | | if (villageId!=null){ |
| | | /** |
| | | * 获取5级行政区划信息 |
| | | */ |
| | | Map map_districts = Optional.ofNullable(divideSv.getDistrictsByVillageId(villageId)).orElse(new HashMap()); |
| | | if(map_districts.size() <= 0) { |
| | | return BaseResponseUtils.buildFail("区划信息有误"); |
| | | } |
| | | Long countryId = Long.parseLong(map_districts.get("countryId").toString()); |
| | | Long townId = Long.parseLong(map_districts.get("townId").toString()); |
| | | prDivide.setCountyid(countryId); |
| | | prDivide.setTownid(townId); |
| | | } |
| | | |
| | | Date operateTime = new Date(); |
| | | prDivide.setOperatedt(operateTime); |
| | |
| | | @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid PrDivide po, BindingResult bindingResult){ |
| | | public BaseResponse<Boolean> update(@RequestBody @Valid DtoDivide po, BindingResult bindingResult){ |
| | | if(bindingResult != null && bindingResult.hasErrors()){ |
| | | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | // 接收村编号(主键) |
| | | Long villageId = po.getVillageid(); |
| | | Long villageId = po.getVillageId(); |
| | | |
| | | /** |
| | | * 获取5级行政区划信息 |
| | | */ |
| | | Map map_districts = Optional.ofNullable(divideSv.getDistrictsByVillageId(villageId)).orElse(new HashMap()); |
| | | if(map_districts.size() <= 0) { |
| | | return BaseResponseUtils.buildFail("区划信息有误"); |
| | | PrDivide prDivide = DtoToDividePojo.INSTANCT.po2vo(po); |
| | | |
| | | if (villageId!=null){ |
| | | /** |
| | | * 获取5级行政区划信息 |
| | | */ |
| | | Map map_districts = Optional.ofNullable(divideSv.getDistrictsByVillageId(villageId)).orElse(new HashMap()); |
| | | if(map_districts.size() <= 0) { |
| | | return BaseResponseUtils.buildFail("区划信息有误"); |
| | | } |
| | | Long countryId = Long.parseLong(map_districts.get("countryId").toString()); |
| | | Long townId = Long.parseLong(map_districts.get("townId").toString()); |
| | | prDivide.setCountyid(countryId); |
| | | prDivide.setTownid(townId); |
| | | } |
| | | |
| | | Long countryId = Long.parseLong(map_districts.get("countryId").toString()); |
| | | Long townId = Long.parseLong(map_districts.get("townId").toString()); |
| | | |
| | | po.setCountyid(countryId); |
| | | po.setTownid(townId); |
| | | |
| | | Date operateTime = new Date(); |
| | | po.setOperatedt(operateTime); |
| | | prDivide.setOperatedt(operateTime); |
| | | |
| | | Integer rec = Optional.ofNullable(divideSv.updateByPrimaryKey(po)).orElse(0); |
| | | Integer rec = Optional.ofNullable(divideSv.updateByPrimaryKey(prDivide)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail("分水房修改失败"); |
| | | } |