|
|
|
@ -11,6 +11,7 @@ import com.hfkj.common.utils.DateUtil; |
|
|
|
|
import com.hfkj.entity.*; |
|
|
|
|
import com.hfkj.model.CornucopiaLotteryRecordModel; |
|
|
|
|
import com.hfkj.service.partner.*; |
|
|
|
|
import com.hfkj.service.sec.SecDictionaryService; |
|
|
|
|
import com.hfkj.service.user.BsUserAccountService; |
|
|
|
|
import com.hfkj.service.user.BsUserService; |
|
|
|
|
import com.hfkj.sysenum.cornucopia.CornucopiaEnum; |
|
|
|
@ -45,7 +46,8 @@ public class PartnerServiceImpl implements PartnerService { |
|
|
|
|
private BsUserAccountService userAccountService; |
|
|
|
|
@Resource |
|
|
|
|
private BsUserService bsUserService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private SecDictionaryService secDictionaryService; |
|
|
|
|
@Resource |
|
|
|
|
private RedisTemplate<String,Object> redisTemplate; |
|
|
|
|
private final String LOCK_KEY = "PARTNER_LOCK_"; |
|
|
|
@ -413,6 +415,17 @@ public class PartnerServiceImpl implements PartnerService { |
|
|
|
|
// 查询分红等级
|
|
|
|
|
List<BsPartnerLevel> partnerLevels = bsPartnerLevelService.queryAllList(new HashMap<>()); |
|
|
|
|
String lotteryNo = DateUtil.date2String(new Date() , DateUtil.YMD); |
|
|
|
|
// 查询总奖池
|
|
|
|
|
// 查询当期用户内容
|
|
|
|
|
Map<String , Object> mapPool = new HashMap<>(); |
|
|
|
|
mapPool.put("status" , 1); |
|
|
|
|
mapPool.put("lotteryNo" , lotteryNo); |
|
|
|
|
List<BsPartnerPoolPre> list = bsPartnerPoolPreService.queryAllList(mapPool); |
|
|
|
|
BigDecimal toDayPartner = list.stream().map(BsPartnerPoolPre::getGoldCoin).reduce(BigDecimal.ZERO, BigDecimal::add); |
|
|
|
|
// 查询分红汇率
|
|
|
|
|
// 查询数据
|
|
|
|
|
SecDictionary dictionary = secDictionaryService.getDictionary("PARTNER_DIVIDENDS_RATE").get(0); |
|
|
|
|
toDayPartner = toDayPartner.multiply(new BigDecimal(dictionary.getCodeValue())); |
|
|
|
|
for (BsPartnerPool pool : partnerPools) { |
|
|
|
|
// 判断合伙人是否有金币且用户ID不为空
|
|
|
|
|
if (pool.getGoldCoin().compareTo(new BigDecimal(0)) > 0 && pool.getUserId() != null) { |
|
|
|
@ -420,7 +433,7 @@ public class PartnerServiceImpl implements PartnerService { |
|
|
|
|
BsPartnerLevel level = partnerLevels.stream().filter(s-> s.getLevel().equals(pool.getLevel())).findFirst().get(); |
|
|
|
|
|
|
|
|
|
// 根据彩票编号和用户ID查询合伙人用户记录
|
|
|
|
|
BsPartnerUserRecord partnerUserRecord = bsPartnerUserRecordService.queryDetail(lotteryNo , pool.getUserId()); |
|
|
|
|
BsPartnerUserRecord partnerUserRecord = bsPartnerUserRecordService.queryDetail(lotteryNo , pool.getUserId() , 1); |
|
|
|
|
// 根据用户ID查询用户信息
|
|
|
|
|
BsUser user = bsUserService.getUser(pool.getUserId()); |
|
|
|
|
|
|
|
|
@ -434,7 +447,7 @@ public class PartnerServiceImpl implements PartnerService { |
|
|
|
|
partnerUserRecord.setUserId(pool.getUserId()); |
|
|
|
|
partnerUserRecord.setUserName(user.getName()); |
|
|
|
|
// 计算分红金额
|
|
|
|
|
partnerUserRecord.setGoldCoin(pool.getGoldCoin().multiply(level.getDividendsPer())); |
|
|
|
|
partnerUserRecord.setGoldCoin(toDayPartner.multiply(level.getDividendsPer())); |
|
|
|
|
partnerUserRecord.setProportion(level.getDividendsPer()); |
|
|
|
|
partnerUserRecord.setType(1); |
|
|
|
|
partnerUserRecord.setStatus(1); |
|
|
|
|