From 34b542007f7e0dd4e1fdffecbd12a377aa953d68 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 02 九月 2019 17:22:16 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div --- fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java | 184 ++++++++++++++++++---------------------------- 1 files changed, 72 insertions(+), 112 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java index 4e8fee4..bcf2dbe 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java @@ -21,7 +21,6 @@ import com.yeshi.fanli.dto.msg.MsgOtherCouponActivateDTO; import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO; import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum; -import com.yeshi.fanli.entity.bus.user.DeviceLotteryRecord; import com.yeshi.fanli.entity.bus.user.HongBaoV2; import com.yeshi.fanli.entity.bus.user.Order; import com.yeshi.fanli.entity.bus.user.TokenRecord; @@ -54,7 +53,6 @@ import com.yeshi.fanli.service.inter.order.OrderService; import com.yeshi.fanli.service.inter.push.PushCouponRecordService; import com.yeshi.fanli.service.inter.push.PushCouponService; -import com.yeshi.fanli.service.inter.user.DeviceLotteryRecordService; import com.yeshi.fanli.service.inter.user.TokenRecordService; import com.yeshi.fanli.service.inter.user.UserInfoExtraService; import com.yeshi.fanli.service.inter.user.UserInfoService; @@ -136,9 +134,6 @@ @Resource private UserOtherMsgNotificationService userOtherMsgNotificationService; - - @Resource - private DeviceLotteryRecordService deviceLotteryRecordService; @Resource private CommonOrderCountService commonOrderCountService; @@ -1328,113 +1323,78 @@ @Transactional public void copyLotteryPrize(Long uid, int platform, String device) throws Exception { - if (uid == null || device == null) { - return; - } - - // 鏈櫥闄嗕箣鍓嶆娊濂栬褰� - List<DeviceLotteryRecord> list = deviceLotteryRecordService.listByPlatformAndDevice(platform, device); - if (list == null || list.size() == 0) { - return; - } - - // 鑾峰彇棰濆淇℃伅 - UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); - - // 宸茬粡鎶借繃濂栫殑鎴栬�呭凡缁忚繘鍏ヨ繃鎶藉椤甸潰鐨� - if (userInfoExtra != null && userInfoExtra.getLotteryNewbies() != null) { - return; - } - - // 鏄惁鏄柊鐢ㄦ埛 - boolean isNewUser = userInfoExtraService.isNewUser(uid); - if (!isNewUser) { - return; - } - - int coupon = 0; - - for (DeviceLotteryRecord reviceLotteryRecord : list) { - - // 鍒犻櫎璁板綍 - deviceLotteryRecordService.deleteByPrimaryKey(reviceLotteryRecord.getId()); - - Long systemCouponId = reviceLotteryRecord.getSystemCouponId(); - if (systemCouponId == null) { - continue; - } - SystemCoupon systemCoupon = systemCouponService.selectByPrimaryKey(systemCouponId); - if (systemCoupon == null) { - continue; - } - - int stateActivated = 1; - if (systemCoupon.getType() == CouponTypeEnum.welfareFreeCoupon) { - // 绂忓埄鍒哥姸鎬� - long countSuccess = threeSaleSerivce.countSuccessFirstTeam(uid); - // 娌℃湁涓嬬骇闃熷憳 --寰呮縺娲� - if (countSuccess == 0) { - stateActivated = 0; - } - } - - // 缁撴潫鏃ユ湡 - // 浠婂ぉ鍦ㄥ唴 鍑忓幓涓�澶� - String endDay = DateUtil.plusDay(systemCoupon.getExpiryDay() - 1, new Date()); - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - if (endDay != null && endDay.trim().length() > 0) { - endDay += " 23:59:59"; - } - Date endTime = format.parse(endDay); - - UserSystemCoupon userCoupon = new UserSystemCoupon(); - userCoupon.setUid(uid); - userCoupon.setSource(UserSystemCoupon.SOURCE_NEWBIES); - userCoupon.setSystemCoupon(systemCoupon); - userCoupon.setState(UserSystemCoupon.STATE_CAN_USE); - userCoupon.setStateActivated(stateActivated); - userCoupon.setStartTime(new Date()); - userCoupon.setEndTime(endTime); - userCoupon.setCreateTime(new Date()); - userCoupon.setUpdateTime(new Date()); - // 鎻掑叆鏁版嵁搴� - insertSelective(userCoupon); - - // 鍒告暟閲� - coupon++; - - // 娑堟伅鎺ㄩ�� - try { - if (systemCoupon.getType() == CouponTypeEnum.welfareFreeCoupon) { - userOtherMsgNotificationService.welfareCouponGet(userCoupon); - } else if (systemCoupon.getType() == CouponTypeEnum.freeCoupon) { - userOtherMsgNotificationService.freeSheetCouponGet(userCoupon); - } else if (systemCoupon.getType() == CouponTypeEnum.rebatePercentCoupon) { - userOtherMsgNotificationService.rewardCouponGet(userCoupon, systemCoupon.getPercent().intValue()); - } - - } catch (Exception e) { - try { - LogHelper.errorDetailInfo(e); - } catch (Exception e1) { - e1.printStackTrace(); - } - } - } - - if (userInfoExtra == null) { - userInfoExtra = new UserInfoExtra(); - userInfoExtra.setUserInfo(new UserInfo(uid)); - } - - userInfoExtra.setLotteryNewbies(Constant.MAX_COUNT_LOTTERY_NEWBIES - list.size()); - Integer couponNews = userInfoExtra.getCouponNews(); - if (couponNews == null) { - userInfoExtra.setCouponNews(coupon); - } else { - userInfoExtra.setCouponNews(couponNews + coupon); - } - userInfoExtraService.saveUserInfoExtra(userInfoExtra); + return; + + /* + * if (uid == null || device == null) { return; } + * + * // 鏈櫥闄嗕箣鍓嶆娊濂栬褰� List<DeviceLotteryRecord> list = + * deviceLotteryRecordService.listByPlatformAndDevice(platform, device); if + * (list == null || list.size() == 0) { return; } + * + * // 鑾峰彇棰濆淇℃伅 UserInfoExtra userInfoExtra = + * userInfoExtraService.getUserInfoExtra(uid); + * + * // 宸茬粡鎶借繃濂栫殑鎴栬�呭凡缁忚繘鍏ヨ繃鎶藉椤甸潰鐨� if (userInfoExtra != null && + * userInfoExtra.getLotteryNewbies() != null) { return; } + * + * // 鏄惁鏄柊鐢ㄦ埛 boolean isNewUser = userInfoExtraService.isNewUser(uid); if + * (!isNewUser) { return; } + * + * int coupon = 0; + * + * for (DeviceLotteryRecord reviceLotteryRecord : list) { + * + * // 鍒犻櫎璁板綍 + * deviceLotteryRecordService.deleteByPrimaryKey(reviceLotteryRecord.getId()); + * + * Long systemCouponId = reviceLotteryRecord.getSystemCouponId(); if + * (systemCouponId == null) { continue; } SystemCoupon systemCoupon = + * systemCouponService.selectByPrimaryKey(systemCouponId); if (systemCoupon == + * null) { continue; } + * + * int stateActivated = 1; if (systemCoupon.getType() == + * CouponTypeEnum.welfareFreeCoupon) { // 绂忓埄鍒哥姸鎬� long countSuccess = + * threeSaleSerivce.countSuccessFirstTeam(uid); // 娌℃湁涓嬬骇闃熷憳 --寰呮縺娲� if (countSuccess + * == 0) { stateActivated = 0; } } + * + * // 缁撴潫鏃ユ湡 // 浠婂ぉ鍦ㄥ唴 鍑忓幓涓�澶� String endDay = + * DateUtil.plusDay(systemCoupon.getExpiryDay() - 1, new Date()); + * SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); if + * (endDay != null && endDay.trim().length() > 0) { endDay += " 23:59:59"; } + * Date endTime = format.parse(endDay); + * + * UserSystemCoupon userCoupon = new UserSystemCoupon(); userCoupon.setUid(uid); + * userCoupon.setSource(UserSystemCoupon.SOURCE_NEWBIES); + * userCoupon.setSystemCoupon(systemCoupon); + * userCoupon.setState(UserSystemCoupon.STATE_CAN_USE); + * userCoupon.setStateActivated(stateActivated); userCoupon.setStartTime(new + * Date()); userCoupon.setEndTime(endTime); userCoupon.setCreateTime(new + * Date()); userCoupon.setUpdateTime(new Date()); // 鎻掑叆鏁版嵁搴� + * insertSelective(userCoupon); + * + * // 鍒告暟閲� coupon++; + * + * // 娑堟伅鎺ㄩ�� try { if (systemCoupon.getType() == CouponTypeEnum.welfareFreeCoupon) + * { userOtherMsgNotificationService.welfareCouponGet(userCoupon); } else if + * (systemCoupon.getType() == CouponTypeEnum.freeCoupon) { + * userOtherMsgNotificationService.freeSheetCouponGet(userCoupon); } else if + * (systemCoupon.getType() == CouponTypeEnum.rebatePercentCoupon) { + * userOtherMsgNotificationService.rewardCouponGet(userCoupon, + * systemCoupon.getPercent().intValue()); } + * + * } catch (Exception e) { try { LogHelper.errorDetailInfo(e); } catch + * (Exception e1) { e1.printStackTrace(); } } } + * + * if (userInfoExtra == null) { userInfoExtra = new UserInfoExtra(); + * userInfoExtra.setUserInfo(new UserInfo(uid)); } + * + * userInfoExtra.setLotteryNewbies(Constant.MAX_COUNT_LOTTERY_NEWBIES - + * list.size()); Integer couponNews = userInfoExtra.getCouponNews(); if + * (couponNews == null) { userInfoExtra.setCouponNews(coupon); } else { + * userInfoExtra.setCouponNews(couponNews + coupon); } + * userInfoExtraService.saveUserInfoExtra(userInfoExtra); + */ } -- Gitblit v1.8.0