From e5e38de6745c8fcae91fa7e459898f3663d00001 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 19 八月 2019 17:41:32 +0800 Subject: [PATCH] 通用模板修改 --- fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java | 62 +++++++++++++++++++++++++++++-- 1 files changed, 58 insertions(+), 4 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java index f70da5a..2c3ad2f 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinOriginServiceImpl.java @@ -148,7 +148,7 @@ if (uid == null) { throw new UserTaoLiJinOriginException(1, "鍙傛暟涓嶈兘涓虹┖"); } - String value = configTaoLiJinService.getValueByKey("hongbao_newbies"); + String value = configTaoLiJinService.getValueByKey("hongbao_newbies",null); if (StringUtil.isNullOrEmpty(value)) { throw new UserTaoLiJinOriginException(1, "绯荤粺绾㈠寘涓嶅瓨鍦�"); } @@ -207,7 +207,7 @@ throw new UserTaoLiJinOriginException(2, "鐢ㄦ埛绛夌骇涓嶈冻"); } - String value = configTaoLiJinService.getValueByKey(key); + String value = configTaoLiJinService.getValueByKey(key,null); if (StringUtil.isNullOrEmpty(value)) { throw new UserTaoLiJinOriginException(1, "绯荤粺绾㈠寘涓嶅瓨鍦�"); } @@ -246,7 +246,7 @@ throw new UserTaoLiJinOriginException(1, "鍙傛暟涓嶈兘涓虹┖"); } - String value = configTaoLiJinService.getValueByKey("hongbao_invite"); + String value = configTaoLiJinService.getValueByKey("hongbao_invite",null); if (StringUtil.isNullOrEmpty(value)) { throw new UserTaoLiJinOriginException(1, "绯荤粺绾㈠寘涓嶅瓨鍦�"); } @@ -285,7 +285,7 @@ throw new UserTaoLiJinOriginException(1, "鐢ㄦ埛鏈櫥褰�"); } - String value = configTaoLiJinService.getValueByKey("hongbao_share"); + String value = configTaoLiJinService.getValueByKey("hongbao_share",null); if (StringUtil.isNullOrEmpty(value)) { throw new UserTaoLiJinOriginException(1, "绯荤粺绾㈠寘涓嶅瓨鍦�"); } @@ -525,4 +525,58 @@ 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); + } } -- Gitblit v1.8.0