mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 17:21:53 +08:00
Merge remote-tracking branch 'origin/feature/codegen-front' into feature/codegen-front
This commit is contained in:
commit
caeb23a3dc
@ -16,7 +16,7 @@ import java.util.regex.Pattern;
|
||||
*/
|
||||
public class ValidationUtils {
|
||||
|
||||
private static final Pattern PATTERN_MOBILE = Pattern.compile("^(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[189]))\\d{8}$");
|
||||
private static final Pattern PATTERN_MOBILE = Pattern.compile("^(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[0,1,4-9])|(?:5[0-3,5-9])|(?:6[2,5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[0-3,5-9]))\\d{8}$");
|
||||
|
||||
private static final Pattern PATTERN_URL = Pattern.compile("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]");
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class IPUtils {
|
||||
*/
|
||||
@SneakyThrows
|
||||
public static Integer getAreaId(String ip) {
|
||||
return Integer.parseInt(SEARCHER.search(ip));
|
||||
return Integer.parseInt(SEARCHER.search(ip.trim()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,8 +52,8 @@
|
||||
|
||||
<!-- Test 测试相关 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.framework.tenant.core.job;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.service.TenantFrameworkService;
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
* 验证 job 租户逻辑
|
||||
* {@link TenantJobHandlerDecorator}
|
||||
*
|
||||
* @author gaibu
|
||||
*/
|
||||
public class TenantJobTest extends BaseMockitoUnitTest {
|
||||
|
||||
@Mock
|
||||
TenantFrameworkService tenantFrameworkService;
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
// 准备测试租户 id
|
||||
List<Long> tenantIds = Lists.newArrayList(1L, 2L, 3L);
|
||||
// mock 数据
|
||||
Mockito.doReturn(tenantIds).when(tenantFrameworkService).getTenantIds();
|
||||
// 准备测试任务
|
||||
TestJob testJob = new TestJob();
|
||||
// 创建任务装饰器
|
||||
TenantJobHandlerDecorator tenantJobHandlerDecorator = new TenantJobHandlerDecorator(tenantFrameworkService, testJob);
|
||||
|
||||
// 执行任务
|
||||
tenantJobHandlerDecorator.execute(null);
|
||||
|
||||
// 断言返回值
|
||||
assertEquals(testJob.getTenantIds(), tenantIds);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.framework.tenant.core.job;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
||||
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
@Component
|
||||
@TenantJob // 标记多租户
|
||||
public class TestJob implements JobHandler {
|
||||
|
||||
private final List<Long> tenantIds = new CopyOnWriteArrayList<>();
|
||||
|
||||
@Override
|
||||
public String execute(String param) throws Exception {
|
||||
tenantIds.add(TenantContextHolder.getTenantId());
|
||||
return "success";
|
||||
}
|
||||
|
||||
public List<Long> getTenantIds() {
|
||||
CollUtil.sort(tenantIds, Long::compareTo);
|
||||
return tenantIds;
|
||||
}
|
||||
}
|
@ -37,4 +37,8 @@ public class SecurityProperties {
|
||||
*/
|
||||
private List<String> permitAllUrls = Collections.emptyList();
|
||||
|
||||
/**
|
||||
* PasswordEncoder 加密复杂度,越高开销越大
|
||||
*/
|
||||
private Integer passwordEncoderLength = 4;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class YudaoSecurityAutoConfiguration {
|
||||
*/
|
||||
@Bean
|
||||
public PasswordEncoder passwordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
return new BCryptPasswordEncoder(securityProperties.getPasswordEncoderLength());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,6 +135,8 @@ public interface BpmTaskConvert {
|
||||
}
|
||||
|
||||
@Mapping(source = "taskDefinitionKey", target = "definitionKey")
|
||||
@Mapping(target = "createTime", expression = "java(bean.getCreateTime() == null ? null : LocalDateTime.ofInstant(bean.getCreateTime().toInstant(), ZoneId.systemDefault()))")
|
||||
@Mapping(target = "endTime", expression = "java(bean.getEndTime() == null ? null : LocalDateTime.ofInstant(bean.getEndTime().toInstant(), ZoneId.systemDefault()))")
|
||||
BpmTaskRespVO convert3(HistoricTaskInstance bean);
|
||||
|
||||
BpmTaskRespVO.User convert3(AdminUserRespDTO bean);
|
||||
|
@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
|
||||
import cn.iocoder.yudao.module.infra.enums.codegen.CodegenSceneEnum;
|
||||
import cn.iocoder.yudao.module.infra.enums.codegen.CodegenTemplateTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
|
||||
import lombok.Data;
|
||||
@ -26,6 +27,7 @@ public class CodegenTableDO extends BaseDO {
|
||||
/**
|
||||
* ID 编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
|
@ -22,7 +22,7 @@ public class TradeOrderBaseVO {
|
||||
private String no;
|
||||
|
||||
@Schema(description = "下单时间", required = true)
|
||||
private Date createTime;
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "订单类型", required = true, example = "1")
|
||||
private Integer type;
|
||||
|
@ -26,7 +26,7 @@ public class SmsCodeDO extends BaseDO {
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Integer id;
|
||||
private Long id;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
|
@ -52,11 +52,12 @@
|
||||
</el-form-item>
|
||||
<el-form-item prop="mobileCode">
|
||||
<el-input v-model="loginForm.mobileCode" type="text" auto-complete="off" placeholder="短信验证码"
|
||||
class="sms-login-mobile-code-prefix"
|
||||
@keyup.enter.native="handleLogin">
|
||||
<template v-slot="icon">
|
||||
<template>
|
||||
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon"/>
|
||||
</template>
|
||||
<template v-slot="append">
|
||||
<template slot="append">
|
||||
<span v-if="mobileCodeTimer <= 0" class="getMobileCode" @click="getSmsCode" style="cursor: pointer;">获取验证码</span>
|
||||
<span v-if="mobileCodeTimer > 0" class="getMobileCode">{{ mobileCodeTimer }}秒后可重新获取</span>
|
||||
</template>
|
||||
@ -335,4 +336,9 @@ export default {
|
||||
text-decoration: underline red;
|
||||
color: red;
|
||||
}
|
||||
.sms-login-mobile-code-prefix {
|
||||
:deep(.el-input__prefix) {
|
||||
top: 22%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue
Block a user