package com.jsowell.api.thirdparty; import com.alibaba.fastjson2.JSON; import com.jsowell.common.annotation.Anonymous; import com.jsowell.common.core.controller.BaseController; import com.jsowell.common.response.RestApiResponse; import com.jsowell.pile.dto.ruanjie.UseCouponDTO; import com.jsowell.thirdparty.ruanjie.service.RJService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * 软杰controller * * @author Lemon * @Date 2023/9/22 9:00 */ @Anonymous @RestController @RequestMapping("/ruanjie") public class RJController extends BaseController { @Autowired private RJService rjService; @PostMapping("/useCoupon") public RestApiResponse useCoupon(@RequestBody UseCouponDTO dto) { logger.info("软杰--使用优惠券 params:{}", JSON.toJSONString(dto)); RestApiResponse response = null; try { String result = rjService.useCoupon(dto); response = new RestApiResponse<>(result); } catch (Exception e) { logger.error("软杰--使用优惠券 error, ", e); response = new RestApiResponse<>(e); } logger.info("软杰--使用优惠券 result:{}", response); return response; } }