|
|
@@ -161,16 +161,21 @@ public class QwPushCountController extends BaseController {
|
|
|
public TableDataInfo tokenList(FastGptPushTokenTotal pushTokenInfo) {
|
|
|
List<FastGptPushTokenTotal> list = qwPushCountService.selectFastGptPushTokenTotalList(pushTokenInfo);
|
|
|
|
|
|
+ // 计算规则:1元 = 10万token,即 amount = count / 100000.0
|
|
|
+ for (FastGptPushTokenTotal item : list) {
|
|
|
+ if (item.getCount() != null) {
|
|
|
+ double amount = item.getCount() / 100000.0;
|
|
|
+ item.setAmount(Math.round(amount * 100.0) / 100.0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 计算总和
|
|
|
FastGptPushTokenTotal sumTotal = new FastGptPushTokenTotal();
|
|
|
sumTotal.setCompanyName("合计");
|
|
|
Long sum = list.stream().mapToLong(FastGptPushTokenTotal::getCount).sum();
|
|
|
sumTotal.setCount(sum);
|
|
|
- // 计算合计金额
|
|
|
- Double amountSum = list.stream()
|
|
|
- .filter(item -> item.getAmount() != null)
|
|
|
- .mapToDouble(FastGptPushTokenTotal::getAmount)
|
|
|
- .sum();
|
|
|
+ // 根据总token数计算合计金额
|
|
|
+ double amountSum = sum / 100000.0;
|
|
|
sumTotal.setAmount(Math.round(amountSum * 100.0) / 100.0);
|
|
|
|
|
|
// 获取分页参数
|
|
|
@@ -214,16 +219,21 @@ public class QwPushCountController extends BaseController {
|
|
|
public AjaxResult tokenExport(@RequestBody FastGptPushTokenTotal pushTokenInfo) {
|
|
|
List<FastGptPushTokenTotal> list = qwPushCountService.selectFastGptPushTokenTotalList(pushTokenInfo);
|
|
|
|
|
|
+ // 计算规则:1元 = 10万token,即 amount = count / 100000.0
|
|
|
+ for (FastGptPushTokenTotal item : list) {
|
|
|
+ if (item.getCount() != null) {
|
|
|
+ double amount = item.getCount() / 100000.0;
|
|
|
+ item.setAmount(Math.round(amount * 100.0) / 100.0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 计算总和
|
|
|
FastGptPushTokenTotal sumTotal = new FastGptPushTokenTotal();
|
|
|
sumTotal.setCompanyName("合计");
|
|
|
Long sum = list.stream().mapToLong(FastGptPushTokenTotal::getCount).sum();
|
|
|
sumTotal.setCount(sum);
|
|
|
- // 计算合计金额
|
|
|
- Double amountSum = list.stream()
|
|
|
- .filter(item -> item.getAmount() != null)
|
|
|
- .mapToDouble(FastGptPushTokenTotal::getAmount)
|
|
|
- .sum();
|
|
|
+ // 根据总token数计算合计金额
|
|
|
+ double amountSum = sum / 100000.0;
|
|
|
sumTotal.setAmount(Math.round(amountSum * 100.0) / 100.0);
|
|
|
|
|
|
list.add(sumTotal); // 将合计行添加到列表末尾
|