From 36ba03c443aa7927e64a88408b2240cf3b56d16d Mon Sep 17 00:00:00 2001
From: admin <2780501319@qq.com>
Date: 星期四, 05 三月 2020 23:08:59 +0800
Subject: [PATCH] 分享数兼容亿的情况
---
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserShareGoodsGroupServiceImpl.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 46 insertions(+), 8 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserShareGoodsGroupServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserShareGoodsGroupServiceImpl.java
index 4819f5b..e0a57c7 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserShareGoodsGroupServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserShareGoodsGroupServiceImpl.java
@@ -10,12 +10,14 @@
import org.yeshi.utils.DateUtil;
import com.yeshi.fanli.dao.mybatis.share.UserShareGoodsGroupMapper;
+import com.yeshi.fanli.dto.HongBao;
import com.yeshi.fanli.entity.bus.share.UserShareGoodsGroup;
-import com.yeshi.fanli.entity.bus.user.HongBao;
+import com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord.ShareSourceTypeEnum;
import com.yeshi.fanli.exception.share.UserShareGoodsRecordException;
import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
-import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
+import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
import com.yeshi.fanli.service.inter.user.UserShareGoodsGroupService;
+import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
@Service
@@ -62,7 +64,7 @@
@Override
public UserShareGoodsGroup getSingleGoods(Long cid, Long uid) {
- return userShareGoodsGroupMapper.getSingleGoods(cid, uid);
+ return userShareGoodsGroupMapper.getSingleGoods(ShareSourceTypeEnum.goodsDetail,cid, uid );
}
@Override
@@ -71,8 +73,8 @@
}
@Override
- public UserShareGoodsGroup getNewestRecord(Long uid, Long auctionId) {
- return userShareGoodsGroupMapper.getNewestRecord(uid, auctionId);
+ public UserShareGoodsGroup getNewestRecord(Long uid, Long auctionId, Integer goodsType) {
+ return userShareGoodsGroupMapper.getNewestRecord(uid, auctionId, goodsType);
}
@@ -82,7 +84,7 @@
* @param auctionId
*/
@Override
- public void updateOrderRecord (HongBao hongBao) throws UserShareGoodsRecordException{
+ public void updateOrderRecord (HongBao hongBao, int goodsType) throws UserShareGoodsRecordException{
if (hongBao == null) {
throw new UserShareGoodsRecordException(1, "hongBao涓嶈兘涓虹┖");
@@ -101,7 +103,7 @@
throw new UserShareGoodsRecordException(1, "鍟嗗搧ID涓嶈兘涓虹┖");
}
- UserShareGoodsGroup newestRecord = getNewestRecord(uid, hongBao.getAuctionId());
+ UserShareGoodsGroup newestRecord = getNewestRecord(uid, hongBao.getAuctionId(), goodsType);
if (newestRecord != null) {
// 鏇存柊璁㈠崟鏁伴噺
@@ -143,7 +145,7 @@
throw new UserShareGoodsRecordException(1, "鍟嗗搧Id涓嶈兘涓虹┖");
}
- UserShareGoodsGroup group = getNewestRecord(uid, auctionId);
+ UserShareGoodsGroup group = getNewestRecord(uid, auctionId, Constant.SOURCE_TYPE_TAOBAO);
if (group != null) {
UserShareGoodsGroup shareGoodsGroup = new UserShareGoodsGroup(group.getId());
@@ -167,4 +169,40 @@
userShareGoodsGroupMapper.updateByPrimaryKeySelective(shareGoodsGroup);
}
}
+
+
+
+ @Override
+ public void updateBrowseNum(Long uid, Long id, int goodsType) throws UserShareGoodsRecordException{
+
+ if (uid == null) {
+ throw new UserShareGoodsRecordException(1, "鐢ㄦ埛ID涓嶈兘涓虹┖");
+ }
+
+ if (id == null) {
+ throw new UserShareGoodsRecordException(1, "鍟嗗搧Id涓嶈兘涓虹┖");
+ }
+
+ UserShareGoodsGroup group = getNewestRecord(uid, id, goodsType);
+ if (group != null) {
+ UserShareGoodsGroup shareGoodsGroup = new UserShareGoodsGroup(group.getId());
+ // 绱娴忚
+ Integer totalBrowse = group.getTotalBrowse();
+ if (totalBrowse == null) {
+ totalBrowse = 0;
+ }
+ shareGoodsGroup.setTotalBrowse(totalBrowse + 1);
+
+ // 浠婃棩娴忚
+ Date date = new Date();
+ Date browseTime = group.getBrowseTime();
+ if (DateUtil.isSameDay(browseTime, date)) {
+ shareGoodsGroup.setTodayBrowse(group.getTodayBrowse() + 1);
+ } else {
+ shareGoodsGroup.setTodayBrowse(1);
+ }
+ shareGoodsGroup.setBrowseTime(date);
+ userShareGoodsGroupMapper.updateByPrimaryKeySelective(shareGoodsGroup);
+ }
+ }
}
--
Gitblit v1.8.0