From 398f41e16c0230a94d277e297eba17b5839db71c Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 20 八月 2019 18:40:13 +0800 Subject: [PATCH] 金币获取 --- fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinRecordServiceImpl.java | 46 +++++++++++++++++++++++++++------------------- 1 files changed, 27 insertions(+), 19 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinRecordServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinRecordServiceImpl.java index 71d1031..15abadd 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinRecordServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/tlj/UserTaoLiJinRecordServiceImpl.java @@ -220,12 +220,12 @@ perface = new BigDecimal(1); } else { // 璁$畻鎺ㄥ箍绾㈠寘 - String warningRate = configTaoLiJinService.getValueByKey("warning_value"); + String warningRate = configTaoLiJinService.getValueByKey("warning_value",new Date()); perface = TaoLiJinUtil.getSpreadMoney(warningRate, goods); } UserTaoLiJinRecord record = createUserTaoLiJin(2, uid, goods.getAuctionId(), perface, totalNum, name, - sendStartTime, sendEndTime, null, useEndTime, TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT); + sendStartTime, sendEndTime, null, useEndTime, TaoBaoConstant.TAOBAO_TLJ_RELATION_PID_DEFAULT); String sendUrl = record.getSendUrl() + "&relationId=" + relationId; record.setSendUrl(sendUrl); UserTaoLiJinRecord updateRecoed=new UserTaoLiJinRecord(); @@ -533,16 +533,23 @@ if (amount.compareTo(tlj) > 0) throw new UserTaoLiJinRecordException(1, "绾㈠寘浣欓涓嶈冻"); - + Long giveId = null; Date nowDate = new Date(); - - // 璧犻�佽褰� - UserTaoLiJinGiveRecord giveRecord = new UserTaoLiJinGiveRecord(); - giveRecord.setAmount(amount); - giveRecord.setGiveUid(uid); - giveRecord.setState(UserTaoLiJinGiveRecord.STATE_INIT); - giveRecord.setGiveTime(nowDate); - userTaoLiJinGiveRecordService.insertSelective(giveRecord); + try { + // 璧犻�佽褰� + UserTaoLiJinGiveRecord giveRecord = new UserTaoLiJinGiveRecord(); + giveRecord.setAmount(amount); + giveRecord.setGiveUid(uid); + giveRecord.setState(UserTaoLiJinGiveRecord.STATE_INIT); + giveRecord.setGiveTime(nowDate); + giveRecord.setEndTime(DateUtil.plusDayDate(Constant.GIVE_DAYS, new Date())); + userTaoLiJinGiveRecordService.insertSelective(giveRecord); + + giveId = giveRecord.getId(); + } catch (Exception e) { + LogHelper.errorDetailInfo(e); + throw new UserTaoLiJinRecordException(1, "璧犻�佽褰曞垱寤哄け璐�"); + } String token = null; for (int i = 0; i < 5; i++) { @@ -553,10 +560,10 @@ TokenRecord tokenRecord = new TokenRecord(); tokenRecord.setUid(uid); - tokenRecord.setIdentify(giveRecord.getId()+""); // 璁板綍id + tokenRecord.setIdentify(giveId + ""); // 璁板綍id tokenRecord.setType(TokenTypeEnum.taoLiJin); tokenRecord.setStartTime(nowDate); - tokenRecord.setEndTime(DateUtil.plusDayDate(3, nowDate)); + tokenRecord.setEndTime(DateUtil.plusDayDate(Constant.TOKEN_DAYS, new Date())); tokenRecord.setToken(token); tokenRecord.setState(0); tokenRecordService.insertSelective(tokenRecord); @@ -579,12 +586,13 @@ updateExtra.setUpdateTime(new Date()); userMoneyExtraService.updateByPrimaryKeySelective(updateExtra); - String tips = "閫佺粰浣燵%s]鍏冩帹骞跨孩鍖呭揩鍘婚鍙栧惂锛屽鍒舵湰鏉℃秷鎭痆&%s&]锛屾墦寮�[杩斿埄鍒竇App棰嗗彇锛岀敤鎺ㄥ箍鍒嗕韩鐖嗘鍟嗗搧锛屾垚鍗曠巼鏇撮珮鍝︺�俓r\n" - + "----------------------------\r\n" - + "涓嬭浇[杩斿埄鍒竇App閾炬帴:%s\r\n" - + "PS锛氬彛浠ゅ皢浼�24灏忔椂鍐呭け鏁堬紝璇峰強鏃堕鍙栥��"; - - tips = String.format(tips, amount, token, configService.get("app_down_link")); + String tips = configTaoLiJinService.getValueByKey("give_taolijin_tips"); + String projectChineseName = Constant.systemCommonConfig.getProjectChineseName(); + while(tips.contains("{APP鍚嶇О}")) { + tips = tips.replace("{APP鍚嶇О}", projectChineseName); + } + tips = tips.replace("{鍙d护}", token).replace("{涓嬭浇閾炬帴}", configService.get("app_down_link")) + .replace("{闈㈤}", amount.setScale(0).toString()); executor.execute(new Runnable() { @Override -- Gitblit v1.8.0