| | |
| | | import cn.hutool.core.util.DesensitizedUtil; |
| | | import cn.hutool.core.util.PhoneUtil; |
| | | import cn.hutool.core.io.resource.ClassPathResource; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.xiaopeng.api.dto.account.UcUserInfo; |
| | | import com.xiaopeng.api.feignClient.account.SysGroupMenuClient; |
| | | import com.xiaopeng.api.feignClient.account.UserResourcesClient; |
| | | import com.xiaopeng.api.model.operation.XpInvitationCode; |
| | | import com.xiaopeng.api.model.operation.XpWhitelist; |
| | | 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.DateUtils; |
| | | import com.xiaopeng.common.core.utils.SensitiveDataCryptoUtil; |
| | | import com.xiaopeng.common.core.utils.WebUtils; |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.log.annotation.AdminOperationLog; |
| | |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.shardingsphere.transaction.annotation.ShardingSphereTransactionType; |
| | | import org.apache.shardingsphere.transaction.core.TransactionType; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.MessageSource; |
| | | import org.springframework.context.i18n.LocaleContextHolder; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private SysGroupMenuClient groupMenuClient; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private UserResourcesClient userResourcesClient; |
| | | |
| | | private static final Pattern CHINESE_PATTERN = Pattern.compile("\\p{IsHan}"); |
| | | private static final long INVITATION_CODE_LIMIT = 500L; |
| | |
| | | String res = replace.replace("/", "-"); |
| | | locationExcel.setBindTime(res); |
| | | } |
| | | |
| | | xpInvitationCode.setBindTime(DateUtils.stringToLocalDateTime(locationExcel.getBindTime())); |
| | | xpInvitationCode.setStatus(2); |
| | | UcUserInfo userByMobile = userResourcesClient.getUserByMobile(locationExcel.getBindAccount()); |
| | | if(null == userByMobile || StringUtils.isEmpty(userByMobile.getUid())){ |
| | | throw new ServiceException("手机号"+locationExcel.getBindAccount()+"查询用户失败"); |
| | | } |
| | | XpWhitelist xpWhitelist = new XpWhitelist(); |
| | | xpWhitelist.setAccount(locationExcel.getBindAccount()); |
| | | xpWhitelist.setAccount(SensitiveDataCryptoUtil.encrypt(locationExcel.getBindAccount())); |
| | | xpWhitelist.setNickName(userByMobile.getNickName()); |
| | | xpWhitelist.setAppUserId(userByMobile.getUid()); |
| | | xpWhitelist.setStatus(true); |
| | | xpWhitelist.setIsPriorityDispatch(false); |
| | | xpWhitelist.setWhitelistSource(2); |
| | |
| | | public R deleteByIds(String ids){ |
| | | // 再转化为Long类型 |
| | | List<Long> longs = Arrays.stream(ids.split(",")).map(Long::parseLong).collect(Collectors.toList()); |
| | | List<XpInvitationCode> xpInvitationCodes = xpInvitationCodeService.listByIds(longs); |
| | | for (XpInvitationCode xpInvitationCode : xpInvitationCodes) { |
| | | XpWhitelist one = xpWhitelistService.getOne(new QueryWrapper<XpWhitelist>().eq("whitelist_source", 2) |
| | | .eq("status", 1).eq("is_deleted", 0) |
| | | .eq("account", SensitiveDataCryptoUtil.encrypt(xpInvitationCode.getBindAccount())).last(" limit 1")); |
| | | if(null != one){ |
| | | xpWhitelistService.removeById(one); |
| | | } |
| | | } |
| | | xpInvitationCodeService.removeBatchByIds(longs); |
| | | return R.ok(); |
| | | } |