Authored by mingdan.ge

生成渠道号查询走主库

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONException; @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONException;
5 import com.alibaba.fastjson.JSONObject; 5 import com.alibaba.fastjson.JSONObject;
6 import com.yoho.core.common.utils.JsonUtil; 6 import com.yoho.core.common.utils.JsonUtil;
7 import com.yoho.core.config.ConfigReader; 7 import com.yoho.core.config.ConfigReader;
  8 +import com.yoho.core.dal.datasource.annotation.Database;
8 import com.yoho.core.rabbitmq.YhProducer; 9 import com.yoho.core.rabbitmq.YhProducer;
9 import com.yoho.error.ServiceError; 10 import com.yoho.error.ServiceError;
10 import com.yoho.error.exception.ServiceException; 11 import com.yoho.error.exception.ServiceException;
@@ -344,6 +345,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -344,6 +345,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
344 * @return 345 * @return
345 */ 346 */
346 @Override 347 @Override
  348 + @Database(ForceMaster = true)
347 public int agreeApply(IdOrIdsBo req){ 349 public int agreeApply(IdOrIdsBo req){
348 logger.info("agreeApply,req is {}", req); 350 logger.info("agreeApply,req is {}", req);
349 if (req.getId() != null) { 351 if (req.getId() != null) {
@@ -383,12 +385,15 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -383,12 +385,15 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
383 logger.info("agreeApply,updateStatus null,req is {}", req); 385 logger.info("agreeApply,updateStatus null,req is {}", req);
384 return 0; 386 return 0;
385 } 387 }
  388 + logger.info("agreeApply,updateStatus num is {}", result);
386 List<UnionShareUserApply> unionShareUserApplies = unionShareUserApplyMapper.selectByIds(idSet); 389 List<UnionShareUserApply> unionShareUserApplies = unionShareUserApplyMapper.selectByIds(idSet);
387 if (CollectionUtils.isEmpty(unionShareUserApplies)) { 390 if (CollectionUtils.isEmpty(unionShareUserApplies)) {
388 logger.info("agreeApply,selectByIds null,req is {}", req); 391 logger.info("agreeApply,selectByIds null,req is {}", req);
389 return 0; 392 return 0;
390 } 393 }
  394 + logger.info("agreeApply,selectByIds num is {},idSet is {}", unionShareUserApplies.size(),idSet);
391 unionShareUserApplies.forEach(u->{ 395 unionShareUserApplies.forEach(u->{
  396 + logger.info("agreeApply,begin to relateUnionType ,uid is {}",u.getUid());
392 if (u.getCheckTime() == null ||u.getCheckTime() != currentTimeSecond) { 397 if (u.getCheckTime() == null ||u.getCheckTime() != currentTimeSecond) {
393 return; 398 return;
394 } 399 }
@@ -399,6 +404,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -399,6 +404,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
399 } 404 }
400 redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),u.getUid()); 405 redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),u.getUid());
401 }); 406 });
  407 + logger.info("agreeApply end,req is {}", req);
402 return result; 408 return result;
403 } 409 }
404 } 410 }
@@ -422,7 +428,18 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -422,7 +428,18 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
422 428
423 //生成unionType 429 //生成unionType
424 MktMarketingUrl unionDepartmentUrl = buildMktMarketingUrl(uid); 430 MktMarketingUrl unionDepartmentUrl = buildMktMarketingUrl(uid);
425 - mktMarketingUrlDAO.insertSelective(unionDepartmentUrl); 431 + try {
  432 + mktMarketingUrlDAO.insertSelective(unionDepartmentUrl);
  433 + } catch (Exception e) {
  434 + //重试一次
  435 + //生成unionType
  436 + unionDepartmentUrl = buildMktMarketingUrl(uid);
  437 + try {
  438 + mktMarketingUrlDAO.insertSelective(unionDepartmentUrl);
  439 + } catch (Exception e2) {
  440 + logger.info("relateUnionType error,bind unionType,uid is {},unionType is {}", uid,unionDepartmentUrl.getUnionType());
  441 + }
  442 + }
426 logger.info("relateUnionType,bind unionType,uid is {},unionType is {}", uid,unionDepartmentUrl.getUnionType()); 443 logger.info("relateUnionType,bind unionType,uid is {},unionType is {}", uid,unionDepartmentUrl.getUnionType());
427 //绑定uid和unionType 444 //绑定uid和unionType
428 UnionShareUser unionShareUser = new UnionShareUser(); 445 UnionShareUser unionShareUser = new UnionShareUser();