|
@@ -1,15 +1,15 @@
|
|
|
package com.qxgmat.controller.admin;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.nuliji.tools.Response;
|
|
|
-import com.nuliji.tools.ResponseHelp;
|
|
|
-import com.nuliji.tools.Transform;
|
|
|
+import com.github.pagehelper.Page;
|
|
|
+import com.nuliji.tools.*;
|
|
|
import com.qxgmat.data.constants.enums.SettingKey;
|
|
|
-import com.qxgmat.data.dao.entity.Rank;
|
|
|
-import com.qxgmat.data.dao.entity.Setting;
|
|
|
+import com.qxgmat.data.constants.enums.module.ChannelModule;
|
|
|
+import com.qxgmat.data.dao.entity.*;
|
|
|
+import com.qxgmat.dto.admin.request.CommentDto;
|
|
|
+import com.qxgmat.dto.admin.request.FaqDto;
|
|
|
import com.qxgmat.dto.admin.request.RankDto;
|
|
|
-import com.qxgmat.service.inline.RankService;
|
|
|
-import com.qxgmat.service.inline.SettingService;
|
|
|
+import com.qxgmat.service.inline.*;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFCell;
|
|
@@ -26,7 +26,6 @@ import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.io.FileInputStream;
|
|
|
-import java.io.FileNotFoundException;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.util.ArrayList;
|
|
@@ -45,6 +44,15 @@ public class SettingController {
|
|
|
@Autowired
|
|
|
private RankService rankService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CommentService commentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FaqService faqService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MessageService messageService;
|
|
|
+
|
|
|
@RequestMapping(value = "/index", method = RequestMethod.PUT)
|
|
|
@ApiOperation(value = "修改首页配置", httpMethod = "PUT")
|
|
|
private Response<Boolean> editIndex(@RequestBody @Validated JSONObject dto){
|
|
@@ -79,6 +87,22 @@ public class SettingController {
|
|
|
return ResponseHelp.success(entity.getValue());
|
|
|
}
|
|
|
|
|
|
+ @RequestMapping(value = "/message_template", method = RequestMethod.PUT)
|
|
|
+ @ApiOperation(value = "修改消息模版", httpMethod = "PUT")
|
|
|
+ private Response<Boolean> editMessageTemplate(@RequestBody @Validated JSONObject dto){
|
|
|
+ Setting entity = settingService.getByKey(SettingKey.MESSAGE_TEMPLATE);
|
|
|
+ entity.setValue(dto);
|
|
|
+ settingService.edit(entity);
|
|
|
+ return ResponseHelp.success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/message_template", method = RequestMethod.GET)
|
|
|
+ @ApiOperation(value = "获取消息模版", httpMethod = "GET")
|
|
|
+ private Response<JSONObject> getMessageTemplate(){
|
|
|
+ Setting entity = settingService.getByKey(SettingKey.MESSAGE_TEMPLATE);
|
|
|
+
|
|
|
+ return ResponseHelp.success(entity.getValue());
|
|
|
+ }
|
|
|
|
|
|
@RequestMapping(value = "/sentence", method = RequestMethod.PUT)
|
|
|
@ApiOperation(value = "修改长难句设置", httpMethod = "PUT")
|
|
@@ -97,7 +121,6 @@ public class SettingController {
|
|
|
return ResponseHelp.success(entity.getValue());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@RequestMapping(value = "/exercise_time", method = RequestMethod.PUT)
|
|
|
@ApiOperation(value = "修改做题时间设置", httpMethod = "PUT")
|
|
|
private Response<Boolean> editExerciseTime(@RequestBody @Validated JSONObject dto){
|
|
@@ -114,6 +137,7 @@ public class SettingController {
|
|
|
|
|
|
return ResponseHelp.success(entity.getValue());
|
|
|
}
|
|
|
+
|
|
|
@RequestMapping(value = "/examination_time", method = RequestMethod.PUT)
|
|
|
@ApiOperation(value = "修改做题时间设置", httpMethod = "PUT")
|
|
|
private Response<Boolean> editExaminationTime(@RequestBody @Validated JSONObject dto){
|
|
@@ -250,6 +274,23 @@ public class SettingController {
|
|
|
return ResponseHelp.success(entity.getValue());
|
|
|
}
|
|
|
|
|
|
+ @RequestMapping(value = "/course_index", method = RequestMethod.PUT)
|
|
|
+ @ApiOperation(value = "修改课程首页", httpMethod = "PUT")
|
|
|
+ private Response<Boolean> editCourseIndex(@RequestBody @Validated JSONObject dto){
|
|
|
+ Setting entity = settingService.getByKey(SettingKey.COURSE_INDEX);
|
|
|
+ entity.setValue(dto);
|
|
|
+ settingService.edit(entity);
|
|
|
+ return ResponseHelp.success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/course_index", method = RequestMethod.GET)
|
|
|
+ @ApiOperation(value = "获取课程首页", httpMethod = "GET")
|
|
|
+ private Response<JSONObject> getCourseIndex(){
|
|
|
+ Setting entity = settingService.getByKey(SettingKey.COURSE_INDEX);
|
|
|
+
|
|
|
+ return ResponseHelp.success(entity.getValue());
|
|
|
+ }
|
|
|
+
|
|
|
@RequestMapping(value = "/tips", method = RequestMethod.PUT)
|
|
|
@ApiOperation(value = "修改结构说明", httpMethod = "PUT")
|
|
|
private Response<Boolean> editTips(@RequestBody @Validated JSONObject dto){
|
|
@@ -267,6 +308,113 @@ public class SettingController {
|
|
|
return ResponseHelp.success(entity.getValue());
|
|
|
}
|
|
|
|
|
|
+ @RequestMapping(value = "/comment/add", method = RequestMethod.POST)
|
|
|
+ @ApiOperation(value = "添加评价", httpMethod = "POST")
|
|
|
+ private Response<Boolean> addComment(@RequestBody @Validated CommentDto dto){
|
|
|
+ Comment entity = Transform.dtoToEntity(dto);
|
|
|
+ commentService.add(entity);
|
|
|
+ return ResponseHelp.success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/comment/edit", method = RequestMethod.PUT)
|
|
|
+ @ApiOperation(value = "修改评价", httpMethod = "PUT")
|
|
|
+ private Response<Boolean> editComment(@RequestBody @Validated CommentDto dto){
|
|
|
+ Comment entity = Transform.dtoToEntity(dto);
|
|
|
+ commentService.edit(entity);
|
|
|
+ return ResponseHelp.success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/comment/delete", method = RequestMethod.DELETE)
|
|
|
+ @ApiOperation(value = "删除评价", httpMethod = "DELETE")
|
|
|
+ private Response<Boolean> deleteComment(@RequestParam int id){
|
|
|
+ commentService.delete(id);
|
|
|
+ return ResponseHelp.success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/comment/list", method = RequestMethod.GET)
|
|
|
+ @ApiOperation(value = "获取评价列表", httpMethod = "GET")
|
|
|
+ private Response<PageMessage<Comment>> listComment(
|
|
|
+ @RequestParam(required = false, defaultValue = "1") int page,
|
|
|
+ @RequestParam(required = false, defaultValue = "100") int size,
|
|
|
+ @RequestParam(required = false) String channel,
|
|
|
+ @RequestParam(required = false) String position,
|
|
|
+ @RequestParam(required = false) Integer userId,
|
|
|
+ @RequestParam(required = false) Boolean isSpecial
|
|
|
+ ){
|
|
|
+ Page<Comment> p = commentService.listAdmin(page, size, ChannelModule.ValueOf(channel), position, userId, isSpecial);
|
|
|
+ return ResponseHelp.success(p, page, size, p.getTotal());
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/faq/add", method = RequestMethod.POST)
|
|
|
+ @ApiOperation(value = "添加faq", httpMethod = "POST")
|
|
|
+ private Response<Boolean> addFaq(@RequestBody @Validated FaqDto dto){
|
|
|
+ Faq entity = Transform.dtoToEntity(dto);
|
|
|
+ faqService.add(entity);
|
|
|
+ return ResponseHelp.success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/faq/edit", method = RequestMethod.PUT)
|
|
|
+ @ApiOperation(value = "修改faq", httpMethod = "PUT")
|
|
|
+ private Response<Boolean> editFaq(@RequestBody @Validated FaqDto dto){
|
|
|
+ Faq entity = Transform.dtoToEntity(dto);
|
|
|
+ faqService.edit(entity);
|
|
|
+ return ResponseHelp.success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/faq/delete", method = RequestMethod.DELETE)
|
|
|
+ @ApiOperation(value = "删除评价", httpMethod = "DELETE")
|
|
|
+ private Response<Boolean> deleteFaq(@RequestParam int id){
|
|
|
+ faqService.delete(id);
|
|
|
+ return ResponseHelp.success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/faq/list", method = RequestMethod.GET)
|
|
|
+ @ApiOperation(value = "获取faq列表", httpMethod = "GET")
|
|
|
+ private Response<PageMessage<Faq>> listFaq(
|
|
|
+ @RequestParam(required = false, defaultValue = "1") int page,
|
|
|
+ @RequestParam(required = false, defaultValue = "100") int size,
|
|
|
+ @RequestParam(required = false) String channel,
|
|
|
+ @RequestParam(required = false) String position,
|
|
|
+ @RequestParam(required = false) Integer status,
|
|
|
+ @RequestParam(required = false) Boolean isSpecial
|
|
|
+ ){
|
|
|
+ Page<Faq> p = faqService.listAdmin(page, size, ChannelModule.ValueOf(channel), position, status, isSpecial);
|
|
|
+ return ResponseHelp.success(p, page, size, p.getTotal());
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/message/add", method = RequestMethod.POST)
|
|
|
+ @ApiOperation(value = "添加消息", httpMethod = "POST")
|
|
|
+ private Response<Boolean> addMessage(@RequestBody @Validated FaqDto dto){
|
|
|
+ Faq entity = Transform.dtoToEntity(dto);
|
|
|
+ faqService.add(entity);
|
|
|
+ return ResponseHelp.success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/message/edit", method = RequestMethod.PUT)
|
|
|
+ @ApiOperation(value = "修改消息", httpMethod = "PUT")
|
|
|
+ private Response<Boolean> editMessage(@RequestBody @Validated FaqDto dto){
|
|
|
+ Faq entity = Transform.dtoToEntity(dto);
|
|
|
+ faqService.edit(entity);
|
|
|
+ return ResponseHelp.success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/message/delete", method = RequestMethod.DELETE)
|
|
|
+ @ApiOperation(value = "删除消息", httpMethod = "DELETE")
|
|
|
+ private Response<Boolean> deleteMessage(@RequestParam int id){
|
|
|
+ faqService.delete(id);
|
|
|
+ return ResponseHelp.success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/message/list", method = RequestMethod.GET)
|
|
|
+ @ApiOperation(value = "获取消息列表", httpMethod = "GET")
|
|
|
+ private Response<PageMessage<Message>> listMessage(
|
|
|
+ @RequestParam(required = false, defaultValue = "1") int page,
|
|
|
+ @RequestParam(required = false, defaultValue = "100") int size
|
|
|
+ ){
|
|
|
+ Page<Message> p = messageService.select(page, size);
|
|
|
+ return ResponseHelp.success(p, page, size, p.getTotal());
|
|
|
+ }
|
|
|
+
|
|
|
@RequestMapping(value = "/rank/add", method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "添加排行", httpMethod = "POST")
|
|
|
private Response<Boolean> addRank(@RequestBody @Validated RankDto dto){
|