| | |
| | | //package cc.mrbird.febs; |
| | | // |
| | | //import cc.mrbird.febs.common.configure.i18n.MessageSourceUtils; |
| | | //import cc.mrbird.febs.common.contants.AppContants; |
| | | //import cc.mrbird.febs.common.exception.FebsException; |
| | | //import cc.mrbird.febs.common.utils.RedisUtils; |
| | | //import cc.mrbird.febs.dapp.entity.*; |
| | | //import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum; |
| | | //import cc.mrbird.febs.dapp.enumerate.MemberOnHookPlanEnum; |
| | | //import cc.mrbird.febs.dapp.mapper.*; |
| | | //import cc.mrbird.febs.dapp.service.DappWalletService; |
| | | //import cc.mrbird.febs.dapp.service.MemberOnHookPlan; |
| | | //import cc.mrbird.febs.job.MineProfitJob; |
| | | //import cn.hutool.core.codec.Base64; |
| | | //import cn.hutool.core.collection.CollUtil; |
| | | //import cn.hutool.core.date.DateTime; |
| | | //import cn.hutool.core.date.DateUnit; |
| | | //import cn.hutool.core.date.DateUtil; |
| | | //import cn.hutool.core.util.CharsetUtil; |
| | | //import cn.hutool.core.util.ObjectUtil; |
| | | //import cn.hutool.core.util.RandomUtil; |
| | | //import cn.hutool.core.util.StrUtil; |
| | | //import cn.hutool.crypto.SecureUtil; |
| | | //import cn.hutool.crypto.asymmetric.KeyType; |
| | | //import cn.hutool.crypto.asymmetric.RSA; |
| | | //import cn.hutool.json.JSONObject; |
| | | //import cn.hutool.json.JSONUtil; |
| | | //import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | //import org.jline.utils.Log; |
| | | //import org.junit.jupiter.api.Test; |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.beans.factory.annotation.Value; |
| | | //import org.springframework.boot.test.context.SpringBootTest; |
| | | // |
| | | //import java.math.BigDecimal; |
| | | //import java.security.KeyPair; |
| | | //import java.text.DecimalFormat; |
| | | //import java.text.Format; |
| | | //import java.text.SimpleDateFormat; |
| | | //import java.util.*; |
| | | // |
| | | ///** |
| | | // * @author |
| | | // * @date 2022-03-28 |
| | | // **/ |
| | | //@SpringBootTest |
| | | //public class JunitTest { |
| | | // |
| | | //// @Autowired |
| | | //// private MineProfitJob mineProfitJob; |
| | | //// @Autowired |
| | | //// private DappMemberDao dappMemberDao; |
| | | //// |
| | | //// @Test |
| | | //// public void incomeTest() { |
| | | //// mineProfitJob.start(); |
| | | //// } |
| | | //// |
| | | //// @Test |
| | | //// public void userTest() { |
| | | //// DappMemberEntity member = dappMemberDao.selectById(6L); |
| | | //// mineProfitJob.calAgentMoney(member, BigDecimal.TEN); |
| | | //// } |
| | | //// |
| | | //// public static void main(String[] args) { |
| | | //// DateTime tomorrow = DateUtil.beginOfDay(DateUtil.tomorrow()); |
| | | //// System.out.println(DateUtil.between(new Date(), tomorrow, DateUnit.SECOND, true)); |
| | | //// } |
| | | //// |
| | | //// public String PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC1cHrcMpXoKNC8rjAa/jAbgU2bhIBmJmn6iYDfqt0Him/p2s5F0L9nfzZOLYlPq3z12zvXl9IgThhtLIBLi86RPW0ljuwpTvIZz9O36Zae9eMk5bMNsFEFsxg1IOLIM2Oc4ffNvGL58Uupp9RL5NCN1MRQyY61ISy7H2VRTznoJQIDAQAB"; |
| | | //// public String PRIVATE_KEY = "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBALVwetwylego0LyuMBr+MBuBTZuEgGYmafqJgN+q3QeKb+nazkXQv2d/Nk4tiU+rfPXbO9eX0iBOGG0sgEuLzpE9bSWO7ClO8hnP07fplp714yTlsw2wUQWzGDUg4sgzY5zh9828YvnxS6mn1Evk0I3UxFDJjrUhLLsfZVFPOeglAgMBAAECgYAPKWWS5gVB37tFsRajAs+5VK5MCyABqT8c6QWkay5KNYbRl2+6RM3h068RjFuXlUB9eQMAqpasDWqcIOZdqcKqmxm0ILF2zfPzJr4RaQNSNwDCVrKEeaDtrZQcq/0ygaNDF9y203UMHT0dfEQSGp/xkjTgXNsOuC9iLM56XScOVwJBAPOZLbrCi0h4PL7g3rWsCw8/aN6ehkJ3iTDgjYpdBwJOJSyxV0qi0xmDthGqPd99Kvc14u1jy3ghpm1SAEunrj8CQQC+rS6qajIkK7NiRmX43chDhgMPGo0UFHbmHyYBb1Eyrxu1MNWQEh221p54GsB2HqAGRhxxQ98Ds2S26Au7QpibAkA2nQAAn/8kFzjfPoEPz+uG1puHVZkaK7yJRb7V53dbz/NLqtK8O/cCAGKAYV+PzHsmg2FGAZqrazfpyHmifIx3AkBnFau/+A/JnFKr09F3XTfSwZXPyZPyAipRuQ9MAUmNtDuvloovDIxB9//OgPACLAZpvefMmFvuXUMa25LUF2n3AkBGb+vO+69NSyQM2SHKZ9fUrxx9ZPhupNt/TXNL9OMEQiLaHCYgg0tfcojGe3QjBCA6wVG+dCyZUcv5OwiW23pI"; |
| | | //// |
| | | //// @Test |
| | | //// public void encodeTest() { |
| | | //// RSA rsa = new RSA(AppContants.REQ_PRIVATE_KEY, AppContants.REQ_PUBLIC_KEY); |
| | | //// Map<String, Object> map = new HashMap<>(); |
| | | //// map.put("test", 123); |
| | | //// String s = JSONObject.toJSONString(map); |
| | | //// String s1 = rsa.encryptBase64(s, KeyType.PublicKey); |
| | | //// System.out.println(s1); |
| | | //// } |
| | | //// |
| | | //// @Test |
| | | //// public void decodeTest() { |
| | | //// String ss = "pAEYpX4a+gm9lqy2/bQNx/EjJS0D7I/ezcCB+G/pgI5GDLWUj7+S7jhGWlV2PTGHcNj8vJQRXp5qpV7GOmaQX30HVao3srsOEL2CWU5F/5A4T9ncs3NuoYEv5LUCTolEEq8r5VdBRzU9BoZCISLFQxjFIp5inuydjz2JE9lnOBYQIP8kZSXHy2N1gkythypbj81q9cC83wNND7pvSjw140EDtXWqlCIhpoZlwB/n8+D5khBHwxWhuf0wacYLj9aKZ8tSKMyw0/WdQvpBZ6ymxuoHrLlcL36PTEN59rce9tnnRs5+AjAXppx4GIODdvbHLQJurBslw2GVHJeDbugRvA=="; |
| | | //// RSA rsa = new RSA(AppContants.RESP_PRIVATE_KEY, AppContants.RESP_PUBLIC_KEY); |
| | | //// String s = rsa.decryptStr(ss, KeyType.PrivateKey); |
| | | //// System.out.println(s); |
| | | //// } |
| | | //// |
| | | //// @Autowired |
| | | //// private DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | //// @Autowired |
| | | //// private RedisUtils redisUtils; |
| | | //// @Autowired |
| | | //// private DappOnHookAwardDao dappOnHookAwardDao; |
| | | //// @Test |
| | | //// public void getmember(){//获取下一个开奖 |
| | | //// String redisKey = "on_hook_award_id"; |
| | | //// String onHookAwardRedisId = redisUtils.getString(redisKey); |
| | | //// DappOnHookAward dappOnHookAward = dappOnHookAwardDao.selectById(Long.parseLong(onHookAwardRedisId)); |
| | | //// if(ObjectUtil.isEmpty(dappOnHookAward)){ |
| | | //// throw new FebsException(MessageSourceUtils.getString("login_err_003")); |
| | | //// } |
| | | //// Date awardTime = dappOnHookAward.getAwardTime(); |
| | | //// System.out.println(awardTime); |
| | | //// DateTime dateTime = DateUtil.offsetMinute(awardTime, 5); |
| | | //// for(int i =1; i < 100;i++){ |
| | | //// String yyyyMMddHHMM = DateUtil.format(dateTime, "yyyy-MM-dd HH:mm"); |
| | | ////// DappOnHookAward dappOnHookAwardNext = dappOnHookAwardDao.selectByByAwardTime(yyyyMMddHHMM); |
| | | //// System.out.println(yyyyMMddHHMM); |
| | | //// dateTime = DateUtil.offsetMinute(dateTime, 5); |
| | | //// } |
| | | //// } |
| | | //// |
| | | //// @Autowired |
| | | //// private DappMemberDao dappMemberDao; |
| | | //// @Test |
| | | //// public void getplan(){ |
| | | //// DappMemberEntity dappMember = dappMemberDao.selectById(33); |
| | | //// List<DataDictionaryCustom> dataDictionaryCustoms = dataDictionaryCustomMapper.selectDicByType(DataDictionaryEnum.PLAN_A.getType()); |
| | | //// LinkedList<Map<String,String>> strings = new LinkedList<>(); |
| | | //// for(DataDictionaryCustom dataDictionaryCustom : dataDictionaryCustoms){ |
| | | //// Map<String, String> stringStringHashMap = new HashMap<>(); |
| | | //// stringStringHashMap.put(dataDictionaryCustom.getDescription(),dataDictionaryCustom.getValue()); |
| | | //// strings.add(stringStringHashMap); |
| | | //// } |
| | | //// //收益率 |
| | | //// BigDecimal hangingRevenue = BigDecimal.ZERO; |
| | | //// //挂机时长 |
| | | //// DataDictionaryCustom maxHours = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.MAX_HOURS.getType(), DataDictionaryEnum.MAX_HOURS.getCode()); |
| | | //// if(ObjectUtil.isEmpty(maxHours)){ |
| | | //// throw new FebsException(MessageSourceUtils.getString("login_err_003")); |
| | | //// } |
| | | //// |
| | | //// Double maxHoursValue = Double.parseDouble(maxHours.getValue()); |
| | | //// //获取用户信息的是否盈利字段 |
| | | //// Integer isProfit = dappMember.getIsProfit() == null ? 1 : dappMember.getIsProfit(); |
| | | //// String identity = null; |
| | | //// if(isProfit == 2){ |
| | | //// identity = "IS_PROFIT_NO"; |
| | | //// }else{ |
| | | //// identity = "LEVEL_MB"; |
| | | //// DataDictionaryCustom levelMember = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.LEVEL_MB.getType(), dappMember.getIdentity()); |
| | | //// if(ObjectUtil.isEmpty(levelMember)){ |
| | | //// throw new FebsException(MessageSourceUtils.getString("login_err_003")); |
| | | //// } |
| | | //// String levelMemberValue = levelMember.getValue(); |
| | | //// JSONObject levelMemberValueParse = JSONUtil.parseObj(levelMemberValue); |
| | | //// hangingRevenue = new BigDecimal(levelMemberValueParse.get("hangingRevenue").toString()) |
| | | //// .multiply(new BigDecimal(0.01)).setScale(4,BigDecimal.ROUND_DOWN); |
| | | //// } |
| | | //// //获取挂机字表的顺序 |
| | | //// LinkedList<String> isProfitPlan = new LinkedList<>(); |
| | | //// Map<String, LinkedList<String>> identity_level = MemberOnHookPlanEnum.valueOf(identity) |
| | | //// .getMemberOnHook(maxHoursValue,hangingRevenue,strings); |
| | | //// isProfitPlan = identity_level.get(identity); |
| | | //// System.out.println(isProfitPlan); |
| | | //// |
| | | //// } |
| | | //// |
| | | //// |
| | | //// @Autowired |
| | | //// private DappWalletCoinDao dappWalletCoinDao; |
| | | //// |
| | | //// |
| | | //// @Autowired |
| | | //// private DappWalletCoinDao dappWalletCoinDao; |
| | | //// |
| | | //// @Test |
| | | //// public void updateMemberLevel(){ |
| | | //// Log.info("更新用户代理等级"); |
| | | //// DateTime date = DateUtil.date(); |
| | | //// //查询账户总金额大于51的有效用户 |
| | | //// List<DappMemberEntity> dappMemberEntities = dappWalletCoinDao.selectTotalAmount(); |
| | | //// if(CollUtil.isEmpty(dappMemberEntities)){ |
| | | //// //没有账户金额大于51,则全部为会员 |
| | | //// dappMemberDao.updateIdentity(); |
| | | //// }else{ |
| | | //// List<DappMemberEntity> LEVEL_IB = getMemberLevelList(dappMemberEntities, DataDictionaryEnum.LEVEL_MB.getCode(), DataDictionaryEnum.LEVEL_IB.getCode()); |
| | | //// List<DappMemberEntity> LEVEL_FIB = getMemberLevelList(LEVEL_IB, DataDictionaryEnum.LEVEL_IB.getCode(), DataDictionaryEnum.LEVEL_FIB.getCode()); |
| | | //// List<DappMemberEntity> LEVEL_CIB = getMemberLevelList(LEVEL_FIB, DataDictionaryEnum.LEVEL_FIB.getCode(), DataDictionaryEnum.LEVEL_CIB.getCode()); |
| | | //// List<DappMemberEntity> LEVEL_AIB = getMemberLevelList(LEVEL_CIB, DataDictionaryEnum.LEVEL_CIB.getCode(), DataDictionaryEnum.LEVEL_AIB.getCode()); |
| | | //// List<DappMemberEntity> LEVEL_GIB = getMemberLevelList(LEVEL_AIB, DataDictionaryEnum.LEVEL_AIB.getCode(), DataDictionaryEnum.LEVEL_GIB.getCode()); |
| | | //// List<DappMemberEntity> LEVEL_BP = getMemberLevelList(LEVEL_GIB, DataDictionaryEnum.LEVEL_GIB.getCode(), DataDictionaryEnum.LEVEL_BP.getCode()); |
| | | //// List<DappMemberEntity> LEVEL_SP = getMemberLevelList(LEVEL_BP, DataDictionaryEnum.LEVEL_BP.getCode(), DataDictionaryEnum.LEVEL_SP.getCode()); |
| | | //// List<DappMemberEntity> LEVEL_GP = getMemberLevelList(LEVEL_SP, DataDictionaryEnum.LEVEL_SP.getCode(), DataDictionaryEnum.LEVEL_GP.getCode()); |
| | | //// } |
| | | //// } |
| | | //// |
| | | //// private List<DappMemberEntity> getMemberLevelList(List<DappMemberEntity> dappMemberEntities,String identity,String identityNext){ |
| | | //// List<DappMemberEntity> dappMemberEntitiesNext = new ArrayList<>(); |
| | | //// if(CollUtil.isNotEmpty(dappMemberEntities)){ |
| | | //// for(DappMemberEntity dappMemberEntity : dappMemberEntities){ |
| | | //// Long memberEntityId = dappMemberEntity.getId(); |
| | | //// String refererId = dappMemberEntity.getRefererId(); |
| | | //// String inviteId = dappMemberEntity.getInviteId(); |
| | | //// //下级是否存在三个账户总金额大于51的会员,并且代理等级为identity |
| | | //// List<DappMemberEntity> levelMbMembers = dappMemberDao.selectTotalAmountByRefererIdAndIdentity(inviteId,identity); |
| | | //// if(CollUtil.isNotEmpty(levelMbMembers) && 3 <= levelMbMembers.size()){ |
| | | //// //设置identityNext级别 |
| | | //// dappMemberDao.updateIdentityByMemberId(identityNext,memberEntityId); |
| | | //// //获取他的上级会员信息 |
| | | //// DappMemberEntity dappMemberEntityNext = dappMemberDao.selectMemberInfoByInviteId(refererId); |
| | | //// dappMemberEntitiesNext.add(dappMemberEntityNext); |
| | | //// } |
| | | //// } |
| | | //// } |
| | | //// return dappMemberEntitiesNext; |
| | | //// } |
| | | // |
| | | // |
| | | // |
| | | // |
| | | package cc.mrbird.febs; |
| | | |
| | | import cc.mrbird.febs.common.configure.i18n.MessageSourceUtils; |
| | | import cc.mrbird.febs.common.contants.AppContants; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.utils.LoginUserUtil; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.common.utils.ShareCodeUtil; |
| | | import cc.mrbird.febs.dapp.entity.*; |
| | | import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum; |
| | | import cc.mrbird.febs.dapp.enumerate.MemberLevelEnum; |
| | | import cc.mrbird.febs.dapp.enumerate.MemberOnHookPlanEnum; |
| | | import cc.mrbird.febs.dapp.mapper.*; |
| | | import cc.mrbird.febs.dapp.service.ApiIgtOnHookPlanService; |
| | | import cc.mrbird.febs.dapp.service.DappWalletService; |
| | | import cc.mrbird.febs.dapp.service.MemberOnHookPlan; |
| | | import cc.mrbird.febs.job.MineProfitJob; |
| | | import cn.hutool.core.codec.Base64; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.CharsetUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import cn.hutool.crypto.asymmetric.KeyType; |
| | | import cn.hutool.crypto.asymmetric.RSA; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import org.jline.utils.Log; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.security.KeyPair; |
| | | import java.text.DecimalFormat; |
| | | import java.text.Format; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author |
| | | * @date 2022-03-28 |
| | | **/ |
| | | @SpringBootTest |
| | | public class JunitTest { |
| | | |
| | | // @Autowired |
| | | // private IgtOnHookPlanOrderItemDao igtOnHookPlanOrderItemDao; |
| | | // private MineProfitJob mineProfitJob; |
| | | @Autowired |
| | | private DappMemberDao dappMemberDao; |
| | | |
| | | @Test |
| | | public void referenceId(){ |
| | | DappMemberEntity dappMemberEntity = dappMemberDao.selectById(1129L); |
| | | String refererIds = dappMemberEntity.getRefererIds(); |
| | | List<String> refererIdList = StrUtil.split(refererIds, ",", -1, true, true); |
| | | |
| | | //根据上下级,筛选用户的级别 |
| | | ArrayList<String> refererIdLisstUp = new ArrayList<>(); |
| | | String levelNext = MemberLevelEnum.LEVEL_MB.getType(); |
| | | for(String inviteId : refererIdList){ |
| | | DappMemberEntity dappMemberUp = dappMemberDao.selectMemberInfoByInviteId(inviteId); |
| | | String identityUp = dappMemberUp.getIdentity(); |
| | | int compareLevelResult = MemberLevelEnum.LEVEL_MB.compareLevel(identityUp, levelNext); |
| | | if(0 < compareLevelResult){ |
| | | levelNext = identityUp; |
| | | refererIdLisstUp.add(inviteId); |
| | | } |
| | | } |
| | | System.out.println(refererIdLisstUp); |
| | | } |
| | | |
| | | // @Test |
| | | // public void incomeTest() { |
| | | // mineProfitJob.start(); |
| | | // } |
| | | // |
| | | // @Test |
| | | // public void userTest() { |
| | | // DappMemberEntity member = dappMemberDao.selectById(6L); |
| | | // mineProfitJob.calAgentMoney(member, BigDecimal.TEN); |
| | | // } |
| | | // |
| | | // public static void main(String[] args) { |
| | | // DateTime tomorrow = DateUtil.beginOfDay(DateUtil.tomorrow()); |
| | | // System.out.println(DateUtil.between(new Date(), tomorrow, DateUnit.SECOND, true)); |
| | | // } |
| | | // |
| | | // public String PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC1cHrcMpXoKNC8rjAa/jAbgU2bhIBmJmn6iYDfqt0Him/p2s5F0L9nfzZOLYlPq3z12zvXl9IgThhtLIBLi86RPW0ljuwpTvIZz9O36Zae9eMk5bMNsFEFsxg1IOLIM2Oc4ffNvGL58Uupp9RL5NCN1MRQyY61ISy7H2VRTznoJQIDAQAB"; |
| | | // public String PRIVATE_KEY = "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBALVwetwylego0LyuMBr+MBuBTZuEgGYmafqJgN+q3QeKb+nazkXQv2d/Nk4tiU+rfPXbO9eX0iBOGG0sgEuLzpE9bSWO7ClO8hnP07fplp714yTlsw2wUQWzGDUg4sgzY5zh9828YvnxS6mn1Evk0I3UxFDJjrUhLLsfZVFPOeglAgMBAAECgYAPKWWS5gVB37tFsRajAs+5VK5MCyABqT8c6QWkay5KNYbRl2+6RM3h068RjFuXlUB9eQMAqpasDWqcIOZdqcKqmxm0ILF2zfPzJr4RaQNSNwDCVrKEeaDtrZQcq/0ygaNDF9y203UMHT0dfEQSGp/xkjTgXNsOuC9iLM56XScOVwJBAPOZLbrCi0h4PL7g3rWsCw8/aN6ehkJ3iTDgjYpdBwJOJSyxV0qi0xmDthGqPd99Kvc14u1jy3ghpm1SAEunrj8CQQC+rS6qajIkK7NiRmX43chDhgMPGo0UFHbmHyYBb1Eyrxu1MNWQEh221p54GsB2HqAGRhxxQ98Ds2S26Au7QpibAkA2nQAAn/8kFzjfPoEPz+uG1puHVZkaK7yJRb7V53dbz/NLqtK8O/cCAGKAYV+PzHsmg2FGAZqrazfpyHmifIx3AkBnFau/+A/JnFKr09F3XTfSwZXPyZPyAipRuQ9MAUmNtDuvloovDIxB9//OgPACLAZpvefMmFvuXUMa25LUF2n3AkBGb+vO+69NSyQM2SHKZ9fUrxx9ZPhupNt/TXNL9OMEQiLaHCYgg0tfcojGe3QjBCA6wVG+dCyZUcv5OwiW23pI"; |
| | | // |
| | | // @Test |
| | | // public void encodeTest() { |
| | | // RSA rsa = new RSA(AppContants.REQ_PRIVATE_KEY, AppContants.REQ_PUBLIC_KEY); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("test", 123); |
| | | // String s = JSONObject.toJSONString(map); |
| | | // String s1 = rsa.encryptBase64(s, KeyType.PublicKey); |
| | | // System.out.println(s1); |
| | | // } |
| | | // |
| | | // @Test |
| | | // public void decodeTest() { |
| | | // String ss = "pAEYpX4a+gm9lqy2/bQNx/EjJS0D7I/ezcCB+G/pgI5GDLWUj7+S7jhGWlV2PTGHcNj8vJQRXp5qpV7GOmaQX30HVao3srsOEL2CWU5F/5A4T9ncs3NuoYEv5LUCTolEEq8r5VdBRzU9BoZCISLFQxjFIp5inuydjz2JE9lnOBYQIP8kZSXHy2N1gkythypbj81q9cC83wNND7pvSjw140EDtXWqlCIhpoZlwB/n8+D5khBHwxWhuf0wacYLj9aKZ8tSKMyw0/WdQvpBZ6ymxuoHrLlcL36PTEN59rce9tnnRs5+AjAXppx4GIODdvbHLQJurBslw2GVHJeDbugRvA=="; |
| | | // RSA rsa = new RSA(AppContants.RESP_PRIVATE_KEY, AppContants.RESP_PUBLIC_KEY); |
| | | // String s = rsa.decryptStr(ss, KeyType.PrivateKey); |
| | | // System.out.println(s); |
| | | // } |
| | | |
| | | // @Autowired |
| | | // private IgtOnHookPlanOrderDao igtOnHookPlanOrderDao; |
| | | // private DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | // @Autowired |
| | | // private RedisUtils redisUtils; |
| | | // @Autowired |
| | | // private DappOnHookAwardDao dappOnHookAwardDao; |
| | | @Autowired |
| | | private DappOnHookDoneDao dappOnHookDoneDao; |
| | | // @Autowired |
| | | // private DappWalletService dappWalletService; |
| | | // @Autowired |
| | | // private DappAccountMoneyChangeDao dappAccountMoneyChangeDao; |
| | | // @Test |
| | | // public void getmember(){ |
| | | // IgtOnHookPlanOrder igtOnHookPlanOrder = igtOnHookPlanOrderDao.selectById(826L); |
| | | // |
| | | // Long memberId = igtOnHookPlanOrder.getMemberId(); |
| | | // //判断系统是否已经结算过了 |
| | | // QueryWrapper<DappOnHookDone> objectQueryWrapper = new QueryWrapper<>(); |
| | | // objectQueryWrapper.eq("order_id",826L); |
| | | // List<DappOnHookDone> dappOnHookDones = dappOnHookDoneDao.selectList(objectQueryWrapper); |
| | | // if(CollUtil.isNotEmpty(dappOnHookDones)){ |
| | | // new FebsResponse().fail().message(MessageSourceUtils.getString("Operation_003")); |
| | | // } |
| | | // //更新主表为结束状态 |
| | | // igtOnHookPlanOrder.setState(2); |
| | | // igtOnHookPlanOrderDao.updateById(igtOnHookPlanOrder); |
| | | // |
| | | //// BigDecimal totalProfit = igtOnHookPlanOrder.getProfit(); |
| | | // BigDecimal planAmount = igtOnHookPlanOrder.getPlanAmount(); |
| | | //// BigDecimal avaAmount = igtOnHookPlanOrder.getAvaAmount(); |
| | | // //更新用户表是否正在挂机状态字段为否 |
| | | // DappMemberEntity dappMember = dappMemberDao.selectById(memberId); |
| | | // dappMember.setIsOnHook(3); |
| | | // dappMemberDao.updateById(dappMember); |
| | | // |
| | | // //获取当前用户每分钟应该获取的收益 |
| | | // String identity = dappMember.getIdentity(); |
| | | // //当前用户的挂机收益率 |
| | | // BigDecimal hangingRevenue = getHangingRevenue(identity); |
| | | // BigDecimal multiply = hangingRevenue.multiply(planAmount); |
| | | // DataDictionaryCustom maxHoursDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.MAX_HOURS.getType(), DataDictionaryEnum.MAX_HOURS.getCode()); |
| | | // //挂机总时长(分钟) |
| | | // BigDecimal maxHours = new BigDecimal(maxHoursDic.getValue()).multiply(new BigDecimal(60)); |
| | | // //得到每分钟的收益 |
| | | // BigDecimal minuteProfit = multiply.divide(maxHours, 4, BigDecimal.ROUND_DOWN); |
| | | // //获取挂机开始时间到现在的总时长(分钟数) |
| | | // Date startTime = igtOnHookPlanOrder.getStartTime(); |
| | | // long between = DateUtil.between(startTime, DateUtil.date(), DateUnit.MINUTE); |
| | | // //获得总收益 |
| | | // BigDecimal totalProfit = minuteProfit.multiply(new BigDecimal(between)); |
| | | // |
| | | // String refererIds = dappMember.getRefererIds(); |
| | | // List<String> refererIdList = StrUtil.split(refererIds, ",", -1, true, true); |
| | | // //生成流水佣金和盈利分成和流水记录,返回盈利分成和流水佣金总共分成 |
| | | // BigDecimal profitSharingTotal = dappWalletService.updateLSYJYLFC(refererIdList, totalProfit,igtOnHookPlanOrder.getId()); |
| | | // //平台分成 |
| | | // //平台拿走35%盈利分成和流水佣金剩下的全部 |
| | | // BigDecimal systemAdd = totalProfit.multiply(new BigDecimal(0.4)).subtract(profitSharingTotal); |
| | | // BigDecimal systemTotal = dappWalletService.updatePTFC(memberId,systemAdd,igtOnHookPlanOrder.getId()); |
| | | // //个人固定拿走60% |
| | | // totalProfit = totalProfit.multiply(new BigDecimal(0.6)); |
| | | // igtOnHookPlanOrder.setProfit(totalProfit); |
| | | // igtOnHookPlanOrderDao.updateById(igtOnHookPlanOrder); |
| | | // |
| | | // BigDecimal totalMoney = planAmount.add(totalProfit); |
| | | // DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(memberId); |
| | | // dappWalletCoinDao.addTotalAndaddAvailableById(dappWalletCoinEntity.getId(),totalMoney); |
| | | // |
| | | // BigDecimal add = dappWalletCoinEntity.getAvailableAmount().add(totalMoney); |
| | | // BigDecimal subtract = add.subtract(totalProfit); |
| | | // DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(memberId, subtract, totalProfit, add, "投注盈利", 5,igtOnHookPlanOrder.getId()); |
| | | // dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | // |
| | | // DappOnHookDone dappOnHookDone = new DappOnHookDone(memberId, igtOnHookPlanOrder.getId()); |
| | | // dappOnHookDoneDao.insert(dappOnHookDone); |
| | | // } |
| | | |
| | | |
| | | // private BigDecimal getHangingRevenue(String identity){ |
| | | // DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.LEVEL_MB.getType(), identity); |
| | | // String dataDictionaryCustomValue = dataDictionaryCustom.getValue(); |
| | | // cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(dataDictionaryCustomValue); |
| | | // String runningCommission = jsonObject.get("hangingRevenue").toString(); |
| | | // return new BigDecimal(runningCommission).multiply(new BigDecimal(0.01)); |
| | | // } |
| | | |
| | | // @Autowired |
| | | // private DappMemberDao dappMemberDao; |
| | | // @Test |
| | | // public void getplan(){ |
| | | // DappMemberEntity dappMember = dappMemberDao.selectById(33); |
| | | // List<DataDictionaryCustom> dataDictionaryCustoms = dataDictionaryCustomMapper.selectDicByType(DataDictionaryEnum.PLAN_A.getType()); |
| | | // LinkedList<Map<String,String>> strings = new LinkedList<>(); |
| | | // for(DataDictionaryCustom dataDictionaryCustom : dataDictionaryCustoms){ |
| | | // Map<String, String> stringStringHashMap = new HashMap<>(); |
| | | // stringStringHashMap.put(dataDictionaryCustom.getDescription(),dataDictionaryCustom.getValue()); |
| | | // strings.add(stringStringHashMap); |
| | | // } |
| | | // //收益率 |
| | | // BigDecimal hangingRevenue = BigDecimal.ZERO; |
| | | // //挂机时长 |
| | | // DataDictionaryCustom maxHours = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.MAX_HOURS.getType(), DataDictionaryEnum.MAX_HOURS.getCode()); |
| | | // if(ObjectUtil.isEmpty(maxHours)){ |
| | | // throw new FebsException(MessageSourceUtils.getString("login_err_003")); |
| | | // } |
| | | // |
| | | // Double maxHoursValue = Double.parseDouble(maxHours.getValue()); |
| | | // //获取用户信息的是否盈利字段 |
| | | // Integer isProfit = dappMember.getIsProfit() == null ? 1 : dappMember.getIsProfit(); |
| | | // String identity = null; |
| | | // if(isProfit == 2){ |
| | | // identity = "IS_PROFIT_NO"; |
| | | // }else{ |
| | | // identity = "LEVEL_MB"; |
| | | // DataDictionaryCustom levelMember = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.LEVEL_MB.getType(), dappMember.getIdentity()); |
| | | // if(ObjectUtil.isEmpty(levelMember)){ |
| | | // throw new FebsException(MessageSourceUtils.getString("login_err_003")); |
| | | // } |
| | | // String levelMemberValue = levelMember.getValue(); |
| | | // JSONObject levelMemberValueParse = JSONUtil.parseObj(levelMemberValue); |
| | | // hangingRevenue = new BigDecimal(levelMemberValueParse.get("hangingRevenue").toString()) |
| | | // .multiply(new BigDecimal(0.01)).setScale(4,BigDecimal.ROUND_DOWN); |
| | | // } |
| | | // //获取挂机字表的顺序 |
| | | // LinkedList<String> isProfitPlan = new LinkedList<>(); |
| | | // Map<String, LinkedList<String>> identity_level = MemberOnHookPlanEnum.valueOf(identity) |
| | | // .getMemberOnHook(maxHoursValue,hangingRevenue,strings); |
| | | // isProfitPlan = identity_level.get(identity); |
| | | // System.out.println(isProfitPlan); |
| | | // |
| | | // } |
| | | // |
| | | // |
| | | // @Autowired |
| | | // private DappWalletCoinDao dappWalletCoinDao; |
| | | // |
| | | // |
| | | // @Autowired |
| | | // private DappAccountMoneyChangeDao dappAccountMoneyChangeDao; |
| | | // private DappWalletCoinDao dappWalletCoinDao; |
| | | // |
| | | // @Test |
| | | // public void updateMemberLevel(){ |
| | | // Log.info("更新用户代理等级"); |
| | | // DateTime date = DateUtil.date(); |
| | | // //查询账户总金额大于51的有效用户 |
| | | // List<DappMemberEntity> dappMemberEntities = dappWalletCoinDao.selectTotalAmount(); |
| | | // if(CollUtil.isEmpty(dappMemberEntities)){ |
| | | // //没有账户金额大于51,则全部为会员 |
| | | // dappMemberDao.updateIdentity(); |
| | | // }else{ |
| | | // List<DappMemberEntity> LEVEL_IB = getMemberLevelList(dappMemberEntities, DataDictionaryEnum.LEVEL_MB.getCode(), DataDictionaryEnum.LEVEL_IB.getCode()); |
| | | // List<DappMemberEntity> LEVEL_FIB = getMemberLevelList(LEVEL_IB, DataDictionaryEnum.LEVEL_IB.getCode(), DataDictionaryEnum.LEVEL_FIB.getCode()); |
| | | // List<DappMemberEntity> LEVEL_CIB = getMemberLevelList(LEVEL_FIB, DataDictionaryEnum.LEVEL_FIB.getCode(), DataDictionaryEnum.LEVEL_CIB.getCode()); |
| | | // List<DappMemberEntity> LEVEL_AIB = getMemberLevelList(LEVEL_CIB, DataDictionaryEnum.LEVEL_CIB.getCode(), DataDictionaryEnum.LEVEL_AIB.getCode()); |
| | | // List<DappMemberEntity> LEVEL_GIB = getMemberLevelList(LEVEL_AIB, DataDictionaryEnum.LEVEL_AIB.getCode(), DataDictionaryEnum.LEVEL_GIB.getCode()); |
| | | // List<DappMemberEntity> LEVEL_BP = getMemberLevelList(LEVEL_GIB, DataDictionaryEnum.LEVEL_GIB.getCode(), DataDictionaryEnum.LEVEL_BP.getCode()); |
| | | // List<DappMemberEntity> LEVEL_SP = getMemberLevelList(LEVEL_BP, DataDictionaryEnum.LEVEL_BP.getCode(), DataDictionaryEnum.LEVEL_SP.getCode()); |
| | | // List<DappMemberEntity> LEVEL_GP = getMemberLevelList(LEVEL_SP, DataDictionaryEnum.LEVEL_SP.getCode(), DataDictionaryEnum.LEVEL_GP.getCode()); |
| | | // } |
| | | // } |
| | | // |
| | | // private List<DappMemberEntity> getMemberLevelList(List<DappMemberEntity> dappMemberEntities,String identity,String identityNext){ |
| | | // List<DappMemberEntity> dappMemberEntitiesNext = new ArrayList<>(); |
| | | // if(CollUtil.isNotEmpty(dappMemberEntities)){ |
| | | // for(DappMemberEntity dappMemberEntity : dappMemberEntities){ |
| | | // Long memberEntityId = dappMemberEntity.getId(); |
| | | // String refererId = dappMemberEntity.getRefererId(); |
| | | // String inviteId = dappMemberEntity.getInviteId(); |
| | | // //下级是否存在三个账户总金额大于51的会员,并且代理等级为identity |
| | | // List<DappMemberEntity> levelMbMembers = dappMemberDao.selectTotalAmountByRefererIdAndIdentity(inviteId,identity); |
| | | // if(CollUtil.isNotEmpty(levelMbMembers) && 3 <= levelMbMembers.size()){ |
| | | // //设置identityNext级别 |
| | | // dappMemberDao.updateIdentityByMemberId(identityNext,memberEntityId); |
| | | // //获取他的上级会员信息 |
| | | // DappMemberEntity dappMemberEntityNext = dappMemberDao.selectMemberInfoByInviteId(refererId); |
| | | // dappMemberEntitiesNext.add(dappMemberEntityNext); |
| | | // } |
| | | // } |
| | | // } |
| | | // return dappMemberEntitiesNext; |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private IgtOnHookPlanOrderItemDao igtOnHookPlanOrderItemDao; |
| | | |
| | | @Autowired |
| | | private IgtOnHookPlanOrderDao igtOnHookPlanOrderDao; |
| | | // |
| | | @Autowired |
| | | private DappWalletCoinDao dappWalletCoinDao; |
| | | |
| | | @Autowired |
| | | private DappAccountMoneyChangeDao dappAccountMoneyChangeDao; |
| | | // |
| | | // @Autowired |
| | | // private DappMemberDao dappMemberDao; |
| | |
| | | // @Autowired |
| | | // private RedisUtils redisUtils; |
| | | // |
| | | // @Autowired |
| | | // private DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | @Autowired |
| | | private DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | // |
| | | // @Autowired |
| | | // private DappWalletService dappWalletService; |
| | | @Autowired |
| | | private DappWalletService dappWalletService; |
| | | // |
| | | // |
| | | // @Value("${spring.profiles.active}") |
| | | // private String active; |
| | | // |
| | | // @Autowired |
| | | // private ApiIgtOnHookPlanService apiIgtOnHookPlanService; |
| | | // |
| | | // @Test |
| | | // public void getActive(){ |
| | |
| | | // } |
| | | // |
| | | // @Test |
| | | // public void testUpdateIgt(){//返还两次中奖之间的本金 |
| | | // IgtOnHookPlanOrderItem igtOnHookPlanOrderItem = igtOnHookPlanOrderItemDao.selectById(3758); |
| | | // Date endTime = igtOnHookPlanOrderItem.getCreateTime(); |
| | | // Date startTime = null; |
| | | // //返回上次中奖的记录 |
| | | // IgtOnHookPlanOrderItem igtOld = igtOnHookPlanOrderItemDao.selectByCreateTimeAndIsgoaAndOrderId(endTime,1,188L); |
| | | // if(ObjectUtil.isNotEmpty(igtOld)){ |
| | | // startTime = igtOld.getCreateTime(); |
| | | // public void updateMemberLevel(){ |
| | | // Log.info("更新用户代理等级"); |
| | | // DateTime date = DateUtil.date(); |
| | | // //查询账户总金额大于51的有效用户 |
| | | // List<DappMemberEntity> dappMemberEntities = dappWalletCoinDao.selectByIdentity(); |
| | | //// List<DappMemberEntity> dappMemberEntities = dappWalletCoinDao.selectTotalAmount(); |
| | | // if(CollUtil.isEmpty(dappMemberEntities)){ |
| | | // //没有账户金额大于51,则全部为会员 |
| | | // dappMemberDao.updateIdentity(); |
| | | // }else{ |
| | | // List<DappMemberEntity> LEVEL_IB = getMemberLevelList(dappMemberEntities, DataDictionaryEnum.LEVEL_MB.getCode(), DataDictionaryEnum.LEVEL_IB.getCode()); |
| | | // List<DappMemberEntity> LEVEL_FIB = getMemberLevelList(dappMemberEntities, DataDictionaryEnum.LEVEL_IB.getCode(), DataDictionaryEnum.LEVEL_FIB.getCode()); |
| | | // List<DappMemberEntity> LEVEL_CIB = getMemberLevelList(dappMemberEntities, DataDictionaryEnum.LEVEL_FIB.getCode(), DataDictionaryEnum.LEVEL_CIB.getCode()); |
| | | // List<DappMemberEntity> LEVEL_AIB = getMemberLevelList(dappMemberEntities, DataDictionaryEnum.LEVEL_CIB.getCode(), DataDictionaryEnum.LEVEL_AIB.getCode()); |
| | | // List<DappMemberEntity> LEVEL_GIB = getMemberLevelList(dappMemberEntities, DataDictionaryEnum.LEVEL_AIB.getCode(), DataDictionaryEnum.LEVEL_GIB.getCode()); |
| | | // List<DappMemberEntity> LEVEL_BP = getMemberLevelList(dappMemberEntities, DataDictionaryEnum.LEVEL_GIB.getCode(), DataDictionaryEnum.LEVEL_BP.getCode()); |
| | | // List<DappMemberEntity> LEVEL_SP = getMemberLevelList(dappMemberEntities, DataDictionaryEnum.LEVEL_BP.getCode(), DataDictionaryEnum.LEVEL_SP.getCode()); |
| | | // List<DappMemberEntity> LEVEL_GP = getMemberLevelList(dappMemberEntities, DataDictionaryEnum.LEVEL_SP.getCode(), DataDictionaryEnum.LEVEL_GP.getCode()); |
| | | // } |
| | | // BigDecimal totalAmount = igtOnHookPlanOrderItemDao.selectTotalAmountByCreateTimeAndOrderId(startTime,endTime,188L); |
| | | // } |
| | | // |
| | | // private List<DappMemberEntity> getMemberLevelList(List<DappMemberEntity> dappMemberEntities,String identity,String identityNext){ |
| | | // List<DappMemberEntity> dappMemberEntitiesNext = new ArrayList<>(); |
| | | // if(CollUtil.isNotEmpty(dappMemberEntities)){ |
| | | // for(DappMemberEntity dappMemberEntity : dappMemberEntities){ |
| | | // if(ObjectUtil.isEmpty(dappMemberEntity)){ |
| | | // continue; |
| | | // } |
| | | // Long memberEntityId = dappMemberEntity.getId(); |
| | | // String refererId = dappMemberEntity.getRefererId(); |
| | | // String inviteId = dappMemberEntity.getInviteId(); |
| | | // //是否存在三条以上的推广线路,存在才能升级,不满足则 |
| | | // List<DappMemberEntity> levelMbMembers = dappMemberDao.selectTotalMemberByRefererIdAndIdentity(inviteId); |
| | | // if(3 > levelMbMembers.size()){ |
| | | // dappMemberEntity.setIdentity(DataDictionaryEnum.LEVEL_MB.getCode()); |
| | | // dappMemberDao.updateById(dappMemberEntity); |
| | | // continue; |
| | | // } |
| | | // int identityDown = 0; |
| | | // for(DappMemberEntity dappMemberDown : levelMbMembers){ |
| | | // //下级是否存在账户总金额大于51的会员,并且代理等级为identity |
| | | // List<DappMemberEntity> levelMbMembersDown = dappMemberDao.selectTotalAmountByRefererIdAndIdentity(dappMemberDown.getInviteId(),identity); |
| | | // if(CollUtil.isNotEmpty(levelMbMembersDown)){ |
| | | // identityDown = identityDown + 1; |
| | | // } |
| | | // |
| | | // } |
| | | // if(identityDown >= 3){ |
| | | // //设置identityNext级别 |
| | | // dappMemberDao.updateIdentityByMemberId(identityNext,memberEntityId); |
| | | // } |
| | | // } |
| | | // } |
| | | // return dappMemberEntitiesNext; |
| | | // } |
| | | //// |
| | | // @Test |
| | | // public void testProfitSharing(){ |
| | | // IgtOnHookPlanOrder igtOnHookPlanOrder = igtOnHookPlanOrderDao.selectById(129L); |
| | | // Long orderId = igtOnHookPlanOrder.getId(); |
| | | // Long memberId = igtOnHookPlanOrder.getMemberId(); |
| | | // BigDecimal planAmount = igtOnHookPlanOrder.getPlanAmount(); |
| | | // BigDecimal avaAmount = igtOnHookPlanOrder.getAvaAmount(); |
| | | // IgtOnHookPlanOrderItem igtOnHookPlanOrderItem = igtOnHookPlanOrderItemDao.selectByOrderIdAndMemberIdAndState(orderId,memberId,2); |
| | | // if(ObjectUtil.isEmpty(igtOnHookPlanOrderItem)){ |
| | | // BigDecimal totalProfit = igtOnHookPlanOrderItemDao.selectTotalProfitByByOrderIdAndMemberIdAndState(orderId,memberId,1,2); |
| | | // IgtOnHookPlanOrder igtOnHookPlanOrder = igtOnHookPlanOrderDao.selectById(3220L); |
| | | // if(ObjectUtil.isEmpty(igtOnHookPlanOrder)){ |
| | | // return; |
| | | // } |
| | | // Long memberId = igtOnHookPlanOrder.getMemberId(); |
| | | // BigDecimal planAmount = igtOnHookPlanOrder.getPlanAmount(); |
| | | // |
| | | // System.out.println(totalProfit); |
| | | // DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId); |
| | | // String refererIds = dappMemberEntity.getRefererIds(); |
| | | // List<String> refererIdList = StrUtil.split(refererIds, ",", -1, true, true); |
| | | // //生成流水佣金和盈利分成和流水记录,返回剩余盈利 |
| | | // BigDecimal profitSharingTotal = dappWalletService.updateLSYJYLFC(refererIdList, totalProfit); |
| | | // System.out.println("流水佣金和盈利分成"+profitSharingTotal); |
| | | // //平台分成,返回剩余盈利 |
| | | // BigDecimal systemTotal = dappWalletService.updatePTFC(memberId,totalProfit); |
| | | // System.out.println("平台分成"+systemTotal); |
| | | // } |
| | | // DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId); |
| | | // if(ObjectUtil.isEmpty(dappMemberEntity)){ |
| | | // return; |
| | | // } |
| | | // //避免重复 |
| | | // QueryWrapper<DappOnHookDone> objectQueryWrapper = new QueryWrapper<>(); |
| | | // objectQueryWrapper.eq("order_id",igtOnHookPlanOrder.getId()); |
| | | // List<DappOnHookDone> dappOnHookDones = dappOnHookDoneDao.selectList(objectQueryWrapper); |
| | | // if(CollUtil.isNotEmpty(dappOnHookDones)){ |
| | | // return; |
| | | // } |
| | | // //生成记录 |
| | | // DappOnHookDone dappOnHookDone = new DappOnHookDone(dappMemberEntity.getId(), igtOnHookPlanOrder.getId()); |
| | | // dappOnHookDoneDao.insert(dappOnHookDone); |
| | | // //获取收益率 |
| | | // DataDictionaryCustom identityDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.LEVEL_MB.getType(), dappMemberEntity.getIdentity()); |
| | | // String identityDicValue = identityDic.getValue(); |
| | | // JSONObject identityDicValueParse = JSONUtil.parseObj(identityDicValue); |
| | | // BigDecimal hangingRevenueLevel = new BigDecimal(identityDicValueParse.get("hangingRevenue").toString()) |
| | | // .multiply(new BigDecimal(0.01)).setScale(4,BigDecimal.ROUND_DOWN); |
| | | // //获取收益 |
| | | // //获取当前用户每分钟应该获取的收益 |
| | | // BigDecimal multiply = hangingRevenueLevel.multiply(planAmount); |
| | | // DataDictionaryCustom maxHoursDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.MAX_HOURS.getType(), DataDictionaryEnum.MAX_HOURS.getCode()); |
| | | // //挂机总时长(分钟) |
| | | // BigDecimal maxHours = new BigDecimal(maxHoursDic.getValue()).multiply(new BigDecimal(60)); |
| | | // //得到每分钟的收益 |
| | | // BigDecimal minuteProfit = multiply.divide(maxHours, 4, BigDecimal.ROUND_DOWN); |
| | | // //获取挂机开始时间到现在的总时长(分钟数) |
| | | // Date startTime = igtOnHookPlanOrder.getStartTime(); |
| | | // long between = DateUtil.between(startTime, DateUtil.date(), DateUnit.MINUTE); |
| | | // //获得总收益 |
| | | // BigDecimal totalProfit = minuteProfit.multiply(new BigDecimal(between)).setScale(4,BigDecimal.ROUND_DOWN); |
| | | //// BigDecimal totalProfit = planAmount.multiply(hangingRevenueLevel).setScale(4,BigDecimal.ROUND_DOWN); |
| | | // |
| | | // String refererIds = dappMemberEntity.getRefererIds(); |
| | | // List<String> refererIdList = StrUtil.split(refererIds, ",", -1, true, true); |
| | | // //只有上级用户金额大于51U才能得到对应的佣金 |
| | | //// ArrayList<String> refererIdLisstUp = new ArrayList<>(); |
| | | //// for(String inviteId : refererIdList){ |
| | | //// DappMemberEntity dappMemberUp = dappMemberDao.selectMemberInfoByInviteId(inviteId); |
| | | //// if(ObjectUtil.isNotEmpty(dappMemberUp)){ |
| | | //// DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(dappMemberUp.getId()); |
| | | //// if(AppContants.ONHOOK_BASIC_AMOUNT.compareTo(dappWalletCoinEntity.getAvailableAmount())<=0){ |
| | | //// refererIdLisstUp.add(inviteId); |
| | | //// } |
| | | //// } |
| | | //// } |
| | | // //生成流水佣金和盈利分成和流水记录,返回剩余盈利 |
| | | // BigDecimal profitSharingTotal = dappWalletService.updateLSYJYLFC(refererIdList, totalProfit,igtOnHookPlanOrder.getId()); |
| | | // //平台分成 |
| | | // //平台拿走35%盈利分成和流水佣金剩下的全部 |
| | | // BigDecimal systemAdd = totalProfit.multiply(new BigDecimal(0.4)).subtract(profitSharingTotal); |
| | | // BigDecimal systemTotal = dappWalletService.updatePTFC(memberId,systemAdd,igtOnHookPlanOrder.getId()); |
| | | // //个人固定拿走60% |
| | | // totalProfit = totalProfit.multiply(new BigDecimal(0.6)); |
| | | // igtOnHookPlanOrder.setState(2); |
| | | // //一次挂机剩余的全部金额 |
| | | // BigDecimal totalMoney = totalProfit.add(planAmount); |
| | | // |
| | | // igtOnHookPlanOrder.setProfit(totalProfit); |
| | | // igtOnHookPlanOrderDao.updateById(igtOnHookPlanOrder); |
| | | // dappMemberEntity.setIsOnHook(3); |
| | | // dappMemberDao.updateById(dappMemberEntity); |
| | | // |
| | | // DappWalletCoinEntity dappWalletCoinEntity = dappWalletCoinDao.selectByMemberId(memberId); |
| | | // BigDecimal availableAmount = dappWalletCoinEntity.getAvailableAmount(); |
| | | // dappWalletCoinDao.addTotalAndaddAvailableById(dappWalletCoinEntity.getId(),totalMoney); |
| | | // |
| | | // BigDecimal add = availableAmount.add(totalMoney); |
| | | // BigDecimal subtract = add.subtract(totalProfit); |
| | | // DappAccountMoneyChangeEntity dappAccountMoneyChangeEntity = new DappAccountMoneyChangeEntity(memberId, subtract, totalProfit, add, "投注盈利", 5,igtOnHookPlanOrder.getId()); |
| | | // dappAccountMoneyChangeDao.insert(dappAccountMoneyChangeEntity); |
| | | // |
| | | // } |
| | | // |
| | |
| | | // |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | //} |
| | | |
| | | |
| | | } |