|  |  |  | 
|---|
|  |  |  | package com.matrix.system.shopXcx.api.action; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import org.springframework.stereotype.Controller; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.CrossOrigin; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.matrix.system.hive.bean.SysVipInfo; | 
|---|
|  |  |  | import com.matrix.component.redis.RedisUserLoginUtils; | 
|---|
|  |  |  | import com.matrix.core.pojo.AjaxResult; | 
|---|
|  |  |  | import com.matrix.system.score.dao.ScoreUseRecordDao; | 
|---|
|  |  |  | import com.matrix.system.score.dao.ScoreVipDetailDao; | 
|---|
|  |  |  | import com.matrix.system.shopXcx.api.dto.ScoreFlowDto; | 
|---|
|  |  |  | import com.matrix.system.shopXcx.api.vo.ScoreUseRecordVo; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import io.swagger.annotations.ApiResponse; | 
|---|
|  |  |  | import io.swagger.annotations.ApiResponses; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.validation.annotation.Validated; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PostMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestBody; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @description 用户积分控制器 | 
|---|
|  |  |  | * @author jyy | 
|---|
|  |  |  | * @date 2019-08-09 15:10 | 
|---|
|  |  |  | * @date 2021-03-22 15:10 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Controller | 
|---|
|  |  |  | @RequestMapping(value="/wxapi/shopScoreRecord") | 
|---|
|  |  |  | @CrossOrigin(origins = "*", maxAge = 3600) | 
|---|
|  |  |  | @Api(tags = "用户积分接口类") | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping(value = "/wxapi/score") | 
|---|
|  |  |  | public class WxShopScoreAction { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | RedisUserLoginUtils redisUserLoginUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | ScoreUseRecordDao scoreUseRecordDao; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | ScoreVipDetailDao scoreVipDetailDao; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "获取积分流水", notes = "") | 
|---|
|  |  |  | @PostMapping(value = "/getFlowList") | 
|---|
|  |  |  | @ApiResponses({ | 
|---|
|  |  |  | @ApiResponse(code = 200, message = "ok", response = ScoreUseRecordVo.class) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | AjaxResult getFlowList(@RequestBody @Validated ScoreFlowDto scoreFlowDto) { | 
|---|
|  |  |  | SysVipInfo loginUser = redisUserLoginUtils.getLoginUser(SysVipInfo.class); | 
|---|
|  |  |  | Page<ScoreUseRecordVo> page=new Page<>(scoreFlowDto.getPageNum(),scoreFlowDto.getPageSize()); | 
|---|
|  |  |  | scoreFlowDto.setVipId(loginUser.getId()); | 
|---|
|  |  |  | IPage<ScoreUseRecordVo> shopScoreRecord = scoreUseRecordDao.selectFlowList(page,  scoreFlowDto); | 
|---|
|  |  |  | AjaxResult result=AjaxResult.buildSuccessInstance(shopScoreRecord.getRecords()); | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "获取用户积分", notes = "") | 
|---|
|  |  |  | @PostMapping(value = "/getUserScore") | 
|---|
|  |  |  | @ApiResponses({ | 
|---|
|  |  |  | @ApiResponse(code = 200, message = "ok", response = AjaxResult.class) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | AjaxResult getUserScore() { | 
|---|
|  |  |  | SysVipInfo loginUser = redisUserLoginUtils.getLoginUser(SysVipInfo.class); | 
|---|
|  |  |  | AjaxResult result=AjaxResult.buildSuccessInstance(scoreVipDetailDao.selectUserTotalScore(loginUser.getId())); | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|