| @@ -7,6 +7,7 @@ import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import me.chanjar.weixin.common.error.WxErrorException; | import me.chanjar.weixin.common.error.WxErrorException; | ||||
| import me.chanjar.weixin.mp.api.WxMpService; | import me.chanjar.weixin.mp.api.WxMpService; | ||||
| import me.chanjar.weixin.mp.bean.card.WxMpCardBatchGetResult; | |||||
| import me.chanjar.weixin.mp.bean.card.WxMpCardResult; | import me.chanjar.weixin.mp.bean.card.WxMpCardResult; | ||||
| import me.chanjar.weixin.mp.bean.card.WxMpCardUserGetCardListResult; | import me.chanjar.weixin.mp.bean.card.WxMpCardUserGetCardListResult; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -17,6 +18,9 @@ import org.springframework.web.bind.annotation.PathVariable; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("wxCardIO") | @RequestMapping("wxCardIO") | ||||
| @Api(description = "微信卡券接口") | @Api(description = "微信卡券接口") | ||||
| @@ -53,4 +57,35 @@ public class WxCardController extends BaseController { | |||||
| } | } | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("查看卡券详情") | |||||
| @GetMapping("cardGet/{appId}") | |||||
| public ResultData cardGet(@PathVariable String appId, String cardId) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCardController::cardGet"); | |||||
| try { | |||||
| WxMpService mpService = openService.getWxOpenComponentService().getWxMpServiceByAppid(appId); | |||||
| String result = mpService.getCardService().getCardDetail(cardId); | |||||
| logger.info(result); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("批量查询卡券列表") | |||||
| @GetMapping("cardBatchGet/{appId}") | |||||
| public ResultData cardBatchGet(@PathVariable String appId) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCardController::cardBatchGet"); | |||||
| List<String> statusList = new ArrayList<>(); | |||||
| statusList.add("CARD_STATUS_NOT_VERIFY"); | |||||
| statusList.add("CARD_STATUS_VERIFY_OK"); | |||||
| try { | |||||
| WxMpService mpService = openService.getWxOpenComponentService().getWxMpServiceByAppid(appId); | |||||
| WxMpCardBatchGetResult result = mpService.getCardService().getCardBatchGet(0, 10, statusList); | |||||
| logger.info(result.toString()); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| } | } | ||||