Compare commits
10 Commits
zjut-1.1.2
...
zjut/1.1.6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70178b7f0d | ||
|
|
ca96685022 | ||
|
|
0e6bee4714 | ||
|
|
ae67cc53ec | ||
|
|
419cb06ff6 | ||
|
|
384ac928e3 | ||
|
|
130cd45de2 | ||
|
|
6840faa9d8 | ||
|
|
b6caecf140 | ||
|
|
fdcb1614cc |
25
.gitea/workflows/mvn-deploy.yaml
Normal file
25
.gitea/workflows/mvn-deploy.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
## 工作流触发时机
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
|
||||
## 任务名称
|
||||
local-deploy:
|
||||
|
||||
## 任务执行的服务器
|
||||
runs-on: tiesheng-local
|
||||
|
||||
## 任务步骤
|
||||
steps:
|
||||
|
||||
## 检出代码(固定配置)
|
||||
- name: Check out repository code
|
||||
uses: https://git.tieshengkeji.com/actions/checkout@v4
|
||||
|
||||
## maven打包
|
||||
- name: Maven deploy
|
||||
run: |
|
||||
mvn deploy
|
||||
@@ -1,17 +0,0 @@
|
||||
stages:
|
||||
- deploy
|
||||
|
||||
deploy-jar:
|
||||
stage: deploy
|
||||
tags:
|
||||
- zengos
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
script:
|
||||
- mvn clean deploy -Dmaven.test.skip -DaltDeploymentRepository=master::default::file:$TAG_REPO_FOLDER
|
||||
- cd $TAG_REPO_FOLDER
|
||||
- git checkout master
|
||||
- git pull
|
||||
- git add .
|
||||
- git commit -m "deploy $CI_PROJECT_NAME $CI_COMMIT_TAG"
|
||||
- git push origin master
|
||||
31
pom.xml
31
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>springboot-parent</name>
|
||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||
@@ -57,55 +57,55 @@
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-database</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-login</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-web</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-util</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-platform</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-message</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-encrypt</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-poi</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -125,11 +125,18 @@
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>kepai-repo-plugin</id>
|
||||
<url>http://git.kepai365.com/tiesheng/repository/raw/master</url>
|
||||
<id>gitea</id>
|
||||
<url>https://git.tieshengkeji.com/api/packages/tieshengkeji/maven</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>gitea</id>
|
||||
<url>https://git.tieshengkeji.com/api/packages/tieshengkeji/maven</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-ademo</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//package com.tiesheng.demo.config;
|
||||
//
|
||||
//import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
//import org.springframework.security.core.GrantedAuthority;
|
||||
//import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
//import org.springframework.security.core.context.SecurityContextHolder;
|
||||
//import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
||||
//import org.springframework.web.filter.OncePerRequestFilter;
|
||||
//
|
||||
//import javax.servlet.FilterChain;
|
||||
//import javax.servlet.ServletException;
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import javax.servlet.http.HttpServletResponse;
|
||||
//import java.io.IOException;
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//public class JWTAuthenticationFilter extends OncePerRequestFilter {
|
||||
//
|
||||
// public JWTAuthenticationFilter(JwtTokenProvider tokenProvider) {
|
||||
// this.tokenProvider = tokenProvider;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
|
||||
// String authHeader = request.getHeader("Authorization");
|
||||
// if (authHeader != null && authHeader.startsWith("Bearer ")) {
|
||||
// String token = authHeader.substring(7);
|
||||
// String username = tokenProvider.getUsername(token);
|
||||
// if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {
|
||||
// if (tokenProvider.validateToken(token)) {
|
||||
// List<GrantedAuthority> authorities = new ArrayList<>();
|
||||
// // 根据你的应用程序需求设置权限
|
||||
// authorities.add(new SimpleGrantedAuthority("ROLE_USER"));
|
||||
// UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, null, authorities);
|
||||
// authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
|
||||
// SecurityContextHolder.getContext().setAuthentication(authenticationToken);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// filterChain.doFilter(request, response);
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,29 @@
|
||||
//package com.tiesheng.demo.config;
|
||||
//
|
||||
//import cn.hutool.extra.spring.SpringUtil;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
//import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletResponse;
|
||||
//
|
||||
//@Configuration
|
||||
//@EnableWebSecurity
|
||||
//public class TieshengSecurityAdapter extends WebSecurityConfigurerAdapter {
|
||||
//
|
||||
// @Override
|
||||
// protected void configure(HttpSecurity http) throws Exception {
|
||||
// SpringUtil.getBeanFactory().getA
|
||||
// http.csrf().disable() // JWT 通常与状态无关,因此 CSRF 保护不适用
|
||||
// .authorizeRequests()
|
||||
// .antMatchers("/login").permitAll() // 登录接口允许所有人访问
|
||||
// .anyRequest().authenticated() // 其他所有请求需要认证
|
||||
// .and()
|
||||
// .exceptionHandling()
|
||||
// .authenticationEntryPoint((request, response, authException) -> response.sendError(HttpServletResponse.SC_UNAUTHORIZED))
|
||||
// .and()
|
||||
// .addFilterBefore(new JWTAuthenticationFilter(tokenProvider), UsernamePasswordAuthenticationFilter.class);
|
||||
// }
|
||||
//}
|
||||
@@ -58,7 +58,6 @@ public class TestController {
|
||||
|
||||
@RequestMapping("/index")
|
||||
public ApiResp<String> index() {
|
||||
dbBackupConfig.dbBackup();
|
||||
return ApiResp.respOK("hello world");
|
||||
}
|
||||
|
||||
@@ -94,7 +93,7 @@ public class TestController {
|
||||
public ApiResp<MessageReqResp> sendMessage() {
|
||||
|
||||
MessageReqResp reqResp = coreMessageService.send(new UserChannel("13567116463", "sms"),
|
||||
JSONUtil.createObj().putOpt("code", "123456").putOpt("template_code", "SMS_154950909"));
|
||||
JSONUtil.createObj().putOpt("action", "sms-visitor-invite"));
|
||||
|
||||
return ApiResp.respOK(reqResp);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.tiesheng.demo.service;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.tiesheng.message.config.aliyun.AliyunSmsHandler;
|
||||
import com.tiesheng.message.pojos.AliyunTempParam;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class DemoSmsHandler implements AliyunSmsHandler {
|
||||
|
||||
@Override
|
||||
public AliyunTempParam handler(JSONObject obj) {
|
||||
|
||||
String action = obj.getStr("action");
|
||||
|
||||
AliyunTempParam param = new AliyunTempParam();
|
||||
param.setSignName("智慧校园");
|
||||
|
||||
if (Objects.equals(action, "sms-visitor-invite")) {
|
||||
param.setTemplateCode("SMS_276125463");
|
||||
param.setTemplateParam(JSONUtil.createObj()
|
||||
.putOpt("date", DateUtil.today())
|
||||
);
|
||||
}
|
||||
|
||||
return param;
|
||||
}
|
||||
}
|
||||
@@ -25,4 +25,5 @@ tiesheng:
|
||||
aliyun:
|
||||
access-key-id: LTAI5tJtbgBCnTY5eS4SmrTf
|
||||
access-key-secret: JIHqpRUFffCHhXaJEVvWN31WcexWqG
|
||||
sign-name: 阿里云短信测试
|
||||
encrypt:
|
||||
body: true
|
||||
|
||||
@@ -9,6 +9,7 @@ spring:
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 20MB
|
||||
max-request-size: 20MB
|
||||
web:
|
||||
resources:
|
||||
static-locations: classpath:/static/,file:static/
|
||||
@@ -24,3 +25,4 @@ tiesheng:
|
||||
token:
|
||||
ignore-paths:
|
||||
- /test/index
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-database</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-encrypt</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-login</artifactId>
|
||||
|
||||
@@ -27,7 +27,7 @@ public class TsTokenConfig {
|
||||
private String encryptKey = "%kIp9frQCu";
|
||||
private Integer expireHours = 48;
|
||||
private String[] ignorePaths;
|
||||
private boolean validLoginSign = false;
|
||||
private boolean validLoginSign = true;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,7 @@ public class UniqueIndexDTO extends LoginToInfo {
|
||||
if (StrUtil.isEmpty(getNo()) || getTimestamp() == null) {
|
||||
return false;
|
||||
}
|
||||
if ((DateUtil.currentSeconds() - getTimestamp()) > 60) {
|
||||
if ((DateUtil.currentSeconds() - getTimestamp()) > 10) {
|
||||
return false;
|
||||
}
|
||||
String mySign = getNo() + getTimestamp();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-message</artifactId>
|
||||
|
||||
@@ -3,10 +3,8 @@ package com.tiesheng.message.config.aliyun;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.extra.validation.ValidationUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
@@ -18,7 +16,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -103,7 +100,16 @@ public class AliyunSmsSender implements TieshengMessageSender {
|
||||
String signature = specialUrlEncode(digest);
|
||||
queryMap.put("Signature", signature);
|
||||
|
||||
return HttpUtil.get(ENDPOINT + "?Signature=" + signature + sortQueryStringTmp, 10 * 1000);
|
||||
String respBody = "";
|
||||
try {
|
||||
respBody = HttpUtil.get(ENDPOINT + "?Signature=" + signature + sortQueryStringTmp, 10 * 1000);
|
||||
} catch (Exception e) {
|
||||
respBody = JSONUtil.createObj()
|
||||
.putOpt("Code", "Error")
|
||||
.putOpt("Message", "消息通道异常")
|
||||
.toString();
|
||||
}
|
||||
return respBody;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-platform</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-poi</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-util</artifactId>
|
||||
|
||||
@@ -23,17 +23,26 @@ public class EncryptConfig {
|
||||
/**
|
||||
* 加解密对象
|
||||
*/
|
||||
private final SM4 sm4;
|
||||
private static SM4 sm4;
|
||||
|
||||
/**
|
||||
* 加密密钥
|
||||
*/
|
||||
private String key = "WmdUzPJXbngVNiaSsQrihg==";
|
||||
private String key = "Z1mn6fKe6ubnm5762KR3Cg==";
|
||||
private Integer saltSize = 8;
|
||||
private boolean body = false;
|
||||
|
||||
public EncryptConfig() {
|
||||
sm4 = SmUtil.sm4(Base64.decode(getKey()));
|
||||
|
||||
/**
|
||||
* 获取SM4对象
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private SM4 getSm4() {
|
||||
if (sm4 == null) {
|
||||
sm4 = SmUtil.sm4(Base64.decode(getKey()));
|
||||
}
|
||||
return sm4;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +55,7 @@ public class EncryptConfig {
|
||||
if (StrUtil.isEmpty(content)) {
|
||||
return "";
|
||||
}
|
||||
return sm4.encryptBase64(content);
|
||||
return getSm4().encryptBase64(content);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +67,7 @@ public class EncryptConfig {
|
||||
*/
|
||||
public String decrypt(String base64) {
|
||||
try {
|
||||
return sm4.decryptStr(base64);
|
||||
return getSm4().decryptStr(base64);
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
return base64;
|
||||
@@ -117,7 +126,8 @@ public class EncryptConfig {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// setter\getter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// ////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>zjut-1.1.6</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-web</artifactId>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.tiesheng.core.util;
|
||||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class CharacterUtils {
|
||||
|
||||
|
||||
/**
|
||||
* 移除特殊字符
|
||||
*
|
||||
* @param o 类
|
||||
*/
|
||||
public static void removeSymbol(Object o) {
|
||||
removeSymbol(o, "\n|\r|\t| ");
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除特殊字符
|
||||
*
|
||||
* @param o 类
|
||||
* @param searchStr 规则
|
||||
*/
|
||||
public static void removeSymbol(Object o, String searchStr) {
|
||||
JSONObject object = JSONUtil.parseObj(o, false);
|
||||
for (Map.Entry<String, Object> entry : object) {
|
||||
if (ObjectUtil.isEmpty(entry.getValue()) || StrUtil.equals("null", String.valueOf(entry.getValue()))) {
|
||||
entry.setValue("");
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isNotEmpty(entry.getKey())) {
|
||||
entry.setValue(StrUtil.trim(StrUtil.replace(entry.getValue().toString(), searchStr, "")));
|
||||
}
|
||||
}
|
||||
BeanUtil.copyProperties(object, o);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user