yanderong
2026-07-13 810b9e4a3aab5f52c8fa7c394c788cceb141e6fb
feat: 首页增加入口导航和可视化分享
2个文件已修改
50 ■■■■■ 已修改文件
ManagementYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/system/BlackboardController.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementYKDTravel/guns-admin/src/main/webapp/WEB-INF/view/home.html 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ManagementYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/system/BlackboardController.java
@@ -3,7 +3,9 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.shiro.ShiroUser;
import com.stylefeng.guns.core.util.DateUtil;
import com.stylefeng.guns.core.util.JwtTokenUtil;
import com.stylefeng.guns.modular.system.model.Dept;
import com.stylefeng.guns.modular.system.model.LoginLog;
import com.stylefeng.guns.modular.system.model.Role;
@@ -11,12 +13,15 @@
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.util.ResultUtil;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Date;
/**
@@ -45,16 +50,25 @@
    private ITCompanyService companyService;
    
    private ResultUtil resultUtil;
    @Value("${embedded.route-switch-url}")
    private String routeSwitchUrl;
    @Value("${embedded.statistical-table-url}")
    private String statisticalTableUrl;
    /**
     * 跳转到黑板
     */
    @RequestMapping("")
    public String blackboard(Model model, Integer type) {
    public String blackboard(Model model, Integer type) throws UnsupportedEncodingException {
        //查询当前用户是否有"首页"菜单的权限
        Integer id = ShiroKit.getUser().getId();
        User user = userService.selectById(id);
        Integer menuNum = userService.getMenuNumByRole(user.getRoleid());
        model.addAttribute("routeSwitchUrl", buildTokenUrl(routeSwitchUrl));
        model.addAttribute("statisticalTableUrl", buildTokenUrl(statisticalTableUrl));
        if (menuNum > 0) {
            return "/home.html";
        } else {
@@ -92,5 +106,17 @@
        return resultUtil;
    }
    private String buildTokenUrl(String baseUrl) throws UnsupportedEncodingException {
        return baseUrl + generateCurrentUserToken();
    }
    private String generateCurrentUserToken() throws UnsupportedEncodingException {
        ShiroUser user = ShiroKit.getUser();
        if (user == null || user.getId() == null) {
            return "";
        }
        String token = JwtTokenUtil.generateToken(user.getId().toString());
        return URLEncoder.encode(token, "UTF-8");
    }
}
ManagementYKDTravel/guns-admin/src/main/webapp/WEB-INF/view/home.html
@@ -29,6 +29,12 @@
                    <div class="col-sm-2">
                        <#button name="搜索" icon="fa-search" clickFun="getData()"/>
                    </div>
                    <div class="col-sm-2">
                        <#button name="入口导航" icon="fa-bars" id="sharePageBtn1"/>
                    </div>
                    <div class="col-sm-2">
                        <#button name="可视化" icon="fa-bars" id="sharePageBtn2"/>
                    </div>
                </div>
                <div class="col-sm-3">
                    <div class="ibox float-e-margins">
@@ -217,6 +223,12 @@
                    <div class="col-sm-2">
                        <#button name="搜索" icon="fa-search" clickFun="getData1()"/>
                    </div>
                    <div class="col-sm-2">
                        <#button name="入口导航" icon="fa-bars" id="sharePageBtn1"/>
                    </div>
                    <div class="col-sm-2">
                        <#button name="可视化" icon="fa-bars" id="sharePageBtn2"/>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2" style="padding: 0px; height: 47em; overflow: auto">
@@ -260,6 +272,14 @@
    window._AMapSecurityConfig = {
        securityJsCode: '44c5ee9ad584605d91ca69bfac32c761',
    }
    document.getElementById("sharePageBtn1").onclick = function () {
        window.open("${routeSwitchUrl}", "_blank", "noopener,noreferrer");
    };
    document.getElementById("sharePageBtn2").onclick = function () {
        window.open("${statisticalTableUrl}", "_blank", "noopener,noreferrer");
    };
</script>
<script src="https://webapi.amap.com/maps?v=1.4.15&key=d3bde6afb050067e1a765a8d1d1f4c54"
        type="text/javascript"></script>