浏览代码

临时调阅账号维护、提醒

limeng 2 年之前
父节点
当前提交
4105ec958f

+ 1 - 1
leiSP-admin/src/main/resources/application.yml

@@ -7,7 +7,7 @@ leisp:
   # 版权年份
   copyrightYear: 2019
   # 实例演示开关
-  demoEnabled: false
+  demoEnabled: true
   # 文件路径 示例( Windows配置D:/leisp/uploadPath,Linux配置 /home/leisp/uploadPath)
   profile: D:/workingSpace/IEDA_Pro/lEISP/leiSP-admin/src/main/resources/static/img/upload
   # 获取ip地址开关

+ 17 - 10
leiSP-admin/src/main/resources/static/css/toast.style.css

@@ -48,25 +48,30 @@ i {
   -moz-user-select: none;
   -ms-user-select: none;
   user-select: none; }
-  .toast-item-wrapper i.toast-icon {
+  .toast-item-wrapper i.toast-icon{
     position: absolute;
-    top: 12px;
-    left: 0;
+    top: 18px;
+    left: -5px;
     width: 50px;
     text-align: center;
     vertical-align: middle;
-    font-size: 2rem; }
+    font-size: 2rem;
+    color: #d20000;
+  }
   .toast-item-wrapper .toast-close {
     font-size: 1.2rem;
     position: absolute;
-    top: 0;
-    right: 0;
+    top: 4px;
+    right: 5px;
     width: 20px;
     text-align: center;
-    cursor: pointer; }
+    cursor: pointer;
+    color: #000;
+  }
   .toast-item-wrapper.success {
-    background-color: #44aeff;
-    border: 1px solid #1a9581; }
+    background-color: #f3f3f3;
+    border: 1px solid#c3c3c3; }
+
   .toast-item-wrapper.error {
     background-color: #ff7946;
     border: 1px solid #f35818; }
@@ -103,7 +108,9 @@ i {
     right: 20px;
     width: calc(100% - 40px); }
   .toast-item-wrapper p {
-    margin: 0; }
+    margin: 0;
+    line-height: 30px;
+  }
   .toast-item-wrapper .toast-message {
     font-size: 0.87rem; }
   .toast-item-wrapper .toast-progress {

+ 16 - 16
leiSP-admin/src/main/resources/static/js/toast.script.js

@@ -57,8 +57,8 @@
             if( $options.rtl){
                 css["padding-right"] = 50;
             } else {
-                css["padding-left"] = 50;
-            }            
+                css["padding-left"] = 30;
+            }
         }
 
         if($options.has_progress && $options.timeout > 0){
@@ -77,34 +77,34 @@
                 }
                 case "toast-top-right" : {
                     css["top"] = 0;
-                    css["left"] = 0;                    
+                    css["left"] = 0;
                     break;
                 }
                 case "toast-top-center" : {
                     css["top"] = 0;
-                    css["left"] = css["right"] = 0;  
-                    css["width"] = "100%";                  
+                    css["left"] = css["right"] = 0;
+                    css["width"] = "100%";
                     break;
                 }
                 case "toast-bottom-left" : {
                     css["bottom"] = 0;
-                    css["left"] = 0;                     
+                    css["left"] = 0;
                     break;
                 }
                 case "toast-bottom-right" : {
                     css["bottom"] = 0;
-                    css["right"] = 0;                     
+                    css["right"] = 0;
                     break;
                 }
                 case "toast-bottom-center" : {
                     css["bottom"] = 0;
-                    css["left"] = css["right"] = 0;  
-                    css["width"] = "100%";                     
+                    css["left"] = css["right"] = 0;
+                    css["width"] = "100%";
                     break;
                 }
                 default : {
                     break;
-                }                                                                        
+                }
             }
         }
 
@@ -118,7 +118,7 @@
                     css["bottom"] = parseInt($(this).css("bottom")) + this.offsetHeight + spacing;
                 });
             }
-        }        
+        }
 
         $element.css(css);
 
@@ -130,7 +130,7 @@
             $alert.css({display: 'block', opacity: 1});
         }
 
-		function removeToast(){          
+		function removeToast(){
 			$.Toast.remove( $element );
 		}
 
@@ -139,7 +139,7 @@
             if($options.has_progress){
                 $(".toast-progress", $element).animate({"width":"100%"}, $options.timeout);
             }
-		}        
+		}
 
         $(".toast-close", $element).click(removeToast)
 
@@ -147,7 +147,7 @@
     }
 
     $.Toast.remove = function( $element ){
-        "use strict";        
+        "use strict";
 		if($element.fadeOut)
 		{
 			$element.fadeOut(function(){
@@ -156,6 +156,6 @@
 		}
 		else{
 			$element.remove();
-		}        
+		}
     }
-})();
+})();

