From 1bcbc66438458a1393591c933243e94f47b7acd2 Mon Sep 17 00:00:00 2001
From: admin <2780501319@qq.com>
Date: 星期日, 08 三月 2020 11:14:22 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div
---
fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralTaskRecordServiceImpl.java | 42 ++++++++++++++++++------------------------
1 files changed, 18 insertions(+), 24 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralTaskRecordServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralTaskRecordServiceImpl.java
index ba9418b..500a5d6 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralTaskRecordServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/integral/IntegralTaskRecordServiceImpl.java
@@ -16,11 +16,8 @@
import org.springframework.transaction.annotation.Transactional;
import org.yeshi.utils.DateUtil;
-import com.aliyun.openservices.ons.api.Message;
import com.aliyun.openservices.ons.api.Producer;
import com.yeshi.fanli.dao.mybatis.integral.IntegralTaskRecordMapper;
-import com.yeshi.fanli.dto.mq.user.UserTopicTagEnum;
-import com.yeshi.fanli.dto.mq.user.body.IntegralTaskMQMsg;
import com.yeshi.fanli.dto.msg.MsgOtherRewardIntegralDTO;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.integral.IntegralDetail;
@@ -29,6 +26,7 @@
import com.yeshi.fanli.entity.integral.IntegralTaskClass;
import com.yeshi.fanli.entity.integral.IntegralTaskClass.UniqueKeyEnum;
import com.yeshi.fanli.entity.integral.IntegralTaskRecord;
+import com.yeshi.fanli.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.exception.integral.IntegralTaskRecordException;
import com.yeshi.fanli.exception.user.UserInfoExtraException;
import com.yeshi.fanli.log.LogHelper;
@@ -39,10 +37,9 @@
import com.yeshi.fanli.service.inter.user.integral.IntegralTaskClassService;
import com.yeshi.fanli.service.inter.user.integral.IntegralTaskRecordService;
import com.yeshi.fanli.service.inter.user.integral.IntegralTaskService;
+import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
-import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory;
-import com.yeshi.fanli.util.rocketmq.MQTopicName;
@Service
public class IntegralTaskRecordServiceImpl implements IntegralTaskRecordService {
@@ -82,6 +79,11 @@
return integralTaskRecordMapper.countFinished(uid, cid, dateType);
}
+ @Override
+ public void invalidGoldCoin() {
+ integralTaskRecordMapper.invalidGoldCoin();
+ }
+
@Override
public void finishedTask(long uid, long cid, long taskId, int goldCoin) {
IntegralTaskRecord taskRecord = new IntegralTaskRecord();
@@ -239,7 +241,7 @@
// 宸查鍙�
Integer state = record.getState();
- if (state != null && state == 1)
+ if (state != null && state != 0)
continue;
if (addDetail(uid, record))
@@ -359,20 +361,16 @@
if (record.getCid() == null || record.getTaskId() == null || record.getGoldCoin() == null
|| record.getState() == null || record.getUid() == null)
throw new IntegralTaskRecordException(2, "鏁版嵁涓嶅畬鎴�");
-
+ Date date = new Date();
if (record.getCreateTime() == null)
- record.setCreateTime(new Date());
+ record.setCreateTime(date);
if (record.getUpdateTime() == null)
- record.setUpdateTime(new Date());
+ record.setUpdateTime(date);
+
+ // 璁剧疆鏈夋晥鏈�
+ record.setEndTime(DateUtil.plusDayDate(Constant.GOLD_COIN_VALID_DAYS, date));
integralTaskRecordMapper.insertSelective(record);
- long count = integralTaskRecordMapper.getTotalGoldCoinByUid(record.getUid());
- if (count >= 200) {// 澶т簬200鍙戦�佹秷鎭�
- IntegralTaskMQMsg msg = new IntegralTaskMQMsg(record.getUid(), count, new Date());
- Message message = MQMsgBodyFactory.create(MQTopicName.TOPIC_USER, UserTopicTagEnum.integralTaskFinish, msg);
- producer.send(message);
- }
-
return record;
}
@@ -393,10 +391,6 @@
return integralTaskRecordMapper.listByUidAndTaskId(uid, taskId, (page - 1) * count, count);
}
- @Override
- public long getTotalGoldCoinByUid(Long uid) {
- return integralTaskRecordMapper.getTotalGoldCoinByUid(uid);
- }
@Async()
@Override
@@ -404,7 +398,7 @@
if (uid == null || originUid == null)
return;
- String reward = configService.get("first_order_reward_boss");
+ String reward = configService.get(ConfigKeyEnum.firstOrderRewardBoss.getKey());
if (StringUtil.isNullOrEmpty(reward))
return;
firstOrderReward(uid, originUid, Integer.parseInt(reward), "涓�", beizu);
@@ -416,7 +410,7 @@
if (uid == null || originUid == null)
return;
- String reward = configService.get("first_order_reward_boss_super");
+ String reward = configService.get(ConfigKeyEnum.firstOrderRewardBossSuper.getKey());
if (StringUtil.isNullOrEmpty(reward))
return;
firstOrderReward(uid, originUid, Integer.parseInt(reward), "浜�", beizu);
@@ -428,7 +422,7 @@
if (uid == null)
return;
- String reward = configService.get("first_share_order_reward");
+ String reward = configService.get(ConfigKeyEnum.firstShareOrderReward.getKey());
if (StringUtil.isNullOrEmpty(reward))
return;
firstOrderReward(uid, null, Integer.parseInt(reward), null, beizu);
@@ -440,7 +434,7 @@
if (uid == null || originUid == null)
return;
- String reward = configService.get("first_share_order_reward_boss");
+ String reward = configService.get(ConfigKeyEnum.firstShareOrderRewardBoss.getKey());
if (StringUtil.isNullOrEmpty(reward))
return;
firstOrderReward(uid, originUid, Integer.parseInt(reward), "涓�", beizu);
--
Gitblit v1.8.0