Compare commits

..

1 Commits

Author SHA1 Message Date
丁磊
db575be748 // 移除占位符对应的值为空或null的占位符//日期格式化 2025-02-11 16:16:10 +08:00
16 changed files with 41 additions and 42 deletions

18
pom.xml
View File

@@ -6,7 +6,7 @@
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
<packaging>pom</packaging>
<name>springboot-parent</name>
<description>杭州铁晟科技有限公司基础依赖</description>
@@ -58,49 +58,49 @@
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-database</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-login</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-web</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-util</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-platform</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-message</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-role</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-annotation</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
</dependency>
<dependency>

View File

@@ -6,11 +6,11 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
</parent>
<artifactId>springboot-ademo</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>

View File

@@ -12,7 +12,6 @@ import com.alibaba.fastjson.JSONObject;
import com.tiesheng.annotation.role.RoleAuthority;
import com.tiesheng.annotation.token.TokenIgnore;
import com.tiesheng.database.config.DbBackupConfig;
import com.tiesheng.demo.pojos.CustTokenBean;
import com.tiesheng.demo.pojos.JsonTest;
import com.tiesheng.demo.pojos.PoiBean;
import com.tiesheng.platform.config.ding.PlatformDingConfig;
@@ -44,6 +43,7 @@ import java.util.function.Consumer;
*/
@RestController
@RequestMapping("/test")
@RoleAuthority(value = "test", group = "test")
public class TestController {
@Autowired
@@ -65,6 +65,7 @@ public class TestController {
@RequestMapping("/index")
@TokenIgnore
public void index(HttpServletResponse response) {
globalConfig.redirectWithVer("mobile", "/test", response);
}
@@ -112,9 +113,8 @@ public class TestController {
@GetMapping("/send")
public ApiResp<String> sendMessage(CustTokenBean tokenBean) {
tokenBean.test();
@TokenIgnore
public ApiResp<String> sendMessage() {
// MessageReqResp reqResp = coreMessageService.send(new UserChannel("13567116463", "sms"),
// JSONUtil.createObj().putOpt("action", "sms-visitor-invite"));

View File

@@ -1,12 +0,0 @@
package com.tiesheng.demo.pojos;
import com.tiesheng.util.pojos.TokenBean;
public class CustTokenBean extends TokenBean {
public void test() {
System.out.println("test: " + getId());
}
}

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
</parent>
<artifactId>springboot-annotation</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
</parent>
<artifactId>springboot-database</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
</parent>
<artifactId>springboot-login</artifactId>

View File

@@ -1,6 +1,5 @@
package com.tiesheng.login.config;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import com.tiesheng.annotation.token.TokenIgnore;
@@ -41,7 +40,7 @@ public class TokenWebMvcConfigurer implements WebMvcConfigurer {
resolvers.add(new HandlerMethodArgumentResolver() {
@Override
public boolean supportsParameter(MethodParameter parameter) {
return TokenBean.class.isAssignableFrom(parameter.getParameterType());
return parameter.getParameterType().isAssignableFrom(TokenBean.class);
}
@Override
@@ -55,9 +54,7 @@ public class TokenWebMvcConfigurer implements WebMvcConfigurer {
TokenIgnore annotation = method.getAnnotation(TokenIgnore.class);
thrExp = annotation == null;
}
TokenBean tokenBean = tsTokenConfig.validToken(header, thrExp);
return BeanUtil.copyProperties(tokenBean, parameter.getParameterType());
return tsTokenConfig.validToken(header, thrExp);
}
});
}

View File

@@ -68,7 +68,7 @@ public interface TsLoginConfigurer {
/**
* 获取登录失败的次数,默认0次不校验
* 获取登录失败的次数,默认5次
*
* @return
*/

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
</parent>
<artifactId>springboot-message</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
</parent>
<artifactId>springboot-platform</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
</parent>
<artifactId>springboot-role</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
</parent>
<artifactId>springboot-util</artifactId>

View File

@@ -16,7 +16,7 @@ import javax.annotation.PostConstruct;
@ConfigurationProperties(prefix = "tiesheng.ip2region")
public class Ip2regionConfig {
private String dbUrl = "https://git.tieshengkeji.com/tieshengkeji/Ip2region/raw/branch/main/ip2region.xdb";
private String dbUrl = "http://git.kepai365.com/tiesheng/repository/raw/master/ipdb/ip2region.xdb";
private String dbPath = System.getProperty("user.dir") + "/runtime/ip2region/ip2region.xdb";
///////////////////////////////////////////////////////////////////////////

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>2.0.20</version>
<version>2.0.18</version>
</parent>
<artifactId>springboot-web</artifactId>

View File

@@ -1,6 +1,7 @@
package com.tiesheng.web.config.operation;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
@@ -19,6 +20,7 @@ import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -100,6 +102,18 @@ public class OperationAspect {
subject = (StrUtil.isEmpty(insertVal) ? "添加" : "编辑") + subject;
}
for (String key : allParams.keySet()) {
Object value = allParams.get(key);
if (value == null || StrUtil.isEmpty(value.toString())) {
// 移除占位符对应的值为空或null的占位符
String placeholder = "{" + key + "}";
subject = subject.replace(placeholder, "");
} else if (value instanceof Date) {
//日期格式化
allParams.put(key, DateUtil.format((Date) value,"yyyy-MM-dd HH:mm:ss"));
}
}
// 占位符处理
subject = StrUtil.format(subject, allParams);
} else {