+ 28 - 16
leiSP-admin/src/main/resources/templates/main.html

@@ -294,7 +294,7 @@
 
     $(document).ready(function () {
         getVisualization();
-
+        addToast();
     });
 </script>
 <script>
@@ -323,22 +323,34 @@
         drawPlot(d2);
     }
 
-
+    /** 用户临期提醒 **/
     function addToast(){
-        $.Toast("<p style='font-size: 18px;'>系统提示</p>",
-            "<p style='font-size: 15px;'><a href='https://www.baidu.com' target='_blank'>用户【admin】权限即将到期,请及时处理!</a></p>" +
-            "<p style='font-size: 15px;'><a href='https://www.baidu.com' target='_blank'>用户【admin】权限即将到期,请及时处理!</a></p>",
-            "success", {
-            stack: true,
-            has_icon:true,
-            has_close_btn:true,
-            fullscreen:false,
-            width:250,
-            timeout:0,
-            sticky:false,
-            has_progress:true,
-            rtl:false,
-        });
+        let url = '/system/tempPer/expirationList';
+        $.ajax({
+            url: url,
+            type: "post",
+            success: function(result) {
+                let content = "";
+                for(let i=0;i<result.length;i++){
+                    let temp = "<p style='font-size: 15px;'><a style='color: #333;'>【{deptName}】用户【{userName}】的权限还有{remainingDays}天到期,请及时处理!</a></p>";
+                    temp = temp.replace("{deptName}",result[i].deptName);
+                    temp = temp.replace("{userName}",result[i].userName);
+                    temp = temp.replace("{remainingDays}",result[i].remainingDays);
+                    content += temp;
+                }
+                $.Toast("<p  style='font-size: 18px;color: #c70000;font-weight: 900;height: 35px;line-height: 35px;'>临期提醒</p>", content, "success",{
+                    stack: true,
+                    has_icon:true,
+                    has_close_btn:true,
+                    fullscreen:false,
+                    width:250,
+                    timeout:5000,
+                    sticky:false,
+                    has_progress:true,
+                    rtl:false,
+                });
+            }
+        })
     }
 </script>
 </body>

+ 22 - 6
leiSP-common/src/main/java/com/sooka/common/utils/DateUtils.java

@@ -3,12 +3,15 @@ package com.sooka.common.utils;
 import java.lang.management.ManagementFactory;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.util.Calendar;
 import java.util.Date;
+import java.util.GregorianCalendar;
+
 import org.apache.commons.lang3.time.DateFormatUtils;
 
 /**
  * 时间工具类
- * 
+ *
  * @author lei_wang
  */
 public class DateUtils extends org.apache.commons.lang3.time.DateUtils
@@ -22,15 +25,15 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
     public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
 
     public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
-    
+
     private static String[] parsePatterns = {
-            "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", 
+            "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
             "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
             "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
 
     /**
      * 获取当前Date型日期
-     * 
+     *
      * @return Date() 当前日期
      */
     public static Date getNowDate()
@@ -40,7 +43,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
 
     /**
      * 获取当前日期, 默认格式为yyyy-MM-dd
-     * 
+     *
      * @return String
      */
     public static String getDate()
@@ -121,7 +124,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
             return null;
         }
     }
-    
+
     /**
      * 获取服务器启动时间
      */
@@ -152,4 +155,17 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         // long sec = diff % nd % nh % nm / ns;
         return day + "天" + hour + "小时" + min + "分钟";
     }
+    /**
+     * 计算两个时间差
+     */
+    public static Long getDaysPoor(Date endDate, Date nowDate)
+    {
+        long nd = 1000 * 24 * 60 * 60;
+        // 获得两个时间的毫秒时间差异
+        long diff = endDate.getTime() - nowDate.getTime();
+        // 计算差多少天
+        long day = diff / nd;
+        return Math.abs(day);
+    }
+
 }

+ 148 - 0
mybusiness/src/main/java/com/sooka/system/controller/TTempPermissionController.java

