Quellcode durchsuchen

static方法调用service

LIVE_YE vor 2 Jahren
Ursprung
Commit
632ec58b50

+ 2 - 2
boman-web-core/pom.xml

@@ -145,12 +145,12 @@
             <artifactId>boman-api-jflow</artifactId>
             <version>2.5.0-SNAPSHOT</version>
         </dependency>
-        <dependency>
+        <!--<dependency>
             <groupId>cn.hutool</groupId>
             <artifactId>hutool-core</artifactId>
             <version>5.6.5</version>
             <scope>compile</scope>
-        </dependency>
+        </dependency>-->
 
 
         <!--阿里短信服务-->

+ 28 - 6
boman-web-core/src/main/java/com/boman/web/core/utils/GjzwfwptSignUtil.java

@@ -1,9 +1,17 @@
 package com.boman.web.core.utils;
 
 
+import cn.hutool.extra.spring.SpringUtil;
 import cn.hutool.http.HttpRequest;
 import com.alibaba.fastjson.JSONObject;
+import com.boman.common.core.utils.StringUtils;
 import com.boman.common.redis.service.RedisService;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
 import java.util.concurrent.TimeUnit;
 /**
@@ -11,10 +19,22 @@ import java.util.concurrent.TimeUnit;
  * @author 86150
  *
  */
+@Component
 public class GjzwfwptSignUtil {
 
 	@Resource
-	static RedisService redisService;
+	private RedisService redisService;
+
+	private static GjzwfwptSignUtil gjzwfwptSignUtil;
+
+	@PostConstruct
+	public void init(){
+		gjzwfwptSignUtil= this;
+		gjzwfwptSignUtil.redisService = this.redisService;
+	}
+
+
+
 	/**
 	 * 获取签名
 	 * 1、sid+rid+rtime+appkey 加密生成gjzwfwpt_sign
@@ -29,8 +49,8 @@ public class GjzwfwptSignUtil {
 	public static String getGjzwfwptSign(String sid, String rid,
 			String appkey) {
 
-		String gjzwfwpt_sign = redisService.getCacheObject(appkey + ":gjzwfwpt_sign");
-		if (null == gjzwfwpt_sign) {
+		String gjzwfwpt_sign = gjzwfwptSignUtil.redisService.getCacheObject(appkey + ":gjzwfwpt_sign");
+		if (StringUtils.isEmpty(gjzwfwpt_sign)) {
 			// 1、sid+rid+rtime+appkey 加密生成gjzwfwpt_sign
 			Long rtime = System.currentTimeMillis();
 			String content = sid + rid + rtime; // 内容拼接
@@ -60,8 +80,8 @@ public class GjzwfwptSignUtil {
 						gjzwfwpt_sign = AESUtil.sign(content, appsecret);
 					}
 					// Tips:gjzwfwpt_sign有效期10分钟
-					redisService.setCacheObject(appkey + ":gjzwfwpt_sign",gjzwfwpt_sign, 600L, TimeUnit.SECONDS );
-					redisService.setCacheObject(appkey + ":gjzwfwpt_rtime",rtime.toString(), 600L, TimeUnit.SECONDS);
+					gjzwfwptSignUtil.redisService.setCacheObject(appkey + ":gjzwfwpt_sign",gjzwfwpt_sign, 600L, TimeUnit.SECONDS );
+					gjzwfwptSignUtil.redisService.setCacheObject(appkey + ":gjzwfwpt_rtime",rtime.toString(), 600L, TimeUnit.SECONDS);
 					System.out.println("最终签名"+gjzwfwpt_sign);
 					return gjzwfwpt_sign;
 				} else {
@@ -75,8 +95,10 @@ public class GjzwfwptSignUtil {
 	}
 	
 	public static String getGjzwfwptRtime(String appkey) {
-		String gjzwfwpt_rtime = redisService.getCacheObject(appkey + ":gjzwfwpt_rtime");
+		String gjzwfwpt_rtime = gjzwfwptSignUtil.redisService.getCacheObject(appkey + ":gjzwfwpt_rtime");
 		System.out.println(gjzwfwpt_rtime);
 		return gjzwfwpt_rtime;
 	}
+
+
 }

+ 1 - 0
boman-web-core/src/main/resources/mapper/AccountingDateMapper.xml

@@ -104,6 +104,7 @@
             <if test="cjssxq != null  and cjssxq != ''">and cjssxq like concat('%',#{cjssxq}, '%')</if>
             <if test="cjqxqh != null  and cjqxqh != ''">and cjqxqh = #{cjqxqh}</if>
         </where>
+        order by cjsj desc
     </select>