fix: 账单列表;充值类型
This commit is contained in:
@@ -27,6 +27,7 @@ public class OmadaTask {
|
|||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
remoteUserService.deviceJob();
|
remoteUserService.deviceJob();
|
||||||
remoteUUserService.addCdrInfoByOmadaApi();
|
remoteUUserService.addCdrInfoByOmadaApi();
|
||||||
|
remoteUUserService.sendReminderEMail();
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
log.info(MessageUtils.message("job.execute.success", endTime - startTime));
|
log.info(MessageUtils.message("job.execute.success", endTime - startTime));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class ReminderTask {
|
|||||||
private RemoteUUserService remoteUUserService;
|
private RemoteUUserService remoteUUserService;
|
||||||
|
|
||||||
public R<Boolean> reminderJob() {
|
public R<Boolean> reminderJob() {
|
||||||
return remoteUUserService.sendReminderEMail();
|
return R.ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ import org.wfc.user.domain.UAccount;
|
|||||||
import org.wfc.user.domain.UBill;
|
import org.wfc.user.domain.UBill;
|
||||||
import org.wfc.user.domain.UBillRule;
|
import org.wfc.user.domain.UBillRule;
|
||||||
import org.wfc.user.domain.UClient;
|
import org.wfc.user.domain.UClient;
|
||||||
import org.wfc.user.domain.constant.ReminderStatusEnum;
|
|
||||||
import org.wfc.user.domain.constant.OrderStatusEnum;
|
import org.wfc.user.domain.constant.OrderStatusEnum;
|
||||||
import org.wfc.user.domain.constant.OrderTypeEnum;
|
import org.wfc.user.domain.constant.OrderTypeEnum;
|
||||||
|
import org.wfc.user.domain.constant.ReminderStatusEnum;
|
||||||
import org.wfc.user.domain.properties.ReminderProperties;
|
import org.wfc.user.domain.properties.ReminderProperties;
|
||||||
import org.wfc.user.domain.vo.UAccountDashboardVo;
|
import org.wfc.user.domain.vo.UAccountDashboardVo;
|
||||||
import org.wfc.user.domain.vo.UCdrUserVo;
|
import org.wfc.user.domain.vo.UCdrUserVo;
|
||||||
@@ -336,7 +336,9 @@ public class UAccountServiceImpl extends ServiceImpl<UAccountMapper, UAccount> i
|
|||||||
for (UAccount packageAccount : packageAccounts) {
|
for (UAccount packageAccount : packageAccounts) {
|
||||||
if (packageAccount.getTrafficEnable()) {
|
if (packageAccount.getTrafficEnable()) {
|
||||||
try {
|
try {
|
||||||
if ((packageAccount.getTraffic() - packageAccount.getTrafficUsed()) / packageAccount.getTraffic() <= reminderProperties.getTrafficThreshold() / 100) {
|
BigDecimal value = BigDecimal.valueOf(packageAccount.getTraffic()).subtract(BigDecimal.valueOf(packageAccount.getTrafficUsed())).divide(BigDecimal.valueOf(packageAccount.getTraffic()), 2, RoundingMode.HALF_UP);
|
||||||
|
BigDecimal threshold = BigDecimal.valueOf(reminderProperties.getTrafficThreshold()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
|
||||||
|
if (value.compareTo(threshold) <= 0) {
|
||||||
Context context = new Context();
|
Context context = new Context();
|
||||||
context.setVariable("threshold", reminderProperties.getTrafficThreshold());
|
context.setVariable("threshold", reminderProperties.getTrafficThreshold());
|
||||||
context.setVariable("totalTraffic", TrafficConverter.formatBytes(packageAccount.getTraffic()));
|
context.setVariable("totalTraffic", TrafficConverter.formatBytes(packageAccount.getTraffic()));
|
||||||
|
|||||||
@@ -136,12 +136,13 @@ public class UOrderServiceImpl extends ServiceImpl<UOrderMapper, UOrder> impleme
|
|||||||
callbackPackage(order, account, false);
|
callbackPackage(order, account, false);
|
||||||
} else if (OrderTypeEnum.RECHARGE.getCode().equals(order.getType())) {
|
} else if (OrderTypeEnum.RECHARGE.getCode().equals(order.getType())) {
|
||||||
// 充值
|
// 充值
|
||||||
|
// 如果已欠费,充值时补充欠费部分以抵消
|
||||||
|
if (ObjectUtil.isNotNull(account.getBalanceUsed()) && account.getBalanceUsed().compareTo(BigDecimal.ZERO) > 0
|
||||||
|
&& ObjectUtil.isNotNull(account.getBalance()) && account.getBalance().subtract(account.getBalanceUsed()).compareTo(BigDecimal.ZERO) < 0) {
|
||||||
|
account.setBalance(account.getBalanceUsed().add(order.getOrderAmount()));
|
||||||
|
} else {
|
||||||
// 更新账户余额
|
// 更新账户余额
|
||||||
account.setBalance(order.getOrderAmount().add(Optional.ofNullable(account.getBalance()).orElse(BigDecimal.ZERO)));
|
account.setBalance(order.getOrderAmount().add(Optional.ofNullable(account.getBalance()).orElse(BigDecimal.ZERO)));
|
||||||
// 如果已欠费,充值时补充欠费部分以抵消
|
|
||||||
if (ObjectUtil.isNull(account.getBalanceUsed()) && account.getBalanceUsed().compareTo(BigDecimal.ZERO) > 0
|
|
||||||
&& ObjectUtil.isNull(account.getBalance()) && account.getBalance().subtract(account.getBalanceUsed()).compareTo(BigDecimal.ZERO) < 0) {
|
|
||||||
account.setBalance(account.getBalance().add(account.getBalanceUsed().subtract(account.getBalance())));
|
|
||||||
}
|
}
|
||||||
account.setBalanceReminder(ReminderStatusEnum.NO.getCode());
|
account.setBalanceReminder(ReminderStatusEnum.NO.getCode());
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
FROM
|
FROM
|
||||||
u_bill b
|
u_bill b
|
||||||
WHERE b.del_flag = 0
|
WHERE b.del_flag = 0
|
||||||
AND b.type in (1, 2)
|
AND b.type in (0, 1)
|
||||||
AND b.invoice_number is not null
|
AND b.invoice_number is not null
|
||||||
AND b.user_id = #{userId}
|
AND b.user_id = #{userId}
|
||||||
order by b.create_time desc
|
order by b.create_time desc
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
WHERE
|
WHERE
|
||||||
cdr.del_flag = 0
|
cdr.del_flag = 0
|
||||||
AND ch.id is not null
|
AND ch.id is not null
|
||||||
|
AND c.client_id is not null
|
||||||
<if test="userId != null and userId != ''">
|
<if test="userId != null and userId != ''">
|
||||||
AND cdr.user_id = #{userId}
|
AND cdr.user_id = #{userId}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user