增加校验逻辑

bynt 1 year ago
parent b42eeef9c8
commit ec5f864e74

@ -39,6 +39,7 @@ import java.util.stream.Collectors;
*/ */
@Slf4j @Slf4j
@Service @Service
@Deprecated
@RequiredArgsConstructor @RequiredArgsConstructor
public class DmpMonitorNumServiceImpl implements DmpMonitorNumService { public class DmpMonitorNumServiceImpl implements DmpMonitorNumService {

@ -165,10 +165,8 @@ public class DmpMonitorV2ServiceImpl implements DmpMonitorV2Service {
private List<DmpMonitorJpaDto> getDmpMonitorJpaDto(List<DmpMonitorJpaDto> list) { private List<DmpMonitorJpaDto> getDmpMonitorJpaDto(List<DmpMonitorJpaDto> list) {
List<DmpMonitorJpaDto> tradeList = new ArrayList<>(); List<DmpMonitorJpaDto> tradeList = new ArrayList<>();
Map<String, List<DmpMonitorJpaDto>> stringCollectionMap = Map<String, List<DmpMonitorJpaDto>> stringCollectionMap =
list.stream().collect(Collectors.groupingBy(DmpMonitorJpaDto::getTag)); list.stream().collect(Collectors.groupingBy(DmpMonitorJpaDto::getTag));
if (CollUtil.isNotEmpty(stringCollectionMap)) { if (CollUtil.isNotEmpty(stringCollectionMap)) {
List<DmpMonitorJpaDto> newDataList = Lists.newArrayList(); List<DmpMonitorJpaDto> newDataList = Lists.newArrayList();
List<DeliveryStatisticDTO> saveDataList = Lists.newArrayList(); List<DeliveryStatisticDTO> saveDataList = Lists.newArrayList();

@ -78,9 +78,10 @@ public class CheckPlatPointParamsUtil {
//安卓0 //安卓0
//IOS1 //IOS1
//其他3 //其他3
int os = Integer.parseInt(os1); if (ValidationUtil.isInteger(os1)) {
int os = Integer.parseInt(os1);
log.info("================================= [pre check model, os is {} ] =================================", os); log.info("================================= [pre check model, os is {} ] =================================", os);
/* /*
imei MD5 , 0md5 000000000000000 imei MD5 , 0md5 000000000000000
@ -88,30 +89,31 @@ public class CheckPlatPointParamsUtil {
*/ */
// 安卓 // 安卓
if (os == 0 && if (os == 0 &&
(StrUtil.equals(SpecialCheckParmConstant.ZERO_JL_IMEI, imei) || (StrUtil.equals(SpecialCheckParmConstant.ZERO_JL_IMEI, imei) ||
StrUtil.equals(SpecialCheckParmConstant.ZERO_JL_IMEI_MD5, imei) || StrUtil.equals(SpecialCheckParmConstant.ZERO_JL_IMEI_MD5, imei) ||
StrUtil.isBlank(imei)) StrUtil.isBlank(imei))
){ ){
return Boolean.FALSE; return Boolean.FALSE;
} }
// IOS // IOS
if (os == 1 && if (os == 1 &&
(StrUtil.equals(SpecialCheckParmConstant.ZERO_JL_IDFA, idfa) || (StrUtil.equals(SpecialCheckParmConstant.ZERO_JL_IDFA, idfa) ||
StrUtil.equals(SpecialCheckParmConstant.ZERO_JL_IDFA_MD5, idfaMD5) || StrUtil.equals(SpecialCheckParmConstant.ZERO_JL_IDFA_MD5, idfaMD5) ||
( StrUtil.isBlank(idfa) && StrUtil.isBlank(idfaMD5))) ( StrUtil.isBlank(idfa) && StrUtil.isBlank(idfaMD5)))
){ ){
return Boolean.FALSE; return Boolean.FALSE;
} }
// 其他 // 其他
if (os == 3 && (StrUtil.isBlank(imei) && StrUtil.isBlank(idfa) && StrUtil.isBlank(idfaMD5) && StrUtil.isBlank(mac))){ if (os == 3 && (StrUtil.isBlank(imei) && StrUtil.isBlank(idfa) && StrUtil.isBlank(idfaMD5) && StrUtil.isBlank(mac))){
return Boolean.FALSE; return Boolean.FALSE;
}
return Boolean.TRUE;
} }
return Boolean.FALSE;
return Boolean.TRUE;
} }
/** /**

@ -0,0 +1,35 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.baiyee.adcallback.tools;
import java.util.regex.Pattern;
/**
*
* @author Zheng Jie
* @date 2018-11-23
*/
public class ValidationUtil {
private ValidationUtil(){
}
public static boolean isInteger(String str) {
Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$");
return pattern.matcher(str).matches();
}
}
Loading…
Cancel
Save