From 3519348cafe6d2e34bc9e1d7d6c231ab16b0af59 Mon Sep 17 00:00:00 2001
From: admin <2780501319@qq.com>
Date: 星期一, 22 十一月 2021 00:25:10 +0800
Subject: [PATCH] 接口编写

---
 app/src/main/java/com/yeshi/location/app/aop/SignValidate.java |  113 --------------------------------------------------------
 1 files changed, 0 insertions(+), 113 deletions(-)

diff --git a/app/src/main/java/com/yeshi/location/app/aop/SignValidate.java b/app/src/main/java/com/yeshi/location/app/aop/SignValidate.java
index 8443410..5701c07 100644
--- a/app/src/main/java/com/yeshi/location/app/aop/SignValidate.java
+++ b/app/src/main/java/com/yeshi/location/app/aop/SignValidate.java
@@ -1,25 +1,14 @@
 package com.yeshi.location.app.aop;
 
-import com.yeshi.location.app.entity.APPPlatform;
 import com.yeshi.location.app.entity.config.SystemConfigKey;
-import com.yeshi.location.app.service.inter.config.SystemConfigService;
-import com.yeshi.location.app.utils.ApiCodeConstant;
-import com.yeshi.location.app.utils.SystemInfoUtil;
 import com.yeshi.location.app.vo.AcceptData;
 import net.sf.json.JSONObject;
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
 import org.aspectj.lang.annotation.Aspect;
 import org.springframework.core.annotation.Order;
 import org.springframework.stereotype.Component;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-import org.yeshi.utils.JsonUtil;
 import org.yeshi.utils.StringUtil;
 
-import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import java.io.PrintWriter;
 import java.util.*;
 
 //瀹㈡埛绔帴鍙g鍚嶉獙璇�
@@ -27,75 +16,6 @@
 @Aspect
 @Order(2)
 public class SignValidate {
-
-    public static final String EDP = "execution(* com.yeshi.location.app.controller.client..*.*(..))";
-
-    @Resource
-    private SystemConfigService systemConfigService;
-
-
-    @Around(EDP)
-    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
-        Object[] args = joinPoint.getArgs();
-        PrintWriter out = null;
-        ServletRequestAttributes servletContainer = (ServletRequestAttributes) RequestContextHolder
-                .getRequestAttributes();
-
-        out = servletContainer.getResponse().getWriter();
-        HttpServletRequest request = servletContainer.getRequest();
-
-        AcceptData acceptData = null;
-        for (Object obj : args) {
-            if (obj instanceof AcceptData) {
-                acceptData = (AcceptData) obj;
-            } else if (obj instanceof HttpServletRequest) {
-                request = (HttpServletRequest) obj;
-            }
-        }
-
-        if (acceptData == null) {
-            out.print(JsonUtil.loadFalseResult(ApiCodeConstant.CODE_FAIL_SIGN_ERROR, "绛惧悕閿欒"));
-            return null;
-        }
-
-        boolean isRight = signIsRight(request, acceptData);
-        // 绛惧悕鏄惁姝g‘
-        if (isRight) {
-            // 鍒ゆ柇绛惧悕瓒呮椂
-            if (Math.abs((acceptData.getTimestamp() - System.currentTimeMillis())) > 1000 * 60 * 10) {
-                out.print(JsonUtil.loadFalseResult(ApiCodeConstant.CODE_FAIL_OUT_TIME, "鏃堕棿閿欒"));
-                return null;
-            }
-
-            if (acceptData != null) {
-                acceptData.setSystem(SystemInfoUtil.getSystem(acceptData.getPlatform(), acceptData.getPackages()));
-            }
-//            final String url = request.getRequestURI();
-//            final Map<String, String[]> params = request.getParameterMap();
-//            ThreadUtil.run(new Runnable() {
-//                @Override
-//                public void run() {
-//                    // 璁板綍璇锋眰鏃ュ織
-//                    LogHelper.requestInfo(url, params);
-//                }
-//            });
-
-            Object obj = null;
-            try {
-                long startTime = System.currentTimeMillis();
-                obj = joinPoint.proceed(args);
-
-
-            } catch (Throwable e) {
-                out.print(JsonUtil.loadFalseResult(ApiCodeConstant.CODE_ERROR_IN_SERVER, "鏈嶅姟鍣ㄥ唴閮ㄩ敊璇�"));
-                return null;
-            }
-            return obj;
-        } else {
-            out.print(JsonUtil.loadFalseResult(ApiCodeConstant.CODE_FAIL_SIGN_ERROR, "绛惧悕閿欒"));
-            return null;
-        }
-    }
 
     private String getHttpServletParams(HttpServletRequest request) {
         if (request == null) {
@@ -119,39 +39,6 @@
         return "";
     }
 
-
-    /**
-     * 鍒ゆ柇绛惧悕鐨勬纭�� Android version>50
-     *
-     * @param request
-     * @return
-     */
-    private boolean signIsRight(HttpServletRequest request, AcceptData acceptData) {
-        Map<String, String[]> map = request.getParameterMap();
-        Iterator<String> its = map.keySet().iterator();
-        List<String> list = new ArrayList<>();
-
-        while (its.hasNext()) {
-            String key = its.next();
-            if (key.equalsIgnoreCase("sign") || key.equalsIgnoreCase("callback") || key.equalsIgnoreCase("_")) {
-                continue;
-            }
-            String[] values = map.get(key);
-            list.add(key + "=" + values[0]);
-        }
-        Collections.sort(list);
-        String str = "";
-        for (String st : list) {
-            str += st + "&";
-        }
-        String key = systemConfigService.getValueCache(acceptData.getSystem(), SystemConfigKey.signKey);
-        String sign = StringUtil.Md5(str + key);
-        if (sign.equalsIgnoreCase(request.getParameter("sign") + "")) {
-            return true;
-        } else {
-            return false;
-        }
-    }
 
 
 }

--
Gitblit v1.8.0