/** * Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng) *
* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *
* http://www.apache.org/licenses/LICENSE-2.0 *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.stylefeng.guns.sys.modular.system.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.stylefeng.guns.base.auth.context.LoginContextHolder;
import cn.stylefeng.guns.base.auth.model.LoginUser;
import cn.stylefeng.guns.base.oshi.SystemHardwareInfo;
import cn.stylefeng.guns.sys.core.constant.factory.ConstantFactory;
import cn.stylefeng.guns.sys.core.log.LogObjectHolder;
import cn.stylefeng.guns.sys.core.util.DefaultImages;
import cn.stylefeng.guns.sys.modular.system.entity.Notice;
import cn.stylefeng.guns.sys.modular.system.entity.User;
import cn.stylefeng.guns.sys.modular.system.model.UploadResult;
import cn.stylefeng.guns.sys.modular.system.service.FileInfoService;
import cn.stylefeng.guns.sys.modular.system.service.NoticeService;
import cn.stylefeng.guns.sys.modular.system.service.UserService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.util.ToolUtil;
import cn.stylefeng.roses.kernel.model.exception.RequestEmptyException;
import cn.stylefeng.roses.kernel.model.exception.ServiceException;
import cn.stylefeng.roses.kernel.model.exception.enums.CoreExceptionEnum;
import cn.stylefeng.roses.kernel.model.response.ResponseData;
import cn.stylefeng.roses.kernel.model.response.SuccessResponseData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.List;
/**
* 通用控制器
*
* @author fengshuonan
* @Date 2017年2月17日20:27:22
*/
@Controller
@RequestMapping("/system")
@Slf4j
public class SystemController extends BaseController {
@Autowired
private UserService userService;
@Autowired
private FileInfoService fileInfoService;
@Autowired
private NoticeService noticeService;
/**
* 控制台页面
*
* @author fengshuonan
* @Date 2018/12/24 22:43
*/
@RequestMapping("/console")
public String console() {
return "/modular/frame/console.html";
}
/**
* 分析页面
*
* @author fengshuonan
* @Date 2018/12/24 22:43
*/
@RequestMapping("/console2")
public String console2() {
return "/modular/frame/console2.html";
}
/**
* 系统硬件信息页面
*
* @author fengshuonan
* @Date 2018/12/24 22:43
*/
@RequestMapping("/systemInfo")
public String systemInfo(Model model) {
SystemHardwareInfo systemHardwareInfo = new SystemHardwareInfo();
systemHardwareInfo.copyTo();
model.addAttribute("server", systemHardwareInfo);
return "/modular/frame/systemInfo.html";
}
/**
* 跳转到首页通知
*
* @author fengshuonan
* @Date 2018/12/23 6:06 PM
*/
@RequestMapping("/notice")
public String hello() {
List