@@ -0,0 +1,148 @@
+package com.sooka.system.controller;
+
+import java.util.Date;
+import java.util.List;
+
+import com.sooka.common.annotation.Log;
+import com.sooka.common.core.controller.BaseController;
+import com.sooka.common.core.domain.AjaxResult;
+import com.sooka.common.core.page.TableDataInfo;
+import com.sooka.common.enums.BusinessType;
+import com.sooka.common.utils.poi.ExcelUtil;
+import com.sooka.system.domain.SysUser;
+import com.sooka.system.domain.TempPerUser;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import com.sooka.system.domain.TTempPermission;
+import com.sooka.system.service.ITTempPermissionService;
+
+
+/**
+ * tempPerController
+ *
+ * @author lei
+ * @date 2022-08-09
+ */
+@Controller
+@RequestMapping("/system/tempPer")
+public class TTempPermissionController extends BaseController
+{
+    private String prefix = "system/tempPer";
+
+    @Autowired
+    private ITTempPermissionService tTempPermissionService;
+
+    @RequiresPermissions("system:tempPer:view")
+    @GetMapping()
+    public String tempPer()
+    {
+        return prefix + "/tempPer";
+    }
+
+    /**
+     * 查询tempPer列表
+     */
+    @RequiresPermissions("system:tempPer:list")
+    @PostMapping("/list")
+    @ResponseBody
+    public TableDataInfo list(TTempPermission tTempPermission)
+    {
+        startPage();
+        List<TTempPermission> list = tTempPermissionService.selectTTempPermissionList(tTempPermission);
+        return getDataTable(list);
+    }
+
+    @PostMapping("/expirationList")
+    @ResponseBody
+    public List<TTempPermission> expirationList(TTempPermission tTempPermission)
+    {
+        tTempPermission.setEndTime(new Date());
+        return tTempPermissionService.selectTTempPermissionList(tTempPermission);
+    }
+
+    @RequiresPermissions("system:tempPer:add")
+    @PostMapping("/listUser")
+    @ResponseBody
+    public List<TempPerUser> listUser()
+    {
+        List<TempPerUser> list = tTempPermissionService.listUser();
+        return list;
+    }
+
+    /**
+     * 导出tempPer列表
+     */
+    @RequiresPermissions("system:tempPer:export")
+    @Log(title = "tempPer", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    @ResponseBody
+    public AjaxResult export(TTempPermission tTempPermission)
+    {
+        List<TTempPermission> list = tTempPermissionService.selectTTempPermissionList(tTempPermission);
+        ExcelUtil<TTempPermission> util = new ExcelUtil<TTempPermission>(TTempPermission.class);
+        return util.exportExcel(list, "tempPer");
+    }
+
+    /**
+     * 新增tempPer
+     */
+    @GetMapping("/add")
+    public String add()
+    {
+        return prefix + "/add";
+    }
+
+    /**
+     * 新增保存tempPer
+     */
+    @RequiresPermissions("system:tempPer:add")
+    @Log(title = "tempPer", businessType = BusinessType.INSERT)
+    @PostMapping("/add")
+    @ResponseBody
+    public AjaxResult addSave(TTempPermission tTempPermission)
+    {
+        return toAjax(tTempPermissionService.insertTTempPermission(tTempPermission));
+    }
+
+    /**
+     * 修改tempPer
+     */
+    @GetMapping("/edit/{id}")
+    public String edit(@PathVariable("id") Long id, ModelMap mmap)
+    {
+        TTempPermission tTempPermission = tTempPermissionService.selectTTempPermissionById(id);
+        mmap.put("tTempPermission", tTempPermission);
+        return prefix + "/edit";
+    }
+
+    /**
+     * 修改保存tempPer
+     */
+    @RequiresPermissions("system:tempPer:edit")
+    @Log(title = "tempPer", businessType = BusinessType.UPDATE)
+    @PostMapping("/edit")
+    @ResponseBody
+    public AjaxResult editSave(TTempPermission tTempPermission)
+    {
+        return toAjax(tTempPermissionService.updateTTempPermission(tTempPermission));
+    }
+
+    /**
+     * 删除tempPer
+     */
+    @RequiresPermissions("system:tempPer:remove")
+    @Log(title = "tempPer", businessType = BusinessType.DELETE)
+    @PostMapping( "/remove")
+    @ResponseBody
+    public AjaxResult remove(String ids)
+    {
+        return toAjax(tTempPermissionService.deleteTTempPermissionByIds(ids));
+    }
+}

+ 61 - 0
mybusiness/src/main/java/com/sooka/system/domain/TTempPermission.java

@@ -0,0 +1,61 @@
+package com.sooka.system.domain;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import com.sooka.common.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+/**
+ * tempPer对象 t_temp_permission
+ *
+ * @author lei
+ * @date 2022-08-09
+ */
+@Data
+public class TTempPermission extends BaseBusinessEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    private Long id;
+
+    /** 用户ID */
+    private Long userId;
+
+    /** 登录账号 */
+    @Excel(name = "登录账号")
+    private String loginName;
+
+    /** 用户昵称 */
+    @Excel(name = "用户昵称")
+    private String userName;
+
+    /** 部门ID */
+    private Long deptId;
+
+    /** 所属部门 */
+    @Excel(name = "所属部门")
+    private String deptName;
+
+    /** 开始时间 */
+    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date startTime;
+
+    /** 结束时间 */
+    @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date endTime;
+
+    /** 起止时间 */
+    private String duration;
+
+    private Long[] users;
+
+    /** 剩余天数 */
+    @Excel(name = "剩余天数")
+    private Long remainingDays;
+
+}

