From ad6b7f0d80337bcddb1d694cc53bd6273c03149e Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期三, 11 十月 2023 11:10:58 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/crm/manager/controller/DashboardController.java | 33 +++++++++++++++++++++++++++++----
1 files changed, 29 insertions(+), 4 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 0692dcf..633cf6e 100644
--- a/src/main/java/com/zy/crm/manager/controller/DashboardController.java
+++ b/src/main/java/com/zy/crm/manager/controller/DashboardController.java
@@ -1,12 +1,15 @@
package com.zy.crm.manager.controller;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.annotations.ManagerAuth;
+import com.core.common.Cools;
import com.core.common.R;
import com.zy.crm.common.web.BaseController;
import com.zy.crm.manager.entity.CompanyTarget;
import com.zy.crm.manager.entity.Order;
import com.zy.crm.manager.service.CompanyTargetService;
import com.zy.crm.manager.service.OrderService;
+import com.zy.crm.system.entity.Role;
import com.zy.crm.system.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -42,12 +45,15 @@
if (companyTarget == null) {
return R.error();
}
- map.put("yearTarget", formatter.format(Double.parseDouble(companyTarget.getTarget())));//鍏ㄥ勾浜ゆ槗鐩爣
+ double whole = Double.parseDouble(companyTarget.getTarget());
+ map.put("yearTarget", formatter.format(whole));//鍏ㄥ勾浜ゆ槗鐩爣
//鑾峰彇鍏ㄥ勾浜ゆ槗鎴愬姛閲戦
Double successMoney = orderService.selectMoneyByYearAndStatus(year, 1);
//鑾峰彇鍏ㄥ勾鏈氦鏄撴垚鍔熼噾棰�
- Double progressMoney = orderService.selectMoneyByYearAndStatus(year, 0);
+// double v = whole - orderService.selectMoneyByYearAndStatus(year, 0);
+ double v = whole - orderService.selectMoneyByYearAndStatus(year, 1);
+ Double progressMoney = v > 0? v : 0D;
//鑾峰彇鍏ㄥ勾浜ゆ槗澶辫触閲戦
Double failedMoney = orderService.selectMoneyByYearAndStatus(year, 2);
//鍏ㄥ勾瀹屾垚鐜�
@@ -81,15 +87,18 @@
//鑾峰彇鍏ㄥ勾浜ゆ槗鎴愬姛閲戦
Double successMoney = orderService.selectMoneyByUserAndYearAndStatus(getUserId(), year, 1);
//鑾峰彇鍏ㄥ勾鏈氦鏄撴垚鍔熼噾棰�
- Double progressMoney = orderService.selectMoneyByUserAndYearAndStatus(getUserId(), year, 0);
+ double v = yearTarget - orderService.selectMoneyByUserAndYearAndStatus(getUserId(), year, 1);
+ Double progressMoney = v > 0? v : 0D;
+ Double progressMoney2 = orderService.selectMoneyByUserAndYearAndStatus(getUserId(), year, 0);
//鑾峰彇鍏ㄥ勾浜ゆ槗澶辫触閲戦
Double failedMoney = orderService.selectMoneyByUserAndYearAndStatus(getUserId(), year, 2);
//鍏ㄥ勾瀹屾垚鐜�
// double yearTransactionRate = successMoney == 0 ? successMoney : (successMoney / (successMoney + progressMoney + failedMoney)) * 100;
- double yearTransactionRate = successMoney == 0 ? successMoney : (successMoney / yearTarget) * 100;
+ double yearTransactionRate = yearTarget==0? 0 : successMoney == 0 ? successMoney : (successMoney / yearTarget) * 100;
map.put("successMoney", formatter.format(successMoney));//鍏ㄥ勾浜ゆ槗鎴愬姛閲戦
map.put("progressMoney", formatter.format(progressMoney));//鍏ㄥ勾鏈氦鏄撴垚鍔熼噾棰�
+ map.put("progressMoney2", formatter.format(progressMoney2));//璺熻釜椤圭洰閲戦
map.put("yearTransactionRate", String.format("%.2f", yearTransactionRate));//鍏ㄥ勾浜ゆ槗鐜�
//鑾峰彇鍏ㄥ勾璺熻釜鏁伴噺
@@ -125,4 +134,20 @@
return R.ok().add(list);
}
+ @RequestMapping("/dashboard/popup/auth")
+ public R popup(String token) {
+ String item = "false";
+ if (Cools.isEmpty(token)){
+ return R.ok(item);
+ }
+ User user = getUser(token);
+ if (Cools.isEmpty(user) || Cools.isEmpty(user.getRoleId())){
+ return R.ok(item);
+ }
+ if (user.getRoleId()<3){
+ item="true";
+ }
+ return R.ok(item);
+ }
+
}
--
Gitblit v1.9.1