fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ConfigController.java
@@ -13,9 +13,6 @@ import com.yeshi.fanli.entity.accept.AcceptData; import com.yeshi.fanli.entity.bus.homemodule.FloatAD; import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState; import com.yeshi.fanli.entity.bus.tlj.DeviceTaoLiJinRecord; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin.TaoLiJinOriginEnum; import com.yeshi.fanli.entity.bus.user.UserActiveLog; import com.yeshi.fanli.entity.config.AppHomeFloatImg; import com.yeshi.fanli.entity.taobao.ClientTBPid; @@ -24,7 +21,6 @@ import com.yeshi.fanli.service.inter.homemodule.FloatADService; import com.yeshi.fanli.service.inter.msg.MsgDeviceReadStateService; import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService; import com.yeshi.fanli.service.inter.tlj.DeviceTaoLiJinRecordService; import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService; import com.yeshi.fanli.service.inter.user.TBPidService; import com.yeshi.fanli.service.inter.user.UserActiveLogService; @@ -32,7 +28,6 @@ import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.ThreadUtil; import com.yeshi.fanli.util.VersionUtil; import net.sf.json.JSONObject; @@ -71,9 +66,6 @@ private UserTaoLiJinOriginService uerTaoLiJinOriginService; @Resource private DeviceTaoLiJinRecordService deviceTaoLiJinRecordService; @Resource private UserActiveLogService userActiveLogService; /** @@ -102,27 +94,9 @@ data.put("floatNotifyImg", notifyImg); } FloatAD floatAD = null; if (VersionUtil.greaterThan_1_5_60(acceptData.getPlatform(), acceptData.getVersion())) { if (uid == null) { DeviceTaoLiJinRecord deviceRecord = deviceTaoLiJinRecordService.getByDevice(acceptData.getDevice()); if (deviceRecord == null) { floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_INDEX, 1); } } else { UserTaoLiJinOrigin userTaoLiJin = uerTaoLiJinOriginService.getByUidAndOrigin(uid, TaoLiJinOriginEnum.newbiesWin.name()); if (userTaoLiJin == null) { floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_INDEX, 1); } } } // 无新人弹框 则查询默认 if (floatAD == null) { floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_INDEX, 0); } FloatAD floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_INDEX, 0); if (floatAD != null) { JSONObject detail = new JSONObject(); @@ -168,25 +142,7 @@ */ @RequestMapping(value = "getMSGConfig", method = RequestMethod.POST) public void getMSGConfig(AcceptData acceptData, Long uid, PrintWriter out) { JSONObject data = new JSONObject(); boolean show = false; if (uid != null) { show = uerTaoLiJinOriginService.hasRankHongBao(uid); } if (show) { FloatAD floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_MSGCENTER, null); if (floatAD != null) { JSONObject detail = new JSONObject(); detail.put("img", floatAD.getPicture()); detail.put("jumpDetail", floatAD.getJumpDetail()); detail.put("params", floatAD.getParams()); detail.put("showTime", floatAD.getShowMode()); detail.put("accountLogin", floatAD.isJumpNeedLogin()); data.put("floatImgDetail", detail); } } out.print(JsonUtil.loadTrueResult(data)); out.print(JsonUtil.loadFalseResult("推广红包相关功能已下线!")); } @RequestMapping(value = "getTaoBaoCartConfig", method = RequestMethod.POST) fanli/src/main/java/com/yeshi/fanli/controller/client/v1/RecommendController.java
@@ -101,7 +101,6 @@ import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService; import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService; import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService; import com.yeshi.fanli.service.inter.tlj.DeviceTaoLiJinRecordService; import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService; import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService; import com.yeshi.fanli.service.inter.user.ShamUserService; @@ -252,9 +251,6 @@ @Resource private ConfigTaoLiJinService configTaoLiJinService; @Resource private DeviceTaoLiJinRecordService deviceTaoLiJinRecordService; @Resource private DeviceSexService deviceSexService; @@ -2577,18 +2573,6 @@ String name = special.getName(); if (StringUtil.isNullOrEmpty(name)) { continue; } // 是否需要弹出框 if (name.equals("账户等级特权")) { if (!VersionUtil.greaterThan_1_5_60(acceptData.getPlatform(), acceptData.getVersion())) { list.remove(i); i--; } else { if (uid != null) { special.setElastic(userTaoLiJinOriginService.hasRankHongBao(uid)); } } } } fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserAccountController.java
@@ -67,7 +67,6 @@ import com.yeshi.fanli.util.RedisManager; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.ThreadUtil; import com.yeshi.fanli.util.VersionUtil; import com.yeshi.fanli.util.account.UserUtil; import com.yeshi.fanli.util.wx.WXLoginUtil; @@ -1228,15 +1227,6 @@ e.printStackTrace(); } if (VersionUtil.greaterThan_1_5_60(acceptData.getPlatform(), acceptData.getVersion())) { /* 新人红包 */ try { userTaoLiJinOriginService.synchDeviceHongbao(uuser.getId(), device); } catch (Exception e) { e.printStackTrace(); } } // 绑定oppo推送 DeviceActive active = deviceActiveService.getFirstActiveInfo(acceptData.getDevice()); if (active != null) { fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ConfigControllerV2.java
@@ -10,13 +10,9 @@ import org.yeshi.utils.JsonUtil; import org.yeshi.utils.encrypt.DESUtil; import com.taobao.api.TaobaoClient; import com.yeshi.fanli.entity.accept.AcceptData; import com.yeshi.fanli.entity.bus.homemodule.FloatAD; import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState; import com.yeshi.fanli.entity.bus.tlj.DeviceTaoLiJinRecord; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin.TaoLiJinOriginEnum; import com.yeshi.fanli.entity.bus.user.UserActiveLog; import com.yeshi.fanli.entity.config.AppHomeFloatImg; import com.yeshi.fanli.entity.taobao.ClientTBPid; @@ -25,7 +21,6 @@ import com.yeshi.fanli.service.inter.homemodule.FloatADService; import com.yeshi.fanli.service.inter.msg.MsgDeviceReadStateService; import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService; import com.yeshi.fanli.service.inter.tlj.DeviceTaoLiJinRecordService; import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService; import com.yeshi.fanli.service.inter.user.TBPidService; import com.yeshi.fanli.service.inter.user.UserActiveLogService; @@ -74,9 +69,6 @@ private UserTaoLiJinOriginService uerTaoLiJinOriginService; @Resource private DeviceTaoLiJinRecordService deviceTaoLiJinRecordService; @Resource private UserActiveLogService userActiveLogService; /** @@ -105,27 +97,8 @@ data.put("floatNotifyImg", notifyImg); } FloatAD floatAD = null; if (VersionUtil.greaterThan_1_5_60(acceptData.getPlatform(), acceptData.getVersion())) { if (uid == null) { DeviceTaoLiJinRecord deviceRecord = deviceTaoLiJinRecordService.getByDevice(acceptData.getDevice()); if (deviceRecord == null) { floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_INDEX, 1); } } else { UserTaoLiJinOrigin userTaoLiJin = uerTaoLiJinOriginService.getByUidAndOrigin(uid, TaoLiJinOriginEnum.newbiesWin.name()); if (userTaoLiJin == null) { floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_INDEX, 1); } } } // 无新人弹框 则查询默认 if (floatAD == null) { floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_INDEX, 0); } FloatAD floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_INDEX, 0); if (floatAD != null) { JSONObject detail = new JSONObject(); @@ -171,25 +144,7 @@ */ @RequestMapping(value = "getMSGConfig", method = RequestMethod.POST) public void getMSGConfig(AcceptData acceptData, Long uid, PrintWriter out) { JSONObject data = new JSONObject(); boolean show = false; if (uid != null) { show = uerTaoLiJinOriginService.hasRankHongBao(uid); } if (show) { FloatAD floatAD = floatADService.getEffectiveFloatAD(FloatAD.POSITION_MSGCENTER, null); if (floatAD != null) { JSONObject detail = new JSONObject(); detail.put("img", floatAD.getPicture()); detail.put("jumpDetail", floatAD.getJumpDetail()); detail.put("params", floatAD.getParams()); detail.put("showTime", floatAD.getShowMode()); detail.put("accountLogin", floatAD.isJumpNeedLogin()); data.put("floatImgDetail", detail); } } out.print(JsonUtil.loadTrueResult(data)); out.print(JsonUtil.loadFalseResult("推广红包相关功能已下线!")); } @RequestMapping(value = "getTaoBaoCartConfig", method = RequestMethod.POST) fanli/src/main/java/com/yeshi/fanli/controller/client/v2/TaoLiJinControllerV2.java
@@ -17,7 +17,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.yeshi.utils.JsonUtil; import com.fasterxml.jackson.core.util.VersionUtil; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; @@ -29,18 +28,12 @@ import com.google.gson.stream.JsonWriter; import com.yeshi.fanli.entity.accept.AcceptData; import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture; import com.yeshi.fanli.entity.bus.tlj.DeviceTaoLiJinRecord; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail.TaoLiJinDetailTypeEnum; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin.TaoLiJinOriginEnum; import com.yeshi.fanli.entity.bus.user.UserMoneyExtra; import com.yeshi.fanli.entity.bus.user.UserRank; import com.yeshi.fanli.entity.taobao.ShareHotGoods; import com.yeshi.fanli.entity.taobao.TLJBuyGoods; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra; import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException; import com.yeshi.fanli.exception.tlj.UserTaoLiJinRecordException; import com.yeshi.fanli.service.inter.common.JumpDetailV2Service; import com.yeshi.fanli.service.inter.config.ConfigService; import com.yeshi.fanli.service.inter.goods.ShareGoodsService; @@ -54,7 +47,6 @@ import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService; import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService; import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService; import com.yeshi.fanli.service.inter.tlj.DeviceTaoLiJinRecordService; import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinDetailService; import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService; import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService; @@ -63,7 +55,6 @@ import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService; import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.TaoBaoConstant; import com.yeshi.fanli.util.TimeUtil; import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory; @@ -133,9 +124,6 @@ @Resource private QualityGoodsService qualityGoodsService; @Resource private DeviceTaoLiJinRecordService deviceTaoLiJinRecordService; @Resource private JumpDetailV2Service jumpDetailV2Service; @@ -376,146 +364,7 @@ out.print(JsonUtil.loadTrueResult(data)); } /** * 红包领取详情 * * @param acceptData * @param uid * @param type * @param out */ @RequestMapping(value = "getHongbaoDetails", method = RequestMethod.POST) public void getHongbaoDetails(AcceptData acceptData, Long uid, String type, PrintWriter out) { if (StringUtil.isNullOrEmpty(type)) { out.print(JsonUtil.loadFalseResult(1, "类型不能为空")); return; } // 用户未登录时 设备领取新红包 if (uid == null || uid <= 0) { BigDecimal money = null; DeviceTaoLiJinRecord deviceRecord = deviceTaoLiJinRecordService.getByDevice(acceptData.getDevice()); if (deviceRecord != null) { // 已领取 money = deviceRecord.getMoney(); } else { String value = configTaoLiJinService.getValueByKey("hongbao_newbies", null); if (StringUtil.isNullOrEmpty(value)) { out.print(JsonUtil.loadFalseResult(1, "系统红包不存在")); return; } money = new BigDecimal(value); deviceTaoLiJinRecordService.save(acceptData.getDevice(), money); } JSONObject data = new JSONObject(); data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon", null)); data.put("title", "新人红包"); data.put("content", "自购直接抵现,优惠真实可见!"); data.put("type", 1); data.put("money", money.setScale(2).toString()); data.put("usage", "领取成功,已存入“我的-推广红包”"); data.put("jumpName", "去使用"); data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot")); data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip", null)); data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link", null)); out.print(JsonUtil.loadTrueResult(data)); return; } // 登录用户 boolean isReceive = false; JSONObject data = new JSONObject(); data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon", null)); if (type.equals(TaoLiJinOriginEnum.newbiesWin.name())) { BigDecimal hasMoney = null; UserTaoLiJinOrigin userTaoLiJin = userTaoLiJinOriginService.getByUidAndOrigin(uid, type); if (userTaoLiJin != null) { // 已领取 hasMoney = userTaoLiJin.getMoney(); } else { try { UserTaoLiJinOrigin origin = userTaoLiJinOriginService.addNewbiesWinMoney(uid); hasMoney = origin.getMoney(); } catch (UserTaoLiJinOriginException e) { out.print(JsonUtil.loadFalseResult(e.getMsg())); return; } } data.put("title", "新人红包"); data.put("content", "自购直接抵现,优惠真实可见!"); data.put("type", 1); data.put("money", hasMoney.setScale(2).toString()); data.put("usage", "领取成功,已存入“我的-推广红包”"); data.put("jumpName", "去使用"); data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot")); data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip", null)); data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link", null)); } else if (type.equals(TaoLiJinOriginEnum.rankWin.name())) { boolean isRank = false; BigDecimal hasMoney = null; UserTaoLiJinOrigin userTaoLiJin = userTaoLiJinOriginService.getRankByThisMonth(uid, type); if (userTaoLiJin != null) { // 已领取 isRank = true; isReceive = true; hasMoney = userTaoLiJin.getMoney(); } else { isRank = false; UserRank userRank = userInfoExtraService.gerUserRank(uid); if (userRank != null) { try { UserTaoLiJinOrigin origin = userTaoLiJinOriginService.addRankWinMoney(uid, userRank); hasMoney = origin.getMoney(); isRank = true; } catch (UserTaoLiJinOriginException e) { if (e.getCode() != 2) { isRank = false; out.print(JsonUtil.loadFalseResult(e.getMsg())); return; } } } } // 等级不足 if (!isRank) { data.put("title", "账户等级福利"); data.put("content", "推广红包,好友福利!"); data.put("type", 2); data.put("money", "本月账户等级未达到\r\n继续加油"); data.put("jumpName", "去查看"); data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("user_rank")); data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_not_enough_tip", null)); data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link", null)); out.print(JsonUtil.loadTrueResult(data)); return; } else { data.put("title", "账户等级福利"); data.put("content", "推广红包,好友福利!"); data.put("type", 1); data.put("money", hasMoney.setScale(2).toString()); if (isReceive) { data.put("usage", "本月领取,已存入“我的-推广红包”"); } else { data.put("usage", "领取成功,已存入“我的-推广红包”"); } data.put("jumpName", "去使用"); data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot")); data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_tip", null)); data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link", null)); } } else { out.print(JsonUtil.loadFalseResult(1, "类型不匹配")); return; } out.print(JsonUtil.loadTrueResult(data)); } /** * 分享爆款商品-限于淘礼金 @@ -858,17 +707,7 @@ */ @RequestMapping(value = "giveTLJ", method = RequestMethod.POST) public void giveTLJ(AcceptData acceptData, Long uid, BigDecimal amount, PrintWriter out) { if (uid == null || uid <= 0) { out.print(JsonUtil.loadFalseResult(1, "用户未登录")); return; } try { String tips = userTaoLiJinRecordService.giveTaolijin(uid, amount); out.print(JsonUtil.loadTrueResult(tips)); } catch (UserTaoLiJinRecordException e) { out.print(JsonUtil.loadFalseResult(1, e.getMsg())); } out.print(JsonUtil.loadFalseResult(1, "抱歉,推广红包相关功能已下线!")); } } fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserAccountControllerV2.java
@@ -45,7 +45,6 @@ import com.yeshi.fanli.util.RedisManager; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.ThreadUtil; import com.yeshi.fanli.util.VersionUtil; import com.yeshi.fanli.util.account.UserUtil; import com.yeshi.fanli.util.annotation.RequestSerializableByKey; @@ -186,15 +185,6 @@ homeNavbarUserService.synchroDeviceToUser(uuser.getId(), device); } catch (Exception e) { LogHelper.errorDetailInfo(e); } if (VersionUtil.greaterThan_1_5_60(acceptData.getPlatform(), acceptData.getVersion())) { /* 新人红包 */ try { userTaoLiJinOriginService.synchDeviceHongbao(uuser.getId(), device); } catch (Exception e) { e.printStackTrace(); } } // 绑定oppo,VIVO推送 fanli/src/main/java/com/yeshi/fanli/dao/tlj/DeviceTaoLiJinRecordDao.java
File was deleted fanli/src/main/java/com/yeshi/fanli/entity/bus/tlj/DeviceTaoLiJinRecord.java
File was deleted fanli/src/main/java/com/yeshi/fanli/job/TaoLiJinJob.java
@@ -10,7 +10,6 @@ import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord; import com.yeshi.fanli.entity.taobao.ShareHotGoods; import com.yeshi.fanli.entity.taobao.TLJBuyGoods; import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; @@ -55,39 +54,7 @@ @Resource private UserTaoLiJinOriginService userTaoLiJinOriginService; /** * 更新报告 */ @Scheduled(cron = "0 0 1,10 * * ?") public void insetDynamicInfo() { if (!Constant.IS_TASK) { return; } try { userTaoLiJinReportService.needUpdateReport(); } catch (Exception e) { LogHelper.errorDetailInfo(e); } } /** * 退回超过3天无领取的淘礼金 */ @Scheduled(cron = "0 0 1 * * ?") public void refundNotWin() { if (!Constant.IS_TASK) { return; } try { userTaoLiJinReportService.refundNotWin(); } catch (Exception e) { LogHelper.errorDetailInfo(e); } } /** * 每天凌晨过5分钟验证 @@ -204,32 +171,4 @@ addTLJBuyGoods(list, day); } /** * 每2个小时 赠送退回已过期淘礼金 */ @Scheduled(cron = "0 0 0/2 * * ? ") public void giveSendBack() { if (!Constant.IS_TASK) return; for (int i = 0; i < 100; i++) { List<UserTaoLiJinGiveRecord> overdueList = userTaoLiJinGiveRecordService.overdueList(500); if (overdueList == null || overdueList.size() == 0) { break; } for (UserTaoLiJinGiveRecord record : overdueList) { try { userTaoLiJinOriginService.giveSendBack(record.getGiveUid(), record); // 更新记录 UserTaoLiJinGiveRecord updateRecord = new UserTaoLiJinGiveRecord(); updateRecord.setId(record.getId()); updateRecord.setState(UserTaoLiJinGiveRecord.STATE_OVERDUE); userTaoLiJinGiveRecordService.updateByPrimaryKeySelective(updateRecord); } catch (Exception e) { e.printStackTrace(); } } } } } fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/DeviceTaoLiJinRecordServiceImpl.java
File was deleted fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java
@@ -1,45 +1,23 @@ package com.yeshi.fanli.service.impl.tlj; import java.math.BigDecimal; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import javax.annotation.Resource; import org.springframework.core.task.TaskExecutor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.yeshi.utils.DateUtil; import com.yeshi.fanli.dao.mybatis.tlj.UserTaoLiJinOriginMapper; import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO; import com.yeshi.fanli.dto.msg.MsgOtherTaoLiJinContentDTO; import com.yeshi.fanli.entity.bus.tlj.DeviceTaoLiJinRecord; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail.TaoLiJinDetailTypeEnum; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin.TaoLiJinOriginEnum; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport; import com.yeshi.fanli.entity.bus.user.UserInfoExtra; import com.yeshi.fanli.entity.bus.user.UserMoneyExtra; import com.yeshi.fanli.entity.bus.user.UserRank; import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.money.UserMoneyExtraService; import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService; import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService; import com.yeshi.fanli.service.inter.tlj.DeviceTaoLiJinRecordService; import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinDetailService; import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService; import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService; import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinReportService; import com.yeshi.fanli.service.inter.user.UserInfoExtraService; import com.yeshi.fanli.util.MoneyBigDecimalUtil; import com.yeshi.fanli.util.StringUtil; @Service public class UserTaoLiJinOriginServiceImpl implements UserTaoLiJinOriginService{ @@ -58,9 +36,6 @@ @Resource private UserTaoLiJinDetailService userTaoLiJinDetailService; @Resource private DeviceTaoLiJinRecordService deviceTaoLiJinRecordService; @Resource private UserOtherMsgNotificationService userOtherMsgNotificationService; @@ -99,571 +74,14 @@ public UserTaoLiJinOrigin getRankByThisMonth(long uid, String type) { return userTaoLiJinOriginMapper.getRankByThisMonth(uid, type); } @Override public boolean hasRankHongBao(long uid) { UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); if (userInfoExtra == null) { return false; } // 等级验证 UserRank userRank = userInfoExtra.getUserRank(); if (userRank == null || userRank.getId() <= 1) { return false; } // 是否已领取 long countRan = userTaoLiJinOriginMapper.countRankByThisMonth(uid); if (countRan > 0) { return false; } return true; } @Override public void synchDeviceHongbao(long uid, String device) { // 是否已领取 long count = userTaoLiJinOriginMapper.countByUidAndType(uid, TaoLiJinOriginEnum.newbiesWin.name()); if (count > 0) { return; } // 设备是否已领取 DeviceTaoLiJinRecord record = deviceTaoLiJinRecordService.getByDevice(device); if (record == null) { return; } try { addNewbiesWinMoney(uid); } catch (UserTaoLiJinOriginException e) { LogHelper.errorDetailInfo(e); } } @Override @Transactional public UserTaoLiJinOrigin addNewbiesWinMoney(Long uid) throws UserTaoLiJinOriginException{ if(1>0) throw new UserTaoLiJinOriginException(1, "接口已下线"); if (uid == null) { throw new UserTaoLiJinOriginException(1, "参数不能为空"); } String value = configTaoLiJinService.getValueByKey("hongbao_newbies",null); if (StringUtil.isNullOrEmpty(value)) { throw new UserTaoLiJinOriginException(1, "系统红包不存在"); } BigDecimal money = new BigDecimal(value); // 是否可以自购 boolean canSelfBuy = userInfoExtraService.isNewUser(uid); // 添加用户红包 userMoneyExtraService.addTaoLiJin(uid, money, canSelfBuy); // 添加新增记录 UserTaoLiJinOrigin origin = saveOrigin(uid, canSelfBuy?2:1, money, TaoLiJinOriginEnum.newbiesWin); // 红包明细 userTaoLiJinDetailService.createAddDetail(origin); // 消息 executor.execute(new Runnable() { @Override public void run() { try { String source = ""; if(canSelfBuy) { source = "新人红包"; } else { source = "分享红包"; } MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO(); content.setState("红包增加"); content.setSource(source); content.setMoney(money); userOtherMsgNotificationService.taoLiJinMsg(uid, "", content); } catch (Exception e) { LogHelper.errorDetailInfo(e); } } }); return origin; } @Override @Transactional public UserTaoLiJinOrigin addRankWinMoney(Long uid, UserRank userRank) throws UserTaoLiJinOriginException{ if (uid == null || userRank == null) { throw new UserTaoLiJinOriginException(1, "参数不能为空"); } if(1>0) throw new UserTaoLiJinOriginException(1, "接口已下线"); String key = ""; if (userRank.getId() == 2) { key = "hongbao_rank_silver"; } else if (userRank.getId() == 3) { key = "hongbao_rank_gold"; } else if (userRank.getId() == 4) { key = "hongbao_rank_platinum"; } else { throw new UserTaoLiJinOriginException(2, "用户等级不足"); } String value = configTaoLiJinService.getValueByKey(key,null); if (StringUtil.isNullOrEmpty(value)) { throw new UserTaoLiJinOriginException(1, "系统红包不存在"); } BigDecimal money = new BigDecimal(value); // 添加红包余额 userMoneyExtraService.addTaoLiJin(uid, money, false); // 添加新增记录 UserTaoLiJinOrigin origin = saveOrigin(uid, 1, money, TaoLiJinOriginEnum.rankWin); // 红包明细 userTaoLiJinDetailService.createAddDetail(origin); // 消息 executor.execute(new Runnable() { @Override public void run() { try { String beizhu = "上月账户等级" + userRank.getName(); MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO(); content.setState("红包增加"); content.setSource("账户等级福利"); content.setMoney(money); userOtherMsgNotificationService.taoLiJinMsg(uid, beizhu, content); } catch (Exception e) { LogHelper.errorDetailInfo(e); } } }); return origin; } @Override @Transactional public UserTaoLiJinOrigin addInviteWinMoney(Long uid, String inviteName) throws UserTaoLiJinOriginException{ if (uid == null || StringUtil.isNullOrEmpty(inviteName)) { throw new UserTaoLiJinOriginException(1, "参数不能为空"); } if(1>0) throw new UserTaoLiJinOriginException(1, "接口已下线"); String value = configTaoLiJinService.getValueByKey("hongbao_invite",null); if (StringUtil.isNullOrEmpty(value)) { throw new UserTaoLiJinOriginException(1, "系统红包不存在"); } BigDecimal money = new BigDecimal(value); // 添加用户红包 userMoneyExtraService.addTaoLiJin(uid, money, false); // 添加新增记录 UserTaoLiJinOrigin origin = saveOrigin(uid, 1, money, TaoLiJinOriginEnum.inviteWin); // 红包明细 userTaoLiJinDetailService.createAddDetail(origin); // 消息 executor.execute(new Runnable() { @Override public void run() { try { String beizhu = "成功邀请队员" + inviteName; MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO(); content.setState("红包增加"); content.setSource("邀请队员奖励"); content.setMoney(money); userOtherMsgNotificationService.taoLiJinMsg(uid, beizhu, content); } catch (Exception e) { LogHelper.errorDetailInfo(e); } } }); return origin; } @Override @Transactional public UserTaoLiJinOrigin addShareWinMoney(Long uid) throws UserTaoLiJinOriginException{ if (uid == null) { throw new UserTaoLiJinOriginException(1, "用户未登录"); } if(1>0) throw new UserTaoLiJinOriginException(1, "接口已下线"); String value = configTaoLiJinService.getValueByKey("hongbao_share",null); if (StringUtil.isNullOrEmpty(value)) { throw new UserTaoLiJinOriginException(1, "系统红包不存在"); } BigDecimal money = new BigDecimal(value); // 添加用户红包 userMoneyExtraService.addTaoLiJin(uid, money, false); // 添加新增记录 UserTaoLiJinOrigin origin = saveOrigin(uid, 1, money, TaoLiJinOriginEnum.shareWin); // 红包明细 userTaoLiJinDetailService.createAddDetail(origin); // // 消息 // executor.execute(new Runnable() { // @Override // public void run() { // try { // String beizhu = "近30天产生过分享(仅一次奖励)"; // MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO(); // content.setState("红包增加"); // content.setSource("分享订单奖励"); // content.setMoney(money); // userOtherMsgNotificationService.taoLiJinMsg(uid, beizhu, content); // } catch (Exception e) { // LogHelper.errorDetailInfo(e); // } // } // }); return origin; } // 添加新增记录 public UserTaoLiJinOrigin saveOrigin(Long uid, int type, BigDecimal money, TaoLiJinOriginEnum originEnum) { UserTaoLiJinOrigin taoLiJinOrigin = new UserTaoLiJinOrigin(); taoLiJinOrigin.setUid(uid); taoLiJinOrigin.setType(type); taoLiJinOrigin.setOrigin(originEnum); taoLiJinOrigin.setMoney(money); taoLiJinOrigin.setMoneySurplus(money); taoLiJinOrigin.setCreateTime(new Date()); taoLiJinOrigin.setUpdateTime(new Date()); taoLiJinOrigin.setRemark(originEnum.getDesc()); userTaoLiJinOriginMapper.insertSelective(taoLiJinOrigin); return taoLiJinOrigin; } @Override @Transactional public void refundMoney(UserTaoLiJinReport report) throws UserTaoLiJinOriginException{ if (report == null) { throw new UserTaoLiJinOriginException(1, "参数不能为空"); } String rightsId = report.getId(); BigDecimal refundAmount = report.getRefundAmount(); // 已退回的金额 BigDecimal moneyOrigin = userTaoLiJinOriginMapper.countMoneyByOrigin(rightsId, TaoLiJinOriginEnum.refund.name()); if (refundAmount.compareTo(moneyOrigin) < 1) { return; } // 查询用户信息 UserTaoLiJinRecord record = userTaoLiJinRecordService.getByRightsId(rightsId); if (record == null) { return; } Long uid = record.getUid(); // 计算本次退回的金额 BigDecimal money = MoneyBigDecimalUtil.sub(refundAmount, moneyOrigin); // 添加用户红包 userMoneyExtraService.addTaoLiJin(uid, money, false); // 添加新增记录 UserTaoLiJinOrigin taoLiJinOrigin = new UserTaoLiJinOrigin(); taoLiJinOrigin.setUid(uid); taoLiJinOrigin.setType(1); taoLiJinOrigin.setRightsId(rightsId); taoLiJinOrigin.setMoney(money); taoLiJinOrigin.setMoneySurplus(money); taoLiJinOrigin.setOrigin(TaoLiJinOriginEnum.refund); taoLiJinOrigin.setRemark(TaoLiJinOriginEnum.refund.getDesc()); taoLiJinOrigin.setCreateTime(new Date()); taoLiJinOrigin.setUpdateTime(new Date()); userTaoLiJinOriginMapper.insertSelective(taoLiJinOrigin); // 红包明细 userTaoLiJinDetailService.createAddDetail(taoLiJinOrigin); // 消息 executor.execute(new Runnable() { @Override public void run() { try { String beizhu = "共创建:" + record.getTotalNum() + "个,已领取"+report.getWinNum()+"个,剩余"+report.getRefundNum()+ "个退回"; SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd hh.mm"); String time = sd.format(record.getCreateTime()); MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO(); content.setState("红包退回"); content.setSource(time + " 创建的分享记录"); content.setMoney(money); userOtherMsgNotificationService.taoLiJinMsg(uid, beizhu, content); } catch (Exception e) { LogHelper.errorDetailInfo(e); } } }); } @Override public void overdueHongBao(Long uid) { if (uid == null) { return; } // 15天前过期- 非等级红包 try { Date date = DateUtil.reduceDay(14, new Date()); List<UserTaoLiJinOrigin> list = userTaoLiJinOriginMapper.getOverdueTaoLiJin(uid, date); executeOverdueHongBao(uid, date, list); } catch (ParseException e) { e.printStackTrace(); } // 30天前过期 - 等级红包 try { Date date = DateUtil.reduceDay(29, new Date()); List<UserTaoLiJinOrigin> list = userTaoLiJinOriginMapper.getOverdueTaoLiJinByRank(uid, date); executeOverdueHongBao(uid, date, list); } catch (ParseException e) { e.printStackTrace(); } } public void executeOverdueHongBao(Long uid, Date date, List<UserTaoLiJinOrigin> list) { if (list == null || list.size() == 0) { return; } BigDecimal total = new BigDecimal(0); for (UserTaoLiJinOrigin userTaoLiJinOrigin : list) { SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm"); String time = sd.format(userTaoLiJinOrigin.getCreateTime()); BigDecimal moneySurplus = userTaoLiJinOrigin.getMoneySurplus(); total = MoneyBigDecimalUtil.add(total, moneySurplus); String rightsId = null; boolean refund = false; TaoLiJinOriginEnum originEnum = userTaoLiJinOrigin.getOrigin(); if (TaoLiJinOriginEnum.refund.equals(originEnum)) { refund = true; rightsId = userTaoLiJinOrigin.getRightsId(); } UserTaoLiJinOrigin origin = new UserTaoLiJinOrigin(); origin.setId(userTaoLiJinOrigin.getId()); origin.setMoneySurplus(new BigDecimal(0)); origin.setUpdateTime(new Date()); userTaoLiJinOriginMapper.updateByPrimaryKeySelective(origin); if (refund) { UserTaoLiJinReport report = userTaoLiJinReportService.selectByPrimaryKey(rightsId); Date shareTime = null; if (report == null) { shareTime = date; } else { shareTime = report.getCreateTime(); } // 消息 MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO(); content.setState("红包收回"); content.setSource("于[" + sd.format(shareTime) + "]创建的分享未被领取部分"); content.setTimeDesc("退回于" + time); content.setMoney(moneySurplus); content.setReason("本笔退回推广红包从退回日起至今并未产生分享记录"); content.setResult("长期未使用收回"); userOtherMsgNotificationService.taoLiJinMsg(uid, "如有疑问请联系人工客服", content); } else { // 消息 MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO(); content.setState("红包收回"); content.setSource(originEnum.getDesc()); content.setTimeDesc("获得于" + time); content.setMoney(moneySurplus); content.setReason("本笔推广红包从获得日起至今并未产生分享记录"); content.setResult("长期未使用收回"); userOtherMsgNotificationService.taoLiJinMsg(uid, "如有疑问请联系人工客服", content); } } // 用户剩余淘礼金 UserMoneyExtra userMoneyExtra = userMoneyExtraService.selectByPrimaryKey(uid); if (userMoneyExtra == null || userMoneyExtra.getTlj() == null) { return; } UserMoneyExtra updateExtra = new UserMoneyExtra(); updateExtra.setUid(uid); BigDecimal tljSelf = userMoneyExtra.getTljSelf(); if (tljSelf != null && tljSelf.compareTo(new BigDecimal(0)) > 0) { // 剩余淘礼金-- 自购 BigDecimal sub = MoneyBigDecimalUtil.sub(tljSelf, total); if (sub.compareTo(new BigDecimal(0)) > 0) { updateExtra.setTljSelf(sub); } else { updateExtra.setTljSelf(new BigDecimal(0)); } } updateExtra.setTlj(MoneyBigDecimalUtil.sub(userMoneyExtra.getTlj(), total)); updateExtra.setUpdateTime(new Date()); userMoneyExtraService.updateByPrimaryKeySelective(updateExtra); // 插入明细 UserTaoLiJinDetail detail = new UserTaoLiJinDetail(); detail.setUid(uid); detail.setMoney(new BigDecimal("-" + total.toString())); detail.setTitle(TaoLiJinDetailTypeEnum.sendBack.getDesc()); detail.setType(TaoLiJinDetailTypeEnum.sendBack); detail.setCreateTime(new Date()); userTaoLiJinDetailService.insertSelective(detail); } @Override public List<UserTaoLiJinOrigin> getSurplusLiJin(long uid) { return userTaoLiJinOriginMapper.getSurplusLiJin(uid); } @Override @Transactional public void addInviteWinMoneyByHand(Long uid, String inviteName, Date date) throws UserTaoLiJinOriginException { if (uid == null || StringUtil.isNullOrEmpty(inviteName)) { throw new UserTaoLiJinOriginException(1, "参数不能为空"); } String value = configTaoLiJinService.getValueByKey("hongbao_invite",null); if (StringUtil.isNullOrEmpty(value)) { throw new UserTaoLiJinOriginException(1, "系统红包不存在"); } BigDecimal money = new BigDecimal(value); // 添加用户红包 userMoneyExtraService.addTaoLiJin(uid, money, false); // 添加新增记录 UserTaoLiJinOrigin taoLiJinOrigin = new UserTaoLiJinOrigin(); taoLiJinOrigin.setUid(uid); taoLiJinOrigin.setType(1); taoLiJinOrigin.setOrigin(TaoLiJinOriginEnum.inviteWin); taoLiJinOrigin.setMoney(money); taoLiJinOrigin.setMoneySurplus(money); taoLiJinOrigin.setCreateTime(date); taoLiJinOrigin.setUpdateTime(date); taoLiJinOrigin.setRemark(TaoLiJinOriginEnum.inviteWin.getDesc()); userTaoLiJinOriginMapper.insertSelective(taoLiJinOrigin); // 明细 UserTaoLiJinDetail detail = new UserTaoLiJinDetail(); detail.setUid(uid); detail.setMoney(money); detail.setType(TaoLiJinDetailTypeEnum.add); detail.setTitle(TaoLiJinDetailTypeEnum.add.getDesc()); detail.setDescInfo("来源:" + TaoLiJinOriginEnum.inviteWin.getDesc()); detail.setCreateTime(date); userTaoLiJinDetailService.insertSelective(detail); } @Override @Transactional public void exchangeMoney(Long uid, BigDecimal money) throws UserTaoLiJinOriginException{ if (uid == null || money == null) { throw new UserTaoLiJinOriginException(1, "参数不能为空"); } // 添加用户红包 userMoneyExtraService.addTaoLiJin(uid, money, false); // 添加新增记录 UserTaoLiJinOrigin origin = saveOrigin(uid, 1, money, TaoLiJinOriginEnum.exchange); // 红包明细 userTaoLiJinDetailService.createAddDetail(origin); } @Override @Transactional public UserTaoLiJinOrigin receiveFriendsGive(Long uid, BigDecimal money) throws UserTaoLiJinOriginException{ if (uid == null || money == null) { throw new UserTaoLiJinOriginException(1, "参数不能为空"); } // 添加红包余额 userMoneyExtraService.addTaoLiJin(uid, money, false); // 添加新增记录 UserTaoLiJinOrigin origin = saveOrigin(uid, 1, money, TaoLiJinOriginEnum.friendsGive); // 红包明细 userTaoLiJinDetailService.createAddDetail(origin); // 消息 executor.execute(new Runnable() { @Override public void run() { try { MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO(); content.setState("红包增加"); content.setSource("好友赠送"); content.setMoney(money); userOtherMsgNotificationService.taoLiJinMsg(uid, "", content); } catch (Exception e) { LogHelper.errorDetailInfo(e); } } }); return origin; } @Override @Transactional public void giveSendBack(Long uid, UserTaoLiJinGiveRecord record) throws UserTaoLiJinOriginException{ if (uid == null || record == null) { throw new UserTaoLiJinOriginException(1, "参数不能为空"); } BigDecimal money = record.getAmount(); // 添加红包余额 userMoneyExtraService.addTaoLiJin(uid, money, false); // 添加新增记录 saveOrigin(uid, 1, money, TaoLiJinOriginEnum.giveSendBack); // 红包明细 UserTaoLiJinDetail detail = new UserTaoLiJinDetail(); detail.setUid(uid); detail.setMoney(money); detail.setType(TaoLiJinDetailTypeEnum.giveBack); detail.setTitle(TaoLiJinDetailTypeEnum.giveBack.getDesc()); detail.setCreateTime(new Date()); userTaoLiJinDetailService.insertSelective(detail); executor.execute(new Runnable() { @Override public void run() { // 退回消息 String beiZhu = "请到我的-推广红包查看"; SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm"); MsgOtherGiveContentDTO msgOther = new MsgOtherGiveContentDTO(); msgOther.setType(MsgOtherGiveContentDTO.TYEP_TLJ); msgOther.setTitle("推广红包退回"); msgOther.setGiveType("你赠送的¥"+ money + "元推广红包未被领取"); msgOther.setGiveTime(sd.format(record.getGiveTime())); msgOther.setReturnTime(sd.format(new Date())); userOtherMsgNotificationService.tokenGiveMsg(record.getGiveUid(), beiZhu, msgOther); } }); } } fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinReportServiceImpl.java
@@ -2,7 +2,6 @@ import java.math.BigDecimal; import java.util.Date; import java.util.List; import javax.annotation.Resource; @@ -10,13 +9,9 @@ import com.yeshi.fanli.dao.mybatis.tlj.UserTaoLiJinReportMapper; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport; import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService; import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinReportService; import com.yeshi.fanli.util.MoneyBigDecimalUtil; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.taobao.TaoKeApiUtil; @Service public class UserTaoLiJinReportServiceImpl implements UserTaoLiJinReportService{ @@ -51,8 +46,6 @@ } @Override public void updateByPrimaryKeySelective(UserTaoLiJinReport record) { if (record == null || record.getId() == null) { @@ -63,111 +56,6 @@ userTaoLiJinReportMapper.updateByPrimaryKeySelective(record); } @Override public void needUpdateReport() { List<UserTaoLiJinReport> list = userTaoLiJinReportMapper.needUpdateReport(); if (list == null || list.size() == 0) { return; } for (UserTaoLiJinReport report: list) { UserTaoLiJinReport taoLiJinReport = null; try { taoLiJinReport = TaoKeApiUtil.getTaoLiJinEffective(report.getId()); } catch (Exception e) { LogHelper.errorDetailInfo(e); continue; } if (taoLiJinReport == null) { continue; } // 是否需要更新 boolean needUpdate = false; if(taoLiJinReport.getWinNum() != report.getWinNum()){ needUpdate = true; } if(taoLiJinReport.getWinAmount() != report.getWinAmount()){ needUpdate = true; } if(taoLiJinReport.getUnfreezeNum() != report.getUnfreezeNum()){ needUpdate = true; } if(taoLiJinReport.getUnfreezeAmount() != report.getUnfreezeAmount()){ needUpdate = true; } if(taoLiJinReport.getPreCommissionAmount() != report.getPreCommissionAmount()){ needUpdate = true; } if(taoLiJinReport.getUseNum() != report.getUseNum()){ needUpdate = true; } if(taoLiJinReport.getUseAmount() != report.getUseAmount()){ needUpdate = true; } if(taoLiJinReport.getAlipayAmount() != report.getAlipayAmount()){ needUpdate = true; } if(taoLiJinReport.getRefundNum() != report.getRefundNum()){ needUpdate = true; } // 失效退回金额发生变化 BigDecimal refundAmount = taoLiJinReport.getRefundAmount(); if(refundAmount.compareTo(report.getRefundAmount()) > 0) { needUpdate = true; try { userTaoLiJinOriginService.refundMoney(taoLiJinReport); } catch (UserTaoLiJinOriginException e) { e.printStackTrace(); } } // 更新报告 if(needUpdate) { taoLiJinReport.setUpdateTime(new Date()); userTaoLiJinReportMapper.updateByPrimaryKeySelective(taoLiJinReport); } } } @Override public void refundNotWin() { List<UserTaoLiJinReport> list = userTaoLiJinReportMapper.refundNotWin(); if (list == null || list.size() == 0) { return; } for (UserTaoLiJinReport report: list) { // 总个数 Integer totalNum = report.getTotalNum(); BigDecimal preFace = report.getPreFace(); // 总金额 BigDecimal money = MoneyBigDecimalUtil.mul(new BigDecimal(totalNum), preFace); report.setRefundNum(totalNum); report.setRefundAmount(money); report.setUpdateTime(new Date()); try { // 退回淘礼金 userTaoLiJinOriginService.refundMoney(report); } catch (UserTaoLiJinOriginException e) { LogHelper.errorDetailInfo(e); continue; } // 更新报告 userTaoLiJinReportMapper.updateByPrimaryKeySelective(report); } } @Override public UserTaoLiJinReport selectByPrimaryKey(String id) { fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java
@@ -1,6 +1,5 @@ package com.yeshi.fanli.service.impl.user; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; @@ -15,7 +14,6 @@ import com.yeshi.fanli.dao.mybatis.user.TokenRecordMapper; import com.yeshi.fanli.dto.msg.MsgInviteContentDTO; import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord; import com.yeshi.fanli.entity.bus.user.TokenRecord; import com.yeshi.fanli.entity.bus.user.TokenRecord.TokenTypeEnum; import com.yeshi.fanli.entity.bus.user.UserInfo; @@ -25,14 +23,11 @@ import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord; import com.yeshi.fanli.entity.system.SystemCoupon; import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum; import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException; import com.yeshi.fanli.exception.user.TokenRecordException; import com.yeshi.fanli.exception.user.UserInfoExtraException; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.config.SystemCouponService; import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService; import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinGiveRecordService; import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService; import com.yeshi.fanli.service.inter.user.TokenRecordService; import com.yeshi.fanli.service.inter.user.UserInfoExtraService; import com.yeshi.fanli.service.inter.user.UserInfoService; @@ -67,9 +62,6 @@ private ThreeSaleSerivce threeSaleSerivce; @Resource private UserTaoLiJinGiveRecordService userTaoLiJinGiveRecordService; @Resource private UserInfoExtraService userInfoExtraService; @Resource @@ -77,9 +69,6 @@ @Resource private UserSystemCouponGiveRecordService userSystemCouponGiveRecordService; @Resource private UserTaoLiJinOriginService userTaoLiJinOriginService; @Resource private UserOtherMsgNotificationService userOtherMsgNotificationService; @@ -220,35 +209,7 @@ throw new TokenRecordException(1, "口令已失效"); } } else if (tokenType == TokenTypeEnum.taoLiJin) { type = 12; UserTaoLiJinGiveRecord giveRecord = userTaoLiJinGiveRecordService.selectByPrimaryKey(Long.parseLong(identify)); if (giveRecord == null) throw new TokenRecordException(1, "口令已失效"); BigDecimal amount = giveRecord.getAmount(); num = Integer.parseInt(amount.setScale(0).toString()); if(giveRecord.getState() == UserTaoLiJinGiveRecord.STATE_OVERDUE) { tips.add("哎呀,推广红包已失效了!"); } else if (giveRecord.getState() == UserTaoLiJinGiveRecord.STATE_RECEIVE) { tips.add("哎呀,推广红包已被领取了!"); } else if (giveRecord.getState() == UserTaoLiJinGiveRecord.STATE_INIT) { if (uid == null || uid <= 0) throw new TokenRecordException(1001, "温馨提示,[推广红包]需要登录后领取"); state = true; UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) { tips.add("确认领取后,你将成为赠送者的一级队员;"); tips.add("推广红包,可分享爆款商品,让分享订单成单率更高;"); tips.add("成功领取后,请到“我的-推广红包”中查看。"); } else { tips.add("推广红包,可分享爆款商品,让分享订单成单率更高;"); tips.add("成功领取后,请到“我的-推广红包”中查看。"); } } else { throw new TokenRecordException(1, "口令失效"); } throw new TokenRecordException(1, "推广红包相关功能已下线!"); } else { throw new TokenRecordException(1, "无对应类型"); } @@ -505,64 +466,7 @@ } }); } else if (tokenType == TokenTypeEnum.taoLiJin) { UserTaoLiJinGiveRecord giveRecord = userTaoLiJinGiveRecordService .selectByPrimaryKey(Long.parseLong(identify)); if (giveRecord == null || giveRecord.getState() != UserTaoLiJinGiveRecord.STATE_INIT) throw new TokenRecordException(1, "赠送记录失效或已被领取"); Date endTime = giveRecord.getEndTime(); if (endTime != null && endTime.getTime() < now.getTime()) throw new TokenRecordException(1, "推广红包已失效了"); BigDecimal amount = giveRecord.getAmount(); try { // 领取 userTaoLiJinOriginService.receiveFriendsGive(uid, amount); // 更新记录 UserTaoLiJinGiveRecord updateRecord = new UserTaoLiJinGiveRecord(); updateRecord.setId(Long.parseLong(identify)); updateRecord.setReceiveTime(new Date()); updateRecord.setReceiveUid(uid); updateRecord.setState(UserTaoLiJinGiveRecord.STATE_RECEIVE); userTaoLiJinGiveRecordService.updateByPrimaryKeySelective(updateRecord); integralGetService.addGiveTaoLiJin(giveUid); msg = "领取成功[推广红包]成功,请到[我的-推广红包]中查看"; // 消息 + 队员 executor.execute(new Runnable() { @Override public void run() { SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm"); boolean addTeam = addInviteTeam(uid, giveUid, userInfoExtra); String beiZhu = "无"; if (addTeam) beiZhu = "领取人已经成为你的一级队员"; String userName = "无"; UserInfo user = userInfoService.selectByPKey(uid); if (user != null && !StringUtil.isNullOrEmpty(user.getNickName())) userName = user.getNickName(); MsgOtherGiveContentDTO msgOther = new MsgOtherGiveContentDTO(); msgOther.setType(MsgOtherGiveContentDTO.TYEP_TLJ); msgOther.setTitle("赠送推广红包"); msgOther.setGiveType("你赠送的推广红包被成功领取"); msgOther.setReceiveInfo("昵称:" + userName + " ID:" + uid); msgOther.setGiveTime(sd.format(giveRecord.getGiveTime())); msgOther.setReceiveTime(sd.format(new Date())); userOtherMsgNotificationService.tokenGiveMsg(giveUid, beiZhu, msgOther); // 激活邀请信息 if (addTeam) addInviteMsg(uid, giveUid, amount.setScale(2) + "元推广红包"); } }); } catch (UserTaoLiJinOriginException e) { e.printStackTrace(); } throw new TokenRecordException(1, "推广红包相关功能已下线!"); } else { throw new TokenRecordException(1, "无对应类型"); } fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralExchangeServiceImpl.java
@@ -266,9 +266,7 @@ exchange.setNeedJump(true); exchange.setBtnName("去查看"); } else if (ExchangeTypeEnum.taoLiJin == type) { thing = "推广红包"; thingNum = exchange.getAmount() + "元"; userTaoLiJinOriginService.exchangeMoney(uid, exchange.getAmount()); throw new IntegralExchangeException(1, "推广红包相关功能已下线!"); } else if (ExchangeTypeEnum.cash == type) { thing = "现金红包"; BigDecimal money = exchange.getAmount(); fanli/src/main/java/com/yeshi/fanli/service/impl/user/invite/ThreeSaleSerivceImpl.java
@@ -17,12 +17,9 @@ import com.yeshi.fanli.dao.mybatis.UserInfoMapper; import com.yeshi.fanli.entity.bus.user.ThreeSale; import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo; import com.yeshi.fanli.entity.bus.user.UserActiveLog; import com.yeshi.fanli.entity.bus.user.UserInfo; import com.yeshi.fanli.exception.user.ThreeSaleException; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService; import com.yeshi.fanli.service.inter.user.UserActiveLogService; import com.yeshi.fanli.service.inter.user.UserInfoExtraService; import com.yeshi.fanli.service.inter.user.UserInfoService; @@ -33,7 +30,6 @@ import com.yeshi.fanli.service.inter.user.invite.UserInviteMsgNotificationService; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.VersionUtil; import com.yeshi.fanli.util.cmq.ThreeSaleCMQManager; import net.sf.json.JSONArray; @@ -59,9 +55,6 @@ @Resource private MsgInviteDetailService msgInviteDetailService; @Resource private UserTaoLiJinOriginService userTaoLiJinOriginService; @Resource private UserActiveLogService userActiveLogService; @@ -552,38 +545,6 @@ executor.execute(new Runnable() { @Override public void run() { UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(inviter.getId()); try { if (activeLog != null && !StringUtil.isNullOrEmpty(activeLog.getVersionCode())) { String versionCode = activeLog.getVersionCode(); String channel = activeLog.getChannel(); boolean result = false; // 渠道是appstore 判断为IOS 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(); if (StringUtil.isNullOrEmpty(inviteName)) { UserInfo userInfo = userInfoService.selectByPKey(invitee.getId()); if (userInfo != null) { inviteName = userInfo.getNickName(); } } // 奖励邀请红包(淘礼金) userTaoLiJinOriginService.addInviteWinMoney(inviter.getId(), inviteName); } } } catch (Exception e) { LogHelper.errorDetailInfo(e); } // 邀请金币 integralGetService.addInviteLevelOne(inviter.getId(), invitee.getId()); } @@ -648,37 +609,6 @@ executor.execute(new Runnable() { @Override public void run() { try { UserActiveLog activeLog = userActiveLogService.getUserLatestActiveInfo(inviterId); if (activeLog != null && !StringUtil.isNullOrEmpty(activeLog.getVersionCode())) { boolean result = false; String versionCode = activeLog.getVersionCode(); String channel = activeLog.getChannel(); // 渠道是appstore 判断为IOS 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(); if (StringUtil.isNullOrEmpty(inviteName)) { UserInfo userInfo = userInfoService.selectByPKey(invitee.getId()); if (userInfo != null) { inviteName = userInfo.getNickName(); } } // 奖励邀请红包(淘礼金) userTaoLiJinOriginService.addInviteWinMoney(inviterId, inviteName); } } } catch (Exception e) { LogHelper.errorDetailInfo(e); } // 邀请金币 integralGetService.addInviteLevelOne(boss.getId(), invitee.getId()); } fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/DeviceTaoLiJinRecordService.java
File was deleted fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinOriginService.java
@@ -1,14 +1,9 @@ package com.yeshi.fanli.service.inter.tlj; import java.math.BigDecimal; import java.util.Date; import java.util.List; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport; import com.yeshi.fanli.entity.bus.user.UserRank; import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException; public interface UserTaoLiJinOriginService { @@ -28,18 +23,7 @@ */ public long countByUidAndOrigin(long uid, String origin); /** * 判断本月红包领取个数 * @param uid * @return */ public boolean hasRankHongBao(long uid); /** * 使红包过期 * @param uid */ public void overdueHongBao(Long uid); /** * 获取类型 @@ -70,92 +54,8 @@ */ public void updateByPrimaryKeySelective(UserTaoLiJinOrigin record); /** * 新人红包设备同步 * @param uid * @param device */ public void synchDeviceHongbao(long uid, String device); /** * 获得新人红包 * @param uid * @param money * @throws UserTaoLiJinOriginException */ public UserTaoLiJinOrigin addNewbiesWinMoney(Long uid) throws UserTaoLiJinOriginException; /** * 等级红包 * @param uid * @param money * @param userRank * @throws UserTaoLiJinOriginException */ public UserTaoLiJinOrigin addRankWinMoney(Long uid, UserRank userRank) throws UserTaoLiJinOriginException; /** * 邀请红包 * @param uid * @param money * @param inviteName * @throws UserTaoLiJinOriginException */ public UserTaoLiJinOrigin addInviteWinMoney(Long uid, String inviteName) throws UserTaoLiJinOriginException; /** * 分享红包 * @param uid * @param money * @throws UserTaoLiJinOriginException */ public UserTaoLiJinOrigin addShareWinMoney(Long uid) throws UserTaoLiJinOriginException; /** * 退回 * @param uid * @param money * @param total * @param report * @throws UserTaoLiJinOriginException */ public void refundMoney(UserTaoLiJinReport report) throws UserTaoLiJinOriginException; /** * 手动添加邀请红包- 不发生消息 * @param uid * @param inviteName * @param date * @return * @throws UserTaoLiJinOriginException */ public void addInviteWinMoneyByHand(Long uid, String inviteName, Date date) throws UserTaoLiJinOriginException; /** * 金币兑换 * @param uid * @param money * @param userRank * @throws UserTaoLiJinOriginException */ public void exchangeMoney(Long uid, BigDecimal money) throws UserTaoLiJinOriginException; /** * 领取淘礼金-好友赠送 * @param uid * @param money * @return * @throws UserTaoLiJinOriginException */ public UserTaoLiJinOrigin receiveFriendsGive(Long uid, BigDecimal money) throws UserTaoLiJinOriginException; /** * 红包赠送退回 * @param uid * @param UserTaoLiJinGiveRecord record * @throws UserTaoLiJinOriginException */ public void giveSendBack(Long uid, UserTaoLiJinGiveRecord record) throws UserTaoLiJinOriginException; } fanli/src/main/java/com/yeshi/fanli/service/inter/tlj/UserTaoLiJinReportService.java
@@ -16,17 +16,6 @@ */ public void updateByPrimaryKeySelective(UserTaoLiJinReport record); /** * 报告更新 * @return */ public void needUpdateReport(); /** * 超过3天的未领取 退回金额 */ public void refundNotWin(); public UserTaoLiJinReport selectByPrimaryKey(String id); }