New file |
| | |
| | | package com.matrix.system.hive.action; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | import com.matrix.system.hive.dao.SysVipInfoDao; |
| | | import com.matrix.system.hive.dto.ScoreChangeDto; |
| | | import com.matrix.system.score.dao.ScoreUseRecordDao; |
| | | import com.matrix.system.score.dao.ScoreVipDetailDao; |
| | | import com.matrix.system.score.entity.ScoreVipDetail; |
| | | import com.matrix.system.score.service.ScoreVipDetailService; |
| | | 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.*; |
| | | |
| | | /** |
| | | * @author jyy |
| | | * @date 2021-03-22 15:10 |
| | | */ |
| | | @Api(tags = "用户积分接口类") |
| | | @RestController |
| | | @RequestMapping(value = "/admin/score") |
| | | public class ErpShopScoreAction { |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | ScoreUseRecordDao scoreUseRecordDao; |
| | | |
| | | @Autowired |
| | | ScoreVipDetailDao scoreVipDetailDao; |
| | | |
| | | @Autowired |
| | | ScoreVipDetailService scoreVipDetailService; |
| | | |
| | | @Autowired |
| | | SysVipInfoDao sysVipInfoDao; |
| | | |
| | | @ApiOperation(value = "获取积分流水", notes = "") |
| | | @PostMapping(value = "/getFlowList") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = ScoreUseRecordVo.class) |
| | | }) |
| | | AjaxResult getFlowList(@RequestBody ScoreFlowDto scoreFlowDto) { |
| | | SysVipInfo vipInfo = sysVipInfoDao.selectById(scoreFlowDto.getVipId()); |
| | | scoreFlowDto.setVipId(vipInfo.getId()); |
| | | Page<ScoreUseRecordVo> page=new Page<>(scoreFlowDto.getPageNum(),scoreFlowDto.getPageSize()); |
| | | IPage<ScoreUseRecordVo> shopScoreRecord = scoreUseRecordDao.selectFlowList(page,scoreFlowDto); |
| | | AjaxResult result=AjaxResult.buildSuccessInstance(shopScoreRecord.getRecords(),shopScoreRecord.getTotal()); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "调整用户积分", notes = "") |
| | | @PostMapping(value = "/changeUserScore") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = AjaxResult.class) |
| | | }) |
| | | AjaxResult changeUserScore(@RequestBody @Validated ScoreChangeDto scoreChangeDto) { |
| | | SysVipInfo vipInfo = sysVipInfoDao.selectById(scoreChangeDto.getVipId()); |
| | | SysUsers sysUsers = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | |
| | | if(scoreChangeDto.getAmount()>0){ |
| | | scoreVipDetailService.addScore(vipInfo.getId(),sysUsers.getSuId(),sysUsers.getShopId(),scoreChangeDto.getAmount(),0L, ScoreVipDetail.SCORE_VIP_TYPE_USERCHANGE,scoreChangeDto.getRemarks()); |
| | | }else if (scoreChangeDto.getAmount()<0){ |
| | | scoreVipDetailService.deductionScore(vipInfo.getId(),sysUsers.getSuId(),sysUsers.getShopId(),Math.abs(scoreChangeDto.getAmount()),0L,ScoreVipDetail.SCORE_VIP_TYPE_USERCHANGE,scoreChangeDto.getRemarks()); |
| | | } |
| | | AjaxResult result=AjaxResult.buildSuccessInstance("调整成功"); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "获取用户积分", notes = "") |
| | | @PostMapping(value = "/getUserScore/{vipId}") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = AjaxResult.class) |
| | | }) |
| | | AjaxResult getUserScore(@PathVariable Long vipId) { |
| | | AjaxResult result=AjaxResult.buildSuccessInstance(scoreVipDetailDao.selectUserTotalScore(vipId)); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | } |