Authored by chaogeng

Merge branch 'test6.8.9'

@@ -115,7 +115,7 @@ public class PublicUserAttention extends BaseEntity implements Serializable { @@ -115,7 +115,7 @@ public class PublicUserAttention extends BaseEntity implements Serializable {
115 targetId = tblAttentionUser.getUidAttention(); 115 targetId = tblAttentionUser.getUidAttention();
116 status = 1; 116 status = 1;
117 attentionType = 1; 117 attentionType = 1;
118 - createTime = tblAttentionUser.getCreateTime()==null?System.currentTimeMillis():tblAttentionUser.getCreateTime()*1000; 118 + createTime = tblAttentionUser.getCreateTime()==null?System.currentTimeMillis():tblAttentionUser.getCreateTime()*1000l;
119 authorType = 1; 119 authorType = 1;
120 srcChannel = 3; 120 srcChannel = 3;
121 } 121 }
@@ -218,7 +218,7 @@ public class PublicUserComment extends BaseEntity implements Serializable { @@ -218,7 +218,7 @@ public class PublicUserComment extends BaseEntity implements Serializable {
218 this.auditStatus = 2; 218 this.auditStatus = 2;
219 this.toCommentId = null == parent ? null : parent.getId(); 219 this.toCommentId = null == parent ? null : parent.getId();
220 this.srcChannel = 3; 220 this.srcChannel = 3;
221 - this.createTime = comment.getCreateTime() == null ? System.currentTimeMillis():comment.getCreateTime(); 221 + this.createTime = comment.getCreateTime() == null ? System.currentTimeMillis():comment.getCreateTime()*1000l;
222 this.relateId = comment.getId(); 222 this.relateId = comment.getId();
223 this.relateParentId = null == parent ? null : parent.getRelateId(); 223 this.relateParentId = null == parent ? null : parent.getRelateId();
224 this.praiseNum = comment.getRealPraiseNum(); 224 this.praiseNum = comment.getRealPraiseNum();
@@ -105,6 +105,7 @@ public class PublicUserPraise extends BaseEntity implements Serializable { @@ -105,6 +105,7 @@ public class PublicUserPraise extends BaseEntity implements Serializable {
105 targetId = article.getId(); 105 targetId = article.getId();
106 createTime = praise.getCreateTime() == null ? System.currentTimeMillis() : praise.getCreateTime(); 106 createTime = praise.getCreateTime() == null ? System.currentTimeMillis() : praise.getCreateTime();
107 status = 1; 107 status = 1;
  108 + praiseType=1;
108 srcChannel=3; 109 srcChannel=3;
109 } 110 }
110 } 111 }
@@ -64,7 +64,7 @@ public class YohoNowDataSynService { @@ -64,7 +64,7 @@ public class YohoNowDataSynService {
64 @Resource 64 @Resource
65 private ITblAttentionUserRepository tblAttentionUserRepository; 65 private ITblAttentionUserRepository tblAttentionUserRepository;
66 private final Logger logger = LoggerFactory.getLogger(YohoNowDataSynService.class); 66 private final Logger logger = LoggerFactory.getLogger(YohoNowDataSynService.class);
67 - @Resource(name = "entityManagerPrimary") 67 + @Resource(name = "entityManagerSecondary")
68 private EntityManager publicEntityManager; 68 private EntityManager publicEntityManager;
69 public final int size=50; 69 public final int size=50;
70 private Boolean isStop =false; 70 private Boolean isStop =false;
@@ -345,7 +345,23 @@ public class YohoNowDataSynService { @@ -345,7 +345,23 @@ public class YohoNowDataSynService {
345 List<PublicUserAttention> userAttentions = buildSynAttentionAuthor(fanUsersMap,filtedFanUids); 345 List<PublicUserAttention> userAttentions = buildSynAttentionAuthor(fanUsersMap,filtedFanUids);
346 logger.info("before synAttentionAuthorByArticle.size is {}",userAttentions.size()); 346 logger.info("before synAttentionAuthorByArticle.size is {}",userAttentions.size());
347 if(!CollectionUtils.isEmpty(userAttentions)){ 347 if(!CollectionUtils.isEmpty(userAttentions)){
348 - publicUserAttentionRepository.saveAll(userAttentions); 348 + publicEntityManager.getTransaction().begin();
  349 + StringBuilder sb = null;
  350 + for(PublicUserAttention attention : userAttentions){
  351 + if(null == sb ){
  352 + sb = new StringBuilder("insert into public_user_attention(uid,target_id,attention_type,author_type,status,src_channel,create_time,update_time) values ");
  353 + }else {
  354 + sb.append(",");
  355 + }
  356 + sb.append("(").append(attention.getUid()).append(",").append(attention.getTargetId()).append(",").append(attention.getAttentionType()).append(",")
  357 + .append(attention.getAuthorType()).append(",").append(attention.getStatus()).append(",").
  358 + append(attention.getSrcChannel()).append(",").append(attention.getCreateTime()).append(",").append(attention.getUpdateTime()).append(")");
  359 + }
  360 + 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)");
  361 + publicEntityManager.createNativeQuery(sb.toString()).executeUpdate();
  362 + publicEntityManager.flush();
  363 + publicEntityManager.getTransaction().commit();
  364 +
349 try{ 365 try{
350 Thread.sleep(500); 366 Thread.sleep(500);
351 }catch (Exception exp){ 367 }catch (Exception exp){