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

Commit 4ed7ec6c authored by 张国柄's avatar 张国柄

完善参数校验部分;

parent c160ebc2
package com.liquidnet.service.adam.dto; package com.liquidnet.service.adam.dto;
import com.liquidnet.commons.lang.constant.LnsRegex;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.io.Serializable; import java.io.Serializable;
...@@ -21,11 +23,11 @@ public class AdamThirdPartParam implements Serializable { ...@@ -21,11 +23,11 @@ public class AdamThirdPartParam implements Serializable {
@Size(max = 255, message = "已超出头像链接长度限制") @Size(max = 255, message = "已超出头像链接长度限制")
private String avatar; private String avatar;
@ApiModelProperty(position = 14, required = true, value = "平台类型[255]", allowableValues = "WEIBO,WECHAT,QQ") @ApiModelProperty(position = 14, required = true, value = "平台类型[255]", allowableValues = "WEIBO,WECHAT,QQ")
//@Pattern(regexp = "\\b(WEIBO,WECHAT,QQ)\\b", message = "平台类型无效") @Pattern(regexp = LnsRegex.Valid.TRIPLE_ACC_FOR_ULGOIN, message = "平台类型无效")
private String platform; private String platform;
@ApiModelProperty(position = 15, required = false, value = "手机号[新账号时必传]", example = "13111111111") @ApiModelProperty(position = 15, required = false, value = "手机号[新账号时必传]")
private String mobile; private String mobile;
@ApiModelProperty(position = 16, required = false, value = "验证码[新账号时必传]", example = "111111") @ApiModelProperty(position = 16, required = false, value = "验证码[新账号时必传]")
private String code; private String code;
@ApiModelProperty(position = 17, required = false, value = "强制绑定[第三方账号已绑定其他手机号时]", example = "false") @ApiModelProperty(position = 17, required = false, value = "强制绑定[第三方账号已绑定其他手机号时]", example = "false")
private Boolean force; private Boolean force;
......
...@@ -22,6 +22,11 @@ public class LnsRegex { ...@@ -22,6 +22,11 @@ public class LnsRegex {
* 汉字-省|市|区(2~30位) * 汉字-省|市|区(2~30位)
*/ */
public static final String CN_PCD = "^[\\u4e00-\\u9fa5]{2,30}$"; public static final String CN_PCD = "^[\\u4e00-\\u9fa5]{2,30}$";
/* ======================================================================= | 证件类 */
/** /**
* 大陆居民身份证(15位||18位) * 大陆居民身份证(15位||18位)
*/ */
...@@ -58,5 +63,29 @@ public class LnsRegex { ...@@ -58,5 +63,29 @@ public class LnsRegex {
* 样本: 12345678 1234567890B * 样本: 12345678 1234567890B
*/ */
public static final String CN_ID_CARD_TW = "/^(?:\\d{8}|\\d{18}|\\d{10}[A-Z])$/"; public static final String CN_ID_CARD_TW = "/^(?:\\d{8}|\\d{18}|\\d{10}[A-Z])$/";
/* ======================================================================= | 第三方平台类 */
/**
* 用户中心:登录注册:支持的第三方账号平台类型
*/
public static final String TRIPLE_ACC_FOR_ULGOIN = "\\b(WEIBO|WECHAT|QQ)\\b";
/* ======================================================================= | */
/* ======================================================================= | */
/* ======================================================================= | */
} }
} }
...@@ -44,7 +44,7 @@ public class AdamCollectionController { ...@@ -44,7 +44,7 @@ public class AdamCollectionController {
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "contentId", value = "内容ID[1,64]"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "contentId", value = "内容ID[1,64]"),
}) })
@PostMapping("add") @PostMapping("add")
public ResponseDto<Object> add(//@Pattern(regexp = "\\b(TICKET,VIDEO)\\b", message = "收藏类型无效") public ResponseDto<Object> add(@Pattern(regexp = "\\b(TICKET|VIDEO)\\b", message = "收藏类型无效")
@RequestParam String type, @RequestParam String type,
@Size(min = 1, max = 64, message = "收藏内容ID长度限制1-64位") @Size(min = 1, max = 64, message = "收藏内容ID长度限制1-64位")
@RequestParam String contentId) { @RequestParam String contentId) {
...@@ -70,7 +70,7 @@ public class AdamCollectionController { ...@@ -70,7 +70,7 @@ public class AdamCollectionController {
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "contentIds", value = "内容ID[多个ID用','分隔]"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "contentIds", value = "内容ID[多个ID用','分隔]"),
}) })
@PostMapping("del") @PostMapping("del")
public ResponseDto<Object> del(//@Pattern(regexp = "\\b(TICKET,VIDEO)\\b", message = "收藏类型无效") public ResponseDto<Object> del(@Pattern(regexp = "\\b(TICKET|VIDEO)\\b", message = "收藏类型无效")
@RequestParam String type, @RequestParam String type,
@NotBlank(message = "内容ID不能为空") @RequestParam String contentIds) { @NotBlank(message = "内容ID不能为空") @RequestParam String contentIds) {
adamCollectionService.del(CurrentUtil.getCurrentUid(), type, contentIds.split(",")); adamCollectionService.del(CurrentUtil.getCurrentUid(), type, contentIds.split(","));
...@@ -86,7 +86,7 @@ public class AdamCollectionController { ...@@ -86,7 +86,7 @@ public class AdamCollectionController {
@ApiImplicitParam(type = "form", required = false, dataType = "Integer", name = "pageSize", value = "页展示条数", example = "5"), @ApiImplicitParam(type = "form", required = false, dataType = "Integer", name = "pageSize", value = "页展示条数", example = "5"),
}) })
@PostMapping("list") @PostMapping("list")
public ResponseDto<PageInfo<AdamCollectVo>> list(//@Pattern(regexp = "\\b(TICKET,VIDEO)\\b", message = "收藏类型无效") public ResponseDto<PageInfo<AdamCollectVo>> list(@Pattern(regexp = "\\b(TICKET|VIDEO)\\b", message = "收藏类型无效")
@RequestParam String type, @RequestParam String type,
@RequestParam(defaultValue = "1", required = false) int pageNo, @RequestParam(defaultValue = "1", required = false) int pageNo,
@RequestParam(defaultValue = "5", required = false) int pageSize) { @RequestParam(defaultValue = "5", required = false) int pageSize) {
...@@ -118,7 +118,7 @@ public class AdamCollectionController { ...@@ -118,7 +118,7 @@ public class AdamCollectionController {
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "contentId", value = "内容ID[64]"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "contentId", value = "内容ID[64]"),
}) })
@GetMapping("state") @GetMapping("state")
public ResponseDto<Boolean> state(//@Pattern(regexp = "\\b(TICKET,VIDEO)\\b", message = "收藏类型无效") public ResponseDto<Boolean> state(@Pattern(regexp = "\\b(TICKET|VIDEO)\\b", message = "收藏类型无效")
@RequestParam String type, @RequestParam String type,
@Size(min = 1, max = 64, message = "收藏内容ID长度限制1-64位") @Size(min = 1, max = 64, message = "收藏内容ID长度限制1-64位")
@RequestParam String contentId) { @RequestParam String contentId) {
......
...@@ -45,7 +45,7 @@ public class AdamDisposedController { ...@@ -45,7 +45,7 @@ public class AdamDisposedController {
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "contentId", value = "内容ID[1,64]"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "contentId", value = "内容ID[1,64]"),
}) })
@PostMapping("add") @PostMapping("add")
public ResponseDto<Object> add(//@Pattern(regexp = "\\b(TICKET,VIDEO)\\b", message = "想去类型无效") public ResponseDto<Object> add(@Pattern(regexp = "\\b(TICKET|VIDEO)\\b", message = "想去类型无效")
@RequestParam String type, @RequestParam String type,
@Size(min = 1, max = 64, message = "内容ID长度限制1-64位") @Size(min = 1, max = 64, message = "内容ID长度限制1-64位")
@RequestParam String contentId) { @RequestParam String contentId) {
...@@ -72,7 +72,7 @@ public class AdamDisposedController { ...@@ -72,7 +72,7 @@ public class AdamDisposedController {
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "contentIds", value = "内容ID[多个ID用','分隔]"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "contentIds", value = "内容ID[多个ID用','分隔]"),
}) })
@PostMapping("del") @PostMapping("del")
public ResponseDto<Object> del(//@Pattern(regexp = "\\b(TICKET,VIDEO)\\b", message = "想去类型无效") public ResponseDto<Object> del(@Pattern(regexp = "\\b(TICKET|VIDEO)\\b", message = "想去类型无效")
@RequestParam String type, @RequestParam String type,
@NotBlank(message = "内容ID不能为空") @RequestParam String contentIds) { @NotBlank(message = "内容ID不能为空") @RequestParam String contentIds) {
adamDisposedService.del(CurrentUtil.getCurrentUid(), type, contentIds.split(",")); adamDisposedService.del(CurrentUtil.getCurrentUid(), type, contentIds.split(","));
...@@ -88,7 +88,7 @@ public class AdamDisposedController { ...@@ -88,7 +88,7 @@ public class AdamDisposedController {
@ApiImplicitParam(type = "form", required = false, dataType = "Integer", name = "pageSize", value = "页展示条数", example = "5"), @ApiImplicitParam(type = "form", required = false, dataType = "Integer", name = "pageSize", value = "页展示条数", example = "5"),
}) })
@PostMapping("list") @PostMapping("list")
public ResponseDto<PageInfo<AdamDisposedVo>> list(//@Pattern(regexp = "\\b(TICKET,VIDEO)\\b", message = "想去类型无效") public ResponseDto<PageInfo<AdamDisposedVo>> list(@Pattern(regexp = "\\b(TICKET|VIDEO)\\b", message = "想去类型无效")
@RequestParam String type, @RequestParam String type,
@RequestParam(defaultValue = "1", required = false) int pageNo, @RequestParam(defaultValue = "1", required = false) int pageNo,
@RequestParam(defaultValue = "5", required = false) int pageSize) { @RequestParam(defaultValue = "5", required = false) int pageSize) {
...@@ -107,7 +107,7 @@ public class AdamDisposedController { ...@@ -107,7 +107,7 @@ public class AdamDisposedController {
@ApiImplicitParam(type = "form", required = false, dataType = "Integer", name = "pageSize", value = "页展示条数", example = "10"), @ApiImplicitParam(type = "form", required = false, dataType = "Integer", name = "pageSize", value = "页展示条数", example = "10"),
}) })
@PostMapping("list/user") @PostMapping("list/user")
public ResponseDto<PageInfo<AdamDisposedUserVo>> listUser(//@Pattern(regexp = "\\b(TICKET,VIDEO)\\b", message = "想去类型无效") public ResponseDto<PageInfo<AdamDisposedUserVo>> listUser(@Pattern(regexp = "\\b(TICKET|VIDEO)\\b", message = "想去类型无效")
@RequestParam String type, @RequestParam String type,
@Size(min = 1, max = 64, message = "内容ID长度限制1-64位") @Size(min = 1, max = 64, message = "内容ID长度限制1-64位")
@RequestParam String contentId, @RequestParam String contentId,
...@@ -126,7 +126,7 @@ public class AdamDisposedController { ...@@ -126,7 +126,7 @@ public class AdamDisposedController {
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "contentId", value = "内容ID[64]"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "contentId", value = "内容ID[64]"),
}) })
@GetMapping("state") @GetMapping("state")
public ResponseDto<Boolean> state(//@Pattern(regexp = "\\b(TICKET,VIDEO)\\b", message = "想去类型无效") public ResponseDto<Boolean> state(@Pattern(regexp = "\\b(TICKET|VIDEO)\\b", message = "想去类型无效")
@RequestParam String type, @RequestParam String type,
@Size(min = 1, max = 64, message = "内容ID长度限制1-64位") @Size(min = 1, max = 64, message = "内容ID长度限制1-64位")
@RequestParam String contentId) { @RequestParam String contentId) {
......
...@@ -275,7 +275,7 @@ public class AdamUserController { ...@@ -275,7 +275,7 @@ public class AdamUserController {
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "platform", value = "平台类型", allowableValues = "WEIBO,WECHAT,QQ"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "platform", value = "平台类型", allowableValues = "WEIBO,WECHAT,QQ"),
}) })
@PostMapping(value = {"tpa/unbind/{platform}"}) @PostMapping(value = {"tpa/unbind/{platform}"})
public ResponseDto<List<AdamThirdPartInfoVo>> unbindTpa(//@Pattern(regexp = "\\b(WEIBO,WECHAT,QQ)\\b", message = "平台类型无效") public ResponseDto<List<AdamThirdPartInfoVo>> unbindTpa(@Pattern(regexp = LnsRegex.Valid.TRIPLE_ACC_FOR_ULGOIN, message = "平台类型无效")
@PathVariable String platform) { @PathVariable String platform) {
String currentUid = CurrentUtil.getCurrentUid(); String currentUid = CurrentUtil.getCurrentUid();
log.debug("unbind tpa.platform:{},uid:{}", platform, currentUid); log.debug("unbind tpa.platform:{},uid:{}", platform, currentUid);
......
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