...
|
...
|
@@ -64,7 +64,7 @@ public class YohoNowDataSynService { |
|
|
@Resource
|
|
|
private ITblAttentionUserRepository tblAttentionUserRepository;
|
|
|
private final Logger logger = LoggerFactory.getLogger(YohoNowDataSynService.class);
|
|
|
@Resource(name = "entityManagerPrimary")
|
|
|
@Resource(name = "entityManagerSecondary")
|
|
|
private EntityManager publicEntityManager;
|
|
|
public final int size=50;
|
|
|
private Boolean isStop =false;
|
...
|
...
|
@@ -345,7 +345,23 @@ public class YohoNowDataSynService { |
|
|
List<PublicUserAttention> userAttentions = buildSynAttentionAuthor(fanUsersMap,filtedFanUids);
|
|
|
logger.info("before synAttentionAuthorByArticle.size is {}",userAttentions.size());
|
|
|
if(!CollectionUtils.isEmpty(userAttentions)){
|
|
|
publicUserAttentionRepository.saveAll(userAttentions);
|
|
|
publicEntityManager.getTransaction().begin();
|
|
|
StringBuilder sb = null;
|
|
|
for(PublicUserAttention attention : userAttentions){
|
|
|
if(null == sb ){
|
|
|
sb = new StringBuilder("insert into public_user_attention(uid,target_id,attention_type,author_type,status,src_channel,create_time,update_time) values ");
|
|
|
}else {
|
|
|
sb.append(",");
|
|
|
}
|
|
|
sb.append("(").append(attention.getUid()).append(",").append(attention.getTargetId()).append(",").append(attention.getAttentionType()).append(",")
|
|
|
.append(attention.getAuthorType()).append(",").append(attention.getStatus()).append(",").
|
|
|
append(attention.getSrcChannel()).append(",").append(attention.getCreateTime()).append(",").append(attention.getUpdateTime()).append(")");
|
|
|
}
|
|
|
sb.append("ON DUPLICATE KEY UPDATE uid=values(uid),target_id=values(target_id),attention_type=values(attention_type),author_type=values(author_type),status=values(status),src_channel=values(src_channel),create_time=values(create_time),update_time=values(update_time)");
|
|
|
publicEntityManager.createNativeQuery(sb.toString()).executeUpdate();
|
|
|
publicEntityManager.flush();
|
|
|
publicEntityManager.getTransaction().commit();
|
|
|
|
|
|
try{
|
|
|
Thread.sleep(500);
|
|
|
}catch (Exception exp){
|
...
|
...
|
|