Commit ed42d163 authored by licc's avatar licc

优化月度任务接口

parent b3765080
...@@ -32,9 +32,10 @@ public class TradeRecord implements Serializable { ...@@ -32,9 +32,10 @@ public class TradeRecord implements Serializable {
private String userId; private String userId;
/** /**
* 交易记录类型 1:提现 2:订单返佣 3:订单下单 4:月度肥料 5:培育奖 6:工资奖励 7:进步奖 * 交易记录类型 1:提现 2:订单返佣 3:订单下单 4:月度肥料 5:培育奖 6:工资奖励 7:进步奖 8:运营中心补贴
*/ */
@ApiModelProperty(name = "tradeType", value = "交易类型 1:提现 2:订单返佣 3:订单下单 4:月度肥料 5:培育奖 6:工资 7:进步奖") @ApiModelProperty(name = "tradeType", value = "交易类型 1:提现 2:订单返佣 3:订单下单 4:月度肥料 5:培育奖 " +
"6:工资 7:进步奖 8:运营中心补贴")
private Integer tradeType; private Integer tradeType;
/** /**
......
...@@ -62,6 +62,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -62,6 +62,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
@Autowired @Autowired
private MonthManureMapper monthManureMapper; private MonthManureMapper monthManureMapper;
@Autowired
private LastAccountMapper lastAccountMapper;
private static final String PATTERN = "yyyy-MM"; private static final String PATTERN = "yyyy-MM";
private static final Integer TWENTY = 20; private static final Integer TWENTY = 20;
...@@ -286,7 +289,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -286,7 +289,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
BigDecimal earningsMonth = accountInfo.getEarningsMonth().add(BigDecimal.valueOf(income)); BigDecimal earningsMonth = accountInfo.getEarningsMonth().add(BigDecimal.valueOf(income));
accountInfo.setEarningsMonth(earningsMonth); accountInfo.setEarningsMonth(earningsMonth);
//用户总收益 =其他总收益 + earningsMonth //用户总收益 =其他总收益 + 最大进步奖收益
BigDecimal earningsTotal = accountInfo.getEarningsTotal().add(BigDecimal.valueOf(income)); BigDecimal earningsTotal = accountInfo.getEarningsTotal().add(BigDecimal.valueOf(income));
accountInfo.setEarningsTotal(earningsTotal); accountInfo.setEarningsTotal(earningsTotal);
accountInfoList.add(accountInfo); accountInfoList.add(accountInfo);
...@@ -319,7 +322,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -319,7 +322,7 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//更新账户信息,添加交易流水记录 //更新账户信息,添加交易流水记录
boolean bool = accountManager.updateAccountAddRecordAddPrize(accountInfoList, tradeRecordList, boolean bool = accountManager.updateAccountAddRecordAddPrize(accountInfoList, tradeRecordList,
addPrizeList,updatePrizeList); addPrizeList, updatePrizeList);
if (!bool) { if (!bool) {
return R.ok(1, false); return R.ok(1, false);
} }
...@@ -414,14 +417,25 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo> ...@@ -414,14 +417,25 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
//获取账户信息 //获取账户信息
AccountInfo accountInfo = accountMapper.getByUserId(user.getUserId()); AccountInfo accountInfo = accountMapper.getByUserId(user.getUserId());
BigDecimal bigDecimal = new BigDecimal(income); BigDecimal bigDecimal = new BigDecimal(income);
BigDecimal performanceMonth = accountInfo.getEarningsMonth().add(bigDecimal);
//获取用户本月收益=可提现金额+ 本月肥料收益
BigDecimal performanceMonth = accountInfo.getExtractMoney().add(bigDecimal);
accountInfo.setEarningsMonth(performanceMonth); accountInfo.setEarningsMonth(performanceMonth);
BigDecimal performanceTotal = accountInfo.getEarningsTotal().add(bigDecimal); //获取用户上月总收益
LastMonthAccount lastMonthAccount = lastAccountMapper.getByUserIdAndTime(user.getUserId(), yearMonthTime);
BigDecimal lastTotalMonth;
if (null == lastMonthAccount || null == lastMonthAccount.getEarningsTotal()) {
lastTotalMonth = new BigDecimal("0.00");
} else {
lastTotalMonth = lastMonthAccount.getEarningsTotal();
}
//用户总收益=上月总收益+本月收益
BigDecimal performanceTotal = lastTotalMonth.add(performanceMonth);
accountInfo.setEarningsTotal(performanceTotal); accountInfo.setEarningsTotal(performanceTotal);
accountInfoList.add(accountInfo); accountInfoList.add(accountInfo);
//5、添加交易流水记录 //5、添加交易流水记录
TradeRecord tradeRecord = new TradeRecord(); TradeRecord tradeRecord = new TradeRecord();
tradeRecord.setUserId(user.getUserId()); tradeRecord.setUserId(user.getUserId());
......
...@@ -449,10 +449,22 @@ public class MonthTaskServiceImpl implements MonthTaskService { ...@@ -449,10 +449,22 @@ public class MonthTaskServiceImpl implements MonthTaskService {
//获取账户信息 //获取账户信息
AccountInfo accountInfo = accountMapper.getByUserId(user.getUserId()); AccountInfo accountInfo = accountMapper.getByUserId(user.getUserId());
BigDecimal bigDecimal = new BigDecimal(income).setScale(2, RoundingMode.HALF_UP); BigDecimal bigDecimal = new BigDecimal(income).setScale(2, RoundingMode.HALF_UP);
BigDecimal performanceMonth = accountInfo.getEarningsMonth().add(bigDecimal);
accountInfo.setEarningsMonth(performanceMonth.setScale(2, RoundingMode.HALF_UP));
BigDecimal performanceTotal = accountInfo.getEarningsTotal().add(bigDecimal); //获取用户上月月收益=可提现金额+ 上月肥料收益
BigDecimal performanceMonth = accountInfo.getExtractMoney().add(bigDecimal);
accountInfo.setEarningsMonth(performanceMonth);
//获取用户上上月总收益
LastMonthAccount lastMonthAccount = lastAccountMapper.getByUserIdAndTime(user.getUserId(), yearMonthTime);
BigDecimal lastTotalMonth;
if (null == lastMonthAccount || null == lastMonthAccount.getEarningsTotal()) {
lastTotalMonth = new BigDecimal("0.00");
} else {
lastTotalMonth = lastMonthAccount.getEarningsTotal();
}
//用户总收益=上上月总收益+上月收益
BigDecimal performanceTotal = lastTotalMonth.add(performanceMonth);
accountInfo.setEarningsTotal(performanceTotal.setScale(2, RoundingMode.HALF_UP)); accountInfo.setEarningsTotal(performanceTotal.setScale(2, RoundingMode.HALF_UP));
accountInfoList.add(accountInfo); accountInfoList.add(accountInfo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment