| | |
| | | Long districtNum = Long.parseLong(provinceNum + cityNum + district8); |
| | | String districtTitle = countryName + townName + villageName; |
| | | |
| | | // 生成虚拟卡号 |
| | | Long virtualId = Optional.ofNullable(clientSv.getMa1xVirtualId()).orElse(0L); |
| | | if(virtualId == 0) { |
| | | virtualId = 1000000000L; |
| | | }else { |
| | | virtualId = virtualId + 1; |
| | | if(virtualId > 10000000000L) { |
| | | return BaseResponseUtils.buildFail("虚拟卡号超限"); |
| | | } |
| | | } |
| | | |
| | | SeClient seClient = DtoClientToSeClient.INSTANCT.po2vo(po); |
| | | seClient.setCountyid(countryId); |
| | | seClient.setTownid(townId); |
| | | seClient.setVirtualid(virtualId); |
| | | seClient.setClientnum(clientNum); |
| | | seClient.setDistrictnum(districtNum); |
| | | seClient.setDistricttitle(districtTitle); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 修改农户对象 |
| | | * 修改农户对象 虚拟卡号、禁止标志、逻辑删除标识不参与修改 |
| | | * @param po 农户对象 |
| | | * @param bindingResult |
| | | * @return |
| | |
| | | seClient.setDistricttitle(districtTitle); |
| | | Date operateTime = new Date(); |
| | | seClient.setOperatedt(operateTime); |
| | | // |
| | | //seClient.setDisabled((byte)0); |
| | | //seClient.setDeleted((byte)0); |
| | | |
| | | Integer rec = Optional.ofNullable(clientSv.updateByPrimaryKey(seClient)).orElse(0); |
| | | if(rec == 0) { |
| | | return BaseResponseUtils.buildFail("添加农户失败"); |
| | | return BaseResponseUtils.buildFail("农户修改失败"); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取用水方式列表 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @Operation(summary = "获得用水方式列表", description = "返回用水方式列表") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回一页农户数据(BaseResponse.content:QueryResultVo[{}])", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = BaClient.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/watertypes") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<Map<String, Object>>>> getWaterTypes(){ |
| | | List<Map<String, Object>> map_WaterTypes = Optional.ofNullable(clientSv.getWaterTypes()).orElse(new ArrayList<>()); |
| | | if(map_WaterTypes == null || map_WaterTypes.size() == 0) { |
| | | return BaseResponseUtils.buildFail("没有用水方式") ; |
| | | } |
| | | return BaseResponseUtils.buildSuccess(map_WaterTypes); |
| | | } |
| | | } |