From 89cc8f054c27f70fcfe16f14554a8a12e0c19e23 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期三, 18 十二月 2019 09:22:31 +0800 Subject: [PATCH] 邀请统计 --- fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinNewbiesServiceImpl.java | 30 +++++++++++++++++++++--------- 1 files changed, 21 insertions(+), 9 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinNewbiesServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinNewbiesServiceImpl.java index 69a7845..bf113e7 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinNewbiesServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinNewbiesServiceImpl.java @@ -4,8 +4,6 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.HashMap; -import java.util.Map; import javax.annotation.Resource; @@ -19,6 +17,7 @@ import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail.TaoLiJinDetailTypeEnum; import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinNewbies; +import com.yeshi.fanli.entity.bus.user.UserInfo; import com.yeshi.fanli.entity.bus.user.UserInfoExtra; import com.yeshi.fanli.entity.push.DeviceActive; import com.yeshi.fanli.entity.taobao.TLJFreeBuyGoods; @@ -37,6 +36,7 @@ import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService; import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinDetailService; import com.yeshi.fanli.service.inter.user.UserInfoExtraService; +import com.yeshi.fanli.service.inter.user.UserInfoService; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.MoneyBigDecimalUtil; import com.yeshi.fanli.util.StringUtil; @@ -47,6 +47,8 @@ import com.yeshi.fanli.util.taobao.TaoKeApiUtil; import com.yeshi.fanli.vo.redpack.TaoLiJinWinDetailVO; +import net.sf.json.JSONObject; + @Service public class UserTaoLiJinNewbiesServiceImpl implements UserTaoLiJinNewbiesService { @@ -55,6 +57,9 @@ @Resource private ConfigTaoLiJinService configTaoLiJinService; + + @Resource + private UserInfoService userInfoService; @Resource private UserInfoExtraService userInfoExtraService; @@ -141,6 +146,10 @@ if (uid == null || uid <= 0) return null; // 鏈櫥褰曞脊鍑� + UserInfo userInfo = userInfoService.selectByPKey(uid); + if (userInfo == null) + return null; + UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); if (userInfoExtra == null || userInfoExtra.getFirstLoginTime() == null) return null; @@ -220,9 +229,8 @@ detail.setRemark("鏂颁汉绾㈠寘"); userTaoLiJinDetailService.insertSelective(detail); - - Map<String,String> map = new HashMap<String,String>(); - map.put("url", configTaoLiJinService.getValueByKey("new_user_free_buy_list")); + JSONObject json = new JSONObject(); + json.put("url", configTaoLiJinService.getValueByKey("new_user_free_buy_list")); TaoLiJinWinDetailVO winDetailVO = new TaoLiJinWinDetailVO(); winDetailVO.setTitle("鏂颁汉绾㈠寘"); @@ -230,10 +238,10 @@ winDetailVO.setMoney(money.toString()); winDetailVO.setDesc("宸查鍙栵細" + balance + "鍏�"); winDetailVO.setTips(configTaoLiJinService.getValueByKey("new_user_win_tips")); - winDetailVO.setParams(map.toString()); + winDetailVO.setParams(json.toString()); winDetailVO.setJumpDetail(jumpDetailV2Service.getByTypeCache("web")); winDetailVO.setLogo(Constant.systemCommonConfig.getDefaultPortrait()); - winDetailVO.setLogoLight(Constant.systemCommonConfig.getDefaultPortrait()); + winDetailVO.setLogoLight(userInfo.getPortrait()); return winDetailVO; } @@ -279,7 +287,11 @@ UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid); if (userInfoExtra == null || userInfoExtra.getFirstLoginTime() == null) throw new UserTaoLiJinNewbiesException(1001, "浣犱笉鏄�滄柊鐢ㄦ埛鈥濇棤娉曚娇鐢ㄦ柊浜虹孩鍖�0鍏冭喘涔般��"); - + + // 楠岃瘉鏄惁婵�娲� + if (StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) + throw new UserTaoLiJinNewbiesException(1002, "閭�璇风爜鏈縺娲伙紝鏃犳硶浣跨敤鏂颁汉绾㈠寘0鍏冭喘涔般��"); + // 楠岃瘉鏄惁宸茶秴鍑烘柊鐢ㄦ埛瀹氫箟 try { int days = DateUtil.daysBetween2(userInfoExtra.getFirstLoginTime(), new Date()); @@ -288,7 +300,7 @@ } catch (ParseException e1) { throw new UserTaoLiJinNewbiesException(1, "鏃ユ湡淇℃伅璁$畻澶辫触"); } - + // 楠岃瘉浣欓 UserTaoLiJinNewbies taoLiJinNewbies = userTaoLiJinNewbiesMapper.selectForUpdate(uid); if (taoLiJinNewbies == null || taoLiJinNewbies.getMoney() == null || -- Gitblit v1.8.0