From 26d8a34915d8c0cd19c3a2d21706b12377eb1e05 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期五, 11 十月 2019 17:20:39 +0800
Subject: [PATCH] 微信支付证书
---
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserGoodsStorageServiceImpl.java | 31 +++++++++++++++----------------
1 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserGoodsStorageServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserGoodsStorageServiceImpl.java
index f8cc44f..3528ca2 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserGoodsStorageServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserGoodsStorageServiceImpl.java
@@ -10,6 +10,7 @@
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.entity.FileUploadResult;
@@ -29,9 +30,10 @@
import com.yeshi.fanli.exception.user.UserGoodsStorageException;
import com.yeshi.fanli.service.inter.config.ConfigService;
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.UserGoodsStorageService;
import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService;
+import com.yeshi.fanli.util.CommonGoodsUtil;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.RedisManager;
@@ -160,15 +162,15 @@
jdGoods = JDApiUtil.getGoodsDetail(auctionId);
}
if (jdGoods == null) {
- throw new UserGoodsStorageException(1, "auctionId鍟嗗搧宸蹭笅鏋�");
+ throw new UserGoodsStorageException(1, auctionId + "鍟嗗搧宸蹭笅鏋�");
}
commonGoods = CommonGoodsFactory.create(jdGoods);
- } else if (goodsType == Constant.SOURCE_TYPE_JD) {
+ } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
// 鎷煎澶�
PDDGoodsDetail pddGoods = PinDuoDuoApiUtil.getGoodsDetail(auctionId);
if (pddGoods == null) {
- throw new UserGoodsStorageException(1, "auctionId鍟嗗搧宸蹭笅鏋�");
+ throw new UserGoodsStorageException(1, auctionId + "鍟嗗搧宸蹭笅鏋�");
}
commonGoods = CommonGoodsFactory.create(pddGoods);
} else {
@@ -178,7 +180,7 @@
TaoBaoGoodsBrief goodsBrief = redisManager.getTaoBaoGoodsBrief(auctionId);
commonGoods = CommonGoodsFactory.create(goodsBrief);
} catch (TaobaoGoodsDownException e) {
- throw new UserGoodsStorageException(1, "auctionId鍟嗗搧宸蹭笅鏋�");
+ throw new UserGoodsStorageException(1, auctionId + "鍟嗗搧宸蹭笅鏋�");
}
}
@@ -215,6 +217,7 @@
@Override
+ @Transactional
public void addCommonGoods(Long uid, Set<Long> ids) throws UserGoodsStorageException {
if (uid == null) {
@@ -348,7 +351,7 @@
}
return state;
}
-
+
@Override
public JSONObject shareGoods(Long uid, List<Long> listStorageID)
throws UserGoodsStorageException, UserShareGoodsRecordException {
@@ -403,7 +406,6 @@
throw new UserGoodsStorageException(1, "閫夊搧搴撳晢鍝佷笉瀛樺湪");
}
-
List<UserGoodsStorage> listResult = new ArrayList<UserGoodsStorage>();
// 杩樺師椤哄簭 鐢ㄤ簬鍒跺浘
for (Long sid: listStorageID) {
@@ -417,30 +419,27 @@
}
BigDecimal totalMoney = new BigDecimal(0.00);
- List<TaoBaoGoodsBrief> listGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
+ List<CommonGoods> listCommonGoods = new ArrayList<CommonGoods>();
Integer goodsType = null;
BigDecimal rate = hongBaoManageService.getShareRate();
for (UserGoodsStorage userGoodsStorage: listResult) {
CommonGoods commonGoods = userGoodsStorage.getCommonGoods();
+ BigDecimal money = CommonGoodsUtil.getCommission(commonGoods, rate);
+ totalMoney = MoneyBigDecimalUtil.add(totalMoney, money);
+ listCommonGoods.add(commonGoods);
if (goodsType == null) {
goodsType = commonGoods.getGoodsType();
}
-
- TaoBaoGoodsBrief goodsBrief = TaoBaoUtil.convert(commonGoods);
- listGoodsBrief.add(goodsBrief);
-
- BigDecimal money = TaoBaoUtil.getGoodsHongBaoMoney(goodsBrief, rate);
- totalMoney = MoneyBigDecimalUtil.add(totalMoney, money);
}
- ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsStorageV2(uid, listGoodsBrief, listStorageID);
+ ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsStorageV2(uid, listCommonGoods, listStorageID);
FileUploadResult uploadResult = new FileUploadResult();
uploadResult.setUrl(shareRecord.getSharePictureUrl());
JSONObject data = new JSONObject();
- data.put("revenue", listGoodsBrief.size() + "涓晢鍝侀浼板垎浜閲戯細楼"+totalMoney);
+ data.put("revenue", listCommonGoods.size() + "涓晢鍝侀浼板垎浜閲戯細楼"+totalMoney);
data.put("shareId", shareRecord.getRedisKey());
data.put("shareImg", uploadResult);
--
Gitblit v1.8.0