+ 17 - 0
mybusiness/src/main/java/com/sooka/system/domain/TempPerUser.java

@@ -0,0 +1,17 @@
+package com.sooka.system.domain;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class TempPerUser extends BaseBusinessEntity
+{
+    private static final long serialVersionUID = 1L;
+    /** 部门ID */
+    private Long deptId;
+    /** 部门名称 */
+    private String deptName;
+    /** 用户组 */
+    private List<SysUser> users;
+}

+ 61 - 0
mybusiness/src/main/java/com/sooka/system/mapper/TTempPermissionMapper.java

@@ -0,0 +1,61 @@
+package com.sooka.system.mapper;
+
+import java.util.List;
+import com.sooka.system.domain.TTempPermission;
+
+/**
+ * tempPerMapper接口
+ * 
+ * @author lei
+ * @date 2022-08-09
+ */
+public interface TTempPermissionMapper 
+{
+    /**
+     * 查询tempPer
+     * 
+     * @param id tempPerID
+     * @return tempPer
+     */
+    public TTempPermission selectTTempPermissionById(Long id);
+
+    /**
+     * 查询tempPer列表
+     * 
+     * @param tTempPermission tempPer
+     * @return tempPer集合
+     */
+    public List<TTempPermission> selectTTempPermissionList(TTempPermission tTempPermission);
+
+    /**
+     * 新增tempPer
+     * 
+     * @param tTempPermission tempPer
+     * @return 结果
+     */
+    public int insertTTempPermission(TTempPermission tTempPermission);
+
+    /**
+     * 修改tempPer
+     * 
+     * @param tTempPermission tempPer
+     * @return 结果
+     */
+    public int updateTTempPermission(TTempPermission tTempPermission);
+
+    /**
+     * 删除tempPer
+     * 
+     * @param id tempPerID
+     * @return 结果
+     */
+    public int deleteTTempPermissionById(Long id);
+
+    /**
+     * 批量删除tempPer
+     * 
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteTTempPermissionByIds(String[] ids);
+}

+ 10 - 0
mybusiness/src/main/java/com/sooka/system/mapper/TempPerUserMapper.java

@@ -0,0 +1,10 @@
+package com.sooka.system.mapper;
+
+import com.sooka.system.domain.TempPerUser;
+
+import java.util.List;
+
+public interface TempPerUserMapper {
+
+    public List<TempPerUser> listUser();
+}

+ 66 - 0
mybusiness/src/main/java/com/sooka/system/service/ITTempPermissionService.java

@@ -0,0 +1,66 @@
+package com.sooka.system.service;
+
+import java.util.List;
+import com.sooka.system.domain.TTempPermission;
+import com.sooka.system.domain.TempPerUser;
+
+/**
+ * tempPerService接口
+ *
+ * @author lei
+ * @date 2022-08-09
+ */
+public interface ITTempPermissionService
+{
+    /**
+     * 查询tempPer
+     *
+     * @param id tempPerID
+     * @return tempPer
+     */
+    public TTempPermission selectTTempPermissionById(Long id);
+
+    /**
+     * 查询tempPer列表
+     *
+     * @param tTempPermission tempPer
+     * @return tempPer集合
+     */
+    public List<TTempPermission> selectTTempPermissionList(TTempPermission tTempPermission);
+
+    /**
+     * 新增tempPer
+     *
+     * @param tTempPermission tempPer
+     * @return 结果
+     */
+    public int insertTTempPermission(TTempPermission tTempPermission);
+
+    /**
+     * 修改tempPer
+     *
+     * @param tTempPermission tempPer
+     * @return 结果
+     */
+    public int updateTTempPermission(TTempPermission tTempPermission);
+
+    /**
+     * 批量删除tempPer
+     *
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteTTempPermissionByIds(String ids);
+
+    /**
+     * 删除tempPer信息
+     *
+     * @param id tempPerID
+     * @return 结果
+     */
+    public int deleteTTempPermissionById(Long id);
+
+
+    public List<TempPerUser> listUser();
+
+}

+ 138 - 0
mybusiness/src/main/java/com/sooka/system/service/impl/TTempPermissionServiceImpl.java

@@ -0,0 +1,138 @@
+package com.sooka.system.service.impl;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+import com.sooka.common.core.text.Convert;
+import com.sooka.common.utils.DateUtils;
+import com.sooka.framework.util.ShiroUtils;
+import com.sooka.system.domain.TempPerUser;
+import com.sooka.system.mapper.TempPerUserMapper;
+import org.apache.catalina.security.SecurityUtil;
+import org.apache.shiro.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.sooka.system.mapper.TTempPermissionMapper;
+import com.sooka.system.domain.TTempPermission;
+import com.sooka.system.service.ITTempPermissionService;
+
+
+/**
+ * tempPerService业务层处理
+ *
+ * @author lei
+ * @date 2022-08-09
+ */
+@Service
+public class TTempPermissionServiceImpl implements ITTempPermissionService
+{
+    @Autowired
+    private TTempPermissionMapper tTempPermissionMapper;
+
+    @Autowired
+    private TempPerUserMapper tempPerUserMapper;
+
+    /**
+     * 查询tempPer
+     *
+     * @param id tempPerID
+     * @return tempPer
+     */
+    @Override
+    public TTempPermission selectTTempPermissionById(Long id)
+    {
+        return tTempPermissionMapper.selectTTempPermissionById(id);
+    }
+
+    /**
+     * 查询tempPer列表
+     *
+     * @param tTempPermission tempPer
+     * @return tempPer
+     */
+    @Override
+    public List<TTempPermission> selectTTempPermissionList(TTempPermission tTempPermission)
+    {
+        List<TTempPermission> list = tTempPermissionMapper.selectTTempPermissionList(tTempPermission);
+        /** 计算剩余天数 **/
+        list.forEach(item->{
+            item.setRemainingDays(DateUtils.getDaysPoor(item.getEndTime(),item.getStartTime()));
+        });
+        return list;
+    }
+
+    /**
+     * 新增tempPer
+     *
+     * @param tTempPermission tempPer
+     * @return 结果
+     */
+    @Override
+    public int insertTTempPermission(TTempPermission tTempPermission)
+    {
+        for(Long userId : tTempPermission.getUsers()){
+            tTempPermission.setUserId(userId);
+            tTempPermission.setCreateTime(DateUtils.getNowDate());
+            tTempPermission.setCreateBy(ShiroUtils.getSysUser().getUserName());
+            tTempPermission.setStartTime(transferString2Date(tTempPermission.getDuration().split(" - ")[0]));
+            tTempPermission.setEndTime(transferString2Date(tTempPermission.getDuration().split(" - ")[1]));
+            tTempPermissionMapper.insertTTempPermission(tTempPermission);
+        }
+        return 1;
+    }
+
+    public static Date transferString2Date(String s) {
+        Date date = new Date();
+        try {
+            date = new SimpleDateFormat("yyyy-MM-dd").parse(s);
+        } catch (ParseException e) {
+            e.printStackTrace();
+        }
+        return date;
+    }
+
+    /**
+     * 修改tempPer
+     *
+     * @param tTempPermission tempPer
+     * @return 结果
+     */
+    @Override
+    public int updateTTempPermission(TTempPermission tTempPermission)
+    {
+        tTempPermission.setUpdateTime(DateUtils.getNowDate());
+        tTempPermission.setUpdateBy(ShiroUtils.getSysUser().getUserName());
+        return tTempPermissionMapper.updateTTempPermission(tTempPermission);
+    }
+
+    /**
+     * 删除tempPer对象
+     *
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTTempPermissionByIds(String ids)
+    {
+        return tTempPermissionMapper.deleteTTempPermissionByIds(Convert.toStrArray(ids));
+    }
+
+    /**
+     * 删除tempPer信息
+     *
+     * @param id tempPerID
+     * @return 结果
+     */
+    @Override
+    public int deleteTTempPermissionById(Long id)
+    {
+        return tTempPermissionMapper.deleteTTempPermissionById(id);
+    }
+
+    @Override
+    public List<TempPerUser> listUser(){
+        return tempPerUserMapper.listUser();
+    }
+}

+ 105 - 0
mybusiness/src/main/resources/mapper/system/TTempPermissionMapper.xml

@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.sooka.system.mapper.TTempPermissionMapper">
+
+    <resultMap type="TTempPermission" id="TTempPermissionResult">
+        <result property="id"    column="id"    />
+        <result property="userId"    column="user_id"    />
+        <result property="loginName"    column="login_name"    />
+        <result property="userName"    column="user_name"    />
+        <result property="deptId"    column="dept_id"    />
+        <result property="deptName"    column="dept_name"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="startTime"    column="start_time"    />
+        <result property="endTime"    column="end_time"    />
+    </resultMap>
+
+    <sql id="selectTTempPermissionVo">
+        SELECT
+            id,
+            t.user_id,
+            u.login_name,
+            u.user_name,
+            d.dept_id,
+            d.dept_name,
+            t.create_by,
+            t.create_time,
+            t.update_by,
+            t.update_time,
+            start_time,
+            end_time
+        FROM
+            t_temp_permission t
+        LEFT JOIN sys_user u ON t.user_id = u.user_id
+        LEFT JOIN sys_dept d ON u.dept_id = d.dept_id
+    </sql>
+
+    <select id="selectTTempPermissionList" parameterType="TTempPermission" resultMap="TTempPermissionResult">
+        <include refid="selectTTempPermissionVo"/>
+        <where>
+            <if test="loginName != null  and loginName != ''"> and u.login_name like concat('%', #{loginName}, '%')</if>
+            <if test="userName != null  and userName != ''"> and u.user_name like concat('%', #{userName}, '%')</if>
+            <if test="deptId != null "> and d.dept_id = #{deptId}</if>
+            <if test="endTime != null "> and TO_DAYS(NOW())-TO_DAYS(end_time) >= -7</if>
+        </where>
+        order by t.start_time desc, t.end_time asc
+    </select>
+
+    <select id="selectTTempPermissionById" parameterType="Long" resultMap="TTempPermissionResult">
+        <include refid="selectTTempPermissionVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertTTempPermission" parameterType="TTempPermission" useGeneratedKeys="true" keyProperty="id">
+        insert into t_temp_permission
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="userId != null">user_id,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="startTime != null">start_time,</if>
+            <if test="endTime != null">end_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="userId != null">#{userId},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="startTime != null">#{startTime},</if>
+            <if test="endTime != null">#{endTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTTempPermission" parameterType="TTempPermission">
+        update t_temp_permission
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="startTime != null">start_time = #{startTime},</if>
+            <if test="endTime != null">end_time = #{endTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteTTempPermissionById" parameterType="Long">
+        delete from t_temp_permission where id = #{id}
+    </delete>
+
+    <delete id="deleteTTempPermissionByIds" parameterType="String">
+        delete from t_temp_permission where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+</mapper>

+ 51 - 0
mybusiness/src/main/resources/mapper/system/TempPerUserMapper.xml

@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.sooka.system.mapper.TempPerUserMapper">
+
+    <resultMap type="TempPerUser" id="TempPerUserResult">
+        <result property="deptId"     column="dept_id"     />
+        <result property="deptName"   column="dept_name"   />
+        <collection  property="users"   javaType="java.util.List"        resultMap="UserResult" />
+    </resultMap>
+
+    <resultMap id="UserResult" type="SysUser">
+        <id     property="userId"       column="user_id"      />
+        <result property="deptId"       column="dept_id"      />
+        <result property="loginName"    column="login_name"   />
+        <result property="userName"     column="user_name"    />
+        <result property="userType"     column="user_type"    />
+        <result property="email"        column="email"        />
+        <result property="phonenumber"  column="phonenumber"  />
+        <result property="sex"          column="sex"          />
+        <result property="avatar"       column="avatar"       />
+        <result property="password"     column="password"     />
+        <result property="salt"         column="salt"         />
+        <result property="status"       column="status"       />
+        <result property="delFlag"      column="del_flag"     />
+        <result property="loginIp"      column="login_ip"     />
+        <result property="loginDate"    column="login_date"   />
+        <result property="createBy"     column="create_by"    />
+        <result property="createTime"   column="create_time"  />
+        <result property="updateBy"     column="update_by"    />
+        <result property="updateTime"   column="update_time"  />
+        <result property="remark"       column="remark"       />
+    </resultMap>
+
+    <select id="listUser" resultMap="TempPerUserResult">
+        SELECT
+            d.dept_id,
+            d.dept_name,
+            u.user_id,
+            u.user_name
+        FROM
+            sys_dept d
+        LEFT JOIN sys_user u ON d.dept_id = u.dept_id
+        WHERE
+            user_id != ""
+    </select>
+
+
+
+</mapper>

+ 81 - 0
mybusiness/src/main/resources/templates/system/tempPer/add.html

@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
+<head>
+    <th:block th:include="include :: header('新增调阅用户')" />
+    <th:block th:include="include :: datetimepicker-css" />
+    <th:block th:include="include :: select2-css" />
+</head>
+<body class="white-bg">
+    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
+        <form class="form-horizontal m" id="form-tempPer-add">
+            <div class="form-group">
+                <label class="col-sm-3 control-label">起止时间:</label>
+                <div class="col-sm-8">
+                    <div class="input-group date">
+                        <input name="duration" id="duration" class="form-control" placeholder="请选择起止时间" required type="text">
+                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                    </div>
+                </div>
+            </div>
+            <div class="form-group">
+                <label class="col-sm-3 control-label">选择用户:</label>
+                <div class="col-sm-8">
+                    <select class="form-control select2-multiple" name="users" id="users" placeholder="请选择用户" multiple>
+
+                    </select>
+                </div>
+            </div>
+        </form>
+    </div>
+    <th:block th:include="include :: footer" />
+    <th:block th:include="include :: datetimepicker-js" />
+    <th:block th:include="include :: select2-js" />
+    <script th:inline="javascript">
+        var prefix = ctx + "system/tempPer"
+
+        $(function() {
+            /** 范围选择日期框 **/
+            layui.use('laydate', function(){
+                var laydate = layui.laydate;
+                laydate.render({
+                    elem: '#duration',
+                    range: true
+                });
+            });
+            /** 查询用户列表并构建一个分组多选下拉 **/
+            queryAndMakeUserSelect();
+        });
+
+        function queryAndMakeUserSelect(){
+            let url = '/system/tempPer/listUser';
+            let options = '';
+            $.ajax({
+                url: url,
+                type: "post",
+                success: function(result) {
+                    for(let i=0;i<result.length;i++){
+                        let optgroup = '';
+                        optgroup += '<optgroup label="--------'+result[i].deptName+'--------">';
+                        for(let j=0;j<result[i].users.length;j++){
+                            optgroup += '<option value="'+result[i].users[j].userId+'">'+result[i].users[j].userName+'</option>';
+                        }
+                        optgroup += '</optgroup>';
+                        options += optgroup;
+                    }
+                    $("#users").append(options);
+                }
+            })
+        }
+
+        $("#form-tempPer-add").validate({
+            focusCleanup: true
+        });
+
+        function submitHandler() {
+            if ($.validate.form()) {
+                $.operate.save(prefix + "/add", $('#form-tempPer-add').serialize());
+            }
+        }
+    </script>
+</body>
+</html>

+ 76 - 0
mybusiness/src/main/resources/templates/system/tempPer/edit.html

@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
+<head>
+    <th:block th:include="include :: header('修改tempPer')" />
+    <th:block th:include="include :: datetimepicker-css" />
+</head>
+<body class="white-bg">
+    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
+        <form class="form-horizontal m" id="form-tempPer-edit" th:object="${tTempPermission}">
+            <input name="id" th:field="*{id}" type="hidden">
+            <div class="form-group">
+                <label class="col-sm-3 control-label">用户昵称:</label>
+                <div class="col-sm-8">
+                    <input name="userName" th:field="*{userName}" class="form-control" th:disabled="true" type="text">
+                </div>
+            </div>
+            <div class="form-group">
+                <label class="col-sm-3 control-label">登录账号:</label>
+                <div class="col-sm-8">
+                    <input name="loginName" th:field="*{loginName}" class="form-control" th:disabled="true" type="text">
+                </div>
+            </div>
+            <div class="form-group">
+                <label class="col-sm-3 control-label">所属部门:</label>
+                <div class="col-sm-8">
+                    <input name="deptName" th:field="*{deptName}" class="form-control" th:disabled="true" type="text">
+                </div>
+            </div>
+            <div class="form-group">
+                <label class="col-sm-3 control-label is-required">开始时间:</label>
+                <div class="col-sm-8">
+                    <div class="input-group date">
+                        <input required name="startTime" th:value="${#dates.format(tTempPermission.startTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
+                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                    </div>
+                </div>
+            </div>
+            <div class="form-group">
+                <label class="col-sm-3 control-label is-required">结束时间:</label>
+                <div class="col-sm-8">
+                    <div class="input-group date">
+                        <input required name="endTime" th:value="${#dates.format(tTempPermission.endTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
+                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
+                    </div>
+                </div>
+            </div>
+        </form>
+    </div>
+    <th:block th:include="include :: footer" />
+    <th:block th:include="include :: datetimepicker-js" />
+    <script th:inline="javascript">
+        var prefix = ctx + "system/tempPer";
+        $("#form-tempPer-edit").validate({
+            focusCleanup: true
+        });
+
+        function submitHandler() {
+            if ($.validate.form()) {
+                $.operate.save(prefix + "/edit", $('#form-tempPer-edit').serialize());
+            }
+        }
+
+        $("input[name='startTime']").datetimepicker({
+            format: "yyyy-mm-dd",
+            minView: "month",
+            autoclose: true
+        });
+
+        $("input[name='endTime']").datetimepicker({
+            format: "yyyy-mm-dd",
+            minView: "month",
+            autoclose: true
+        });
+    </script>
+</body>
+</html>

+ 178 - 0
mybusiness/src/main/resources/templates/system/tempPer/tempPer.html

@@ -0,0 +1,178 @@
+<!DOCTYPE html>
+<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
+<head>
+    <th:block th:include="include :: header('tempPer列表')" />
+</head>
+<body class="gray-bg">
+     <div class="container-div">
+        <div class="row">
+            <div class="col-sm-12 search-collapse">
+                <form id="formId">
+                    <div class="select-list">
+                        <ul>
+                            <li>
+                                <label>登录账号:</label>
+                                <input type="text" name="loginName"/>
+                            </li>
+                            <li>
+                                <label>用户昵称:</label>
+                                <input type="text" name="userName"/>
+                            </li>
+                            <li>
+                                <label>所属部门:</label>
+                                <input type="text" name="deptName" onclick="selectDeptTree()" id="treeName" placeholder="请选择归属部门"/>
+                            </li>
+                            <li>
+                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
+                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
+                            </li>
+                        </ul>
+                    </div>
+                </form>
+            </div>
+
+            <div class="btn-group-sm" id="toolbar" role="group">
+                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:tempPer:add">
+                    <i class="fa fa-plus"></i> 添加
+                </a>
+                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:tempPer:edit">
+                    <i class="fa fa-edit"></i> 修改
+                </a>
+                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:tempPer:remove">
+                    <i class="fa fa-remove"></i> 删除
+                </a>
+                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:tempPer:export">
+                    <i class="fa fa-download"></i> 导出
+                </a>
+            </div>
+            <div class="col-sm-12 select-table table-striped">
+                <table id="bootstrap-table"></table>
+            </div>
+        </div>
+    </div>
+    <th:block th:include="include :: footer" />
+    <script th:inline="javascript">
+        let editFlag = [[${@permission.hasPermi('system:tempPer:edit')}]];
+        let removeFlag = [[${@permission.hasPermi('system:tempPer:remove')}]];
+        let prefix = ctx + "system/tempPer";
+
+        $(function() {
+            let options = {
+                url: prefix + "/list",
+                createUrl: prefix + "/add",
+                updateUrl: prefix + "/edit/{id}",
+                removeUrl: prefix + "/remove",
+                exportUrl: prefix + "/export",
+                modalName: "调阅用户",
+                columns: [{
+                    checkbox: true
+                },
+                {
+                    field: 'id',
+                    title: '主键',
+                    visible: false
+                },
+                {
+                    field: 'userId',
+                    title: '用户ID',
+                    visible: false
+                },
+                {
+                    field: 'loginName',
+                    title: '登录账号'
+                },
+                {
+                    field: 'userName',
+                    title: '用户昵称'
+                },
+                {
+                    field: 'deptId',
+                    title: '部门ID',
+                    visible: false
+                },
+                {
+                    field: 'deptName',
+                    title: '所属部门'
+                },
+                {
+                    field: 'startTime',
+                    title: '开始时间'
+                },
+                {
+                    field: 'endTime',
+                    title: '结束时间'
+                },
+                {
+                    field: 'remainingDays',
+                    title: '剩余天数',
+                    formatter: function(value, item, index) {
+                        if (value > 14) {
+                            return '<span class="label label-primary">'+value+'天</span>';
+                        }
+                        else if (14 >= value && value > 7) {
+                            return '<span class="label label-warning">'+value+'天</span>';
+                        }
+                        else if (value <= 7) {
+                            return '<span class="label label-danger">'+value+'天</span>';
+                        }
+                    }
+                },
+                {
+                    title: '操作',
+                    align: 'center',
+                    formatter: function(value, row, index) {
+                        let actions = [];
+                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
+                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
+                        return actions.join('');
+                    }
+                }]
+            };
+            $.table.init(options);
+        });
+
+        function format(fmt){
+            let o = {
+                "M+" : this.getMonth()+1, //月份
+                "d+" : this.getDate(), //日
+                "h+" : this.getHours()%12 == 0 ? 12 : this.getHours()%12, //小时
+                "H+" : this.getHours(), //小时
+                "m+" : this.getMinutes(), //分
+                "s+" : this.getSeconds(), //秒
+                "q+" : Math.floor((this.getMonth()+3)/3), //季度
+                "S" : this.getMilliseconds() //毫秒
+            };
+            if(/(y+)/.test(fmt))
+                fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
+            for(let k in o)
+                if(new RegExp("("+ k +")").test(fmt))
+                    fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
+            return fmt;
+        }
+
+        /*用户管理-新增-选择部门树*/
+        function selectDeptTree() {
+            var treeId = $("#treeId").val();
+            var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
+            var url = ctx + "system/dept/selectDeptTree/" + deptId;
+            var options = {
+                title: '选择部门',
+                width: "380",
+                url: url,
+                callBack: doSubmit
+            };
+            $.modal.openOptions(options);
+        }
+
+        function doSubmit(index, layero){
+            var tree = layero.find("iframe")[0].contentWindow.$._tree;
+            if ($.tree.notAllowParents(tree)) {
+                var body = layer.getChildFrame('body', index);
+                $("#treeId").val(body.find('#treeId').val());
+                $("#treeName").val(body.find('#treeName').val());
+                layer.close(index);
+            }
+        }
+    </script>
+</body>
+</html>