package com.cweb.controller;

import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighCouponCodeOther;
import com.hai.entity.HighUser;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
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 javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping(value = "/couponCodeOther")
@Api(value = "用户接口")
public class HighCouponCodeOtherController {

    private static Logger log = LoggerFactory.getLogger(HighCouponCodeOtherController.class);

    @Resource
    private HighCouponCodeOtherService highCouponCodeOtherService;

    @RequestMapping(value = "/getList", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "查询卡券码列表")
    public ResponseData getList(@RequestParam(name = "type", required = true) Integer type,
                                @RequestParam(name = "orderId", required = false) Long orderId,
                                @RequestParam(name = "childOrderId", required = false) Long childOrderId) {
        try {

            Map<String,Object> map = new HashMap<>();
            map.put("type", type);
            map.put("orderId", orderId);
            map.put("childOrderId", childOrderId);

            return ResponseMsgUtil.success(highCouponCodeOtherService.getList(map));

        } catch (Exception e) {
            log.error("HighCouponCodeOtherController --> getList() error!", e);
            return ResponseMsgUtil.exception(e);
        }
    }
}