|
@@ -39,6 +39,7 @@ import java.math.BigDecimal;
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -68,7 +69,7 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
|
|
return detail;
|
|
return detail;
|
|
}
|
|
}
|
|
|
|
|
|
- public UserAccountVo dealUserAccountVo(UserAccountVo detail){
|
|
|
|
|
|
+ public UserAccountVo dealUserAccountVo(UserAccountVo detail) {
|
|
detail.setAmountUnrecorded(
|
|
detail.setAmountUnrecorded(
|
|
null == detail.getAmountUnrecorded() ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : detail.getAmountUnrecorded().setScale(2, RoundingMode.HALF_UP));
|
|
null == detail.getAmountUnrecorded() ? BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP) : detail.getAmountUnrecorded().setScale(2, RoundingMode.HALF_UP));
|
|
detail.setAmountRecorded(
|
|
detail.setAmountRecorded(
|
|
@@ -99,8 +100,13 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
|
|
if (CollectionUtils.isEmpty(accountRecordDtos)) {
|
|
if (CollectionUtils.isEmpty(accountRecordDtos)) {
|
|
return HttpResponseResult.succeed();
|
|
return HttpResponseResult.succeed();
|
|
}
|
|
}
|
|
|
|
+ //0元过滤
|
|
|
|
+ List<UserAccountRecordDto> accountRecords = accountRecordDtos.stream().filter(o ->
|
|
|
|
+ BigDecimal.ZERO.compareTo(o.getTransAmount()) < 0
|
|
|
|
+ ).collect(Collectors.toList());
|
|
|
|
+
|
|
//校验参数
|
|
//校验参数
|
|
- for (UserAccountRecordDto accountRecordDto : accountRecordDtos) {
|
|
|
|
|
|
+ for (UserAccountRecordDto accountRecordDto : accountRecords) {
|
|
if (null == accountRecordDto.getInOrOut()
|
|
if (null == accountRecordDto.getInOrOut()
|
|
|| null == accountRecordDto.getPostStatus()
|
|
|| null == accountRecordDto.getPostStatus()
|
|
|| (!PostStatusEnum.WAIT.equals(accountRecordDto.getPostStatus()) && !PostStatusEnum.FROZEN.equals(accountRecordDto.getPostStatus()))
|
|
|| (!PostStatusEnum.WAIT.equals(accountRecordDto.getPostStatus()) && !PostStatusEnum.FROZEN.equals(accountRecordDto.getPostStatus()))
|
|
@@ -123,7 +129,7 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//按照不同的账户分组
|
|
//按照不同的账户分组
|
|
- Map<Long, List<UserAccountRecordDto>> accountMap = accountRecordDtos.stream().collect(Collectors.groupingBy(UserAccountRecordDto::getAccountId));
|
|
|
|
|
|
+ Map<Long, List<UserAccountRecordDto>> accountMap = accountRecords.stream().collect(Collectors.groupingBy(UserAccountRecordDto::getAccountId));
|
|
Set<Long> accountIds = accountMap.keySet();
|
|
Set<Long> accountIds = accountMap.keySet();
|
|
|
|
|
|
for (Long accountId : accountIds) {
|
|
for (Long accountId : accountIds) {
|
|
@@ -418,23 +424,23 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
|
|
public void mallTeacherRecordState(MallOrderItemDto shareDto) {
|
|
public void mallTeacherRecordState(MallOrderItemDto shareDto) {
|
|
// 平台修改收入状态
|
|
// 平台修改收入状态
|
|
if (shareDto.getStatus().equals(PostStatusEnum.RECORDED)) {
|
|
if (shareDto.getStatus().equals(PostStatusEnum.RECORDED)) {
|
|
- platformCashAccountRecordService.mallRecordedRecord(shareDto.getProductSkuId(),shareDto.getOrderSn(),GoodTypeEnum.MALL.getCode());
|
|
|
|
|
|
+ platformCashAccountRecordService.mallRecordedRecord(shareDto.getProductSkuId(), shareDto.getOrderSn(), GoodTypeEnum.MALL.getCode());
|
|
|
|
|
|
} else if (shareDto.getStatus().equals(PostStatusEnum.CANCEL)) {
|
|
} else if (shareDto.getStatus().equals(PostStatusEnum.CANCEL)) {
|
|
- platformCashAccountRecordService.cancelRecord(shareDto.getOrderSn(),GoodTypeEnum.MALL.getCode(),shareDto.getProductSkuId());
|
|
|
|
|
|
+ platformCashAccountRecordService.cancelRecord(shareDto.getOrderSn(), GoodTypeEnum.MALL.getCode(), shareDto.getProductSkuId());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
// 修改老师分润
|
|
// 修改老师分润
|
|
List<UserAccountRecord> list = userAccountRecordService.lambdaQuery()
|
|
List<UserAccountRecord> list = userAccountRecordService.lambdaQuery()
|
|
- .eq(UserAccountRecord::getOrderNo, shareDto.getOrderSn())
|
|
|
|
- .eq(UserAccountRecord::getBizId, shareDto.getProductSkuId())
|
|
|
|
- .list();
|
|
|
|
|
|
+ .eq(UserAccountRecord::getOrderNo, shareDto.getOrderSn())
|
|
|
|
+ .eq(UserAccountRecord::getBizId, shareDto.getProductSkuId())
|
|
|
|
+ .list();
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
for (UserAccountRecord userAccount : list) {
|
|
for (UserAccountRecord userAccount : list) {
|
|
- this.accountChange(userAccount,shareDto.getStatus());
|
|
|
|
|
|
+ this.accountChange(userAccount, shareDto.getStatus());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -473,7 +479,7 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
|
|
platformCashAccountRecordService.save(platformCashAccountRecord);
|
|
platformCashAccountRecordService.save(platformCashAccountRecord);
|
|
|
|
|
|
//分润
|
|
//分润
|
|
- if (null != shareDto.getPromoterId() && !shareDto.getPromoterId().equals(shareDto.getUserId()) && shareDto.getPromoterId() !=0) {
|
|
|
|
|
|
+ if (null != shareDto.getPromoterId() && !shareDto.getPromoterId().equals(shareDto.getUserId()) && shareDto.getPromoterId() != 0) {
|
|
//获取分润收益费率
|
|
//获取分润收益费率
|
|
BigDecimal shareFeeRate = userOrderService.getShareFreeByGoodType(GoodTypeEnum.MALL);
|
|
BigDecimal shareFeeRate = userOrderService.getShareFreeByGoodType(GoodTypeEnum.MALL);
|
|
if (shareFeeRate.compareTo(BigDecimal.ZERO) > 0) {
|
|
if (shareFeeRate.compareTo(BigDecimal.ZERO) > 0) {
|
|
@@ -494,8 +500,8 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public AccountTotal dealAccountTotal(AccountTotal info){
|
|
|
|
- if(null == info){
|
|
|
|
|
|
+ public AccountTotal dealAccountTotal(AccountTotal info) {
|
|
|
|
+ if (null == info) {
|
|
info = new AccountTotal();
|
|
info = new AccountTotal();
|
|
}
|
|
}
|
|
info.setTotalInAmount(
|
|
info.setTotalInAmount(
|