| | |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.utils.SensitiveDataCryptoUtil; |
| | | import com.xiaopeng.common.core.utils.WebUtils; |
| | | import com.xiaopeng.common.core.utils.bean.BeanUtils; |
| | | import com.xiaopeng.common.core.utils.ip.IpUtils; |
| | |
| | | public R<XpWhitelist> detail(@PathVariable("id") Long id) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | XpWhitelist xpWhitelist = xpWhitelistService.getById(id); |
| | | xpWhitelist.setAccount(SensitiveDataCryptoUtil.decryptIfPossible(xpWhitelist.getAccount())); |
| | | if(!loginUser.getPhoneDesensitizationExempt()){ |
| | | xpWhitelist.setAccount(DesensitizedUtil.mobilePhone(xpWhitelist.getAccount())); |
| | | } |
| | |
| | | if (!CollectionUtils.isEmpty(candidateAccounts)) { |
| | | existsAccounts = xpWhitelistService.lambdaQuery() |
| | | .select(XpWhitelist::getAccount) |
| | | .in(XpWhitelist::getAccount, candidateAccounts) |
| | | .in(XpWhitelist::getAccount, buildAccountQueryValues(candidateAccounts)) |
| | | .list() |
| | | .stream() |
| | | .map(XpWhitelist::getAccount) |
| | | .map(SensitiveDataCryptoUtil::decryptIfPossible) |
| | | .filter(StringUtils::hasLength) |
| | | .collect(Collectors.toSet()); |
| | | } |
| | |
| | | } |
| | | XpWhitelist xpWhitelist = new XpWhitelist(); |
| | | xpWhitelist.setNickName(whitelistImportExcel.getNickName()); |
| | | xpWhitelist.setAccount(whitelistImportExcel.getAccount()); |
| | | xpWhitelist.setAccount(SensitiveDataCryptoUtil.encrypt(whitelistImportExcel.getAccount())); |
| | | xpWhitelist.setStatus(true); |
| | | xpWhitelist.setIsPriorityDispatch(true); |
| | | xpWhitelist.setWhitelistSource(1); |
| | |
| | | return value.substring(0, maxLength); |
| | | } |
| | | |
| | | private static List<String> buildAccountQueryValues(Collection<String> accounts) { |
| | | Set<String> values = new LinkedHashSet<>(); |
| | | if (accounts == null) { |
| | | return new ArrayList<>(); |
| | | } |
| | | for (String account : accounts) { |
| | | if (StringUtils.hasLength(account)) { |
| | | values.addAll(SensitiveDataCryptoUtil.queryValues(account)); |
| | | } |
| | | } |
| | | return new ArrayList<>(values); |
| | | } |
| | | |
| | | @ApiOperation(value = "白名单导出") |
| | | @PostMapping(value = "/api/v1/whitelist/exportExcels") |
| | | public void exportExcels(@RequestBody WhitelistPageListQuery query) { |
| | |
| | | */ |
| | | @PostMapping("/logan/api/v1/whitelist/inner/getXpWhitelistByPhone") |
| | | public R<List<XpWhitelist>> getXpWhitelistByPhone(@RequestParam String phone){ |
| | | List<XpWhitelist> list = xpWhitelistService.list(new QueryWrapper<XpWhitelist>().eq("account", phone) |
| | | if (!StringUtils.hasLength(phone)) { |
| | | return R.ok(Collections.emptyList()); |
| | | } |
| | | List<XpWhitelist> list = xpWhitelistService.list(new QueryWrapper<XpWhitelist>().in("account", SensitiveDataCryptoUtil.queryValues(phone)) |
| | | .eq("status", 1).eq("is_deleted", 0)); |
| | | list.forEach(item -> item.setAccount(SensitiveDataCryptoUtil.decryptIfPossible(item.getAccount()))); |
| | | return R.ok(list); |
| | | } |
| | | |