|
|
/**
|
|
|
*
|
|
|
*/
|
|
|
package com.yoho.activity.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
...
|
...
|
@@ -45,7 +42,9 @@ import com.yoho.lottery.dal.PrizeMapper; |
|
|
import com.yoho.lottery.dal.model.Lottery;
|
|
|
import com.yoho.lottery.dal.model.LotteryRecord;
|
|
|
import com.yoho.lottery.dal.model.Prize;
|
|
|
import com.yoho.service.model.order.request.OrderDetailRequest;
|
|
|
import com.yoho.service.model.order.request.OrderListRequest;
|
|
|
import com.yoho.service.model.order.response.OrderInfoResponse;
|
|
|
import com.yoho.service.model.order.response.OrderQueryForLotteryResponse;
|
|
|
import com.yoho.service.model.order.response.Orders;
|
|
|
import com.yoho.service.model.order.response.OrdersGoods;
|
...
|
...
|
@@ -283,10 +282,12 @@ public class LotteryServiceImpl implements ILotteryService , ApplicationContextA |
|
|
}
|
|
|
if ("orderyohocoin".equals(prize.getPrizeType())) {
|
|
|
// 订单金额
|
|
|
BigDecimal orderMoney = BigDecimal.ONE;
|
|
|
BigDecimal orderMoney = getOrderMoney(userId, orderCode);
|
|
|
int yohobi = new BigDecimal(prize.getPrizeValue()).divide(new BigDecimal("100")).multiply(orderMoney)
|
|
|
.intValue();
|
|
|
sendCouponHelper.sendYOHOBi(userId, yohobi, orderCode);
|
|
|
.setScale(0, BigDecimal.ROUND_CEILING).intValue();
|
|
|
if (yohobi > 0) {
|
|
|
sendCouponHelper.sendYOHOBi(userId, yohobi, orderCode);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -352,6 +353,19 @@ public class LotteryServiceImpl implements ILotteryService , ApplicationContextA |
|
|
return orderVoList;
|
|
|
}
|
|
|
|
|
|
private BigDecimal getOrderMoney(Integer userId, String orderCode) {
|
|
|
try {
|
|
|
OrderDetailRequest req = new OrderDetailRequest();
|
|
|
req.setUid(userId.toString());
|
|
|
req.setOrderCode(orderCode);
|
|
|
OrderInfoResponse rsp = serviceCaller.call("order.orderDetail", req, OrderInfoResponse.class);
|
|
|
return new BigDecimal(rsp.getPayment_amount());
|
|
|
} catch (Exception e) {
|
|
|
logger.error("获取订单失败!uid={} orderCode={}!", userId, orderCode);
|
|
|
return BigDecimal.ZERO;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private List<LotteryOrderVO> setLotteryOrderStatus(List<LotteryOrderVO> orderVOList, List<LotteryRecord> recordList){
|
|
|
for(LotteryOrderVO orderVO : orderVOList){
|
|
|
//默认设定状态为参加抽奖,即从未抽过奖
|
...
|
...
|
|