|  |  |  | 
|---|
|  |  |  | 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 = VoRecharge.class))} | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @GetMapping(path = "/getRecharges", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @SsoAop("-1") | 
|---|
|  |  |  | public BaseResponse<QueryResultVo<List<VoRecharge>>> get(@RequestBody @Parameter(description = "查询form表单json数据", required = true) QueryVo vo){ | 
|---|
|  |  |  | //@GetMapping(path = "/getRecharges", consumes = MediaType.APPLICATION_JSON_VALUE) | 
|---|
|  |  |  | @GetMapping(path = "/getRecharges") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<QueryResultVo<List<VoRecharge>>> get(QueryVo vo){ | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | QueryResultVo<List<VoRecharge>> res = rechargeSv.getRecharges(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 DtoRecharge po, @Parameter(hidden = true) BindingResult bindingResult){ | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<Boolean> add(@RequestBody @Valid DtoRecharge po, BindingResult bindingResult){ | 
|---|
|  |  |  | if(bindingResult != null && bindingResult.hasErrors()){ | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | * rechargeTime     充值时间 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | Long cardId = 0L; | 
|---|
|  |  |  | String cardNum = po.getCardNum(); | 
|---|
|  |  |  | Long cardNum = po.getCardNum(); | 
|---|
|  |  |  | String clientNum = ""; | 
|---|
|  |  |  | //Long clientId = po.getClientId(); | 
|---|
|  |  |  | Long clientId = 0L; | 
|---|
|  |  |  | Float money = po.getMoney(); | 
|---|
|  |  |  | Float amount = po.getAmount(); | 
|---|
|  |  |  | Float gift = po.getGift(); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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.setMoney(afterRecharge); | 
|---|
|  |  |  | seClientCard.setRechargedt(rechargeTime); | 
|---|
|  |  |  | seClientCard.setLastoper(LastOperateENUM.RECHARGE.getCode ()); | 
|---|
|  |  |  | Integer rec_updateClientCard = Optional.ofNullable(clientCardSv.UpdateClientCard(seClientCard)).orElse(0); | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 删除充值表该卡的充值记录 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | Integer rec_deleteRecharge = Optional.ofNullable(rechargeSv.deleteByCardNum(cardNum)).orElse(0); | 
|---|
|  |  |  | Integer rec_deleteRecharge = Optional.ofNullable(rechargeSv.deleteByCardId(cardId)).orElse(0); | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 添加充值记录 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | SeRecharge seRecharge = new SeRecharge(); | 
|---|
|  |  |  | seRecharge.setCardnum(cardNum); | 
|---|
|  |  |  | seRecharge.setClientnum(clientNum); | 
|---|
|  |  |  | //seRecharge.setCardnum(cardNum); | 
|---|
|  |  |  | //seRecharge.setClientnum(clientNum); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | seRecharge.setCardid(cardId); | 
|---|
|  |  |  | seRecharge.setClientid(clientId); | 
|---|
|  |  |  | seRecharge.setMoney(money); | 
|---|
|  |  |  | seRecharge.setAmount(amount); | 
|---|
|  |  |  | seRecharge.setGift(gift); | 
|---|
|  |  |  | 
|---|
|  |  |  | * 添加补卡历史记录 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | SeRechargeHistory seRechargeHistory = new SeRechargeHistory(); | 
|---|
|  |  |  | seRechargeHistory.setCardnum(cardNum); | 
|---|
|  |  |  | seRechargeHistory.setClientnum(clientNum); | 
|---|
|  |  |  | //seRechargeHistory.setCardnum(cardNum); | 
|---|
|  |  |  | //seRechargeHistory.setClientnum(clientNum); | 
|---|
|  |  |  | seRechargeHistory.setCardid(cardId); | 
|---|
|  |  |  | seRechargeHistory.setClientid(clientId); | 
|---|
|  |  |  | seRechargeHistory.setMoney(money); | 
|---|
|  |  |  | seRechargeHistory.setAmount(amount); | 
|---|
|  |  |  | seRechargeHistory.setGift(gift); | 
|---|
|  |  |  | 
|---|
|  |  |  | if(rec_history == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildFail(SellResultCode.RECHARGE_FAIL_WRITE_RECHARGE_HISTORY_ERROR.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(true) ; | 
|---|
|  |  |  | Map returnMap = new HashMap(); | 
|---|
|  |  |  | returnMap.put("orderNumber",rec+"");//返回充值ID | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(returnMap) ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|