trigger: verify valid_volumes after runner restart

This commit is contained in:
runner
2026-08-26 16:23:30 +08:00
commit 46d1c1d7ed
64 changed files with 4513 additions and 0 deletions
@@ -0,0 +1,39 @@
package com.freedom.admin.utils;
import lombok.Data;
/**
* @description: TODO
* @author: zhangjiaxun
* @date: 2021年03月13日 22:29:00
*/
@Data
public class AlipayBean {
/**
* 商户订单号,必填
* */
private String out_trade_no;
/**
* 订单名称,必填
* */
private String subject;
/**
* 订单名称,必填
* */
private StringBuffer total_amount;
/**
* 商品描述,可空
* */
private String body;
/**
* 超时时间参数
* */
private String timeout_express;
private String product_code;
}
@@ -0,0 +1,75 @@
package com.freedom.admin.utils;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
* @author zhangjiaxun
* @date 2021/2/1 10:06
* @description JwtUtils
*/
@Component
public class JwtUtils {
@Value("${jwt.secret}")
private String secret;
@Value("${jwt.expiration}")
private Long expiration;
/**
* 创建token
*
* @param username 用户名
* @return token令牌
* */
public String generateToken(String username){
return Jwts.builder()
.signWith(SignatureAlgorithm.HS512,secret)
.setSubject(username)
.setIssuedAt(new Date())
.setExpiration(new Date(System.currentTimeMillis() + expiration * 1000))
.compact();
}
/**
* 获取body
*
* @param token 令牌
* @return body包含您想要签署的任何信息
* */
public Claims getBody(String token){
return Jwts.parser()
.setSigningKey(secret)
.parseClaimsJws(token).getBody();
}
/**
* 是否已过期
*
* @param token 令牌
* @return 是否过期
* */
public boolean isExpiration(String token){
return getBody(token)
.getExpiration()
.before(new Date());
}
/**
* 获取用户名
*
* @param token 令牌
* @return username用户名
* */
public String getUsernameFormToken(String token){
return getBody(token)
.getSubject();
}
}
@@ -0,0 +1,73 @@
package com.freedom.admin.utils;
import java.util.ArrayList;
import java.util.List;
/**
* @description: 相似度计算工具类
* @author: zhangjiaxun
* @date: 2021年04月11日 16:07:00
*/
public class SimilarityUtil {
public static double similarity(List<Double> va, List<Double> vb) {
if (va.size() > vb.size()) {
int temp = va.size() - vb.size();
for (int i = 0; i < temp; i++) {
vb.add(0.00);
}
} else if (va.size() < vb.size()) {
int temp = vb.size() - va.size();
for (int i = 0; i < temp; i++) {
va.add(0.00);
}
}
int size = va.size();
double simVal = 0.00;
double num = 0.00;
double den = 1.00;
double powaSum = 0.00;
double powbSum = 0.00;
for (int i = 0; i < size; i++) {
double a = Double.parseDouble(va.get(i).toString());
double b = Double.parseDouble(vb.get(i).toString());
num = num + a * b;
powaSum = powaSum + Math.pow(a, 2);
powbSum = powbSum + Math.pow(b, 2);
}
double sqrta = Math.sqrt(powaSum);
double sqrtb = Math.sqrt(powbSum);
den = sqrta * sqrtb;
simVal = num / den;
return simVal;
}
public static void main(String[] args) {
double a[] = {(double) 4.5, 5, 5, 5,0};
double b[] = {(double) 3.5, 5, 5, 5,0};
ArrayList vitem = new ArrayList();
ArrayList va = new ArrayList();
ArrayList vb = new ArrayList();
for (int i = 0; i < a.length; i++){
va.add(new Double(a[i]));
vb.add(new Double(b[i]));
}
System.out.print("小红");
System.out.println(va);
System.out.print("xxx");
System.out.println(vb);
double simVal = SimilarityUtil.similarity(va, vb);
System.out.println("The sim value is:" + simVal);
}
}