parent
7776cea718
commit
592d4521b3
@ -0,0 +1,55 @@ |
||||
package com.user.controller; |
||||
|
||||
import com.hfkj.common.exception.ErrorCode; |
||||
import com.hfkj.common.exception.ErrorHelp; |
||||
import com.hfkj.common.exception.SysCode; |
||||
import com.hfkj.common.security.UserCenter; |
||||
import com.hfkj.common.utils.ResponseMsgUtil; |
||||
import com.hfkj.model.ResponseData; |
||||
import com.hfkj.model.UserSessionObject; |
||||
import com.hfkj.service.user.BsUserService; |
||||
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.*; |
||||
|
||||
import javax.annotation.Resource; |
||||
|
||||
/** |
||||
* @className: UserIntegralController |
||||
* @author: HuRui |
||||
* @date: 2024/5/20 |
||||
**/ |
||||
@Controller |
||||
@RequestMapping(value="/userIntegral") |
||||
@Api(value="用户积分业务") |
||||
public class UserIntegralController { |
||||
Logger log = LoggerFactory.getLogger(UserIntegralController.class); |
||||
@Resource |
||||
private BsUserService userService; |
||||
@Resource |
||||
private UserCenter userCenter; |
||||
|
||||
@RequestMapping(value="/queryIntegral",method = RequestMethod.POST) |
||||
@ResponseBody |
||||
@ApiOperation(value = "获取积分数量") |
||||
public ResponseData queryIntegral() { |
||||
try { |
||||
// 用户
|
||||
UserSessionObject userSessionObject = userCenter.getSessionModel(UserSessionObject.class); |
||||
if (userSessionObject == null) { |
||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||
} |
||||
|
||||
return ResponseMsgUtil.success(userService.getIntegral(userSessionObject.getUser().getId())); |
||||
|
||||
} catch (Exception e) { |
||||
log.error("error!",e); |
||||
return ResponseMsgUtil.exception(e); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue