| | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrGlobal.voSe.VoTermActiveCard; |
| | | import com.dy.pipIrrGlobal.voSe.VoTermRecharge; |
| | | import com.dy.pipIrrTerminal.card.dto.ActiveCard; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import com.dy.pipIrrTerminal.card.dto.DtoLoss; |
| | | import com.dy.pipIrrTerminal.card.dto.DtoRecharge; |
| | | import com.dy.pipIrrTerminal.card.dto.DtoReissue; |
| | | import jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | public class CardCtrl { |
| | | private final CardSv cardSv; |
| | | |
| | | @PostMapping(path = "activeTermCard", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | /** |
| | | * 开卡(含充值) |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "termActiveCard", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<VoTermRecharge> activeTermCard(@RequestBody @Valid ActiveCard po, BindingResult bindingResult) { |
| | | public BaseResponse<VoTermActiveCard> termActiveCard(@RequestBody @Valid ActiveCard po, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | |
| | | return BaseResponseUtils.buildSuccess(map_result.get("content")) ; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 充值 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "termRecharge", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<VoTermRecharge> termRecharge(@RequestBody @Valid DtoRecharge po, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | Map map_result = cardSv.addRecharge(po); |
| | | if(map_result.get("success").equals(false)) { |
| | | return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(map_result.get("content")) ; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 挂失 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "termReportLoss", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> termReportLoss(@RequestBody @Valid DtoLoss po, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | Map map_result = cardSv.reportLoss(po); |
| | | if(map_result.get("success").equals(false)) { |
| | | return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(map_result.get("content")) ; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 补卡 |
| | | * @param po |
| | | * @param bindingResult |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "termReissue", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | @SsoAop() |
| | | public BaseResponse<VoTermRecharge> termReissue(@RequestBody @Valid DtoReissue po, BindingResult bindingResult) { |
| | | if (bindingResult != null && bindingResult.hasErrors()) { |
| | | return BaseResponseUtils.buildErrorMsg(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); |
| | | } |
| | | |
| | | Map map_result = cardSv.reissue(po); |
| | | if(map_result.get("success").equals(false)) { |
| | | return BaseResponseUtils.buildErrorMsg(map_result.get("msg").toString()); |
| | | } |
| | | return BaseResponseUtils.buildSuccess(map_result.get("content")) ; |
| | | |
| | | } |
| | | } |