| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.YearMonth; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 前端控制器 |
| | | * 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | |
| | | */ |
| | | @GetMapping("/getUserPoint") |
| | | @ApiOperation("获取个人积分") |
| | | public R<UserPointVO> getUserPoint(){ |
| | | public R<UserPointVO> getUserPoint() { |
| | | return R.ok(userPointService.getUserPoint(SecurityUtils.getUserId())); |
| | | } |
| | | |
| | |
| | | */ |
| | | @GetMapping("/getUserPointDetail") |
| | | @ApiOperation("获取变更明细") |
| | | public TableDataInfo<UserPointDetailVO> getUserPointDetail(@ApiParam("指定日期") LocalDateTime date, |
| | | @ApiParam("变动类型(1=消费积分,2=返佣积分,3=拉新人积分,4=兑换商品 " + |
| | | "5 = 门店业绩积分 6 =门店返佣积分7=技师业绩积分8 =转赠积分 9 =做工积分 " + |
| | | "10 =注册积分)") Integer type){ |
| | | public TableDataInfo<UserPointDetailVO> getUserPointDetail(@ApiParam("指定日期") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate date, |
| | | @ApiParam("变动类型(1=消费积分,2=返佣积分,3=拉新人积分,4=兑换商品 " + |
| | | "5 = 门店业绩积分 6 =门店返佣积分7=技师业绩积分8 =转赠积分 9 =做工积分 " + |
| | | "10 =注册积分)") Integer type) { |
| | | LocalDateTime startTime = null; |
| | | LocalDateTime endTime = null; |
| | | if (date != null) { |
| | | // 将 createTime 设置为当天的开始时间 (00:00) |
| | | startTime = date.atStartOfDay(); |
| | | |
| | | // 使用 YearMonth 来获取该月的最后一天 |
| | | YearMonth yearMonth = YearMonth.from(date); |
| | | LocalDate lastDayOfMonth = yearMonth.atEndOfMonth(); |
| | | |
| | | // 将最后一天转换为 LocalDateTime,并设置为当天的最后一秒 (23:59:59.999) |
| | | endTime = lastDayOfMonth.atTime(LocalTime.MAX); |
| | | } |
| | | |
| | | startPage(); |
| | | List<UserPointDetailVO> list = userPointService.getUserPointDetail(SecurityUtils.getUserId(), date, type); |
| | | List<UserPointDetailVO> list = userPointService.getUserPointDetail(SecurityUtils.getUserId(), startTime, endTime, type); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/transferPoint") |
| | | @ApiOperation("转赠积分") |
| | | public R<Void> transferPoint(@ApiParam("积分") BigDecimal point, @ApiParam("手机号") Long phone){ |
| | | public R<Void> transferPoint(@ApiParam("积分") BigDecimal point, @ApiParam("手机号") Long phone) { |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 保存积分流水记录 |
| | | * |
| | | * @param userPoint |
| | | * @return |
| | | */ |
| | | @PostMapping("/saveUserPoint") |
| | | public R saveUserPoint(@RequestBody UserPoint userPoint){ |
| | | public R saveUserPoint(@RequestBody UserPoint userPoint) { |
| | | userPointService.save(userPoint); |
| | | return R.ok(); |
| | | } |