2019-08-15更新

This commit is contained in:
Hellohao
2019-08-15 17:08:16 +08:00
parent a5eed7b1f4
commit b9c5f52a4b
14 changed files with 263 additions and 43 deletions
@@ -6,6 +6,7 @@ import cn.hellohao.utils.StringUtils;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
@@ -31,7 +32,10 @@ public class AdminRootController {
private UploadConfigService uploadConfigService;
@Autowired
private NoticeService noticeService;
@Autowired
private SysConfigService sysConfigService;
@Value("${systemupdate}")
private String systemupdate;
//返回对象存储界面
@RequestMapping(value = "/touser")
public String touser() {
@@ -151,8 +155,10 @@ public class AdminRootController {
public String towebconfig(Model model) {
Config config = configService.getSourceype();
UploadConfig updateConfig = uploadConfigService.getUpdateConfig();
SysConfig sysConfig = sysConfigService.getstate();
model.addAttribute("config",config);
model.addAttribute("updateConfig",updateConfig);
model.addAttribute("sysconfig",sysConfig);
return "admin/webconfig";
}
//修改站点配置
@@ -160,7 +166,7 @@ public class AdminRootController {
@ResponseBody
public Integer updateconfig(String webname,String explain, String logos,
String footed, String links, String notice,String baidu,
String domain,String background1,String background2 ) {
String domain,String background1,String background2,Integer sett ) {
Config config = new Config();
config.setWebname(webname);
config.setExplain(explain);
@@ -172,6 +178,7 @@ public class AdminRootController {
config.setDomain(domain);
config.setBackground1(background1);
config.setBackground2(background2);
config.setSett(sett);
Integer ret = configService.setSourceype(config);
return ret;
}
@@ -192,6 +199,15 @@ public class AdminRootController {
jsonArray.add(ret);
return jsonArray.toString();
}
//修改注册开关
@PostMapping("/setstate")
@ResponseBody
public Integer setstate(HttpSession session, SysConfig sysConfig) {
Integer ret =-1;
ret = sysConfigService.setstate(sysConfig);
return ret;
}
//关于系统
@RequestMapping("/about")
@@ -199,6 +215,7 @@ public class AdminRootController {
//Integer ret = uploadConfigService.setUpdateConfig(updateConfig);
User u = (User) session.getAttribute("user");
model.addAttribute("level",u.getLevel());
model.addAttribute("systemupdate",systemupdate);
return "admin/about";
}
//检查更新
@@ -126,7 +126,6 @@ public class UpdateImgController {
@ResponseBody
public String upimg( HttpSession session
, @RequestParam(value = "file", required = false) MultipartFile[] file) throws Exception {
Config config = configService.getSourceype();//查询当前系统使用的存储源类型。
UploadConfig uploadConfig = uploadConfigService.getUpdateConfig();
User u = (User) session.getAttribute("user");
@@ -0,0 +1,15 @@
package cn.hellohao.dao;
import cn.hellohao.pojo.SysConfig;
import org.apache.ibatis.annotations.Mapper;
/**
* @author Tiansh
* @version 1.0
* @date 2019/8/15 13:33
*/
@Mapper
public interface SysConfigMapper {
SysConfig getstate();
Integer setstate(SysConfig sysConfig);
}
+4 -4
View File
@@ -14,13 +14,13 @@ public class Config {
private String domain;
private String background1;
private String background2;
private String sett;
private Integer sett;
public Config() {
}
public Config(Integer id, Integer sourcekey, Integer emails, String webname, String explain, String logos, String footed, String links, String notice, String baidu, String domain, String background1, String background2, String sett) {
public Config(Integer id, Integer sourcekey, Integer emails, String webname, String explain, String logos, String footed, String links, String notice, String baidu, String domain, String background1, String background2, Integer sett) {
this.id = id;
this.sourcekey = sourcekey;
this.emails = emails;
@@ -141,11 +141,11 @@ public class Config {
this.background2 = background2;
}
public String getSett() {
public Integer getSett() {
return sett;
}
public void setSett(String sett) {
public void setSett(Integer sett) {
this.sett = sett;
}
}
@@ -0,0 +1,35 @@
package cn.hellohao.pojo;
/**
* @author Hellohao
* @version 1.0
* @date 2019/8/15 13:27
*/
public class SysConfig {
private Integer id;
private String register;
public SysConfig() {
}
public SysConfig(Integer id, String register) {
this.id = id;
this.register = register;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getRegister() {
return register;
}
public void setRegister(String register) {
this.register = register;
}
}
@@ -0,0 +1,16 @@
package cn.hellohao.service;
import cn.hellohao.dao.SysConfigMapper;
import cn.hellohao.pojo.SysConfig;
import org.springframework.stereotype.Service;
/**
* @author Hellohao
* @version 1.0
* @date 2019/8/15 13:46
*/
@Service
public interface SysConfigService {
SysConfig getstate();
Integer setstate(SysConfig sysConfig);
}
@@ -0,0 +1,27 @@
package cn.hellohao.service.impl;
import cn.hellohao.dao.SysConfigMapper;
import cn.hellohao.pojo.SysConfig;
import cn.hellohao.service.SysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author Hellohao
* @version 1.0
* @date 2019/8/15 13:48
*/
@Service
public class SysConfigServiceImpl implements SysConfigService {
@Autowired
private SysConfigMapper sysConfigMapper;
@Override
public SysConfig getstate() {
return sysConfigMapper.getstate();
}
@Override
public Integer setstate(SysConfig sysConfig) {
return sysConfigMapper.setstate(sysConfig);
}
}