记得上下班打卡 | git大法好,push需谨慎

Commit ab1603b0 authored by jiangxiulong's avatar jiangxiulong

Merge remote-tracking branch 'origin/dev' into dev

parents f85c7a5c 7627ea4e
......@@ -20,14 +20,14 @@ public class AdamAddressesParam implements java.io.Serializable {
@Pattern(regexp = "\\d{11}", message = "手机号格式有误")
private String phone;
@ApiModelProperty(position = 13, required = true, value = "省份[30]", example = "北京")
@Pattern(regexp = LnsRegex.Valid.CHINESE_PCD, message = "省份必须为2~30位汉字")
@Pattern(regexp = LnsRegex.Valid.CN_PCD, message = "省份必须为2~30位汉字")
private String province;
@ApiModelProperty(position = 14, required = true, value = "城市[30]", example = "北京城区")
@NotNull()
@Pattern(regexp = LnsRegex.Valid.CHINESE_PCD, message = "城市必须为2~30位汉字")
@Pattern(regexp = LnsRegex.Valid.CN_PCD, message = "城市必须为2~30位汉字")
private String city;
@ApiModelProperty(position = 15, required = true, value = "区县[30]", example = "朝阳区")
@Pattern(regexp = LnsRegex.Valid.CHINESE_PCD, message = "区县必须为2~30位汉字")
@Pattern(regexp = LnsRegex.Valid.CN_PCD, message = "区县必须为2~30位汉字")
private String county;
@ApiModelProperty(position = 16, required = true, value = "详细地址[100]", example = "广渠路1号创1958园区")
@Size(max = 100)
......
......@@ -10,21 +10,53 @@ public class LnsRegex {
* yyyy-MM-dd
*/
public static final String DATETIME_YMD = "^(((((0[48]|[2468][048]|[3579][26])00))|(([0-9]{2})(0[48]|[2468][048]|[13579][26])))[-|.|/| ]0?2[-|.|/| ]29|(((?!0{1,4})[0-9]{1,4})[-|.|/| ](((0[13-9]|1[0-2]|[13-9])[-|.|/| ](29|30))|((0[13578]|(10|12)|[13578])[-|.|/| ]31)|((0(?:[1-9])|1(?:[0-2])|[1-9])[-|.|/| ](0(?:[1-9])|1[0-9]|2[0-8]|[1-9])))))$";
/**
* 字母、数字组合
*/
public static final String LETTER_NUMBER = "^[A-Z0-9]+$";
/**
* 汉字-姓名(2~20位)
*/
public static final String CHINESE_HANZI = "^[\\u4e00-\\u9fa5]{2,20}$";
public static final String CN_HANZI = "^[\\u4e00-\\u9fa5]{2,20}$";
/**
* 汉字-省|市|区(2~30位)
*/
public static final String CHINESE_PCD = "^[\\u4e00-\\u9fa5]{2,30}$";
public static final String CN_PCD = "^[\\u4e00-\\u9fa5]{2,30}$";
/**
* 身份证号(15位||18位)
* 大陆居民身份证(15位||18位)
*/
public static final String CHINESE_ID_CARD = "(^\\d{15}$)|(^\\d{18}$)|(^\\d{17}(\\d|X|x)$)";
public static final String CN_ID_CARD = "(^\\d{15}$)|(^\\d{18}$)|(^\\d{17}(\\d|X|x)$)";
/**
* 字母、数字组合
* 大陆居民身份证
*/
public static final String LETTER_NUMBER = "^[A-Z0-9]+$";
public static final String CN_ID_CARD_REF = "/(^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)/";
/**
* 军官证
* 规则: 军/兵/士/文/职/广/(其他中文) + "字第" + 4到8位字母或数字 + "号"
* 样本: 军字第2001988号, 士字第P011816X号
*/
public static final String CN_ID_CARD_MO = "/^[\\x{4E00}-\\x{9FA5}](字第)([0-9a-zA-Z]{4,8})(号?)$/u";
/**
* 中国大陆护照
* 规则: 14/15开头 + 7位数字, P + 7位数字, G/E + 8位数字, S/D + 7或8位数字, 等
* 样本: 141234567, G12345678, P1234567
*/
public static final String CN_ID_CARD_PP = "/^(?:P\\d{7}|[GE]\\d{8}|[SD]\\d{7,8}|[PSD]E\\d{7}|1[45]\\d{7})$/";
/**
* 非中国大陆护照
*/
public static final String CN_ID_CARD_PP_NON = "/^([A-Z0-9]){5,17}$/";
/**
* 港澳居民来往内地通行证
* 规则: H/M + 8位数字, C + 8位数字, C + 1位字母除去IO + 7位数字
* 样本: H12345678
*/
public static final String CN_ID_CARD_HM = "/^(?:[HM]\\d{8}|C[A-HJ-NP-Z0-9]\\d{7})$/";
/**
* 台湾居民来往大陆通行证
* 规则: 8位数字, 18位数字, 10位数字 + 1位英文字母
* 样本: 12345678 1234567890B
*/
public static final String CN_ID_CARD_TW = "/^(?:\\d{8}|\\d{18}|\\d{10}[A-Z])$/";
}
}
......@@ -51,10 +51,38 @@ public class AdamEntersController {
@ApiOperation(value = "添加入场人")
@PostMapping("add")
public ResponseDto<String> add(@RequestBody @Valid AdamEntersParam parameter) {
if (1 == parameter.getType()) {
if (!Pattern.matches(LnsRegex.Valid.CHINESE_HANZI, parameter.getName())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "姓名必须为2~20位汉字");
}
switch (parameter.getType()) {// 证件类型:1-大陆身份证,2-港澳通行证,3-台胞证,4-护照,5-军官证
case 1:
if (!Pattern.matches(LnsRegex.Valid.CN_HANZI, parameter.getName())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "姓名必须为2~20位汉字");
}
if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_REF, parameter.getIdCard())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "身份证号码不合规");
}
break;
case 2:
if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_HM, parameter.getIdCard())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "港澳居民来往内地通行证号码不合规");
}
break;
case 3:
if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_TW, parameter.getIdCard())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "台湾居民来往大陆通行证号码不合规");
}
break;
case 4:
if (Pattern.matches(LnsRegex.Valid.CN_ID_CARD_PP, parameter.getIdCard())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "不支持中国大陆护照");
}
if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_PP_NON, parameter.getIdCard())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "护照号码不合规");
}
break;
case 5:
if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_MO, parameter.getIdCard())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "军官证号不合规");
}
break;
}
List<AdamEntersVo> vos = adamRdmService.getEntersVoByUid(CurrentUtil.getCurrentUid());
......@@ -103,7 +131,7 @@ public class AdamEntersController {
@PostMapping("edit")
public ResponseDto<Object> edit(@RequestBody @Valid AdamEntersParam parameter) {
if (1 == parameter.getType()) {
if (!Pattern.matches(LnsRegex.Valid.CHINESE_HANZI, parameter.getName())) {
if (!Pattern.matches(LnsRegex.Valid.CN_HANZI, parameter.getName())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "姓名必须为2~20位汉字");
}
}
......
......@@ -202,9 +202,9 @@ public class AdamUserController {
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "idCard", value = "证件号"),
})
@PostMapping(value = {"identity"})
public ResponseDto<AdamRealInfoVo> identity(@Pattern(regexp = LnsRegex.Valid.CHINESE_HANZI, message = "姓名必须为2~20位汉字")
public ResponseDto<AdamRealInfoVo> identity(@Pattern(regexp = LnsRegex.Valid.CN_HANZI, message = "姓名必须为2~20位汉字")
@RequestParam String name,
@Pattern(regexp = LnsRegex.Valid.CHINESE_ID_CARD, message = "身份证号格式有误")
@Pattern(regexp = LnsRegex.Valid.CN_ID_CARD_REF, message = "身份证号码不合规")
@RequestParam String idCard) {
log.debug("name:{},idCard:{}", name, idCard);
AdamRealInfoVo vo = adamUserService.identity(CurrentUtil.getCurrentUid(), name, idCard);
......
# Getting Started
### Reference Documentation
For further reference, please consider the following sections:
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.4.5/maven-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.4.5/maven-plugin/reference/html/#build-image)
# Getting Started
### Reference Documentation
For further reference, please consider the following sections:
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.4.5/maven-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.4.5/maven-plugin/reference/html/#build-image)
# Getting Started
### Reference Documentation
For further reference, please consider the following sections:
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.4.5/maven-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.4.5/maven-plugin/reference/html/#build-image)
* [Spring Native Reference Guide](https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/)
### Additional Links
These additional references should also help you:
* [Configure the Spring AOT Plugin](https://docs.spring.io/spring-native/docs/0.9.2-SNAPSHOT/reference/htmlsingle/#spring-aot-maven)
## Spring Native
This project has been configured to let you generate a lightweight container running a native executable.
Docker should be installed and configured on your machine prior to creating the image, see [the Getting Started section of the reference guide](https://docs.spring.io/spring-native/docs/0.9.2-SNAPSHOT/reference/htmlsingle/#getting-started-buildpacks).
To create the image, run the following goal:
```
$ ./mvnw spring-boot:build-image
```
Then, you can run the app like any other container:
```
$ docker run --rm liquidnet-service-ticket-impl:0.0.1-SNAPSHOT
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment