wenhongquan há 3 anos atrás
pai
commit
ae235e0f4c

+ 3 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TableDetectionController.java

@@ -119,6 +119,7 @@ public class TableDetectionController extends BaseController
      * @return
      */
     @PostMapping("/distributed")
+    @PreAuthorize("@ss.hasPermi('system:detection:distributed')")
     public AjaxResult detectionDistributed(@RequestBody TblDetectionLog tbldetectionLog){
         if(tbldetectionLog==null || tbldetectionLog.getDetectionId()==null || tbldetectionLog.getLogDes()==null){
             return error("表单不完整");
@@ -145,6 +146,7 @@ public class TableDetectionController extends BaseController
      * @return
      */
     @PostMapping("/feedback")
+    @PreAuthorize("@ss.hasPermi('system:detection:feedback')")
     public AjaxResult detectionFeedback(@RequestBody TblDetectionLog tbldetectionLog){
         if(tbldetectionLog==null || tbldetectionLog.getDetectionId()==null || tbldetectionLog.getLogDes()==null){
             return error("表单不完整");
@@ -171,6 +173,7 @@ public class TableDetectionController extends BaseController
      * @return
      */
     @PostMapping("/complete")
+    @PreAuthorize("@ss.hasPermi('system:detection:complete')")
     public AjaxResult detectionComplete(@RequestBody TblDetectionLog tbldetectionLog){
         if(tbldetectionLog==null || tbldetectionLog.getDetectionId()==null || tbldetectionLog.getLogDes()==null){
             return error("表单不完整");

+ 3 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TblMaintainController.java

@@ -122,6 +122,7 @@ public class TblMaintainController extends BaseController
      * @return
      */
     @PostMapping("/distributed")
+    @PreAuthorize("@ss.hasPermi('system:maintain:distributed')")
     public AjaxResult maintainDistributed(@RequestBody TblMaintainLog tblMaintainLog){
         if(tblMaintainLog==null || tblMaintainLog.getMaintainId()==null || tblMaintainLog.getLogDes()==null){
             return error("表单不完整");
@@ -148,6 +149,7 @@ public class TblMaintainController extends BaseController
      * @return
      */
     @PostMapping("/feedback")
+    @PreAuthorize("@ss.hasPermi('system:maintain:feedback')")
     public AjaxResult maintainFeedback(@RequestBody TblMaintainLog tblMaintainLog){
         if(tblMaintainLog==null || tblMaintainLog.getMaintainId()==null || tblMaintainLog.getLogDes()==null){
             return error("表单不完整");
@@ -174,6 +176,7 @@ public class TblMaintainController extends BaseController
      * @return
      */
     @PostMapping("/complete")
+    @PreAuthorize("@ss.hasPermi('system:maintain:complete')")
     public AjaxResult maintainComplete(@RequestBody TblMaintainLog tblMaintainLog){
         if(tblMaintainLog==null || tblMaintainLog.getMaintainId()==null || tblMaintainLog.getLogDes()==null){
             return error("表单不完整");

+ 5 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TblTaskController.java

@@ -667,6 +667,7 @@ public class TblTaskController extends BaseController
      * @return
      */
     @PostMapping("/distributed")
+    @PreAuthorize("@ss.hasPermi('system:task:distributed')")
     public AjaxResult taskDistributed(@RequestBody TblTaskLog tblTaskLog){
         if(tblTaskLog==null || tblTaskLog.getTaskId()==null || tblTaskLog.getLogDes()==null){
             return error("表单不完整");
@@ -688,6 +689,7 @@ public class TblTaskController extends BaseController
     }
 
     @PostMapping("/cz")
+    @PreAuthorize("@ss.hasPermi('system:task:cz')")
     public AjaxResult taskcz(@RequestBody TblTaskLog tblTaskLog){
         if(tblTaskLog==null || tblTaskLog.getTaskId()==null || tblTaskLog.getLogDes()==null){
             return error("表单不完整");
@@ -709,6 +711,7 @@ public class TblTaskController extends BaseController
     }
 
     @PostMapping("/gz")
+    @PreAuthorize("@ss.hasPermi('system:task:gz')")
     public AjaxResult taskgz(@RequestBody TblTaskLog tblTaskLog){
         if(tblTaskLog==null || tblTaskLog.getTaskId()==null || tblTaskLog.getLogDes()==null){
             return error("表单不完整");
@@ -730,6 +733,7 @@ public class TblTaskController extends BaseController
     }
 
     @PostMapping("/hc")
+    @PreAuthorize("@ss.hasPermi('system:task:hc')")
     public AjaxResult taskhc(@RequestBody TblTaskLog tblTaskLog){
         if(tblTaskLog==null || tblTaskLog.getTaskId()==null || tblTaskLog.getLogDes()==null){
             return error("表单不完整");
@@ -757,6 +761,7 @@ public class TblTaskController extends BaseController
      * @return
      */
     @PostMapping("/close")
+    @PreAuthorize("@ss.hasPermi('system:task:close')")
     public AjaxResult taskClose(@RequestBody TblTaskLog tblTaskLog){
         if(tblTaskLog==null || tblTaskLog.getTaskId()==null || tblTaskLog.getLogDes()==null){
             return error("表单不完整");

+ 81 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/DingDing.java

@@ -0,0 +1,81 @@
+package com.ruoyi.common.utils;
+import java.net.URL;
+import java.net.URLDecoder;
+import java.security.MessageDigest;
+import java.util.Formatter;
+import java.util.Random;
+
+public class DingDing {
+        /**
+         * 计算dd.config的签名参数
+         *
+         * @param jsticket  通过微应用appKey获取的jsticket
+         * @param nonceStr  自定义固定字符串
+         * @param timeStamp 当前时间戳
+         * @param url       调用dd.config的当前页面URL
+         * @return
+         * @throws Exception
+         */
+        public static String sign(String jsticket, String nonceStr, long timeStamp, String url) throws Exception {
+            String plain = "jsapi_ticket=" + jsticket + "&noncestr=" + nonceStr + "&timestamp=" + String.valueOf(timeStamp)
+                    + "&url=" + decodeUrl(url);
+            try {
+                MessageDigest sha1 = MessageDigest.getInstance("SHA-256");
+                sha1.reset();
+                sha1.update(plain.getBytes("UTF-8"));
+                return byteToHex(sha1.digest());
+            } catch (Exception e) {
+                throw new Exception(e.getMessage());
+            }
+        }
+
+        // 字节数组转化成十六进制字符串
+        private static String byteToHex(final byte[] hash) {
+            Formatter formatter = new Formatter();
+            for (byte b : hash) {
+                formatter.format("%02x", b);
+            }
+            String result = formatter.toString();
+            formatter.close();
+            return result;
+        }
+
+        /**
+         * 因为ios端上传递的url是encode过的,android是原始的url。开发者使用的也是原始url,
+         * 所以需要把参数进行一般urlDecode
+         *
+         * @param url
+         * @return
+         * @throws Exception
+         */
+        private static String decodeUrl(String url) throws Exception {
+            URL urler = new URL(url);
+            StringBuilder urlBuffer = new StringBuilder();
+            urlBuffer.append(urler.getProtocol());
+            urlBuffer.append(":");
+            if (urler.getAuthority() != null && urler.getAuthority().length() > 0) {
+                urlBuffer.append("//");
+                urlBuffer.append(urler.getAuthority());
+            }
+            if (urler.getPath() != null) {
+                urlBuffer.append(urler.getPath());
+            }
+            if (urler.getQuery() != null) {
+                urlBuffer.append('?');
+                urlBuffer.append(URLDecoder.decode(urler.getQuery(), "utf-8"));
+            }
+            return urlBuffer.toString();
+        }
+
+        public static String getRandomStr(int count) {
+            String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+            Random random = new Random();
+            StringBuffer sb = new StringBuffer();
+            for (int i = 0; i < count; i++) {
+                int number = random.nextInt(base.length());
+                sb.append(base.charAt(number));
+            }
+            return sb.toString();
+        }
+
+}