feat(REQ-3193): 钉钉用户历史数据加密Job
This commit is contained in:
parent
63f39a6dc8
commit
2f5398c70b
@ -0,0 +1,67 @@
|
||||
package cn.axzo.riven.job;
|
||||
|
||||
import cn.axzo.basics.common.constant.enums.TableIsDeleteEnum;
|
||||
import cn.axzo.riven.repository.entity.ThirdPartyUser;
|
||||
import cn.axzo.riven.repository.service.ThirdPartyUserDao;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.xxl.job.core.biz.model.ReturnT;
|
||||
import com.xxl.job.core.handler.IJobHandler;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import com.xxl.job.core.log.XxlJobLogger;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class RepairThirdPartUserEncryptJob extends IJobHandler {
|
||||
|
||||
@Autowired
|
||||
private ThirdPartyUserDao thirdPartyUserDao;
|
||||
|
||||
@XxlJob("repairThirdPartyUserEncryptJob")
|
||||
@Override
|
||||
public ReturnT<String> execute(String s) throws Exception {
|
||||
|
||||
XxlJobLogger.log("repairThirdPartyUserEncryptJob 开始, param = " + s);
|
||||
Param param = StringUtils.isNotEmpty(s) ? JSON.parseObject(s, Param.class) : new Param();
|
||||
|
||||
List<ThirdPartyUser> allThirdPeople = thirdPartyUserDao.lambdaQuery()
|
||||
.in(CollUtil.isNotEmpty(param.getIds()), ThirdPartyUser::getId, param.getIds())
|
||||
.in(CollUtil.isNotEmpty(param.getUserPhones()), ThirdPartyUser::getUserPhone, param.getUserPhones())
|
||||
.eq(ThirdPartyUser::getIsDelete, TableIsDeleteEnum.NORMAL.value)
|
||||
.list().stream()
|
||||
.map(tp -> {
|
||||
ThirdPartyUser thirdPerson = new ThirdPartyUser();
|
||||
thirdPerson.setId(tp.getId());
|
||||
thirdPerson.setUserPhone(tp.getUserPhone());
|
||||
thirdPerson.setUpdateAt(tp.getUpdateAt());
|
||||
return thirdPerson;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
thirdPartyUserDao.saveOrUpdateBatch(allThirdPeople);
|
||||
|
||||
XxlJobLogger.log("repairThirdPartyUserEncryptJob 结束,处理条数 - " + allThirdPeople.size());
|
||||
|
||||
return ReturnT.SUCCESS;
|
||||
}
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
@Builder
|
||||
public static class Param {
|
||||
private Set<Long> ids;
|
||||
private Set<String> userPhones;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user