|
|
@@ -71,34 +71,31 @@ public class AppHelpGoodsServiceImpl implements AppHelpGoodsService {
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void exchangeProps(CmccPointRecord cmccPointRecord,CmccDectOrderRequest cmccDectOrderRequest,Long productId) {
|
|
|
- //加锁
|
|
|
- synchronized (cmccPointRecord.getUserId().toString().intern()){
|
|
|
- //获取道具商品
|
|
|
- HelpGoods helpGoods = helpGoodsService.getById(cmccPointRecord.getHelpGoodsId());
|
|
|
- Assert.notNull(helpGoods,"没有找到该道具");
|
|
|
-
|
|
|
- //判断道具是否上架
|
|
|
- Assert.isTrue(Integer.valueOf(1).equals(helpGoods.getStatus()),"该道具未上架");
|
|
|
-
|
|
|
- //获取用户信息
|
|
|
- LoginUser loginUser = loginUserService.getById(cmccPointRecord.getUserId());
|
|
|
- Assert.notNull(loginUser,"没有找到该用户");
|
|
|
-
|
|
|
- //用户兑换道具次数检测,并且添加兑换记录
|
|
|
- userExchangeCountCheck(cmccPointRecord, helpGoods, loginUser);
|
|
|
-
|
|
|
- //先助力
|
|
|
- ActiveHelpRecord activeHelpRecord = new ActiveHelpRecord();
|
|
|
- activeHelpRecord.setProductId(productId);
|
|
|
- activeHelpRecord.setUserId(loginUser.getId());
|
|
|
- activeHelpRecord.setHelpGoodsId(helpGoods.getId());
|
|
|
- activeHelpRecord.setIp(IPUtils.getRealIp(request));
|
|
|
- activeHelpRecord.setVoteCount(helpGoods.getVotePointRate().longValue());
|
|
|
- appActiveProductService.activeHelp(activeHelpRecord);
|
|
|
-
|
|
|
- //助力之后判断是否需要移动积分兑换(防止先兑换之后,助力不成功问题)
|
|
|
- cmccPointExchange(cmccPointRecord, cmccDectOrderRequest, helpGoods, loginUser);
|
|
|
- }
|
|
|
+ //获取道具商品
|
|
|
+ HelpGoods helpGoods = helpGoodsService.getById(cmccPointRecord.getHelpGoodsId());
|
|
|
+ Assert.notNull(helpGoods,"没有找到该道具");
|
|
|
+
|
|
|
+ //判断道具是否上架
|
|
|
+ Assert.isTrue(Integer.valueOf(1).equals(helpGoods.getStatus()),"该道具未上架");
|
|
|
+
|
|
|
+ //获取用户信息
|
|
|
+ LoginUser loginUser = loginUserService.getById(cmccPointRecord.getUserId());
|
|
|
+ Assert.notNull(loginUser,"没有找到该用户");
|
|
|
+
|
|
|
+ //用户兑换道具次数检测,并且添加兑换记录
|
|
|
+ userExchangeCountCheck(cmccPointRecord, helpGoods, loginUser);
|
|
|
+
|
|
|
+ //先助力
|
|
|
+ ActiveHelpRecord activeHelpRecord = new ActiveHelpRecord();
|
|
|
+ activeHelpRecord.setProductId(productId);
|
|
|
+ activeHelpRecord.setUserId(loginUser.getId());
|
|
|
+ activeHelpRecord.setHelpGoodsId(helpGoods.getId());
|
|
|
+ activeHelpRecord.setIp(IPUtils.getRealIp(request));
|
|
|
+ activeHelpRecord.setVoteCount(helpGoods.getVotePointRate().longValue());
|
|
|
+ appActiveProductService.activeHelp(activeHelpRecord);
|
|
|
+
|
|
|
+ //助力之后判断是否需要移动积分兑换(防止先兑换之后,助力不成功问题)
|
|
|
+ cmccPointExchange(cmccPointRecord, cmccDectOrderRequest, helpGoods, loginUser);
|
|
|
}
|
|
|
|
|
|
/**
|