Переглянути джерело

李剑-节假日信息维护功能开发-开始前端页面实现

lijian 4 роки тому
батько
коміт
aa8ab662d9

+ 9 - 9
src/main/java/platform/modules/oauth/LoginCallback.java

@@ -47,11 +47,11 @@ public class LoginCallback extends BaseController {
 
     @PostMapping(value = "")
     public String validateLogin(String SAMLResponse) {
-        log.info("======================log leeking begin========================");
+
         log.info("! SAMLResponse = {}", SAMLResponse);
         //System.out.println("===============");
         User user = ShiroUtils.getCurrentUser();
-        log.info("======================LoginCallback.validateLogin.step1========================");
+
         User existUser = userDao.findByNickName(user.getNick_name(), Constant.UserType.GOVERNMENT);
         if (null == existUser) {
             user.setUser_type(Constant.UserType.GOVERNMENT);
@@ -59,24 +59,24 @@ public class LoginCallback extends BaseController {
             userService.saveSelectiveSso(user);
         }
 
-        log.info("======================LoginCallback.validateLogin.step2========================");
+
         UsernamePasswordToken token = new UsernamePasswordToken();
         token.setUsername(user.getNick_name());
-        log.info("======================LoginCallback.validateLogin.step3========================");
+
         //token.setPassword(resetPassword.toCharArray());
         token.setSSO(true);
-        log.info("======================LoginCallback.validateLogin.step4========================");
+
         SecurityUtils.getSubject().login(token);
 
-        log.info("======================LoginCallback.validateLogin.step5========================");
+
         // 注入token到cookie
         String tokenString = userService.createToken();
         tokenString = tokenString.replace("Bearer ", "");
         log.info("tokenstring: {}", tokenString);
-        log.info("======================LoginCallback.validateLogin.step6========================");
+
         CookieUtil.createWebCookie(response, "token", tokenString, 7200);
-        log.info("======================LoginCallback.validateLogin.step7========================");
-        log.info("======================log leeking end========================");
+
+
         return "redirect:/admin/home";
 
 }

+ 5 - 0
src/main/java/platform/modules/sys/shiro/filter/MyRequestContextFilter.java

@@ -43,6 +43,7 @@ public class MyRequestContextFilter extends RequestContextFilter {
     }
 
     private boolean processSSO(HttpServletRequest request, HttpServletResponse response) {
+
         String reqURI = request.getServletPath();
         System.out.println(reqURI);
         if ("/admin/index".equals(reqURI)) {//访问主页,强制SSO
@@ -74,7 +75,9 @@ public class MyRequestContextFilter extends RequestContextFilter {
                 logger.info("sessionIndex from SAMLResponse: " + sessionIndex);
                 String ssoId = (String) map.get("ssoId");
                 Map<String, Object> sessionMap = new HashMap<>();
+
                 if (!StringUtils.isEmpty(sessionIndex)) {
+
                     sessionMap.put("sessionIndex", sessionIndex);
                     User user = getUser(ssoId);
                     ShiroUtils.setCurrentUser(user);
@@ -83,7 +86,9 @@ public class MyRequestContextFilter extends RequestContextFilter {
                         logger.info("Can not parse userId from SAMLResponse.");
                     }
                     sessionMap.put("userId", userId);
+
                     Cookie cookie = new Cookie("ssoDemo", JSON.toJSONString(sessionMap));
+
                     cookie.setMaxAge(36000);
                     cookie.setPath("/");
                     response.addCookie(cookie);

+ 121 - 0
src/main/resources/static/js/super/holiday/holiday_add.js

@@ -0,0 +1,121 @@
+$(function () {
+	$("#form-templateFile-add").validate({
+        rules: {
+            name: {
+                required: true,
+                minlength: 1,
+                maxlength: 64,
+                remote: {
+                    url: pagePath + "/super/isExistTemplateName",
+                    type: "get",
+                    data: {
+                        name: function () {
+                            return $("#name").val();
+                        },
+                        id: '',
+                        typeId :function(){
+                            return $("#typeId").val();
+                        },
+                        itemId: function () {
+                            return $("#itemId").val();
+                        }
+                    }
+                }
+            },
+            value: {
+                required: true,
+                minlength: 1,
+                maxlength: 64
+            }
+        },
+        messages: {
+            name: {
+                remote: "该模板已存在!"
+            }
+        },
+        onkeyup: false,
+        focusCleanup: true,
+        success: "valid",
+        submitHandler: function (form) {
+            // $(form).find(":submit").attr("disabled", true);
+        	/*if($("#fileListPre").find("input[name='fileDown.file_id']").length==0){
+        		errorMessage('请上传模板文件!');
+        		return false;
+        	}*/
+            $(form).ajaxSubmit({
+                type: 'post',
+                url: pagePath + "/super/template/save",
+                dataType: "json",
+                success: function (data) {
+                    if (data.success) {
+                        succeedMessage(data.message);
+                        setShortTimeClose();
+                    } else {
+                        // $(form).find(":submit").attr("disabled", false);
+                        errorMessage(data.message);
+                    }
+                },
+                error: function () {
+                    errorMessage('系统错误!');
+                }
+            });
+            return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。
+        }
+    });
+	
+});
+
+//添加模板文件
+function template_addFile(title,url,w,h){
+	var typeId = $("#typeList").val()==null?0:$("#typeList").val();
+	var itemId = $("#itemList").val()==null?0:$("#itemList").val();
+	
+	url += "/"+ typeId+"/"+ itemId;
+	layer_show(title,pagePath+url,w,h);
+}
+
+//编辑模板文件
+function template_editFile(title,url,w,h){
+	layer_show(title,pagePath+url,w,h);
+}
+
+/*模板--删除*/
+function template_del( url){
+	
+    layer.confirm('确认要删除吗?',function(index){
+        //此处请求后台程序,下方是成功后的前台处理……
+        $.ajax({
+            type:"DELETE",
+            dataType:"json",
+            url: pagePath+url,
+            data:{
+                "timestamp":new Date().getTime()
+            },
+            success: function (result) {
+                if (result.success) {
+                    smileMessage(result.message)
+                    setTime();
+
+                } else {
+                    errorMessage(result.message);
+                }
+            },
+         	error: function () {
+         		errorMessage('系统错误!');
+         	}
+        });
+    });
+}
+
+//重新加载模板列表
+//changeType : 0 改变type,1改变item
+function reloadTemplateList(changeType){
+	var typeId = $("#typeList").val()==null?0:$("#typeList").val();
+	var itemId = $("#itemList").val()==null?0:$("#itemList").val();
+	if(0==changeType){
+		//改变类型的时候清空item子类型
+		itemId = 0;
+	}
+	var url = pagePath + "/super/template/add/"+ typeId+"/"+ itemId;
+	location.replace(url);
+}

+ 83 - 0
src/main/resources/static/js/super/holiday/holiday_edit.js

@@ -0,0 +1,83 @@
+$(function () {
+	$("#form-templateFile-edit").validate({
+        rules: {
+            name: {
+                required: true,
+                minlength: 1,
+                maxlength: 64,
+                remote: {
+                    url: pagePath + "/super/isExistTemplateName",
+                    type: "get",
+                    data: {
+                        name: function () {
+                            return $("#name").val();
+                        },
+                        id: function () {
+                            return $("#id").val();
+                        },
+                        typeId :function(){
+                            return $("#typeId").val();
+                        },
+                        itemId: function () {
+                            return $("#itemId").val();
+                        },
+                    }
+                }
+            },
+            value: {
+                required: true,
+                minlength: 1,
+                maxlength: 64
+            }
+        },
+        messages: {
+            name: {
+                remote: "该模板已存在!"
+            }
+        },
+        onkeyup: false,
+        focusCleanup: true,
+        success: "valid",
+        submitHandler: function (form) {
+            // $(form).find(":submit").attr("disabled", true);
+        	/*if($("#fileListPre").find("input[name='fileDown.file_id']").length==0 && $("input[name='file_url']").length==0){
+        		errorMessage('请上传模板文件!');
+        		return false;
+        	}*/
+            $(form).ajaxSubmit({
+                type: 'post',
+                url: pagePath + "/super/template/save",
+                dataType: "json",
+                success: function (data) {
+                    if (data.success) {
+                        succeedMessage(data.message);
+                        setShortTimeClose();
+                    } else {
+                        // $(form).find(":submit").attr("disabled", false);
+                        errorMessage(data.message);
+                    }
+                },
+                error: function () {
+                    errorMessage('系统错误!');
+                }
+            });
+            return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。
+        }
+    });
+	
+});
+
+function template_addFile(title,url,w,h){
+	var typeId = $("#typeList").val()==null?0:$("#typeList").val();
+	var itemId = $("#itemList").val()==null?0:$("#itemList").val();
+	url += "/"+ typeId+"/"+ itemId;
+	layer_show(title,pagePath+url,w,h);
+}
+
+//重新加载模板列表
+function reloadTemplateList(){
+	var typeId = $("#typeList").val()==null?0:$("#typeList").val();
+	var itemId = $("#itemList").val()==null?0:$("#itemList").val();
+	var url = pagePath + "/super/template/add/"+ typeId+"/"+ itemId;
+	location.replace(url);
+}

+ 51 - 0
src/main/resources/static/js/super/holiday/holiday_list.js

@@ -0,0 +1,51 @@
+$(function () {
+
+});
+
+/*
+ 参数解释:
+ title	标题
+ url		请求的url
+ id		需要操作的数据id
+ w		弹出层宽度(缺省调默认值)
+ h		弹出层高度(缺省调默认值)
+ */
+/*模板-增加*/
+function template_add(title,url,w,h){
+    var index = layer_show(title,pagePath+url,w,h);
+    layer.full(index);
+}
+
+/*模板--编辑*/
+function template_edit(title,url,w,h){
+	var index = layer_show(title,pagePath+url,w,h);
+    layer.full(index);
+}
+
+/*模板--删除*/
+function template_del( url){
+	
+    layer.confirm('确认要删除吗?',function(index){
+        //此处请求后台程序,下方是成功后的前台处理……
+        $.ajax({
+            type:"DELETE",
+            dataType:"json",
+            url: pagePath+url,
+            data:{
+                "timestamp":new Date().getTime()
+            },
+            success: function (result) {
+                if (result.success) {
+                    smileMessage(result.message)
+                    setTime();
+
+                } else {
+                    errorMessage(result.message);
+                }
+            },
+         	error: function () {
+         		errorMessage('系统错误!');
+         	}
+        });
+    });
+}

+ 8 - 0
src/main/resources/templates/admin/common/left.html

@@ -1691,6 +1691,14 @@
                 </ul>
             </dd>
         </dl>
+        <!-- /////////////////grip begin by leeking 2022-01-04/////////////////////// --->
+        <dl>
+            <dt>
+                <span> <a th:attr="data-href=@{/super/holidayList}" data-title="节假日管理">节假日管理</a></span>
+                <i class="icon-arrow"></i>
+            </dt>
+        </dl>
+        <!-- /////////////////grip end by leeking 2022-01-04/////////////////////// --->
         <dl>
             <dt class="titCellTop">
                 <span> <a th:attr="data-href=@{/admin/log/list}" data-title="日志管理">日志管理</a></span>

+ 84 - 0
src/main/resources/templates/admin/super/holiday/holiday_add.html

@@ -0,0 +1,84 @@
+<!DOCTYPE HTML>
+<html xmlns:th="http://www.thymeleaf.org"
+      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
+      layout:decorate="~{admin/common/common}">
+<head>
+    <title>节假日管理</title>
+</head>
+
+<body layout:fragment="content">
+
+<article class="page-container">
+    <form class="form form-horizontal" id="form-holiday-add">
+    	<input type="hidden" id="typeId" th:value="${typeId}" th:name="tid"/>
+        
+        <div class="row cl">
+        	<div class="pd-15 col-xs-8 col-sm-12">
+	            <span class="l">
+	                <a href="javascript:;" th:onclick="'javascript:holiday_addFile(\'添加模板文件\',\'/super/holiday/addFile\',\'800\',\'500\');'" class="btn btn-primary radius">添加模板文件</a>
+	            </span>
+	        </div>
+            <div class="col-xs-8 col-sm-12">
+
+                <table class="table table-border table-bordered table-bg table-hover">
+                    <thead>
+                    <tr class="text-c">
+                        <th>序号</th>
+						<th>名称</th>
+						<th>年份</th>
+						<th>配置信息</th>
+                        <th>有效标记</th>
+                        <th>创建时间</th>
+                        <th width="100">操作</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    <tr class="text-c" th:each="model,iterStat:${pageInfo.list}" th:object="${model}">
+		                <td><input type="hidden" th:id="*{id}" value="" name=""/><span th:text="${iterStat.index+1}" ></span></td>
+		                <td th:text="*{name}"></td>
+		                <td>
+		                	<th:block th:unless="${model.fileDown} == null">
+		                	<th:block th:unless="${model.fileDown.file_url} == null">
+		                    	<a th:href="${fileUrl} + ${model.fileDown.file_url}" target="_blank">[[${model.fileDown.file_name}]]</a>
+		                    </th:block>
+		                    </th:block>
+		                </td>
+		                <td class="td-status">
+		                	<span class="label radius" th:if="*{is_active==false}">否</span>
+		                    <span class="label radius label-success" th:unless="*{is_active==false}">是</span>
+		                </td>
+                        <td th:text="*{create_time}"></td>
+		                <td class="td-manage">
+		                    <a title="编辑" href="javascript:;"  th:onclick="'javascript:holiday_editFile(\'编辑模板文件\',\'/super/holiday/editFile/'+*{id}+'\',\'800\',\'500\');'" class="ml-5" style="text-decoration:none">编辑</a>
+		                    <a title="删除" href="javascript:;"  th:onclick="'javascript:holiday_del(\'/super/holiday/delete/'+*{id}+'\');'" class="ml-5" style="text-decoration:none">删除</a>
+		                </td>
+		            </tr>
+                    </tbody>
+                </table>
+            </div>
+        </div>
+        
+        <!-- <div class="row cl">
+            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
+                <button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i>新增</button>
+                <button onClick="removeIframe();" class="btn btn-default radius" type="button">&nbsp;&nbsp;返回&nbsp;&nbsp;</button>
+            </div>
+        </div> -->
+    </form>
+</article>
+
+<script type="text/javascript" th:src="@{/js/super/holiday/holiday_add.js}"></script>
+<script th:inline="javascript">
+
+    /**
+     * 取消
+     */
+    function removeIframe() {
+        var index = parent.layer.getFrameIndex(window.name);
+        parent.layer.close(index);
+    }
+    
+
+</script>
+</body>
+</html>

+ 66 - 0
src/main/resources/templates/admin/super/holiday/holiday_list.html

@@ -0,0 +1,66 @@
+<!DOCTYPE HTML>
+<html xmlns:th="http://www.thymeleaf.org"
+      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
+      layout:decorate="~{admin/common/common}">
+<head>
+    <title>节假日配置信息列表</title>
+</head>
+
+<body layout:fragment="content">
+<nav class="breadcrumb">
+   <i class="Hui-iconfont">&#xe67f;</i>
+    首页
+    <span class="c-gray en">&gt;</span>节假日管理
+    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
+        <i class="Hui-iconfont">&#xe68f;</i>
+    </a>
+</nav>
+
+<form id="myForm" th:action="@{/super/holidayList}" th:method="get">
+    <div class="page-container">
+	    <!-- <div class="text-c">
+	            <input type="text" class="input-text" style="width:250px" placeholder="请输入关键字搜索" name="keyword" th:value="${keyword}"/>
+	            <button type="submit" class="btn btn-primary">
+	                搜索
+	            </button>
+	     </div> -->
+        <div class="cl pd-5 bg-1 bk-gray mt-20">
+            <span class="l">
+                <a href="javascript:;" th:onclick="'javascript:holiday_add(\'新增模板\',\'/super/holiday/add/0/0\',\'800\',\'500\');'" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i>新增</a>
+            </span>
+            <span class="r">共有数据:<strong th:text="${pageInfo?.total}" id="total">54</strong> 条</span>
+        </div>
+        <table  class="table table-border table-bordered table-bg table-hover">
+            <thead>
+            <tr class="text-c">
+                <th>编号</th>
+                <th>名称</th>
+                <th>年份</th>
+                <th>配置信息</th>
+                <th width="100">操作</th>
+            </tr>
+            </thead>
+            <tbody>
+            <tr class="text-c" th:each="model,iterStat:${pageInfo.list}" th:object="${model}">
+                <td><input type="hidden" th:id="*{id}" value="" name=""/><span th:text="${iterStat.index+1}" ></span></td>
+                <td th:text="*{config_name}"></td>
+                <td th:text="*{config_key}"></td>
+                <td th:text="*{config_value}"></td>
+                <td class="td-manage">
+                    <a title="修改" href="javascript:;"  th:onclick="'javascript:holiday_edit(\'修改假日数据\',\'/super/holiday/edit/'+*{id}+'\',\'800\',\'500\');'" class="ml-5" style="text-decoration:none">修改</a>
+                    <a title="废弃" href="javascript:;"  th:onclick="'javascript:holiday_del(\'/super/holiday/delete/'+*{id}+'\');'" class="ml-5" style="text-decoration:none">废弃</a>
+                </td>
+            </tr>
+            </tbody>
+        </table>
+        <div th:replace="admin/common/page :: page"></div>
+    </div>
+</form>
+
+<script type="text/javascript" th:src="@{/js/common/page.js}"></script>
+<script type="text/javascript" th:src="@{/js/super/holiday/holiday_list.js}"></script>
+<script th:inline="javascript">
+
+</script>
+</body>
+</html>

+ 1 - 1
src/main/resources/templates/admin/super/industry/industry_file_list.html

@@ -78,7 +78,7 @@
 </form>
 
 <script type="text/javascript" th:src="@{/js/common/page.js}"></script>
-<script type="text/javascript" th:src="@{/js/super/template/template_list.js}"></script>
+<script type="text/javascript" th:src="@{/js/super/template/holiday_list.js}"></script>
 <script type="text/javascript" th:src="@{/js/company/companyInfoManage/layui.all.js}"></script>
 <script th:inline="javascript">
     $(function () {

+ 1 - 0
src/main/resources/templates/left.html

@@ -1581,6 +1581,7 @@
                 </ul>
             </dd>
         </dl>
+
         <dl>
             <dt>
                 <span> <a th:attr="data-href=@{/admin/log/list}" data-title="日志管理">日志管理</a></span>