2
0

fix: 当前流量统计/扣费账单/上网记录类型等

This commit is contained in:
caiyuchao
2025-06-20 17:26:47 +08:00
parent 3b6f05d2c7
commit 35cf811689
8 changed files with 14 additions and 7 deletions

View File

@@ -13,6 +13,6 @@ ADD COLUMN `package_reminder` tinyint(4) NULL COMMENT '套餐提醒' AFTER `up_l
ADD COLUMN `balance_reminder` tinyint(4) NULL COMMENT '余额提醒' AFTER `package_reminder`;
INSERT IGNORE INTO `wfc_system_db`.`sys_job` (`job_id`, `job_name`, `job_group`, `invoke_target`, `cron_expression`, `misfire_policy`, `concurrent`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3, 'Reminder Task', 'DEFAULT', 'reminderTask.reminderJob', '0/60 * * * * ?', '3', '1', '0', 'admin', '2025-06-16 11:26:10', '', NULL, '');
INSERT IGNORE INTO `wfc_system_db`.`sys_job` (`job_id`, `job_name`, `job_group`, `invoke_target`, `cron_expression`, `misfire_policy`, `concurrent`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (3, 'Reminder Task', 'DEFAULT', 'reminderTask.reminderJob', '0 * * * * ?', '3', '1', '0', 'admin', '2025-06-16 11:26:10', '', NULL, '');
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -144,7 +144,7 @@ CREATE TABLE `u_bill_rule` (
-- ----------------------------
-- Records of u_bill_rule
-- ----------------------------
INSERT INTO `u_bill_rule` VALUES (1, 1.0000, 1, 2, 1, 0, NULL, NULL, 2, '2025-01-07 17:11:30');
INSERT INTO `u_bill_rule` VALUES (1, 1.0000, 1, 2, 0, 0, NULL, NULL, 2, '2025-01-07 17:11:30');
-- ----------------------------
-- Table structure for u_cdr

View File

@@ -13,7 +13,8 @@ import lombok.Getter;
public enum OrderTypeEnum {
PACKAGE(0, "Package"),
RECHARGE(1, "Recharge");
RECHARGE(1, "Recharge"),
BALANCE_DEDUCTION(2, "balance deduction"),;
private final Integer code;
private final String desc;

View File

@@ -18,4 +18,5 @@ public class UCdrHistoryUserVo {
private Long duration;
private Long trafficDown;
private Long trafficUp;
private Integer useType;
}

View File

@@ -309,14 +309,15 @@ public class UAccountServiceImpl extends ServiceImpl<UAccountMapper, UAccount> i
bill.setAmount(account.getBalanceUsed());
bill.setUserId(userId);
bill.setCdrHistoryId(cdrHistoryId);
bill.setType(OrderTypeEnum.RECHARGE.getCode());
bill.setType(OrderTypeEnum.BALANCE_DEDUCTION.getCode());
bill.setStatus(OrderStatusEnum.PAID.getCode());
// billMapper.insert(bill);
billMapper.insert(bill);
account.setBalanceUsed(BigDecimal.ZERO);
this.updateById(account);
}
@Transactional
public boolean sendReminderEMail() {
Date current = new Date();
List<UAccount> accounts = this.list(Wrappers.<UAccount>lambdaQuery()

View File

@@ -234,7 +234,7 @@ public class UBillServiceImpl extends ServiceImpl<UBillMapper, UBill> implements
try {
String subject = mailProperties.getSubject();
if (StrUtil.isBlank(subject)) {
subject = "Your WANFI Billing";
subject = "Your Billing";
}
MailUtils.sendHtml(invoiceBo.getEmail(), subject, htmlStr, uploadFile);

View File

@@ -30,6 +30,8 @@
FROM
u_bill b
WHERE b.del_flag = 0
AND b.type in (1, 2)
AND b.invoice_number is not null
AND b.user_id = #{userId}
order by b.create_time desc
</select>

View File

@@ -114,6 +114,7 @@
c.client_device_type,
ch.start_time,
ch.end_time,
ch.use_type,
ifnull( ch.duration, 0 ) duration,
ifnull( ch.traffic_down, 0 ) traffic_down,
ifnull( ch.traffic_up, 0 ) traffic_up
@@ -126,6 +127,7 @@
WHERE
cdr.del_flag = 0
AND ch.id is not null
AND ch.use_type is not null
<if test="item.userId != null and item.userId != ''">
AND cdr.user_id = #{item.userId}
</if>
@@ -172,7 +174,7 @@
sum(ifnull( cdr.traffic_up, 0 )) traffic
FROM
u_client c
LEFT JOIN u_cdr cdr ON c.id = cdr.client_id
LEFT JOIN u_cdr cdr ON c.id = cdr.client_id AND cdr.user_id = #{userId}
AND cdr.del_flag = 0
WHERE
c.del_flag = 0