123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- package com.qxgmat.controller.admin;
- import com.alibaba.fastjson.JSONObject;
- import com.nuliji.tools.Response;
- import com.nuliji.tools.ResponseHelp;
- import com.qxgmat.data.constants.enums.SettingKey;
- import com.qxgmat.data.dao.entity.Setting;
- import com.qxgmat.service.inline.SettingService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.http.MediaType;
- import org.springframework.validation.annotation.Validated;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- @RestController("AdminSettingController")
- @RequestMapping("/admin/common")
- @Api(tags = "配置信息接口", description = "全局独立配置设置", produces = MediaType.APPLICATION_JSON_VALUE)
- public class SettingController {
- @Autowired
- private SettingService settingService;
- @RequestMapping(value = "/index", method = RequestMethod.PUT)
- @ApiOperation(value = "修改首页配置", httpMethod = "PUT")
- private Response<Boolean> indexEdit(@RequestBody @Validated JSONObject dto){
- Setting entity = settingService.getByKey(SettingKey.INDEX.key);
- entity.setValue(dto);
- settingService.edit(entity);
- return ResponseHelp.success(true);
- }
- @RequestMapping(value = "/index", method = RequestMethod.GET)
- @ApiOperation(value = "获取首页配置", httpMethod = "GET")
- private Response<JSONObject> indexGet(){
- Setting entity = settingService.getByKey(SettingKey.INDEX.key);
- return ResponseHelp.success(entity.getValue());
- }
- @RequestMapping(value = "/place", method = RequestMethod.PUT)
- @ApiOperation(value = "修改考点设置", httpMethod = "PUT")
- private Response<Boolean> placeEdit(@RequestBody @Validated JSONObject dto){
- Setting entity = settingService.getByKey(SettingKey.PLACE.key);
- entity.setValue(dto);
- settingService.edit(entity);
- return ResponseHelp.success(true);
- }
- @RequestMapping(value = "/place", method = RequestMethod.GET)
- @ApiOperation(value = "获取考点配置", httpMethod = "GET")
- private Response<JSONObject> placeGet(){
- Setting entity = settingService.getByKey(SettingKey.PLACE.key);
- return ResponseHelp.success(entity.getValue());
- }
- @RequestMapping(value = "/sentence", method = RequestMethod.PUT)
- @ApiOperation(value = "修改长难句设置", httpMethod = "PUT")
- private Response<Boolean> sentenceEdit(@RequestBody @Validated JSONObject dto){
- Setting entity = settingService.getByKey(SettingKey.SENTENCE.key);
- entity.setValue(dto);
- settingService.edit(entity);
- return ResponseHelp.success(true);
- }
- @RequestMapping(value = "/sentence", method = RequestMethod.GET)
- @ApiOperation(value = "获取长难句配置", httpMethod = "GET")
- private Response<JSONObject> sentenceGet(){
- Setting entity = settingService.getByKey(SettingKey.SENTENCE.key);
- return ResponseHelp.success(entity.getValue());
- }
- @RequestMapping(value = "/time", method = RequestMethod.PUT)
- @ApiOperation(value = "修改时间设置", httpMethod = "PUT")
- private Response<Boolean> timeEdit(@RequestBody @Validated JSONObject dto){
- Setting entity = settingService.getByKey(SettingKey.TIME.key);
- entity.setValue(dto);
- settingService.edit(entity);
- return ResponseHelp.success(true);
- }
- @RequestMapping(value = "/time", method = RequestMethod.GET)
- @ApiOperation(value = "获取时间配置", httpMethod = "GET")
- private Response<JSONObject> timeGet(){
- Setting entity = settingService.getByKey(SettingKey.TIME.key);
- return ResponseHelp.success(entity.getValue());
- }
- }
|