Browse Source

查询业务员指标添加months

hu 3 weeks ago
parent
commit
d6952db336

+ 13 - 11
src/custom/restcontroller/webmanage/sale/salestarget_cucu/performancetargetboard.java

@@ -86,8 +86,8 @@ public class performancetargetboard extends Controller {
 
     }
 
-    @API(title = "查询业务员月度指标", apiversion = R.ID2025103010192003.v1.class)
-    public String queryperformancetarget_month() throws YosException {
+    @API(title = "查询业务员指标", apiversion = R.ID2025103010192003.v1.class)
+    public String queryperformancetarget() throws YosException {
         //long hrid= content.getLong("hrid");
         //long sa_saleareaid= content.getLong("sa_saleareaid");
         QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_hr","name","hrid");
@@ -111,6 +111,7 @@ public class performancetargetboard extends Controller {
 
         long year= content.getLong("year");
         long month= content.getLong("month");
+        JSONArray months = content.getJSONArray("months");
         String monthstr = String.format("%02d", month);
 
         BigDecimal gcproportion =BigDecimal.ZERO;
@@ -232,7 +233,7 @@ public class performancetargetboard extends Controller {
         Rows arearows_quarter= queryperformancetarget_quarter(month,arearows,salestargetrowsMap,paymentRows_All,rebateRows_All);
         System.err.println(arearows_quarter.get(0).getString("sa_saleareaid")+":"+arearows_quarter.get(0).getBigDecimal("completedamount"));
         RowsMap arearowsMap_quarter=arearows_quarter.toRowsMap("sa_saleareaid");
-        Rows arearows_total= queryperformancetarget_total(month,arearows,salestargetrowsMap,paymentRows_All,rebateRows_All);
+        Rows arearows_total= queryperformancetarget_total(month,months,arearows,salestargetrowsMap,paymentRows_All,rebateRows_All);
         RowsMap arearowsMap_total=arearows_total.toRowsMap("sa_saleareaid");
         for(Row row : arearows){
             if(arearowsMap_quarter.containsKey(row.getString("sa_saleareaid"))){
@@ -435,19 +436,20 @@ public class performancetargetboard extends Controller {
      * @return
      * @throws YosException
      */
-    public Rows queryperformancetarget_total(long selectmonth,Rows arearows,RowsMap salestargetrowsMap,Rows paymentRows_All,Rows rebateRows_All) throws YosException {
+    public Rows queryperformancetarget_total(long selectmonth,JSONArray months,Rows arearows,RowsMap salestargetrowsMap,Rows paymentRows_All,Rows rebateRows_All) throws YosException {
 
-        JSONArray months =new JSONArray();
         BigDecimal gcproportion =BigDecimal.ZERO.divide(BigDecimal.valueOf(100));
         BigDecimal zzproportion =BigDecimal.ZERO.divide(BigDecimal.valueOf(100));
 //        Rows salestargetbillrows =dbConnect.runSqlQuery("select * from sa_salestargetbill where siteid='"+siteid+"' and year="+year+" and targettype='人员目标'");
         Rows rows = dbConnect.runSqlQuery("select * from sys_site_parameter where siteid='" + siteid + "'");
-        if(rows.isNotEmpty()){
-            gcproportion=rows.get(0).getBigDecimal("gcproportion");
-            zzproportion=rows.get(0).getBigDecimal("zzproportion");
-            for(int i=1;i<=selectmonth;i++){
-                if(rows.get(0).getJSONArray("statistics_months").contains(i)){
-                    months.add(i);
+        if(months.isEmpty()){
+            if(rows.isNotEmpty()){
+                gcproportion=rows.get(0).getBigDecimal("gcproportion");
+                zzproportion=rows.get(0).getBigDecimal("zzproportion");
+                for(int i=1;i<=selectmonth;i++){
+                    if(rows.get(0).getJSONArray("statistics_months").contains(i)){
+                        months.add(i);
+                    }
                 }
             }
         }