嗨森逛服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hai-server/hai-bweb/src/main/java/com/bweb/controller/ApiCouponController.java

73 lines
2.6 KiB

package com.bweb.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.ScPetroConfig;
import com.hai.model.ResponseData;
import com.hai.openApi.service.ApiBlxCouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.HashMap;
@Controller
@RequestMapping(value = "/apiCoupon")
@Api(value = "外部卡券查询")
public class ApiCouponController {
private static Logger log = LoggerFactory.getLogger(HighDiscountPackageController.class);
@Resource
private ApiBlxCouponService apiBlxCouponService;
@RequestMapping(value = "/getBlxCouponList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取比邻星停车券列表")
public ResponseData getBlxCouponList( @RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) {
try {
PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(apiBlxCouponService.getBlxCouponList(new HashMap<>())));
} catch (Exception e) {
log.error("HighDiscountPackageController --> getDiscountPackageList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/synCouponRule", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取四川中石油卡券")
public ResponseData synCouponRule() {
try {
JSONObject jsonObject = ScPetroConfig.synCouponRule();
if (jsonObject.getString("code").equals("1")) {
String data = ScPetroConfig.decrypt(jsonObject.getString("biz_content"));
JSONArray jsonArray = JSONArray.parseArray(data);
return ResponseMsgUtil.success(jsonArray);
}
return ResponseMsgUtil.success("请求失败");
} catch (Exception e) {
log.error("HighDiscountPackageController --> getDiscountPackageList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}