parent
aaeb3473ff
commit
c17032720e
@ -0,0 +1,68 @@ |
||||
package com.web.controller; |
||||
|
||||
import com.github.pagehelper.PageHelper; |
||||
import com.github.pagehelper.PageInfo; |
||||
import com.hai.common.exception.ErrorCode; |
||||
import com.hai.common.exception.ErrorHelp; |
||||
import com.hai.common.exception.SysCode; |
||||
import com.hai.common.security.UserCenter; |
||||
import com.hai.common.utils.ResponseMsgUtil; |
||||
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.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; |
||||
import java.util.Map; |
||||
|
||||
@Controller |
||||
@RequestMapping(value = "/discount") |
||||
@Api(value = "优惠券接口") |
||||
public class DiscountController { |
||||
|
||||
private static Logger log = LoggerFactory.getLogger(DiscountController.class); |
||||
|
||||
@Resource |
||||
private UserCenter userCenter; |
||||
|
||||
@Resource |
||||
private HighDiscountUserRelService discountUserRelService; |
||||
|
||||
@RequestMapping(value="/getUserDiscountList",method = RequestMethod.GET) |
||||
@ResponseBody |
||||
@ApiOperation(value = "查询用户优惠券列表") |
||||
public ResponseData getUserDiscountList(@RequestParam(name = "status", required = false) Integer status, |
||||
@RequestParam(name = "useScope", required = false) Integer useScope, |
||||
@RequestParam(name = "pageNum", required = true) Integer pageNum, |
||||
@RequestParam(name = "ppageSizeageNum", required = true) Integer pageSize) { |
||||
try { |
||||
|
||||
HighUserModel userInfoModel = userCenter.getSessionModel(HighUserModel.class); |
||||
if (userInfoModel == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.SEC_USER_EXPIRED, ""); |
||||
} |
||||
|
||||
Map<String, Object> param = new HashMap<>(); |
||||
param.put("userId", userInfoModel.getHighUser().getId()); |
||||
param.put("useScope", useScope); |
||||
param.put("status", status); |
||||
|
||||
PageHelper.startPage(pageNum,pageSize); |
||||
return ResponseMsgUtil.success(new PageInfo<>(discountUserRelService.getDiscountList(param))); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("HighDiscountController -> getUserDiscountList() error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue