From d8359ddb48dab5cc797a9d552e11fde571f4920c Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期二, 27 八月 2019 12:32:46 +0800 Subject: [PATCH] Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div --- fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java | 1 fanli/src/main/java/com/yeshi/fanli/util/DouYinUtil.java | 34 ++++ fanli/src/main/java/com/yeshi/fanli/util/jd/JDUtil.java | 6 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java | 2 fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralGetService.java | 22 +- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java | 9 fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java | 5 fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java | 2 fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralTaskRecordService.java | 2 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java | 24 +- fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralGetServiceImpl.java | 210 +++++++++++++++---------- fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java | 4 fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/ThreeSaleSerivceImpl.java | 105 ++++++------- fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java | 2 fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoUtil.java | 6 15 files changed, 245 insertions(+), 189 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java index 5217831..799c50a 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java @@ -943,9 +943,7 @@ try { goodsList = TaoKeApiUtil.getBatchGoodsInfo(ids); } catch (TaoKeApiException e1) { - e1.printStackTrace(); } catch (TaobaoGoodsDownException e1) { - e1.printStackTrace(); } if (goodsList != null && goodsList.size() > 0) { diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java index 2508cbf..80e4ce2 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java @@ -108,8 +108,7 @@ @Resource private JumpDetailV2Service jumpDetailV2Service; - - + /** * 鑾峰彇浠诲姟鍒楄〃 * @@ -118,7 +117,7 @@ * @param page * @param out */ -// @RequestSerializableByKey(key="#acceptData.device") + // @RequestSerializableByKey(key="#acceptData.device") @RequestMapping(value = "getTaskList", method = RequestMethod.POST) public void getTaskList(AcceptData acceptData, Long uid, Integer page, PrintWriter out) { if (uid == null || uid <= 0) { @@ -186,17 +185,17 @@ } for (IntegralTaskClassVO taskClassVO : list) { - UniqueKeyEnum uniqueKey = taskClassVO.getUniqueKey(); - + UniqueKeyEnum uniqueKey = taskClassVO.getUniqueKey(); + UserInfoExtraVO extraVO = userInfoExtraService.getInfoExtraVOByUid(uid); if (extraVO == null || StringUtil.isNullOrEmpty(extraVO.getInviteCode())) { JumpDetailV2 jumpDetailV2 = jumpDetailV2Service.getByTypeCache("invite_activate", - Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion())); - + Constant.getPlatformCode(acceptData.getPlatform()), + Integer.parseInt(acceptData.getVersion())); + taskClassVO.setJumpDetail(jumpDetailV2); } - - + String progress = taskClassVO.getProgress(); if (StringUtil.isNullOrEmpty(progress)) continue; @@ -420,7 +419,6 @@ out.print(JsonUtil.loadFalseResult(1, e.getMsg())); } } - /** * 鍏戞崲閲戝竵 @@ -436,7 +434,7 @@ IntegralExchange exchange = integralExchangeService.exchange(uid, id); UserInfoExtra extraVO = userInfoExtraService.getUserInfoExtra(uid); - + GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation(); Gson gson = gsonBuilder.create(); @@ -507,7 +505,7 @@ out.print(JsonUtil.loadFalseResult(1, "椤电爜涓嶆纭�")); return; } - + try { List<CodePublishRecord> list = codePublishRecordService.listValid((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE); @@ -549,7 +547,7 @@ } IntegralTaskRecord record = null; try { - record = integralGetService.addEventStatistic(uid, event, null); + record = integralGetService.addEventStatistic(uid, event); } catch (IntegralGetException e) { } if (record == null) { diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java index d3eb9d0..c66afa5 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java @@ -35,7 +35,6 @@ import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult; import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail; -import com.yeshi.fanli.exception.integral.IntegralGetException; import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException; import com.yeshi.fanli.exception.user.TokenRecordException; import com.yeshi.fanli.log.LogHelper; @@ -446,12 +445,8 @@ ThreadUtil.run(new Runnable() { @Override public void run() { - try { - // 澧炲姞閲戝竵 - integralGetService.addSearchResultScan(uid, key); - } catch (IntegralGetException e) { - e.printStackTrace(); - } + // 澧炲姞閲戝竵 + integralGetService.addSearchResultScan(uid, key); } }); } diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/ThreeSaleSerivceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/ThreeSaleSerivceImpl.java index 0316022..d4c47ac 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/ThreeSaleSerivceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/ThreeSaleSerivceImpl.java @@ -8,6 +8,7 @@ import javax.annotation.Resource; +import org.springframework.context.annotation.Lazy; import org.springframework.core.task.TaskExecutor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -58,30 +59,29 @@ @Resource private MsgInviteDetailService msgInviteDetailService; - + @Resource private UserTaoLiJinOriginService userTaoLiJinOriginService; - + @Resource private UserActiveLogService userActiveLogService; - + @Resource private UserInfoExtraService userInfoExtraService; - + @Resource private ThreeSaleExtraInfoSerivce threeSaleExtraInfoSerivce; + + @Lazy @Resource - private IntegralGetService integralGetService; - - - + private IntegralGetService integralGetService; + @Resource(name = "taskExecutor") private TaskExecutor executor; - - public UserInfo getBoss(final long uid) { + //TODO 鏈塨ug return threeSaleMapper.selectBoss(uid); } @@ -328,12 +328,10 @@ return threeSaleMapper.countSuperiorQuery(state, uid); } - @Override public long countFirstTeam(Long uid, Integer state) { return threeSaleMapper.countFirstTeam(uid, state); } - @Override public long countSecondTeam(Long uid, Integer state) { @@ -354,7 +352,7 @@ public List<ThreeSale> listbyIdAndBossId(Long id, Long uid, Integer expire) { return threeSaleMapper.listbyIdAndBossId(id, uid, expire); } - + @Override public JSONObject getMyFirstTeam(long start, int count, Long uid, Integer state) { @@ -494,8 +492,7 @@ return result; } - - + @Override public List<ThreeSale> listByWorkerId(Long workerId) { return threeSaleMapper.listByWorkerId(workerId); @@ -510,9 +507,9 @@ @Transactional public void bindRelationshipByInviteCode(UserInfo invitee, UserInfo inviter) throws ThreeSaleException { - if (invitee == null || inviter == null) + if (invitee == null || inviter == null) throw new ThreeSaleException(1, "鐢ㄦ埛淇℃伅涓虹┖"); - + // 鑾峰彇鏈夋晥鐨勯個璇峰叧绯� ThreeSale threeSale = threeSaleMapper.getRelationshipByBossIdAndWorkerId(inviter.getId(), invitee.getId()); @@ -553,17 +550,17 @@ // 閭�璇锋秷鎭� userInviteMsgNotificationService.inviteSuccess(inviter.getId(), threeSale); - + executor.execute(new Runnable() { @Override public void run() { - - UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(inviter.getId()); + + UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(inviter.getId()); try { - if (activeLog != null && !StringUtil.isNullOrEmpty(activeLog.getVersionCode()) ) { + if (activeLog != null && !StringUtil.isNullOrEmpty(activeLog.getVersionCode())) { String versionCode = activeLog.getVersionCode(); String channel = activeLog.getChannel(); - + boolean result = false; // 娓犻亾鏄痑ppstore 鍒ゆ柇涓篒OS if (!StringUtil.isNullOrEmpty(channel) && "appstore".equalsIgnoreCase(channel)) { @@ -571,14 +568,14 @@ } else { result = VersionUtil.greaterThan_1_5_60("android", versionCode); } - + if (result) { // 琚個璇峰悕绉� - String inviteName= invitee.getNickName(); + String inviteName = invitee.getNickName(); if (StringUtil.isNullOrEmpty(inviteName)) { UserInfo userInfo = userInfoService.selectByPKey(invitee.getId()); if (userInfo != null) { - inviteName= userInfo.getNickName(); + inviteName = userInfo.getNickName(); } } // 濂栧姳閭�璇风孩鍖咃紙娣樼ぜ閲戯級 @@ -588,26 +585,26 @@ } catch (Exception e) { LogHelper.errorDetailInfo(e); } - + // 閭�璇烽噾甯� integralGetService.addInviteLevelOne(inviter.getId(), invitee.getId()); } }); - - + } @Override @Transactional - public void bindRelationshipByWX(UserInfo invitee, Long inviterId, ThreeSale threeSaleOld) throws ThreeSaleException { + public void bindRelationshipByWX(UserInfo invitee, Long inviterId, ThreeSale threeSaleOld) + throws ThreeSaleException { if (invitee == null || (inviterId == null && threeSaleOld == null)) throw new ThreeSaleException(1, "鐢ㄦ埛淇℃伅涓虹┖"); - + ThreeSale threeSale = null; - if (inviterId != null ) { + if (inviterId != null) { // 鏂板缓绔嬬‘瀹氬叧绯� - threeSale = new ThreeSale(); + threeSale = new ThreeSale(); threeSale.setBoss(new UserInfo(inviterId)); threeSale.setWorker(invitee); threeSale.setState(true); @@ -616,10 +613,10 @@ threeSale.setCreateTime(java.lang.System.currentTimeMillis()); threeSale.setUpdateTime(java.lang.System.currentTimeMillis()); threeSaleMapper.insertSelective(threeSale); - - // 閭�璇峰叧绯诲け鏁� 1.5.3 涔嬪墠澶辨晥 + + // 閭�璇峰叧绯诲け鏁� 1.5.3 涔嬪墠澶辨晥 if (threeSaleOld != null) { - ThreeSale three = new ThreeSale(); + ThreeSale three = new ThreeSale(); three.setId(threeSaleOld.getId()); three.setExpire(ThreeSale.EXPIRE_OUTOFDATE); three.setUpdateTime(java.lang.System.currentTimeMillis()); @@ -632,49 +629,48 @@ threeSaleOld.setSucceedTime(java.lang.System.currentTimeMillis()); threeSaleOld.setUpdateTime(java.lang.System.currentTimeMillis()); threeSaleMapper.updateByPrimaryKeySelective(threeSaleOld); - + threeSale = threeSaleOld; } if (threeSale == null) { throw new ThreeSaleException(1, "鍏崇郴缁戝畾澶辫触"); } - + UserInfo boss = userInfoService.selectByPKey(threeSale.getBoss().getId()); threeSale.setBoss(boss); threeSale.setWorker(invitee); - + // 娣诲姞鍒伴槦鍒� ThreeSaleCMQManager.getInstance().addThreeSaleMsg(threeSale); - + // 閭�璇锋秷鎭� userInviteMsgNotificationService.inviteSuccess(threeSale.getBoss().getId(), threeSale); - - + executor.execute(new Runnable() { @Override public void run() { try { - UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(inviterId); - if (activeLog != null && !StringUtil.isNullOrEmpty(activeLog.getVersionCode()) ) { + UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(inviterId); + if (activeLog != null && !StringUtil.isNullOrEmpty(activeLog.getVersionCode())) { boolean result = false; String versionCode = activeLog.getVersionCode(); String channel = activeLog.getChannel(); - + // 娓犻亾鏄痑ppstore 鍒ゆ柇涓篒OS if (!StringUtil.isNullOrEmpty(channel) && "appstore".equalsIgnoreCase(channel)) { result = VersionUtil.greaterThan_1_5_60("ios", versionCode); } else { result = VersionUtil.greaterThan_1_5_60("android", versionCode); } - + if (result) { // 琚個璇峰悕绉� - String inviteName= invitee.getNickName(); + String inviteName = invitee.getNickName(); if (StringUtil.isNullOrEmpty(inviteName)) { UserInfo userInfo = userInfoService.selectByPKey(invitee.getId()); if (userInfo != null) { - inviteName= userInfo.getNickName(); + inviteName = userInfo.getNickName(); } } // 濂栧姳閭�璇风孩鍖咃紙娣樼ぜ閲戯級 @@ -687,7 +683,7 @@ } }); } - + /** * 鏍规嵁閭�璇疯�呮煡璇㈠叧绯� * @@ -698,8 +694,7 @@ public ThreeSale getByWorkerId(Long workerId) { return threeSaleMapper.getByWorkerId(workerId); } - - + @Override public long countSuccessFirstTeam(Long uid) { return threeSaleMapper.countFirstTeam(uid, 1); @@ -709,19 +704,17 @@ public ThreeSale selectByWorkerId(Long workerId) { return threeSaleMapper.selectSuccessByWorkerId(workerId); } - - + @Override - public List<ThreeSale> getSuccessByDate(Long bossId, Long minTime, Long maxTime){ + public List<ThreeSale> getSuccessByDate(Long bossId, Long minTime, Long maxTime) { return threeSaleMapper.getSuccessByDate(bossId, minTime, maxTime); } - - + @Override public List<ThreeSale> listFirstTeam(long start, int count, Long uid, Integer state) { return threeSaleMapper.listFirstTeam(start, count, uid, state); } - + @Override public List<ThreeSale> listSecondTeam(long start, int count, Long uid, Integer state) { return threeSaleMapper.listSecondTeam(start, count, uid, state); 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 160003f..e78a478 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,9 +5,11 @@ import javax.annotation.Resource; import org.springframework.cache.annotation.Cacheable; +import org.springframework.context.annotation.Lazy; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; +import com.yeshi.fanli.dao.mybatis.ThreeSaleMapper; import com.yeshi.fanli.entity.bus.user.UserInfo; import com.yeshi.fanli.entity.integral.IntegralTask; import com.yeshi.fanli.entity.integral.IntegralTask.FrequencyEnum; @@ -16,15 +18,13 @@ 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; import com.yeshi.fanli.util.RedisManager; import com.yeshi.fanli.util.annotation.integral.IntegralGetVersionLimit; -import net.sf.json.JSONObject; - +@Lazy @Service public class IntegralGetServiceImpl implements IntegralGetService { @@ -35,20 +35,26 @@ private IntegralTaskRecordService integralTaskRecordService; @Resource - private ThreeSaleSerivce threeSaleSerivce; + private ThreeSaleMapper threeSaleMapper; @Resource private RedisManager redisManager; + // TODO 鏈塨ug + private UserInfo getBossByUid(Long uid) { + return threeSaleMapper.selectBoss(uid); + } + + @IntegralGetVersionLimit(uid="#uid") @Override - public IntegralTaskRecord addEventStatistic(Long uid, String event, JSONObject params) throws IntegralGetException { + public IntegralTaskRecord addEventStatistic(Long uid, String event) throws IntegralGetException { Date nowDate = new Date(); IntegralTask task = integralTaskService.getByCidAndUniqueKey(null, event); if (task == null) throw new IntegralGetException(1, "浜嬩欢绫诲瀷涓嶅瓨鍦�"); if (TaskUniqueKeyEnum.inShop == TaskUniqueKeyEnum.valueOf(event)) { - UserInfo boss = threeSaleSerivce.getBoss(uid); + UserInfo boss = getBossByUid(uid); if (boss != null) addInShopLevelOne(boss.getId()); // 涓嬬骇娴忚搴楅摵 } @@ -80,58 +86,62 @@ } catch (IntegralTaskRecordException e) { throw new IntegralGetException(3, "娣诲姞璁板綍澶辫触"); } - - // switch (event) { - // case "recommendSearch": - // break; - // case "shareInvite": - // break; - // case "inShop": - // break; - // case "scanPush": - // break; - // case "scanGoods": - // break; - // case "scanHomeBanner": - // break; - // case "scanSpecial": - // break; - // case "scanTBCart": - // break; - // } } + @Cacheable(value = "integralGetCache", key = "'addRecommendSearch-'+#uid") @Override - public void addRecommendSearch(Long uid) throws IntegralGetException { - + public IntegralTaskRecord addRecommendSearch(Long uid) { + try { + return addEventStatistic(uid, TaskUniqueKeyEnum.recommendSearch.name()); + } catch (IntegralGetException e) { + e.printStackTrace(); + } + return null; } @Cacheable(value = "integralGetCache", key = "'addSearchResultScan-'+#uid+'-'+#kw") @Override - public void addSearchResultScan(Long uid, String kw) throws IntegralGetException { - System.out.println("鎼滅储"); + public IntegralTaskRecord addSearchResultScan(Long uid, String kw) { + try { + return addEventStatistic(uid, TaskUniqueKeyEnum.scanSearchResult.name()); + } catch (IntegralGetException e) { + e.printStackTrace(); + } + + return null; } + @Cacheable(value = "integralGetCache", key = "'addShareInvite-'+#uid") @Override - public void addShareInvite(Long uid) throws IntegralGetException { - + public IntegralTaskRecord addShareInvite(Long uid) { + try { + return addEventStatistic(uid, TaskUniqueKeyEnum.shareInvite.name()); + } catch (IntegralGetException e) { + e.printStackTrace(); + } + return null; } + @Cacheable(value = "integralGetCache", key = "'addIntoShop-'+#uid+'-'+#shopUrlMD5") @Override - public void addIntoShop(Long uid) throws IntegralGetException { - // TODO Auto-generated method stub - + public IntegralTaskRecord addIntoShop(Long uid, String shopUrlMD5) { + try { + return addEventStatistic(uid, TaskUniqueKeyEnum.inShop.name()); + } catch (IntegralGetException e) { + e.printStackTrace(); + } + return null; } @IntegralGetVersionLimit(uid = "#uid") @Async() private void addInShopLevelOne(Long uid) { try { - UserInfo boss = threeSaleSerivce.getBoss(uid); + UserInfo boss = getBossByUid(uid); if (boss != null) addInShopLevelTwo(boss.getId()); // 浜岀骇闃熷憳 - addEventStatistic(uid, TaskUniqueKeyEnum.inShopLevelOne.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.inShopLevelOne.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -141,40 +151,66 @@ @Async() private void addInShopLevelTwo(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.inShopLevelTwo.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.inShopLevelTwo.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } } + @Cacheable(value = "integralGetCache", key = "'addScanPushHistory-'+#uid") @Override - public void addScanPushHistory(Long uid) throws IntegralGetException { - // TODO Auto-generated method stub - + public IntegralTaskRecord addScanPushHistory(Long uid) { + try { + return addEventStatistic(uid, TaskUniqueKeyEnum.scanPush.name()); + } catch (IntegralGetException e) { + e.printStackTrace(); + } + return null; } + @Cacheable(value = "integralGetCache", key = "'addScanGoodsDetail-'+#uid+'-'+#goodsType+'-'+#goodsId") @Override - public void addScanGoodsDetail(Long uid, int goodsType, Long goodsId) { - // TODO Auto-generated method stub - + public IntegralTaskRecord addScanGoodsDetail(Long uid, int goodsType, Long goodsId) { + try { + return addEventStatistic(uid, TaskUniqueKeyEnum.scanGoods.name()); + } catch (IntegralGetException e) { + e.printStackTrace(); + } + return null; } + @Cacheable(value = "integralGetCache", key = "'addScanRecommendBanner-'+#uid+'-'+#id") @Override - public void addScanRecommendBanner(Long uid) { - // TODO Auto-generated method stub - + public IntegralTaskRecord addScanRecommendBanner(Long uid, String id) { + try { + return addEventStatistic(uid, TaskUniqueKeyEnum.scanHomeBanner.name()); + } catch (IntegralGetException e) { + e.printStackTrace(); + } + return null; } + @Cacheable(value = "integralGetCache", key = "'addScanRecommendSpecial-'+#uid+'-'+#id") @Override - public void addScanRecommendSpecial(Long uid) { - // TODO Auto-generated method stub + public IntegralTaskRecord addScanRecommendSpecial(Long uid, String id) { + try { + return addEventStatistic(uid, TaskUniqueKeyEnum.scanSpecial.name()); + } catch (IntegralGetException e) { + e.printStackTrace(); + } + return null; } + @Cacheable(value = "integralGetCache", key = "'addScanTaoBaoCart-'+#uid") @Override - public void addScanTaoBaoCart(Long uid) { - // TODO Auto-generated method stub - + public IntegralTaskRecord addScanTaoBaoCart(Long uid) { + try { + return addEventStatistic(uid, TaskUniqueKeyEnum.scanTBCart.name()); + } catch (IntegralGetException e) { + e.printStackTrace(); + } + return null; } @IntegralGetVersionLimit(uid = "#uid") @@ -182,7 +218,7 @@ @Override public void addTaoLiJinBuy(Long uid, Long goodsId) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.taoLiJinBuy.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.taoLiJinBuy.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -193,11 +229,11 @@ @Override public void addInviteLevelOne(Long uid, Long workerId) { try { - UserInfo boss = threeSaleSerivce.getBoss(uid); + UserInfo boss = getBossByUid(uid); if (boss != null) addInviteLevelTwo(boss.getId()); - - addEventStatistic(uid, TaskUniqueKeyEnum.inviteLevelOne.name(), null); + + addEventStatistic(uid, TaskUniqueKeyEnum.inviteLevelOne.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -212,7 +248,7 @@ @Async() private void addInviteLevelTwo(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.inviteLevelTwo.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.inviteLevelTwo.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -223,7 +259,7 @@ @Override public void addShareSingleGoods(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.shareSingleGoods.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.shareSingleGoods.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -234,7 +270,7 @@ @Override public void addShareMultipleGoods(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.shareMultipleGoods.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.shareMultipleGoods.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -245,7 +281,7 @@ @Override public void addShareTLJGoods(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.shareTLJGoods.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.shareTLJGoods.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -256,7 +292,7 @@ @Override public void addGiveRebateCoupon(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.giveRebateCoupon.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.giveRebateCoupon.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -267,7 +303,7 @@ @Override public void addGiveFreeCoupon(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.giveFreeCoupon.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.giveFreeCoupon.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -278,7 +314,7 @@ @Override public void addGiveTaoLiJin(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.giveTaoLiJin.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.giveTaoLiJin.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -289,7 +325,7 @@ @Override public void addCloseRecommendGoods(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.closeRecommendGoods.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.closeRecommendGoods.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -300,11 +336,11 @@ @Override public void addCouponRebate(Long uid) { try { - UserInfo boss = threeSaleSerivce.getBoss(uid); + UserInfo boss = getBossByUid(uid); if (boss != null) addCouponRebateLevelOne(boss.getId()); - - addEventStatistic(uid, TaskUniqueKeyEnum.couponRebate.name(), null); + + addEventStatistic(uid, TaskUniqueKeyEnum.couponRebate.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -319,11 +355,11 @@ @Async() private void addCouponRebateLevelOne(Long uid) { try { - UserInfo boss = threeSaleSerivce.getBoss(uid); + UserInfo boss = getBossByUid(uid); if (boss != null) addCouponRebateLevelTwo(boss.getId()); // 浜岀骇闃熷憳 - - addEventStatistic(uid, TaskUniqueKeyEnum.couponRebateLevelOne.name(), null); + + addEventStatistic(uid, TaskUniqueKeyEnum.couponRebateLevelOne.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -338,7 +374,7 @@ @Async() private void addCouponRebateLevelTwo(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.couponRebateLevelTwo.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.couponRebateLevelTwo.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -349,11 +385,11 @@ @Override public void addRebateOrder(Long uid) { try { - UserInfo boss = threeSaleSerivce.getBoss(uid); + UserInfo boss = getBossByUid(uid); if (boss != null) addInviteOrderLevelOne(boss.getId()); - - addEventStatistic(uid, TaskUniqueKeyEnum.rebateOrder.name(), null); + + addEventStatistic(uid, TaskUniqueKeyEnum.rebateOrder.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -368,11 +404,11 @@ @Async() private void addInviteOrderLevelOne(Long uid) { try { - UserInfo boss = threeSaleSerivce.getBoss(uid); + UserInfo boss = getBossByUid(uid); if (boss != null) addInviteOrderLevelTwo(boss.getId()); - - addEventStatistic(uid, TaskUniqueKeyEnum.inviteOrderLevelOne.name(), null); + + addEventStatistic(uid, TaskUniqueKeyEnum.inviteOrderLevelOne.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -387,7 +423,7 @@ @Async() private void addInviteOrderLevelTwo(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.inviteOrderLevelTwo.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.inviteOrderLevelTwo.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -398,7 +434,7 @@ @Override public void addShareOrder(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.shareOrder.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.shareOrder.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -409,7 +445,7 @@ @Override public void addBindWeiXin(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.bindWeiXin.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.bindWeiXin.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -420,7 +456,7 @@ @Override public void addBindPhone(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.bindPhone.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.bindPhone.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -431,7 +467,7 @@ @Override public void addBindTaoBao(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.bindTaoBao.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.bindTaoBao.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -442,7 +478,7 @@ @Override public void addSetWeiXinNum(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.setWeiXinNum.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.setWeiXinNum.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -453,7 +489,7 @@ @Override public void addSetGender(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.setGender.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.setGender.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -464,7 +500,7 @@ @Override public void addSetPortrait(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.setPortrait.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.setPortrait.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -475,7 +511,7 @@ @Override public void addSetNickname(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.setNickName.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.setNickName.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -486,7 +522,7 @@ @Override public void addBindAlipay(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.bindAlipay.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.bindAlipay.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } @@ -497,7 +533,7 @@ @Override public void addInviteActivate(Long uid) { try { - addEventStatistic(uid, TaskUniqueKeyEnum.inviteActivate.name(), null); + addEventStatistic(uid, TaskUniqueKeyEnum.inviteActivate.name()); } catch (Exception e) { LogHelper.errorDetailInfo(e); } diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java index 6b272d8..2fcb36b 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/integral/IntegralTaskRecordServiceImpl.java @@ -303,9 +303,9 @@ } @Override - public Integer countGetCountByTaskIdAndDay(Long taskId, Long uid, Date day) { + public int countGetCountByTaskIdAndDay(Long taskId, Long uid, Date day) { if (day == null) - return null; + return 0; Date minTime = new Date( TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(day.getTime(), "yyyy-MM-dd"), "yyyy-MM-dd")); Date maxTime = new Date(minTime.getTime() + 1000 * 60 * 60 * 24L); diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java index c836010..a6e4ea7 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java @@ -8,6 +8,7 @@ import javax.annotation.Resource; +import org.springframework.context.annotation.Lazy; import org.springframework.core.task.TaskExecutor; import org.springframework.stereotype.Service; @@ -80,6 +81,7 @@ @Resource private UserOtherMsgNotificationService userOtherMsgNotificationService; + @Lazy @Resource private IntegralGetService integralGetService; diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java index 9ebec18..e0d3640 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java @@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.yeshi.utils.JsonUtil; @@ -112,6 +113,7 @@ private JedisPool jedisPool; + @Lazy @Resource private UserInfoModifyRecordService userInfoModifyRecordService; diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java index d3ccb92..38898ff 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoServiceImpl.java @@ -20,6 +20,7 @@ import org.hibernate.Query; import org.hibernate.SQLQuery; import org.hibernate.Session; +import org.springframework.context.annotation.Lazy; import org.springframework.core.task.TaskExecutor; import org.springframework.orm.hibernate4.HibernateCallback; import org.springframework.stereotype.Service; @@ -40,8 +41,6 @@ import com.yeshi.fanli.dao.mybatis.share.ShareMapper; import com.yeshi.fanli.dao.user.UserInfoDao; import com.yeshi.fanli.entity.bus.user.BindingAccount; -import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode; -import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum; import com.yeshi.fanli.entity.bus.user.InviteUser; import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo; import com.yeshi.fanli.entity.bus.user.UserInfo; @@ -49,7 +48,6 @@ import com.yeshi.fanli.entity.bus.user.WeiXinUser; import com.yeshi.fanli.entity.system.BusinessSystem; import com.yeshi.fanli.exception.ThreeSaleException; -import com.yeshi.fanli.exception.user.ForbiddenUserIdentifyCodeException; import com.yeshi.fanli.exception.user.UserInfoException; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.config.ConfigService; @@ -135,6 +133,7 @@ @Resource private BindingAccountService bindingAccountService; + @Lazy @Resource private UserInfoModifyRecordService userInfoModifyRecordService; diff --git a/fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralGetService.java b/fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralGetService.java index 1a62a71..c0534aa 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralGetService.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralGetService.java @@ -3,8 +3,6 @@ import com.yeshi.fanli.entity.integral.IntegralTaskRecord; import com.yeshi.fanli.exception.integral.IntegralGetException; -import net.sf.json.JSONObject; - /** * 閲戝竵鑾峰彇鏈嶅姟 * @@ -23,7 +21,7 @@ * 浜嬩欢缂栫爜 * @throws IntegralGetException */ - public IntegralTaskRecord addEventStatistic(Long uid, String event, JSONObject params) throws IntegralGetException; + public IntegralTaskRecord addEventStatistic(Long uid, String event) throws IntegralGetException; /** * 浠庣矘璐存澘鎺ㄨ崘杩涘叆鎼滅储缁撴灉 @@ -31,7 +29,7 @@ * @param uid * @throws IntegralGetException */ - public void addRecommendSearch(Long uid) throws IntegralGetException; + public IntegralTaskRecord addRecommendSearch(Long uid); /** * 鎼滅储缁撴灉娴忚 @@ -39,7 +37,7 @@ * @param uid * @throws IntegralGetException */ - public void addSearchResultScan(Long uid,String kw) throws IntegralGetException; + public IntegralTaskRecord addSearchResultScan(Long uid,String kw) ; /** * 鍒嗕韩閭�璇峰浘 @@ -47,7 +45,7 @@ * @param uid * @throws IntegralGetException */ - public void addShareInvite(Long uid) throws IntegralGetException; + public IntegralTaskRecord addShareInvite(Long uid); /** * 杩涘叆搴楅摵 @@ -55,7 +53,7 @@ * @param uid * @throws IntegralGetException */ - public void addIntoShop(Long uid) throws IntegralGetException; + public IntegralTaskRecord addIntoShop(Long uid, String shopUrlMD5); /** * 鎺ㄩ�佽褰曢〉娴忚 @@ -63,7 +61,7 @@ * @param uid * @throws IntegralGetException */ - public void addScanPushHistory(Long uid) throws IntegralGetException; + public IntegralTaskRecord addScanPushHistory(Long uid) ; /** * 鍟嗗搧璇︽儏椤垫祻瑙� @@ -72,28 +70,28 @@ * @param goodsType * @param goodsId */ - public void addScanGoodsDetail(Long uid, int goodsType, Long goodsId); + public IntegralTaskRecord addScanGoodsDetail(Long uid, int goodsType, Long goodsId); /** * 鎺ㄨ崘banner娴忚 * * @param uid */ - public void addScanRecommendBanner(Long uid); + public IntegralTaskRecord addScanRecommendBanner(Long uid, String id); /** * 鎺ㄨ崘涓撻娴忚 * * @param uid */ - public void addScanRecommendSpecial(Long uid); + public IntegralTaskRecord addScanRecommendSpecial(Long uid, String id); /** * 娣樺疂璐墿杞︽祻瑙� * * @param uid */ - public void addScanTaoBaoCart(Long uid); + public IntegralTaskRecord addScanTaoBaoCart(Long uid); /** * 鑷喘绔嬪噺 diff --git a/fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralTaskRecordService.java b/fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralTaskRecordService.java index a4788d9..78632ca 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralTaskRecordService.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/inter/integral/IntegralTaskRecordService.java @@ -109,7 +109,7 @@ * @param day * @return */ - public Integer countGetCountByTaskIdAndDay(Long taskId, Long uid, Date day); + public int countGetCountByTaskIdAndDay(Long taskId, Long uid, Date day); /** * 娣诲姞鑾峰彇璁板綍 diff --git a/fanli/src/main/java/com/yeshi/fanli/util/DouYinUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/DouYinUtil.java new file mode 100644 index 0000000..a30ba37 --- /dev/null +++ b/fanli/src/main/java/com/yeshi/fanli/util/DouYinUtil.java @@ -0,0 +1,34 @@ +package com.yeshi.fanli.util; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.methods.GetMethod; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.select.Elements; + +public class DouYinUtil { + + public static String parseDouYinGoods(String url) { + HttpClient httpClient = new HttpClient(); + GetMethod gm = new GetMethod(url); + try { + httpClient.executeMethod(gm); + String finalUrl = gm.getURI().toString(); + if (finalUrl.startsWith("https://s.click.taobao.com")) { + Document doc = Jsoup.parse(gm.getResponseBodyAsString()); + + Elements els = doc.getElementsByTag("meta"); + for (int i = 0; i < els.size(); i++) { + if (els.get(i).toString().contains("URL=")) { +// System.out.println(els.get(i)..toString()); + } + System.out.println(els.get(i).attr("URL")); + } + } + + } catch (Exception e) { + } + return null; + } + +} diff --git a/fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java index 6f6d8d6..9e17cc5 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java @@ -132,6 +132,7 @@ JSONObject resultJson = JSONObject.fromObject(result); result = resultJson.optJSONObject("jd_union_open_promotion_common_get_response").optString("result"); + System.out.println(result); if (result == null) { return null; } diff --git a/fanli/src/main/java/com/yeshi/fanli/util/jd/JDUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/jd/JDUtil.java index ea2b1cc..1c6eddb 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/jd/JDUtil.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/jd/JDUtil.java @@ -560,9 +560,9 @@ try { if (engine instanceof Invocable) { Invocable in = (Invocable) engine; - String goodsId = in.invokeFunction("getGoodsId", url).toString(); - if (!StringUtil.isNullOrEmpty(goodsId)) - return goodsId.trim(); + Object goodsId = in.invokeFunction("getGoodsId", url); + if (goodsId!=null) + return goodsId.toString().trim(); } } catch (Exception e) { e.printStackTrace(); diff --git a/fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoUtil.java index 55807c4..a224849 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoUtil.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoUtil.java @@ -516,9 +516,9 @@ try { if (engine instanceof Invocable) { Invocable in = (Invocable) engine; - String goodsId = in.invokeFunction("getGoodsId", url).toString(); - if (!StringUtil.isNullOrEmpty(goodsId)) - return goodsId.trim(); + Object goodsId = in.invokeFunction("getGoodsId", url); + if (goodsId!=null) + return goodsId.toString().trim(); } } catch (Exception e) { e.printStackTrace(); -- Gitblit v1.8.0