平台参数校验修改

This commit is contained in:
万佳 2021-09-13 11:14:21 +08:00
parent 0c3d2672f6
commit 5fb9d2df42
3 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,8 @@
package cn.org.gitlink.notification.common.constant;
import java.util.HashMap;
import java.util.Map;
/**
* @description:
* @author: wanjia
@ -8,4 +11,11 @@ package cn.org.gitlink.notification.common.constant;
public class NotificationSystemConstant {
//平台编码
public static final String PLATFORM_CODE_GITLINK = "gitlink"; //gitlink平台
public static final String PLATFORM_CODE_HEHUI = "hehui"; //hehui平台
public static final Map<String, String> PLATFORM_CODE_MAP = new HashMap<String, String>() {
{
put("gitlink", PLATFORM_CODE_GITLINK);
put("hehui", PLATFORM_CODE_HEHUI);
}
};
}

View File

@ -181,7 +181,7 @@ public class NotificationController {
private ResponseData validatePlatformCodeAndReceiver(String platform, Integer receiver) {
//验证 {platform} 参数合法性以判断请求来源
if (!platform.trim().toLowerCase().equals(NotificationSystemConstant.PLATFORM_CODE_GITLINK)) {
if (!NotificationSystemConstant.PLATFORM_CODE_MAP.containsKey(platform)) {
logger.debug("\t 输入参数 {platform} 的值 {" + platform + "} 无效");
return DataPacketUtil.jsonFailResult("{platform} 参数非法");
}

View File

@ -127,7 +127,7 @@ public class NotificationController {
private ResponseData validatePlatformCode(String platform) {
//验证 {platform} 参数合法性以判断请求来源
if (!platform.trim().toLowerCase().equals(NotificationSystemConstant.PLATFORM_CODE_GITLINK)) {
if (!NotificationSystemConstant.PLATFORM_CODE_MAP.containsKey(platform)) {
logger.debug("\t 输入参数 {platform} 的值 {" + platform + "} 无效");
return DataPacketUtil.jsonFailResult("{platform} 参数非法");
}