From 08bc0a13c0c2e00658e5ea63839893e73902810f Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期五, 23 八月 2019 11:07:39 +0800
Subject: [PATCH] 金币任务

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralGetServiceImpl.java |  347 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 346 insertions(+), 1 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralGetServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralGetServiceImpl.java
index 9b69afd..3aaa9e2 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralGetServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralGetServiceImpl.java
@@ -5,13 +5,18 @@
 import javax.annotation.Resource;
 
 import org.springframework.cache.annotation.Cacheable;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
+import com.yeshi.fanli.entity.bus.user.UserInfo;
 import com.yeshi.fanli.entity.integral.IntegralTask;
 import com.yeshi.fanli.entity.integral.IntegralTask.FrequencyEnum;
+import com.yeshi.fanli.entity.integral.IntegralTask.TaskUniqueKeyEnum;
 import com.yeshi.fanli.entity.integral.IntegralTaskRecord;
 import com.yeshi.fanli.exception.integral.IntegralGetException;
 import com.yeshi.fanli.exception.integral.IntegralTaskRecordException;
+import com.yeshi.fanli.log.LogHelper;
+import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
 import com.yeshi.fanli.service.inter.integral.IntegralGetService;
 import com.yeshi.fanli.service.inter.integral.IntegralTaskRecordService;
 import com.yeshi.fanli.service.inter.integral.IntegralTaskService;
@@ -27,6 +32,9 @@
 
 	@Resource
 	private IntegralTaskRecordService integralTaskRecordService;
+	
+	@Resource
+	private ThreeSaleSerivce threeSaleSerivce;
 
 	@Resource
 	private RedisManager redisManager;
@@ -59,10 +67,19 @@
 		record.setUid(uid);
 
 		try {
-			return integralTaskRecordService.addRecord(record);
+			 IntegralTaskRecord addRecord = integralTaskRecordService.addRecord(record);
+			 if (TaskUniqueKeyEnum.inShop == TaskUniqueKeyEnum.valueOf(event)) {
+				 UserInfo boss = threeSaleSerivce.getBoss(uid);
+				 if (boss != null) 
+					 addInShopLevelOne(boss.getId()); // 涓嬬骇娴忚搴楅摵
+			 }
+			 return addRecord;
 		} catch (IntegralTaskRecordException e) {
 			throw new IntegralGetException(3, "娣诲姞璁板綍澶辫触");
 		}
+		
+		
+		
 
 		// switch (event) {
 		// case "recommendSearch":
@@ -105,6 +122,28 @@
 		// TODO Auto-generated method stub
 
 	}
+	
+	@Async()
+	private void addInShopLevelOne(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.inShopLevelOne.name(), null);
+			UserInfo boss = threeSaleSerivce.getBoss(uid);
+			if (boss != null) 
+				addInShopLevelTwo(boss.getId()); // 浜岀骇闃熷憳
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	@Async()
+	private void addInShopLevelTwo(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.inShopLevelTwo.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
 
 	@Override
 	public void addScanPushHistory(Long uid) throws IntegralGetException {
@@ -136,4 +175,310 @@
 
 	}
 
+	@Async()
+	@Override
+	public void addTaoLiJinBuy(Long uid, Long goodsId) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.taoLiJinBuy.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+
+	@Async()
+	@Override
+	public void addInviteLevelOne(Long uid, Long workerId) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.inviteLevelOne.name(), null);
+			UserInfo boss = threeSaleSerivce.getBoss(uid);
+			if (boss != null)
+				addInviteLevelTwo(boss.getId());
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	/**
+	 * 闂存帴閭�璇�
+	 * @param uid
+	 */
+	@Async()
+	private void addInviteLevelTwo(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.inviteLevelTwo.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	@Async()
+	@Override
+	public void addShareSingleGoods(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.shareSingleGoods.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	
+	@Async()
+	@Override
+	public void addShareMultipleGoods(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.shareMultipleGoods.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	
+	@Async()
+	@Override
+	public void addShareTLJGoods(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.shareTLJGoods.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	@Async()
+	@Override
+	public void addGiveRebateCoupon(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.giveRebateCoupon.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	
+	@Async()
+	@Override
+	public void addGiveFreeCoupon(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.giveFreeCoupon.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	
+	@Async()
+	@Override
+	public void addGiveTaoLiJin(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.giveTaoLiJin.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	
+	@Async()
+	@Override
+	public void addCloseRecommendGoods(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.closeRecommendGoods.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	
+	@Async()
+	@Override
+	public void addCouponRebate(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.couponRebate.name(), null);
+			UserInfo boss = threeSaleSerivce.getBoss(uid);
+			if (boss != null)
+				addCouponRebateLevelOne(boss.getId());
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	
+	/**
+	 * 涓�绾ч槦鍛橀鍒歌繑鍒�
+	 * @param uid
+	 */
+	@Async()
+	private void addCouponRebateLevelOne(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.couponRebateLevelOne.name(), null);
+			UserInfo boss = threeSaleSerivce.getBoss(uid);
+			if (boss != null)
+				addCouponRebateLevelTwo(boss.getId()); // 浜岀骇闃熷憳
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	/**
+	 *  浜岀骇闃熷憳棰嗗埜杩斿埄
+	 * @param uid
+	 */
+	@Async()
+	private void addCouponRebateLevelTwo(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.couponRebateLevelTwo.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	@Async()
+	@Override
+	public void addRebateOrder(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.rebateOrder.name(), null);
+			UserInfo boss = threeSaleSerivce.getBoss(uid);
+			if (boss != null)
+				addInviteOrderLevelOne(boss.getId());
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	
+	/**
+	 * 涓�绾ч槦鍛橀個璇疯鍗�
+	 * @param uid
+	 */
+	@Async()
+	private void addInviteOrderLevelOne(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.inviteOrderLevelOne.name(), null);
+			UserInfo boss = threeSaleSerivce.getBoss(uid);
+			if (boss != null)
+				addInviteOrderLevelTwo(boss.getId());
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	
+	/**
+	 * 浜岀骇闃熷憳閭�璇疯鍗�
+	 * @param uid
+	 */
+	@Async()
+	private void addInviteOrderLevelTwo(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.inviteOrderLevelTwo.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	@Async()
+	@Override
+	public void addShareOrder(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.shareOrder.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	
+	@Async()
+	@Override
+	public void addBindWeiXin(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.bindWeiXin.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	@Async()
+	@Override
+	public void addBindPhone(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.bindPhone.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	
+	@Async()
+	@Override
+	public void addBindTaoBao(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.bindTaoBao.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	
+	@Async()
+	@Override
+	public void addSetWeiXinNum(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.setWeiXinNum.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	@Async()
+	@Override
+	public void addSetGender(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.setGender.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	
+	@Async()
+	@Override
+	public void addSetPortrait(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.setPortrait.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	
+	@Async()
+	@Override
+	public void addSetNickname(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.setNickname.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	
+	@Async()
+	@Override
+	public void addBindAlipay(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.bindAlipay.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
+	
+	@Async()
+	@Override
+	public void addInviteActivate(Long uid) {
+		try {
+			addEventStatistic(uid, TaskUniqueKeyEnum.inviteActivate.name(), null);
+		} catch (Exception e) {
+			LogHelper.errorDetailInfo(e);
+		}
+	}
+	
 }

--
Gitblit v1.8.0