From 930658f087df885f01cefbba30856303e0528c58 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Sun, 04 Feb 2024 18:06:49 +0800
Subject: [PATCH] 确认收货更新用户的会员信息
---
src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java | 98 ++++++++++++++++++++++++++++---------------------
1 files changed, 56 insertions(+), 42 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java
index 2640d2a..94871f7 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java
@@ -14,6 +14,7 @@
import cc.mrbird.febs.system.mapper.UserMapper;
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.math.MathUtil;
import cn.hutool.core.util.ObjectUtil;
@@ -823,7 +824,17 @@
List<MallMember> thirdLevelRecord = getStarRecord(fourLevelRecord, MemberLevelEnum.THIRD_LEVEL.name(), amount, orderNo, 0L,MoneyFlowTypeEnum.STAR_PERK_THREE.getValue());
List<MallMember> secondLevelRecord = getStarRecord(thirdLevelRecord, MemberLevelEnum.SECOND_LEVEL.name(), amount, orderNo, 0L,MoneyFlowTypeEnum.STAR_PERK_TWO.getValue());
}
+ public static void main(String[] args) {
+ Long number = 0L; // 这里可以替换成你需要检查的数字
+ if (number % 3 == 0) {
+ System.out.println(number + " 可以被3整除");
+ } else {
+ System.out.println(number + " 不能被3整除");
+ }
+ DateTime nowTimeFormat = DateUtil.parseTime(DateUtil.formatTime(DateUtil.date()));
+ System.out.println(nowTimeFormat);
+ }
@Override
public void BuyToSell() {
/**
@@ -850,23 +861,46 @@
BigDecimal profitPercent = mallProductNft.getProfit();
for(MallProductBuy mallProductBuy : mallProductBuys){
+
+
Date payTime = mallProductBuy.getPayTime();
+
+
+// //偏移时间--
+// DateTime dateTime = DateUtil.offsetDay(payTime, cycle);
+// int compare = DateUtil.compare(now, dateTime);
+// if(compare >= 0){
+// mallProductBuy.setMateState(ProductEnum.PRODUCT_BUY_MATE_STATE_SUCCESS.getValue());
+// mallProductBuyMapper.updateById(mallProductBuy);
//偏移时间
- DateTime dateTime = DateUtil.offsetDay(payTime, cycle);
- int compare = DateUtil.compare(now, dateTime);
- if(compare >= 0){
+ String s = String.valueOf(DateUtil.between(payTime, DateUtil.date(), DateUnit.DAY));//相差日期天数
+ BigDecimal bigDecimal = new BigDecimal(s).setScale(0, BigDecimal.ROUND_DOWN);//只取整数位
+ if(bigDecimal.compareTo(BigDecimal.ZERO) <= 0){
+ continue;
+ }
+ BigDecimal remainder = bigDecimal.remainder(new BigDecimal(String.valueOf(cycle)));//取余
+ if (remainder.compareTo(BigDecimal.ZERO) == 0) {
/**
- * 更新买单状态
- * 收益生成一条卖单
- * 本金生成一条卖单
+ * 用户的账户增加对应的收益
*/
- mallProductBuy.setMateState(ProductEnum.PRODUCT_BUY_MATE_STATE_SUCCESS.getValue());
- mallProductBuyMapper.updateById(mallProductBuy);
BigDecimal nftTotal = mallProductBuy.getNftTotal();
BigDecimal profit = nftTotal.multiply(profitPercent.multiply(new BigDecimal(0.01)));
- BigDecimal add = nftTotal.add(profit);
- insertSell(mallProductBuy.getMemberId(),add,add,BigDecimal.ZERO,BigDecimal.ZERO);
// insertSell(mallProductBuy.getMemberId(),profit,profit,BigDecimal.ZERO,BigDecimal.ZERO);
+ String orderNoSY = MallUtils.getOrderNum("SYNFT");
+ mallMoneyFlowService.addMoneyFlow(
+ mallProductBuy.getMemberId(),
+ profit,
+ MoneyFlowTypeNewEnum.PERK_CYCLE.getValue(),
+ orderNoSY,
+ null,
+ FlowTypeNewEnum.NFT.getValue(),
+ MoneyFlowTypeNewEnum.PERK_CYCLE.getDescrition(),
+ AppContants.MEMBER_FLOW_DONE);
+
+ MallMemberAmount mallMemberAmountMine = mallMemberAmountMapper.selectByMemberId(mallProductBuy.getMemberId());
+ mallMemberAmountMine.setTrendsNft(mallMemberAmountMine.getTrendsNft().add(profit));
+ mallMemberAmountMapper.updateTrendsNftById(mallMemberAmountMine);
+
/**
* 更新用户上级收益,冻结7天,7天时间到期自动释放到动态钱包
@@ -1018,30 +1052,6 @@
* 3、更新卖单子表的数据
*/
agentProducer.sendFcmOrderBuyCancelMsg(mallProductBuyRecord.getId());
-
-// Long buyId = mallProductBuyRecord.getBuyId();
-// Long sellRecordId = mallProductBuyRecord.getSellRecordId();
-// MallProductBuy mallProductBuy = mallProductBuyMapper.selectById(buyId);
-// Long memberIdBuy = mallProductBuy.getMemberId();
-// //冻结账户
-// MallMember mallMemberBuy = memberMapper.selectById(memberIdBuy);
-// mallMemberBuy.setIsFrozen(ProductEnum.MEMBER_FROZEN.getValue());
-// memberMapper.updateById(mallMemberBuy);
-// //更新买单子表的数据
-// mallProductBuyRecord.setState(ProductEnum.PRODUCT_MATE_STATE_FAIL.getValue());
-// mallProductBuyRecordMapper.updateById(mallProductBuyRecord);
-// //更新买单主表
-// mallProductBuy.setNftAva(mallProductBuy.getNftAva().add(mallProductBuyRecord.getPickNftCnt()));
-// mallProductBuyMapper.updateById(mallProductBuy);
-// //更新卖单子表的数据
-// MallProductSellRecord mallProductSellRecord = mallProductSellRecordMapper.selectById(sellRecordId);
-// mallProductSellRecord.setState(ProductEnum.PRODUCT_MATE_STATE_FAIL.getValue());
-// mallProductSellRecordMapper.updateById(mallProductSellRecord);
-// //更新卖单主表
-// Long sellId = mallProductSellRecord.getSellId();
-// MallProductSell mallProductSell = mallProductSellMapper.selectById(sellId);
-// mallProductSell.setNftCntAva(mallProductSell.getNftCntAva().add(mallProductSellRecord.getNftCnt()));
-// mallProductSellMapper.updateById(mallProductSell);
}
}
}
@@ -1088,12 +1098,16 @@
if(CollUtil.isEmpty(mallProductNfts)){
return;
}
- DateTime nowTime = DateUtil.parseTime(DateUtil.formatTime(DateUtil.date()));
+ DateTime nowTime = DateUtil.date();
+ DateTime nowTimeFormat = DateUtil.parseTime(DateUtil.formatTime(nowTime));
DataDictionaryCustom endTimeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
DataDictionaryEnum.YU_YUE_END_TIME.getType(),
DataDictionaryEnum.YU_YUE_END_TIME.getCode()
);
DateTime endTime = DateUtil.parseTime(endTimeDic.getValue());
+ if(nowTimeFormat.compareTo(endTime) < 0){
+ return;
+ }
for(MallProductNft mallProductNft : mallProductNfts){
Long nftId = mallProductNft.getId();
List<MallProductBuy> mallProductBuys = mallProductBuyMapper.selectListByStateAndProductNFTId(
@@ -1105,9 +1119,9 @@
}
for(MallProductBuy mallProductBuy : mallProductBuys){
/**
- * 当前时间比结束时间大
+ * 当前时间比创建时间大
*/
- if(nowTime.compareTo(endTime) >= 0){
+ if(nowTime.compareTo(mallProductBuy.getCreatedTime()) >= 0){
/**
* 返回令牌
* 预约记录超时
@@ -1468,10 +1482,10 @@
}
return list;
}
- public static void main(String[] args) {
- int[] nums = {1, 2, 2, 5, 2};
- List<Integer> missingNumbers = findDisappearedNumbers(nums);
- System.out.println("缺失的数字为:" + missingNumbers);
- }
+// public static void main(String[] args) {
+// int[] nums = {1, 2, 2, 5, 2};
+// List<Integer> missingNumbers = findDisappearedNumbers(nums);
+// System.out.println("缺失的数字为:" + missingNumbers);
+// }
}
--
Gitblit v1.9.1