|
@@ -7,9 +7,11 @@ import com.rf.woodenFish.record.service.UserKnockRecordService;
|
|
import com.rf.woodenFish.utils.Result;
|
|
import com.rf.woodenFish.utils.Result;
|
|
import com.rf.woodenFish.utils.WebContextUtil;
|
|
import com.rf.woodenFish.utils.WebContextUtil;
|
|
import com.sun.javafx.collections.MappingChange;
|
|
import com.sun.javafx.collections.MappingChange;
|
|
|
|
+import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.data.domain.Page;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -23,11 +25,13 @@ import java.util.Map;
|
|
@Slf4j
|
|
@Slf4j
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/knock")
|
|
@RequestMapping("/knock")
|
|
|
|
+@Api(tags = "用户敲击记录管理")
|
|
public class UserKnockRecordController extends BaseController {
|
|
public class UserKnockRecordController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private UserKnockRecordService service;
|
|
private UserKnockRecordService service;
|
|
|
|
|
|
|
|
+ @ApiOperation(value = "添加记录")
|
|
@PostMapping("/add")
|
|
@PostMapping("/add")
|
|
public Result add(@RequestBody UserKnockRecordEntity entity){
|
|
public Result add(@RequestBody UserKnockRecordEntity entity){
|
|
try {
|
|
try {
|
|
@@ -65,7 +69,7 @@ public class UserKnockRecordController extends BaseController {
|
|
//获取到当前人信息
|
|
//获取到当前人信息
|
|
String openId = WebContextUtil.getOpenId();
|
|
String openId = WebContextUtil.getOpenId();
|
|
Integer num = service.countByCreateDate(openId);
|
|
Integer num = service.countByCreateDate(openId);
|
|
- return success(num);
|
|
|
|
|
|
+ return success(num==null?0:num);
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
log.error(e.getMessage());
|
|
log.error(e.getMessage());
|
|
@@ -80,7 +84,7 @@ public class UserKnockRecordController extends BaseController {
|
|
//获取到当前人信息
|
|
//获取到当前人信息
|
|
String openId = WebContextUtil.getOpenId();
|
|
String openId = WebContextUtil.getOpenId();
|
|
Integer num = service.countByOpenId(openId);
|
|
Integer num = service.countByOpenId(openId);
|
|
- return success(num);
|
|
|
|
|
|
+ return success(num==null?0:num);
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
log.error(e.getMessage());
|
|
log.error(e.getMessage());
|
|
@@ -113,4 +117,18 @@ public class UserKnockRecordController extends BaseController {
|
|
return fail(e.getMessage());
|
|
return fail(e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "查看当前人敲击记录")
|
|
|
|
+ @GetMapping("/findPageByCurrentUser")
|
|
|
|
+ public Result findPageByCurrentUser(@RequestParam int pageNum,@RequestParam int pageSize){
|
|
|
|
+ try {
|
|
|
|
+ Page<UserKnockRecordEntity> page = service.findPageByCurrentUser(pageNum,pageSize);
|
|
|
|
+ return success(page);
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ log.error(e.getMessage());
|
|
|
|
+ return fail(e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|