From 9168aba8b1a368994858829723bb8a6e6f80cc78 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期五, 30 八月 2024 19:58:27 +0800 Subject: [PATCH] 2024-08-30 朱宝民 开卡时根据实际情况(开卡、补卡)设置操作类型,获取片区接口修正无记录清空返回值 --- pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java | 43 +++++++++++++++++++++++-------------------- 1 files changed, 23 insertions(+), 20 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java index 167cecd..053f427 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/divide/DivideCtrl.java @@ -67,12 +67,13 @@ @SsoAop() public BaseResponse<QueryResultVo<List<VoDivide>>> getDivides(QueryVo vo){ try { - QueryResultVo<List<VoDivide>> res = divideSv.getDivides(vo); - if(res.itemTotal != null && res.itemTotal > 0) { - return BaseResponseUtils.buildSuccess(res); - }else { - return BaseResponseUtils.buildFail(ProjectResultCode.NO_DIVIDES.getMessage()); - } + //QueryResultVo<List<VoDivide>> res = divideSv.getDivides(vo); + //if(res.itemTotal != null && res.itemTotal > 0) { + // return BaseResponseUtils.buildSuccess(res); + //}else { + // return BaseResponseUtils.buildSuccess(ProjectResultCode.NO_DIVIDES.getMessage()); + //} + return BaseResponseUtils.buildSuccess(divideSv.getDivides(vo)); } catch (Exception e) { log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e); return BaseResponseUtils.buildException(e.getMessage()) ; @@ -101,7 +102,7 @@ if(res != null) { return BaseResponseUtils.buildSuccess(res); }else { - return BaseResponseUtils.buildFail(ProjectResultCode.NO_DIVIDES.getMessage()); + return BaseResponseUtils.buildErrorMsg(ProjectResultCode.NO_DIVIDES.getMessage()); } } catch (Exception e) { log.error("鏌ヨ鍐滄埛寮傚父", e); @@ -129,7 +130,7 @@ @SsoAop() public BaseResponse<Boolean> add(@RequestBody @Valid DtoDivide po, BindingResult bindingResult){ if(bindingResult != null && bindingResult.hasErrors()){ - return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } // 鎺ユ敹鏉戠紪鍙凤紙涓婚敭锛� Long villageId = po.getVillageId(); @@ -142,7 +143,7 @@ */ Map map_districts = Optional.ofNullable(divideSv.getDistrictsByVillageId(villageId)).orElse(new HashMap()); if(map_districts.size() <= 0) { - return BaseResponseUtils.buildFail("鍖哄垝淇℃伅鏈夎"); + return BaseResponseUtils.buildErrorMsg("鍖哄垝淇℃伅鏈夎"); } Long countryId = Long.parseLong(map_districts.get("countryId").toString()); Long townId = Long.parseLong(map_districts.get("townId").toString()); @@ -155,7 +156,7 @@ prDivide.setDeleted((byte)0); Integer rec = Optional.ofNullable(divideSv.addDivide(prDivide)).orElse(0); if(rec == 0) { - return BaseResponseUtils.buildFail(ProjectResultCode.DIVIDE_FAIL.getMessage()); + return BaseResponseUtils.buildErrorMsg(ProjectResultCode.DIVIDE_FAIL.getMessage()); } return BaseResponseUtils.buildSuccess(true) ; } @@ -186,7 +187,7 @@ try { Integer res = Optional.ofNullable(divideSv.deleteDivideById(id)).orElse(0); if(res == 0) - return BaseResponseUtils.buildFail(ProjectResultCode.DELETE_DIVIDE_FAIL.getMessage()); + return BaseResponseUtils.buildErrorMsg(ProjectResultCode.DELETE_DIVIDE_FAIL.getMessage()); return BaseResponseUtils.buildSuccess(true); } catch (Exception e) { @@ -213,13 +214,15 @@ @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()); + return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } // 鎺ユ敹鏉戠紪鍙凤紙涓婚敭锛� - Long villageId = po.getVillageid(); + Long villageId = po.getVillageId(); + + PrDivide prDivide = DtoToDividePojo.INSTANCT.po2vo(po); if (villageId!=null){ /** @@ -227,20 +230,20 @@ */ Map map_districts = Optional.ofNullable(divideSv.getDistrictsByVillageId(villageId)).orElse(new HashMap()); if(map_districts.size() <= 0) { - return BaseResponseUtils.buildFail("鍖哄垝淇℃伅鏈夎"); + return BaseResponseUtils.buildErrorMsg("鍖哄垝淇℃伅鏈夎"); } Long countryId = Long.parseLong(map_districts.get("countryId").toString()); Long townId = Long.parseLong(map_districts.get("townId").toString()); - po.setCountyid(countryId); - po.setTownid(townId); + prDivide.setCountyid(countryId); + prDivide.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("鍒嗘按鎴夸慨鏀瑰け璐�"); + return BaseResponseUtils.buildErrorMsg("鍒嗘按鎴夸慨鏀瑰け璐�"); } return BaseResponseUtils.buildSuccess(true) ; } -- Gitblit v1.8.0