Compare commits
No commits in common. "8e330577eefe515fe7287a3f7564729118c84fcb" and "4aa6c6250ac5d9e9ffb43c07f4a69b6167560829" have entirely different histories.
8e330577ee
...
4aa6c6250a
|
@ -23,17 +23,6 @@
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-context-support</artifactId>
|
<artifactId>spring-context-support</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.tobato</groupId>
|
|
||||||
<artifactId>fastdfs-client</artifactId>
|
|
||||||
<version>1.26.5</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- quartz定时任务-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-quartz</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- SpringWeb模块 -->
|
<!-- SpringWeb模块 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -63,11 +52,7 @@
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.qiniu</groupId>
|
|
||||||
<artifactId>qiniu-java-sdk</artifactId>
|
|
||||||
<version>7.4.0</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- JSON工具类 -->
|
<!-- JSON工具类 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
|
|
@ -1,84 +0,0 @@
|
||||||
package com.mcwl.common.config;
|
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.BitSet;
|
|
||||||
|
|
||||||
/***
|
|
||||||
* 布隆过滤器
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class BloomFilterUtil {
|
|
||||||
private static final int DEFAULT_SIZE = 2 << 24; // 布隆过滤器的比特长度
|
|
||||||
private static final int[] seeds = new int[] {7, 11, 13, 31,37, 61}; // 这里要选取质数,能很好的降低错误率
|
|
||||||
|
|
||||||
private BitSet bits = new BitSet(DEFAULT_SIZE);
|
|
||||||
private SimpleHash[] func = new SimpleHash[seeds.length];
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
String value = "crankzcool@gmail.com";
|
|
||||||
BloomFilterUtil filter = new BloomFilterUtil();
|
|
||||||
// System.out.println(filter.contains(value));
|
|
||||||
// filter.add(value);
|
|
||||||
// System.out.println(filter.contains(value));
|
|
||||||
|
|
||||||
filter.add("1");
|
|
||||||
filter.add("2");
|
|
||||||
filter.remove("1");
|
|
||||||
System.out.println(filter.contains("1"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void remove(String value) {
|
|
||||||
if (value == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (SimpleHash f : func) {
|
|
||||||
bits.set(f.hash(value), false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public BloomFilterUtil() {
|
|
||||||
for (int i = 0; i < seeds.length; i++) {
|
|
||||||
func[i] = new SimpleHash(DEFAULT_SIZE, seeds[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(String value) {
|
|
||||||
for (SimpleHash f: func) {
|
|
||||||
bits.set(f.hash(value), true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean contains(String value) {
|
|
||||||
if (value == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
boolean ret = true;
|
|
||||||
for (SimpleHash f : func) {
|
|
||||||
ret = ret && bits.get(f.hash(value));
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
public static class SimpleHash {
|
|
||||||
private int cap;
|
|
||||||
private int seed;
|
|
||||||
|
|
||||||
public SimpleHash(int cap, int seed) {
|
|
||||||
this.cap = cap;
|
|
||||||
this.seed = seed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int hash(String value) {
|
|
||||||
int result = 0;
|
|
||||||
int len = value.length();
|
|
||||||
for (int i = 0; i < len; i++) {
|
|
||||||
result = seed * result + value.charAt(i);
|
|
||||||
}
|
|
||||||
return (cap - 1) & result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
package com.mcwl.common.config;
|
|
||||||
|
|
||||||
import com.github.tobato.fastdfs.FdfsClientConfig;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.context.annotation.EnableMBeanExport;
|
|
||||||
import org.springframework.context.annotation.Import;
|
|
||||||
import org.springframework.jmx.support.RegistrationPolicy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @BelongsProject: demo02
|
|
||||||
* @BelongsPackage: com.bw.config
|
|
||||||
* @Author: zhupengfei
|
|
||||||
* @CreateTime: 2022-12-16 14:37
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
// 解决 jmx 重复注册 bean 的问题
|
|
||||||
@EnableMBeanExport(registration = RegistrationPolicy.IGNORE_EXISTING)
|
|
||||||
public class FastConfig {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
package com.mcwl.common.config;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import com.github.tobato.fastdfs.domain.fdfs.StorePath;
|
|
||||||
import com.github.tobato.fastdfs.service.FastFileStorageClient;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class FastUtil {
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(FastUtil.class);
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private FastFileStorageClient storageClient ;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传文件
|
|
||||||
*/
|
|
||||||
public String upload(MultipartFile multipartFile) throws Exception{
|
|
||||||
String originalFilename = multipartFile.getOriginalFilename().
|
|
||||||
substring(multipartFile.getOriginalFilename().
|
|
||||||
lastIndexOf(".") + 1);
|
|
||||||
StorePath storePath = this.storageClient.uploadImageAndCrtThumbImage(
|
|
||||||
multipartFile.getInputStream(),
|
|
||||||
multipartFile.getSize(),originalFilename , null);
|
|
||||||
return storePath.getFullPath() ;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 删除文件
|
|
||||||
*/
|
|
||||||
public String deleteFile(String fileUrl) {
|
|
||||||
if (StringUtils.isEmpty(fileUrl)) {
|
|
||||||
log.info("fileUrl == >>文件路径为空...");
|
|
||||||
return "文件路径不能为空";
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
StorePath storePath = StorePath.parseFromUrl(fileUrl);
|
|
||||||
storageClient.deleteFile(storePath.getGroup(), storePath.getPath());
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage());
|
|
||||||
}
|
|
||||||
return "删除成功";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
package com.mcwl.common.config;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 七牛云配置
|
|
||||||
*
|
|
||||||
* @date 2024/5/5 下午5:01
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@ConfigurationProperties(prefix = "oss.qiniu")
|
|
||||||
@Data
|
|
||||||
public class QiNiuConfig {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AccessKey
|
|
||||||
*/
|
|
||||||
private String accessKey;
|
|
||||||
/**
|
|
||||||
* SecretKey
|
|
||||||
*/
|
|
||||||
private String secretKey;
|
|
||||||
/**
|
|
||||||
* 图片存储空间名
|
|
||||||
*/
|
|
||||||
private String bucketPictureName;
|
|
||||||
/**
|
|
||||||
* 图片外链
|
|
||||||
*/
|
|
||||||
private String domainPicture;
|
|
||||||
/**
|
|
||||||
* 文件存储空间名
|
|
||||||
*/
|
|
||||||
private String bucketFileName;
|
|
||||||
/**
|
|
||||||
* 文件外链
|
|
||||||
*/
|
|
||||||
private String domainFile;
|
|
||||||
}
|
|
|
@ -1,56 +0,0 @@
|
||||||
|
|
||||||
package com.mcwl.common.interfaces;
|
|
||||||
/**
|
|
||||||
* @author 苏三,该项目是知识星球:java突击队 的内部项目
|
|
||||||
* @date 2024/6/11 下午4:12
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.mcwl.common.valid.MaxMoneyConstraintValidator;
|
|
||||||
|
|
||||||
import javax.validation.Constraint;
|
|
||||||
import javax.validation.Payload;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最大值约束.
|
|
||||||
*
|
|
||||||
* @author 苏三,该项目是知识星球:java突击队 的内部项目
|
|
||||||
* @date 2024/6/11 下午4:13
|
|
||||||
*/
|
|
||||||
@Target({ElementType.METHOD, ElementType.FIELD})
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Constraint(validatedBy = MaxMoneyConstraintValidator.class)
|
|
||||||
public @interface MaxMoney {
|
|
||||||
/**
|
|
||||||
* message.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
String message() default "{minMoney.message.error}";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* max value.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
double value() default 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* group.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Class<?>[] groups() default {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* payload.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Class<? extends Payload>[] payload() default {};
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
package com.mcwl.common.interfaces;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @date 2024/6/11 下午4:12
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
import com.mcwl.common.valid.MinMoneyConstraintValidator;
|
|
||||||
|
|
||||||
import javax.validation.Constraint;
|
|
||||||
import javax.validation.Payload;
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最小值约束.
|
|
||||||
*
|
|
||||||
|
|
||||||
* @date 2024/6/11 下午4:13
|
|
||||||
*/
|
|
||||||
@Target({ElementType.METHOD, ElementType.FIELD})
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Constraint(validatedBy = MinMoneyConstraintValidator.class)
|
|
||||||
public @interface MinMoney {
|
|
||||||
/**
|
|
||||||
* message.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
String message() default "{minMoney.message.error}";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* min value.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
double value() default 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* group.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Class<?>[] groups() default {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* payload.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Class<? extends Payload>[] payload() default {};
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
package com.mcwl.common.interfaces;
|
|
||||||
|
|
||||||
import com.mcwl.common.valid.PhoneValidator;
|
|
||||||
|
|
||||||
import javax.validation.Constraint;
|
|
||||||
import javax.validation.Payload;
|
|
||||||
import java.lang.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 苏三
|
|
||||||
* @date 2024/9/24 下午3:09
|
|
||||||
*/
|
|
||||||
@Documented
|
|
||||||
@Constraint(validatedBy = {PhoneValidator.class})
|
|
||||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER})
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
public @interface ValidPhone {
|
|
||||||
/**
|
|
||||||
* 返回信息
|
|
||||||
*/
|
|
||||||
String message() default "手机号码格式不正确";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分组
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Class<?>[] groups() default {};
|
|
||||||
|
|
||||||
Class<? extends Payload>[] payload() default {};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
package com.mcwl.common.utils;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单编号生成工具
|
|
||||||
*
|
|
||||||
* @date 2024/5/30 下午6:02
|
|
||||||
*/
|
|
||||||
public class OrderCodeUtil {
|
|
||||||
|
|
||||||
public static final int ORDER_CODE_LENGTH = 24;
|
|
||||||
private static final String ORDER_CODE_DATA_FORMAT = "yyyyMMddHHmmss";
|
|
||||||
private static final int ORDER_CODE_RANDOM_NUMBER = 10;
|
|
||||||
private static final int ORDER_CODE_RANDOM_LENGTH = 6;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生成订单编号
|
|
||||||
*
|
|
||||||
* @return 订单编号
|
|
||||||
*/
|
|
||||||
public static String generateOrderCode() {
|
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat(ORDER_CODE_DATA_FORMAT);
|
|
||||||
String random = getRandom(ORDER_CODE_RANDOM_LENGTH);
|
|
||||||
Date date = new Date();
|
|
||||||
String time = dateFormat.format(date);
|
|
||||||
String code = "XS" + time + random;
|
|
||||||
while (code.length() < ORDER_CODE_LENGTH) {
|
|
||||||
code = code + 0;
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getRandom(int len) {
|
|
||||||
Random r = new Random();
|
|
||||||
StringBuilder rs = new StringBuilder();
|
|
||||||
for (int i = 0; i < len; i++) {
|
|
||||||
rs.append(r.nextInt(ORDER_CODE_RANDOM_NUMBER));
|
|
||||||
}
|
|
||||||
return rs.toString();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,50 +0,0 @@
|
||||||
package com.mcwl.common.utils;
|
|
||||||
|
|
||||||
import com.qiniu.http.Response;
|
|
||||||
import com.qiniu.storage.Configuration;
|
|
||||||
import com.qiniu.storage.Region;
|
|
||||||
import com.qiniu.storage.UploadManager;
|
|
||||||
import com.qiniu.storage.model.DefaultPutRet;
|
|
||||||
import com.qiniu.util.Auth;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.mcwl.common.config.QiNiuConfig;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 七牛云上传工具
|
|
||||||
*
|
|
||||||
* @date 2024/5/5 下午5:02
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class QiNiuUtil {
|
|
||||||
public static final String IMAGE = "image";
|
|
||||||
public static final String FILE = "file";
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private QiNiuConfig qiNiuConfig;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将图片上传到七牛云
|
|
||||||
*/
|
|
||||||
public String upload(InputStream file, String fileType, String fileContextType) throws Exception {
|
|
||||||
Configuration cfg = new Configuration(Region.region2());
|
|
||||||
UploadManager uploadManager = new UploadManager(cfg);
|
|
||||||
Auth auth = Auth.create(qiNiuConfig.getAccessKey(), qiNiuConfig.getSecretKey());
|
|
||||||
String upToken = null;
|
|
||||||
String path = null;
|
|
||||||
if (fileType.equals(IMAGE)) {
|
|
||||||
upToken = auth.uploadToken(qiNiuConfig.getBucketPictureName());
|
|
||||||
path = qiNiuConfig.getDomainFile();
|
|
||||||
} else if (fileType.equals(FILE)) {
|
|
||||||
upToken = auth.uploadToken(qiNiuConfig.getBucketFileName());
|
|
||||||
path = qiNiuConfig.getDomainFile();
|
|
||||||
}
|
|
||||||
Response response = uploadManager.put(file, null, upToken, null, fileContextType);
|
|
||||||
DefaultPutRet putRet = new Gson().fromJson(response.bodyString(), DefaultPutRet.class);
|
|
||||||
return path + putRet.key;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
package com.mcwl.common.valid;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.mcwl.common.interfaces.MaxMoney;
|
|
||||||
|
|
||||||
import javax.validation.ConstraintValidator;
|
|
||||||
import javax.validation.ConstraintValidatorContext;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最大金额校验
|
|
||||||
* @date 2024/6/11 下午4:13
|
|
||||||
*/
|
|
||||||
public class MaxMoneyConstraintValidator implements ConstraintValidator<MaxMoney, BigDecimal> {
|
|
||||||
|
|
||||||
private MaxMoney constraint;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize(MaxMoney constraint) {
|
|
||||||
this.constraint = constraint;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isValid(BigDecimal value, ConstraintValidatorContext context) {
|
|
||||||
return value != null && value.doubleValue() < constraint.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
package com.mcwl.common.valid;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.mcwl.common.interfaces.MinMoney;
|
|
||||||
|
|
||||||
import javax.validation.ConstraintValidator;
|
|
||||||
import javax.validation.ConstraintValidatorContext;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 最小金额校验
|
|
||||||
*
|
|
||||||
* @date 2024/6/11 下午4:13
|
|
||||||
*/
|
|
||||||
public class MinMoneyConstraintValidator implements ConstraintValidator<MinMoney, BigDecimal> {
|
|
||||||
|
|
||||||
private MinMoney constraint;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initialize(MinMoney constraint) {
|
|
||||||
this.constraint = constraint;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isValid(BigDecimal value, ConstraintValidatorContext context) {
|
|
||||||
return value != null && value.doubleValue() >= constraint.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
package com.mcwl.common.valid;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.mcwl.common.interfaces.ValidPhone;
|
|
||||||
|
|
||||||
import javax.validation.ConstraintValidator;
|
|
||||||
import javax.validation.ConstraintValidatorContext;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 手机号校验
|
|
||||||
*
|
|
||||||
* @author 苏三
|
|
||||||
* @date 2024/9/24 下午3:12
|
|
||||||
*/
|
|
||||||
public class PhoneValidator implements ConstraintValidator<ValidPhone, String> {
|
|
||||||
private static final String PHONE_REGEX = "^1([38][0-9]|4[5-9]|5[0-3,5-9]|6[6]|7[0-8]|9[89])[0-9]{8}$";
|
|
||||||
private final Pattern pattern = Pattern.compile(PHONE_REGEX);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
|
||||||
if (value == null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return pattern.matcher(value).matches();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>com.mcwl</groupId>
|
|
||||||
<artifactId>mcwl</artifactId>
|
|
||||||
<version>3.8.8</version>
|
|
||||||
</parent>
|
|
||||||
<artifactId>mcwl-resource</artifactId>
|
|
||||||
<description>
|
|
||||||
resource资源中心模块
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<!-- 通用工具-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.mcwl</groupId>
|
|
||||||
<artifactId>mcwl-common</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
1
pom.xml
1
pom.xml
|
@ -228,7 +228,6 @@
|
||||||
<module>mcwl-quartz</module>
|
<module>mcwl-quartz</module>
|
||||||
<module>mcwl-generator</module>
|
<module>mcwl-generator</module>
|
||||||
<module>mcwl-common</module>
|
<module>mcwl-common</module>
|
||||||
<module>mcwl-resource</module>
|
|
||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue