|  |  |  | 
|---|
|  |  |  | import com.dy.pipIrrSell.clientCard.LastOperateENUM; | 
|---|
|  |  |  | import com.dy.pipIrrSell.result.SellResultCode; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.Operation; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.Parameter; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.media.Content; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.media.Schema; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.responses.ApiResponse; | 
|---|
|  |  |  | 
|---|
|  |  |  | schema = @Schema(implementation = VoReversal.class))} | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @GetMapping(path = "/getReversals", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @SsoAop("-1") | 
|---|
|  |  |  | public BaseResponse<QueryResultVo<List<VoReversal>>> getReversals(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ | 
|---|
|  |  |  | @GetMapping(path = "/getReversals") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<QueryResultVo<List<VoReversal>>> getReversals(QueryVo vo){ | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | QueryResultVo<List<VoReversal>> res = reversalSv.getReversals(vo); | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(res); | 
|---|
|  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @PostMapping(path = "add", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @Transactional(rollbackFor = Exception.class) | 
|---|
|  |  |  | @SsoAop("-1")//@SsoAop(power = "-1") | 
|---|
|  |  |  | public BaseResponse<Boolean> add(@RequestBody @Parameter(description = "form表单json数据", required = true) @Valid DtoReversal po, @Parameter(hidden = true) BindingResult bindingResult){ | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> add(@RequestBody @Valid DtoReversal po, BindingResult bindingResult){ | 
|---|
|  |  |  | if(bindingResult != null && bindingResult.hasErrors()){ | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * cardId           水卡编号(非传入参数,由cardAddr反查,修改农户卡使用) | 
|---|
|  |  |  | * clientId         农户编号(非传入参数,由cardNum反查) | 
|---|
|  |  |  | * cardNum          水卡地址 | 
|---|
|  |  |  | * clientNum        农户编号(非传入参数,由cardNum反查,添加冲正使用) | 
|---|
|  |  |  | * cardBalance      卡片余额 | 
|---|
|  |  |  | * systemBalance    系统余额 | 
|---|
|  |  |  | * remarks          备注 | 
|---|
|  |  |  | 
|---|
|  |  |  | * reversalTime     冲正 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | Long cardId = 0L; | 
|---|
|  |  |  | String cardNum = po.getCardNum(); | 
|---|
|  |  |  | String clientNum = ""; | 
|---|
|  |  |  | Long cardNum = po.getCardNum(); | 
|---|
|  |  |  | Long clientId = 0L; | 
|---|
|  |  |  | Float cardBalance = po.getCardBalance(); | 
|---|
|  |  |  | Float systemBalance = po.getSystemBalance(); | 
|---|
|  |  |  | String remarks = po.getRemarks(); | 
|---|
|  |  |  | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(SellResultCode.CARD_NUMBER_MISTAKE.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | cardId = Long.parseLong(map.get("cardId").toString()); | 
|---|
|  |  |  | clientNum = map.get("clientNum").toString(); | 
|---|
|  |  |  | clientId = Long.parseLong(map.get("clientId").toString()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改农户卡信息: | 
|---|
|  |  |  | 
|---|
|  |  |  | SeClientCard seClientCard = new SeClientCard(); | 
|---|
|  |  |  | seClientCard.setId(cardId); | 
|---|
|  |  |  | seClientCard.setReversaldt(reversalTime); | 
|---|
|  |  |  | seClientCard.setMoney(cardBalance); | 
|---|
|  |  |  | seClientCard.setLastoper(LastOperateENUM.REVERSAL.getCode()); | 
|---|
|  |  |  | Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0); | 
|---|
|  |  |  | if(rec_updateClientCard == 0) { | 
|---|
|  |  |  | 
|---|
|  |  |  | * 添加冲正记录 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | SeReversal reversal = new SeReversal(); | 
|---|
|  |  |  | reversal.setCardnum(cardNum); | 
|---|
|  |  |  | reversal.setClientnum(clientNum); | 
|---|
|  |  |  | //reversal.setCardnum(cardNum); | 
|---|
|  |  |  | //reversal.setClientnum(clientNum); | 
|---|
|  |  |  | reversal.setCardid(cardId); | 
|---|
|  |  |  | reversal.setClientid(clientId); | 
|---|
|  |  |  | reversal.setCardbalance(cardBalance); | 
|---|
|  |  |  | reversal.setSystembalance(systemBalance); | 
|---|
|  |  |  | reversal.setRemarks(remarks); | 
|---|