Authored by chaogeng

Merge branch 'test6.8.9'

... ... @@ -115,7 +115,7 @@ public class PublicUserAttention extends BaseEntity implements Serializable {
targetId = tblAttentionUser.getUidAttention();
status = 1;
attentionType = 1;
createTime = tblAttentionUser.getCreateTime()==null?System.currentTimeMillis():tblAttentionUser.getCreateTime()*1000;
createTime = tblAttentionUser.getCreateTime()==null?System.currentTimeMillis():tblAttentionUser.getCreateTime()*1000l;
authorType = 1;
srcChannel = 3;
}
... ...
... ... @@ -218,7 +218,7 @@ public class PublicUserComment extends BaseEntity implements Serializable {
this.auditStatus = 2;
this.toCommentId = null == parent ? null : parent.getId();
this.srcChannel = 3;
this.createTime = comment.getCreateTime() == null ? System.currentTimeMillis():comment.getCreateTime();
this.createTime = comment.getCreateTime() == null ? System.currentTimeMillis():comment.getCreateTime()*1000l;
this.relateId = comment.getId();
this.relateParentId = null == parent ? null : parent.getRelateId();
this.praiseNum = comment.getRealPraiseNum();
... ...
... ... @@ -105,6 +105,7 @@ public class PublicUserPraise extends BaseEntity implements Serializable {
targetId = article.getId();
createTime = praise.getCreateTime() == null ? System.currentTimeMillis() : praise.getCreateTime();
status = 1;
praiseType=1;
srcChannel=3;
}
}
... ...
... ... @@ -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){
... ...