|
@@ -0,0 +1,116 @@
|
|
|
+package com.rf.woodenFish.record.controller;
|
|
|
+
|
|
|
+import com.rf.woodenFish.base.rest.BaseController;
|
|
|
+import com.rf.woodenFish.filter.JwtIgnore;
|
|
|
+import com.rf.woodenFish.record.model.UserKnockRecordEntity;
|
|
|
+import com.rf.woodenFish.record.service.UserKnockRecordService;
|
|
|
+import com.rf.woodenFish.utils.Result;
|
|
|
+import com.rf.woodenFish.utils.WebContextUtil;
|
|
|
+import com.sun.javafx.collections.MappingChange;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description:用户敲击记录管理
|
|
|
+ * @Author: mimang
|
|
|
+ * @Date: 2025/6/6
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequestMapping("/knock")
|
|
|
+public class UserKnockRecordController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private UserKnockRecordService service;
|
|
|
+
|
|
|
+ @PostMapping("/add")
|
|
|
+ public Result add(@RequestBody UserKnockRecordEntity entity){
|
|
|
+ try {
|
|
|
+ return success(service.add(entity));
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error(e.getMessage());
|
|
|
+ return fail(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "当前用户本次功德")
|
|
|
+ @GetMapping("/findCurrentRecord")
|
|
|
+ public Result findCurrentRecord(){
|
|
|
+ try {
|
|
|
+ int num = 0;
|
|
|
+ //获取到当前人信息
|
|
|
+ String openId = WebContextUtil.getOpenId();
|
|
|
+ UserKnockRecordEntity entity = service.findCurrentRecord(openId);
|
|
|
+ if (entity != null){
|
|
|
+ num = entity.getKnockNum();
|
|
|
+ }
|
|
|
+ return success(num);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error(e.getMessage());
|
|
|
+ return fail(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "当前用户今日功德")
|
|
|
+ @GetMapping("/countByCreateDate")
|
|
|
+ public Result countByCreateDate(){
|
|
|
+ try {
|
|
|
+ //获取到当前人信息
|
|
|
+ String openId = WebContextUtil.getOpenId();
|
|
|
+ Integer num = service.countByCreateDate(openId);
|
|
|
+ return success(num);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error(e.getMessage());
|
|
|
+ return fail(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "当前用户总功德")
|
|
|
+ @GetMapping("/countByOpenId")
|
|
|
+ public Result countByOpenId(){
|
|
|
+ try {
|
|
|
+ //获取到当前人信息
|
|
|
+ String openId = WebContextUtil.getOpenId();
|
|
|
+ Integer num = service.countByOpenId(openId);
|
|
|
+ return success(num);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error(e.getMessage());
|
|
|
+ return fail(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "今日排行榜")
|
|
|
+ @GetMapping("/orderByCurrentDateNum")
|
|
|
+ public Result orderByCurrentDateNum(){
|
|
|
+ try {
|
|
|
+ List<Map<String,Integer>> list = service.orderByCurrentDateNum();
|
|
|
+ return success(list);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error(e.getMessage());
|
|
|
+ return fail(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "总排行榜")
|
|
|
+ @GetMapping("/orderByTotalNum")
|
|
|
+ public Result orderByTotalNum(){
|
|
|
+ try {
|
|
|
+ List<Map<String,Integer>> list = service.orderByTotalNum();
|
|
|
+ return success(list);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error(e.getMessage());
|
|
|
+ return fail(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|