Commit 9ec882e0 authored by renjie's avatar renjie

费用明细增加余额

parent 2f215f01
package com.edgec.browserbackend.account.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/**
* @Desc
* @Author jason
* @CreateTime 2020/3/12 3:14 下午
**/
@JsonIgnoreProperties(ignoreUnknown = true)
public class Promotion {
private String code;
private int invitedUsers;
private int commission;
private boolean isSale;
public int getCommission() {
return commission;
......@@ -33,4 +37,12 @@ public class Promotion {
public void setCode(String code) {
this.code = code;
}
public boolean isSale() {
return isSale;
}
public void setSale(boolean sale) {
isSale = sale;
}
}
......@@ -50,6 +50,8 @@ public class UserPrePaidBilling {
private String administrator;
private float balanced;
private List<DeductionRecord> deductionRecords = new ArrayList<>();
public float getRate() {
......@@ -199,4 +201,12 @@ public class UserPrePaidBilling {
public void setAdministrator(String administrator) {
this.administrator = administrator;
}
public float getBalanced() {
return balanced;
}
public void setBalanced(float balanced) {
this.balanced = balanced;
}
}
......@@ -252,6 +252,7 @@ public class AccountServiceImpl implements AccountService {
int year = lastmonth.getYear();
bill.setYear(year);
bill.setMonth(monthValue);
bill.setBalanced(userBalance.getBalanced());
prePaidBillingRepository.save(bill);
}
......
......@@ -160,6 +160,10 @@ public class PaymentServiceImpl implements PaymentService {
balance.setUsername(byTradeNo.getUsername());
}
PayBack payBack = payBackRepository.findByPay(byTradeNo.getAmount());
if (payBack == null)
payBack = new PayBack();
if (chargeType == 0) {
UserPrePaidBilling bill = new UserPrePaidBilling();
Account account = accountRepository.findByName(byTradeNo.getUsername());
......@@ -178,6 +182,7 @@ public class PaymentServiceImpl implements PaymentService {
bill.setStatus(BillStatus.PAID);
bill.setPrepaid(true);
bill.setTimestamp(Instant.now().toEpochMilli());
bill.setBalanced(balance.getBalanced() + byTradeNo.getAmount() + payBack.getBack());
final YearMonth lastmonth = YearMonth.now();
......@@ -189,9 +194,6 @@ public class PaymentServiceImpl implements PaymentService {
userPrePaidBillingRepository.save(bill);
}
PayBack payBack = payBackRepository.findByPay(byTradeNo.getAmount());
if (payBack == null)
payBack = new PayBack();
balance.setBalanced(balance.getBalanced() + byTradeNo.getAmount() + payBack.getBack());
userBalanceRepository.save(balance);
}
......@@ -274,6 +276,10 @@ public class PaymentServiceImpl implements PaymentService {
balance.setUsername(byTradeNo.getUsername());
}
PayBack payBack = payBackRepository.findByPay(byTradeNo.getAmount());
if (payBack == null)
payBack = new PayBack();
if (chargeType == 0) {
UserPrePaidBilling bill = new UserPrePaidBilling();
Account account = accountRepository.findByName(byTradeNo.getUsername());
......@@ -292,6 +298,7 @@ public class PaymentServiceImpl implements PaymentService {
bill.setStatus(BillStatus.PAID);
bill.setPrepaid(true);
bill.setTimestamp(Instant.now().toEpochMilli());
bill.setBalanced(balance.getBalanced() + byTradeNo.getAmount() + payBack.getBack());
final YearMonth lastmonth = YearMonth.now();
......@@ -301,9 +308,6 @@ public class PaymentServiceImpl implements PaymentService {
bill.setMonth(monthValue);
}
PayBack payBack = payBackRepository.findByPay(byTradeNo.getAmount());
if (payBack == null)
payBack = new PayBack();
balance.setBalanced(balance.getBalanced() + byTradeNo.getAmount() + payBack.getBack());
userBalanceRepository.save(balance);
}
......
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