|
@@ -2,6 +2,8 @@ package com.ruoyi.zzb.study.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
+import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
@@ -22,25 +24,26 @@ import javax.servlet.http.HttpServletResponse;
|
|
@Slf4j
|
|
@Slf4j
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/api/study")
|
|
@RequestMapping("/api/study")
|
|
-public class StudyController {
|
|
|
|
|
|
+public class StudyController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private StudyService studyService;
|
|
private StudyService studyService;
|
|
|
|
|
|
@PostMapping("/findAllInfo")
|
|
@PostMapping("/findAllInfo")
|
|
- public JSONObject findAllInfo(HttpServletResponse response, HttpServletRequest request,@Validated @RequestBody UserSearchParam userSearchParam) {
|
|
|
|
|
|
+ public AjaxResult findAllInfo(HttpServletResponse response, HttpServletRequest request, @Validated @RequestBody UserSearchParam userSearchParam) {
|
|
try {
|
|
try {
|
|
Page<StudyDocInfo> result = studyService.findAllInfo(userSearchParam);
|
|
Page<StudyDocInfo> result = studyService.findAllInfo(userSearchParam);
|
|
- return RspResult.success(result);
|
|
|
|
|
|
+ return success(result);
|
|
|
|
+// return RspResult.success(result);
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
- e.printStackTrace();
|
|
|
|
- return RspResult.error(e.getMessage());
|
|
|
|
|
|
+ log.error("============【学习助手】异常:findAllInfo======",e);
|
|
|
|
+ return error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("/findDocInfoById")
|
|
@PostMapping("/findDocInfoById")
|
|
- public JSONObject findDocInfoById(HttpServletResponse response, HttpServletRequest request, @Validated @RequestBody QueryInfoVO queryInfoVO) {
|
|
|
|
|
|
+ public AjaxResult findDocInfoById(HttpServletResponse response, HttpServletRequest request, @Validated @RequestBody QueryInfoVO queryInfoVO) {
|
|
|
|
|
|
try {
|
|
try {
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
@@ -53,15 +56,15 @@ public class StudyController {
|
|
studyService.saveViewLogInfo(queryInfoVO,sysUser);
|
|
studyService.saveViewLogInfo(queryInfoVO,sysUser);
|
|
}
|
|
}
|
|
|
|
|
|
- return RspResult.success(result);
|
|
|
|
|
|
+ return success(result);
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
- e.printStackTrace();
|
|
|
|
- return RspResult.error(e.getMessage());
|
|
|
|
|
|
+ log.error("============【学习助手】异常:findDocInfoById======",e);
|
|
|
|
+ return error(e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("/saveDoc")
|
|
@PostMapping("/saveDoc")
|
|
- public JSONObject saveDoc(HttpServletResponse response, HttpServletRequest request,@Validated @RequestBody StudyDocInfo studyDocInfo) {
|
|
|
|
|
|
+ public AjaxResult saveDoc(HttpServletResponse response, HttpServletRequest request,@Validated @RequestBody StudyDocInfo studyDocInfo) {
|
|
|
|
|
|
try {
|
|
try {
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
@@ -72,40 +75,40 @@ public class StudyController {
|
|
studyDocInfo.setCreateUserName(sysUser.getNickName());
|
|
studyDocInfo.setCreateUserName(sysUser.getNickName());
|
|
|
|
|
|
boolean result = studyService.saveDocInfo(studyDocInfo);
|
|
boolean result = studyService.saveDocInfo(studyDocInfo);
|
|
- return RspResult.success(result);
|
|
|
|
|
|
+ return success(result);
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
- e.printStackTrace();
|
|
|
|
- return RspResult.error(e.getMessage());
|
|
|
|
|
|
+ log.error("============【学习助手】异常:saveDocInfo======",e);
|
|
|
|
+ return error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/deleteById")
|
|
@PostMapping("/deleteById")
|
|
- public JSONObject deleteById(HttpServletResponse response, HttpServletRequest request,@RequestBody JSONObject params) {
|
|
|
|
|
|
+ public AjaxResult deleteById(HttpServletResponse response, HttpServletRequest request,@RequestBody JSONObject params) {
|
|
try {
|
|
try {
|
|
String docId = params.getString("docId");
|
|
String docId = params.getString("docId");
|
|
boolean result = studyService.deleteById(docId);
|
|
boolean result = studyService.deleteById(docId);
|
|
- return RspResult.success(result);
|
|
|
|
|
|
+ return success(result);
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
- e.printStackTrace();
|
|
|
|
- return RspResult.error(e.getMessage());
|
|
|
|
|
|
+ log.error("============【学习助手】异常:deleteById======",e);
|
|
|
|
+ return error(e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@PostMapping("/updatePageViewNumById")
|
|
@PostMapping("/updatePageViewNumById")
|
|
- public JSONObject updatePageViewNumById(HttpServletResponse response, HttpServletRequest request,@Validated @RequestBody UpdatePageViewNumVO updatePageViewNumVO) {
|
|
|
|
|
|
+ public AjaxResult updatePageViewNumById(HttpServletResponse response, HttpServletRequest request,@Validated @RequestBody UpdatePageViewNumVO updatePageViewNumVO) {
|
|
try {
|
|
try {
|
|
boolean result = studyService.updatePageViewNumById(updatePageViewNumVO);
|
|
boolean result = studyService.updatePageViewNumById(updatePageViewNumVO);
|
|
- return RspResult.success(result);
|
|
|
|
|
|
+ return success(result);
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
- e.printStackTrace();
|
|
|
|
- return RspResult.error(e.getMessage());
|
|
|
|
|
|
+ log.error("============【学习助手】异常:updatePageViewNumById======",e);
|
|
|
|
+ return error(e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// @PostMapping("/saveViewLog") 关闭保存访问日志对外接口
|
|
// @PostMapping("/saveViewLog") 关闭保存访问日志对外接口
|
|
- public JSONObject saveViewLog(HttpServletResponse response, HttpServletRequest request, @Validated @RequestBody QueryInfoVO queryInfoVO) {
|
|
|
|
|
|
+ public AjaxResult saveViewLog(HttpServletResponse response, HttpServletRequest request, @Validated @RequestBody QueryInfoVO queryInfoVO) {
|
|
try {
|
|
try {
|
|
|
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
@@ -113,10 +116,10 @@ public class StudyController {
|
|
|
|
|
|
queryInfoVO.setUserId(sysUser.getUserId()+"");
|
|
queryInfoVO.setUserId(sysUser.getUserId()+"");
|
|
boolean result = studyService.saveViewLogInfo(queryInfoVO,sysUser);
|
|
boolean result = studyService.saveViewLogInfo(queryInfoVO,sysUser);
|
|
- return RspResult.success(result);
|
|
|
|
|
|
+ return success(result);
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
- e.printStackTrace();
|
|
|
|
- return RspResult.error(e.getMessage());
|
|
|
|
|
|
+ log.error("============【学习助手】异常:saveViewLog======",e);
|
|
|
|
+ return error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -124,14 +127,14 @@ public class StudyController {
|
|
|
|
|
|
|
|
|
|
@PostMapping("/findInfoByTitle")
|
|
@PostMapping("/findInfoByTitle")
|
|
- public JSONObject findInfoByTitle(HttpServletResponse response, HttpServletRequest request, @Validated @RequestBody UserSearchParam userSearchParam) {
|
|
|
|
|
|
+ public AjaxResult findInfoByTitle(HttpServletResponse response, HttpServletRequest request, @Validated @RequestBody UserSearchParam userSearchParam) {
|
|
|
|
|
|
try {
|
|
try {
|
|
Page<StudyDocInfo> result = studyService.findInfoByTitle(userSearchParam);
|
|
Page<StudyDocInfo> result = studyService.findInfoByTitle(userSearchParam);
|
|
- return RspResult.success(result);
|
|
|
|
|
|
+ return success(result);
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
- e.printStackTrace();
|
|
|
|
- return RspResult.error(e.getMessage());
|
|
|
|
|
|
+ log.error("============【学习助手】异常:findInfoByTitle======",e);
|
|
|
|
+ return error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
@@ -139,13 +142,13 @@ public class StudyController {
|
|
|
|
|
|
|
|
|
|
@PostMapping("/updateDocByDocId")
|
|
@PostMapping("/updateDocByDocId")
|
|
- public JSONObject updateDocByDocId(HttpServletResponse response, HttpServletRequest request,@Validated @RequestBody StudyDocInfo studyDocInfo) {
|
|
|
|
|
|
+ public AjaxResult updateDocByDocId(HttpServletResponse response, HttpServletRequest request,@Validated @RequestBody StudyDocInfo studyDocInfo) {
|
|
try {
|
|
try {
|
|
boolean result = studyService.updateById(studyDocInfo);
|
|
boolean result = studyService.updateById(studyDocInfo);
|
|
- return RspResult.success(result);
|
|
|
|
|
|
+ return success(result);
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
- e.printStackTrace();
|
|
|
|
- return RspResult.error(e.getMessage());
|
|
|
|
|
|
+ log.error("============【学习助手】异常:updateDocByDocId======",e);
|
|
|
|
+ return error(e.getMessage());
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|