From f57e1cf99a1516983d75a2522fd9f0ff3c56b65a Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 08 九月 2023 08:55:46 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/crm/manager/controller/DashboardController.java | 20 +++++++++++++-------
src/main/java/com/zy/crm/manager/entity/CompanyTarget.java | 7 -------
2 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/src/main/java/com/zy/crm/manager/controller/DashboardController.java b/src/main/java/com/zy/crm/manager/controller/DashboardController.java
index b2d1ced..a47c028 100644
--- a/src/main/java/com/zy/crm/manager/controller/DashboardController.java
+++ b/src/main/java/com/zy/crm/manager/controller/DashboardController.java
@@ -13,6 +13,8 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@@ -33,6 +35,7 @@
public R getCompanyData() {
HashMap<String, Object> map = new HashMap<>();
+ NumberFormat formatter = new DecimalFormat("#,###");
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy");
String year = format.format(date);
@@ -40,7 +43,7 @@
if (companyTarget == null) {
return R.error();
}
- map.put("yearTarget", companyTarget.getTarget$());//鍏ㄥ勾浜ゆ槗鐩爣
+ map.put("yearTarget", formatter.format(Double.parseDouble(companyTarget.getTarget())));//鍏ㄥ勾浜ゆ槗鐩爣
//鑾峰彇鍏ㄥ勾浜ゆ槗鎴愬姛閲戦
Double successMoney = orderService.selectMoneyByYearAndStatus(year, 1);
@@ -50,8 +53,9 @@
Double failedMoney = orderService.selectMoneyByYearAndStatus(year, 2);
//鍏ㄥ勾浜ゆ槗鐜�
double yearTransactionRate = successMoney == 0 ? successMoney : (successMoney / (successMoney + progressMoney + failedMoney)) * 100;
- map.put("successMoney", WordUtils.formatNumberForAccounting(successMoney));//鍏ㄥ勾浜ゆ槗鎴愬姛閲戦
- map.put("progressMoney", WordUtils.formatNumberForAccounting(progressMoney));//鍏ㄥ勾鏈氦鏄撴垚鍔熼噾棰�
+
+ map.put("successMoney", formatter.format(successMoney));//鍏ㄥ勾浜ゆ槗鎴愬姛閲戦
+ map.put("progressMoney", formatter.format(progressMoney));//鍏ㄥ勾鏈氦鏄撴垚鍔熼噾棰�
map.put("yearTransactionRate", String.format("%.2f", yearTransactionRate));//鍏ㄥ勾浜ゆ槗鐜�
return R.ok().add(map);
}
@@ -62,14 +66,15 @@
public R getPersonData() {
HashMap<String, Object> map = new HashMap<>();
+ NumberFormat formatter = new DecimalFormat("#,###");
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyy");
String year = format.format(date);
User user = getUser();
- String yearTarget = "0.00";//鑾峰彇涓汉鍏ㄥ勾鐩爣鏁版嵁
+ String yearTarget = "0";//鑾峰彇涓汉鍏ㄥ勾鐩爣鏁版嵁
if (user.getTarget() != null) {
- yearTarget = WordUtils.formatNumberForAccounting(Double.parseDouble(user.getTarget()));;
+ yearTarget = formatter.format(Double.parseDouble(user.getTarget()));
}
map.put("yearTarget", yearTarget);//鍏ㄥ勾浜ゆ槗鐩爣
@@ -81,8 +86,9 @@
Double failedMoney = orderService.selectMoneyByUserAndYearAndStatus(user.getId(), year, 2);
//鍏ㄥ勾浜ゆ槗鐜�
double yearTransactionRate = successMoney == 0 ? successMoney : (successMoney / (successMoney + progressMoney + failedMoney)) * 100;
- map.put("successMoney", WordUtils.formatNumberForAccounting(successMoney));//鍏ㄥ勾浜ゆ槗鎴愬姛閲戦
- map.put("progressMoney", WordUtils.formatNumberForAccounting(progressMoney));//鍏ㄥ勾鏈氦鏄撴垚鍔熼噾棰�
+
+ map.put("successMoney", formatter.format(successMoney));//鍏ㄥ勾浜ゆ槗鎴愬姛閲戦
+ map.put("progressMoney", formatter.format(progressMoney));//鍏ㄥ勾鏈氦鏄撴垚鍔熼噾棰�
map.put("yearTransactionRate", String.format("%.2f", yearTransactionRate));//鍏ㄥ勾浜ゆ槗鐜�
//鑾峰彇鍏ㄥ勾璺熻釜鏁伴噺
diff --git a/src/main/java/com/zy/crm/manager/entity/CompanyTarget.java b/src/main/java/com/zy/crm/manager/entity/CompanyTarget.java
index aaec960..0a7bef1 100644
--- a/src/main/java/com/zy/crm/manager/entity/CompanyTarget.java
+++ b/src/main/java/com/zy/crm/manager/entity/CompanyTarget.java
@@ -89,12 +89,5 @@
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime);
}
- public String getTarget$() {
- if (Cools.isEmpty(this.target)){
- return "";
- }
- return WordUtils.formatNumberForAccounting(Double.parseDouble(this.target));
- }
-
}
--
Gitblit v1.9.1