|
@ -31,7 +31,7 @@ import com.epmet.modules.partymember.service.PartymemberBaseInfoService; |
|
|
import com.epmet.resi.partymember.dto.partymember.PartymemberBaseInfoDTO; |
|
|
import com.epmet.resi.partymember.dto.partymember.PartymemberBaseInfoDTO; |
|
|
import com.epmet.resi.partymember.dto.partymember.PartymemberConfirmAutoDTO; |
|
|
import com.epmet.resi.partymember.dto.partymember.PartymemberConfirmAutoDTO; |
|
|
import com.epmet.resi.partymember.dto.partymember.PartymemberInfoDTO; |
|
|
import com.epmet.resi.partymember.dto.partymember.PartymemberInfoDTO; |
|
|
import info.debatty.java.stringsimilarity.JaroWinkler; |
|
|
import info.debatty.java.stringsimilarity.Levenshtein; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.jetbrains.annotations.NotNull; |
|
|
import org.jetbrains.annotations.NotNull; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
@ -129,7 +129,7 @@ public class PartymemberBaseInfoServiceImpl extends BaseServiceImpl<PartymemberB |
|
|
idCardList.stream().filter(baseInfo -> baseInfo.getMobile().equals(partyMemberInfo.getMobile())).findFirst(); |
|
|
idCardList.stream().filter(baseInfo -> baseInfo.getMobile().equals(partyMemberInfo.getMobile())).findFirst(); |
|
|
|
|
|
|
|
|
if (matchingResult.isPresent()) { |
|
|
if (matchingResult.isPresent()) { |
|
|
confirmAutoDTO = getResult(matchingResult.get(), partyMemberInfo); |
|
|
confirmAutoDTO = getResult(matchingResult.get(), partyMemberInfo, true); |
|
|
return confirmAutoDTO; |
|
|
return confirmAutoDTO; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -137,7 +137,7 @@ public class PartymemberBaseInfoServiceImpl extends BaseServiceImpl<PartymemberB |
|
|
matchingResult = idCardList.stream().filter(baseInfo -> baseInfo.getName().equals(name)).findFirst(); |
|
|
matchingResult = idCardList.stream().filter(baseInfo -> baseInfo.getName().equals(name)).findFirst(); |
|
|
|
|
|
|
|
|
if (matchingResult.isPresent()) { |
|
|
if (matchingResult.isPresent()) { |
|
|
confirmAutoDTO = getResult(matchingResult.get(), partyMemberInfo); |
|
|
confirmAutoDTO = getResult(matchingResult.get(), partyMemberInfo, true); |
|
|
return confirmAutoDTO; |
|
|
return confirmAutoDTO; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -147,7 +147,7 @@ public class PartymemberBaseInfoServiceImpl extends BaseServiceImpl<PartymemberB |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
//根据手机号匹配数据
|
|
|
//根据手机号匹配数据
|
|
|
List<PartymemberBaseInfoEntity> mobileList = baseDao.selectBaseInfoByIdCard(partyMemberInfo); |
|
|
List<PartymemberBaseInfoEntity> mobileList = baseDao.selectBaseInfoByMobile(partyMemberInfo); |
|
|
|
|
|
|
|
|
if (null != mobileList && mobileList.size() > 0) { |
|
|
if (null != mobileList && mobileList.size() > 0) { |
|
|
//判断手机号和姓名
|
|
|
//判断手机号和姓名
|
|
@ -155,7 +155,7 @@ public class PartymemberBaseInfoServiceImpl extends BaseServiceImpl<PartymemberB |
|
|
mobileList.stream().filter(baseInfo -> baseInfo.getName().equals(name)).findFirst(); |
|
|
mobileList.stream().filter(baseInfo -> baseInfo.getName().equals(name)).findFirst(); |
|
|
|
|
|
|
|
|
if (matchingResult.isPresent()) { |
|
|
if (matchingResult.isPresent()) { |
|
|
confirmAutoDTO = getResult(matchingResult.get(), partyMemberInfo); |
|
|
confirmAutoDTO = getResult(matchingResult.get(), partyMemberInfo, true); |
|
|
return confirmAutoDTO; |
|
|
return confirmAutoDTO; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -164,7 +164,7 @@ public class PartymemberBaseInfoServiceImpl extends BaseServiceImpl<PartymemberB |
|
|
getSimilarity(p, partyMemberInfo)).reversed()).collect(Collectors.toList()).get(0)); |
|
|
getSimilarity(p, partyMemberInfo)).reversed()).collect(Collectors.toList()).get(0)); |
|
|
} else { |
|
|
} else { |
|
|
//根据姓名匹配数据
|
|
|
//根据姓名匹配数据
|
|
|
List<PartymemberBaseInfoEntity> nameList = baseDao.selectBaseInfoByIdCard(partyMemberInfo); |
|
|
List<PartymemberBaseInfoEntity> nameList = baseDao.selectBaseInfoByName(partyMemberInfo); |
|
|
|
|
|
|
|
|
if (null != nameList && nameList.size() > 0) { |
|
|
if (null != nameList && nameList.size() > 0) { |
|
|
//获取匹配度最高的数据
|
|
|
//获取匹配度最高的数据
|
|
@ -175,13 +175,20 @@ public class PartymemberBaseInfoServiceImpl extends BaseServiceImpl<PartymemberB |
|
|
nameList.stream().sorted(Comparator.comparing((PartymemberBaseInfoEntity p) -> |
|
|
nameList.stream().sorted(Comparator.comparing((PartymemberBaseInfoEntity p) -> |
|
|
getSimilarity(p, partyMemberInfo)).reversed()).collect(Collectors.toList()).get(0); |
|
|
getSimilarity(p, partyMemberInfo)).reversed()).collect(Collectors.toList()).get(0); |
|
|
|
|
|
|
|
|
confirmAutoDTO = getResult(similar, partyMemberInfo); |
|
|
confirmAutoDTO = getResult(similar, partyMemberInfo, false); |
|
|
return confirmAutoDTO; |
|
|
return confirmAutoDTO; |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
return null; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return null; |
|
|
|
|
|
|
|
|
PartymemberBaseInfoEntity similar = |
|
|
|
|
|
sortList.stream().sorted(Comparator.comparing((PartymemberBaseInfoEntity p) -> |
|
|
|
|
|
getSimilarity(p, partyMemberInfo)).reversed()).collect(Collectors.toList()).get(0); |
|
|
|
|
|
|
|
|
|
|
|
return getResult(similar, partyMemberInfo, false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -192,7 +199,8 @@ public class PartymemberBaseInfoServiceImpl extends BaseServiceImpl<PartymemberB |
|
|
* @param info 录入信息 |
|
|
* @param info 录入信息 |
|
|
* @return PartymemberConfirmAutoDTO |
|
|
* @return PartymemberConfirmAutoDTO |
|
|
*/ |
|
|
*/ |
|
|
private PartymemberConfirmAutoDTO getResult(PartymemberBaseInfoEntity baseInfo, PartymemberInfoDTO info) { |
|
|
private PartymemberConfirmAutoDTO getResult(PartymemberBaseInfoEntity baseInfo, PartymemberInfoDTO info, |
|
|
|
|
|
boolean comparisonResults) { |
|
|
PartymemberConfirmAutoDTO confirmAutoDTO = new PartymemberConfirmAutoDTO(); |
|
|
PartymemberConfirmAutoDTO confirmAutoDTO = new PartymemberConfirmAutoDTO(); |
|
|
confirmAutoDTO.setPatryMemberBaseInfoId(baseInfo.getId()); |
|
|
confirmAutoDTO.setPatryMemberBaseInfoId(baseInfo.getId()); |
|
|
confirmAutoDTO.setBaseName(baseInfo.getName()); |
|
|
confirmAutoDTO.setBaseName(baseInfo.getName()); |
|
@ -200,8 +208,9 @@ public class PartymemberBaseInfoServiceImpl extends BaseServiceImpl<PartymemberB |
|
|
confirmAutoDTO.setBaseIdCard(baseInfo.getIdCard()); |
|
|
confirmAutoDTO.setBaseIdCard(baseInfo.getIdCard()); |
|
|
confirmAutoDTO.setInputIdCard(info.getIdCard()); |
|
|
confirmAutoDTO.setInputIdCard(info.getIdCard()); |
|
|
confirmAutoDTO.setBaseMobile(baseInfo.getMobile()); |
|
|
confirmAutoDTO.setBaseMobile(baseInfo.getMobile()); |
|
|
confirmAutoDTO.setInputMobile(info.getIdCard()); |
|
|
confirmAutoDTO.setInputMobile(info.getMobile()); |
|
|
confirmAutoDTO.setContrastTime(new Date()); |
|
|
confirmAutoDTO.setContrastTime(new Date()); |
|
|
|
|
|
confirmAutoDTO.setComparisonResults(comparisonResults); |
|
|
String result = getSimilarity(baseInfo, info); |
|
|
String result = getSimilarity(baseInfo, info); |
|
|
//身份证比对结果
|
|
|
//身份证比对结果
|
|
|
if (EQUAL.equals(result.substring(START, ID_CARD_COUNT))) { |
|
|
if (EQUAL.equals(result.substring(START, ID_CARD_COUNT))) { |
|
@ -237,10 +246,10 @@ public class PartymemberBaseInfoServiceImpl extends BaseServiceImpl<PartymemberB |
|
|
|
|
|
|
|
|
String result = ""; |
|
|
String result = ""; |
|
|
|
|
|
|
|
|
JaroWinkler jw = new JaroWinkler(); |
|
|
Levenshtein levenshtein = new Levenshtein(); |
|
|
double idCardResult = jw.similarity(baseInfo.getIdCard(), info.getIdCard()); |
|
|
double idCardResult = levenshtein.distance(baseInfo.getIdCard(), info.getIdCard()); |
|
|
double mobileResult = jw.similarity(baseInfo.getMobile(), info.getMobile()); |
|
|
double mobileResult = levenshtein.distance(baseInfo.getMobile(), info.getMobile()); |
|
|
double nameResult = jw.similarity(baseInfo.getName(), info.getSurname() + info.getName()); |
|
|
double nameResult = levenshtein.distance(baseInfo.getName(), info.getSurname() + info.getName()); |
|
|
result = getString(result, idCardResult, PartyMemberConstant.ID_MOST, PartyMemberConstant.ID_SMALL); |
|
|
result = getString(result, idCardResult, PartyMemberConstant.ID_MOST, PartyMemberConstant.ID_SMALL); |
|
|
|
|
|
|
|
|
result = getString(result, mobileResult, PartyMemberConstant.MOBILE_MOST, PartyMemberConstant.MOBILE_SMALL); |
|
|
result = getString(result, mobileResult, PartyMemberConstant.MOBILE_MOST, PartyMemberConstant.MOBILE_SMALL); |
|
@ -255,9 +264,9 @@ public class PartymemberBaseInfoServiceImpl extends BaseServiceImpl<PartymemberB |
|
|
private String getString(String result, double comparisonResult, double most, double small) { |
|
|
private String getString(String result, double comparisonResult, double most, double small) { |
|
|
if (comparisonResult == PartyMemberConstant.EQUALS) { |
|
|
if (comparisonResult == PartyMemberConstant.EQUALS) { |
|
|
result = result + "11"; |
|
|
result = result + "11"; |
|
|
} else if (comparisonResult > most) { |
|
|
} else if (comparisonResult <= most) { |
|
|
result = result + "10"; |
|
|
result = result + "10"; |
|
|
} else if (comparisonResult < small) { |
|
|
} else if (comparisonResult >= small) { |
|
|
result = result + "00"; |
|
|
result = result + "00"; |
|
|
} else { |
|
|
} else { |
|
|
result = result + "01"; |
|
|
result = result + "01"; |
|
|