Browse Source

业绩目标逻辑变更

hu 1 month ago
parent
commit
c07333ff7e

+ 13 - 2
src/custom/restcontroller/webmanage/sale/salestarget/personnel.java

@@ -587,11 +587,22 @@ public class personnel extends Controller {
                             double target_l = 0L;
                             double target_h = 0L;
                             if (type.equals("年")) {
-                                target_l = row.getDouble("y1l");
+                                target_l = row.getDouble("m1l")+row.getDouble("m2l")+row.getDouble("m3l")
+                                        +row.getDouble("m4l")+row.getDouble("m5l")+row.getDouble("m6l")
+                                        +row.getDouble("m7l")+row.getDouble("m8l")+row.getDouble("m9l")
+                                        +row.getDouble("m10l")+row.getDouble("m11l")+row.getDouble("m12l");
                                 target_h = row.getDouble("y1h");
                             }
                             if (type.equals("季")) {
-                                target_l = row.getDouble("s" + (i + 1) + "l");
+                                if(i==0){
+                                    target_l = row.getDouble("m1l")+row.getDouble("m2l")+row.getDouble("m3l");
+                                }else if(i==1){
+                                    target_l = row.getDouble("m4l")+row.getDouble("m5l")+row.getDouble("m6l");
+                                }else if(i==2){
+                                    target_l = row.getDouble("m7l")+row.getDouble("m8l")+row.getDouble("m9l");
+                                }else {
+                                    target_l = row.getDouble("m10l")+row.getDouble("m11l")+row.getDouble("m12l");
+                                }
                                 target_h = row.getDouble("s" + (i + 1) + "h");
                             }
                             if (type.equals("月")) {

+ 22 - 21
src/custom/restcontroller/webmanage/sale/salestarget_cucu/performancetargetboard.java

@@ -65,21 +65,22 @@ public class performancetargetboard extends Controller {
         for (Row row : rows) {
             list.add(row.getLong("sa_saleareaid"));
         }
-
-        if(rows.isNotEmpty()){
-             arearows =getSubSaleAreas(this,list);
-             Rows saleareahrrows  =dbConnect.runSqlQuery("select t1.name,t2.sa_saleareaid,t1.hrid from sys_hr t1 inner join sa_salearea_hr t2 on t1.siteid = t2.siteid and t1.hrid = t2.hrid where t1.siteid='"+siteid+"'");
-             RowsMap saleareahrRowsMap =saleareahrrows.toRowsMap("sa_saleareaid");
-             for (Row row :arearows){
-                 if(saleareahrRowsMap.containsKey(row.getString("sa_saleareaid"))){
-                     for(Row row1 :saleareahrRowsMap.get(row.getString("sa_saleareaid"))){
-                         row.put("name",row1.getString("name"));
-                         row.put("hrid",row1.getString("hrid"));
-                         rows.add(row);
-                     }
-                 }
-             }
-        }
+        arearows =getSubSaleAreas(this,list);
+        rows.addAll(arearows);
+//        if(rows.isNotEmpty()){
+//             arearows =getSubSaleAreas(this,list);
+//             Rows saleareahrrows  =dbConnect.runSqlQuery("select t1.name,t2.sa_saleareaid,t1.hrid from sys_hr t1 inner join sa_salearea_hr t2 on t1.siteid = t2.siteid and t1.hrid = t2.hrid where t1.siteid='"+siteid+"'");
+//             RowsMap saleareahrRowsMap =saleareahrrows.toRowsMap("sa_saleareaid");
+//             for (Row row :arearows){
+//                 if(saleareahrRowsMap.containsKey(row.getString("sa_saleareaid"))){
+//                     for(Row row1 :saleareahrRowsMap.get(row.getString("sa_saleareaid"))){
+//                         row.put("name",row1.getString("name"));
+//                         row.put("hrid",row1.getString("hrid"));
+//                         rows.add(row);
+//                     }
+//                 }
+//             }
+//        }
 
         return getSucReturnObject().setData(rows).toString();
 
@@ -87,7 +88,7 @@ public class performancetargetboard extends Controller {
 
     @API(title = "查询业务员月度指标", apiversion = R.ID2025103010192003.v1.class)
     public String queryperformancetarget_month() throws YosException {
-        long hrid= content.getLong("hrid");
+        //long hrid= content.getLong("hrid");
         long sa_saleareaid= content.getLong("sa_saleareaid");
         long year= content.getLong("year");
         long month= content.getLong("month");
@@ -111,7 +112,7 @@ public class performancetargetboard extends Controller {
         }
         SQLFactory personnelsqlFactory = new SQLFactory(this, "人员-目标详情列表");
         personnelsqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
-        personnelsqlFactory.addParameter_SQL("where", " t.hrid="+hrid);
+        personnelsqlFactory.addParameter_SQL("where", " t.sa_saleareaid="+sa_saleareaid);
         personnelsqlFactory.addParameter("siteid", siteid);
         Rows salestargetrows = dbConnect.runSqlQuery(personnelsqlFactory.getSQL());
         BigDecimal rw_month=BigDecimal.ZERO;
@@ -180,7 +181,7 @@ public class performancetargetboard extends Controller {
 
     @API(title = "查询业务员季度指标", apiversion = R.ID2025103010193903.v1.class)
     public String queryperformancetarget_quarter() throws YosException {
-        long hrid= content.getLong("hrid");
+//        long hrid= content.getLong("hrid");
         long sa_saleareaid= content.getLong("sa_saleareaid");
         long year= content.getLong("year");
         int selectmonth= content.getIntValue("month");
@@ -203,7 +204,7 @@ public class performancetargetboard extends Controller {
         }
         SQLFactory personnelsqlFactory = new SQLFactory(this, "人员-目标详情列表");
         personnelsqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
-        personnelsqlFactory.addParameter_SQL("where", " t.hrid="+hrid);
+        personnelsqlFactory.addParameter_SQL("where", " t.sa_saleareaid="+sa_saleareaid);
         personnelsqlFactory.addParameter("siteid", siteid);
         Rows salestargetrows = dbConnect.runSqlQuery(personnelsqlFactory.getSQL());
         BigDecimal rw_quarter=BigDecimal.ZERO;
@@ -279,7 +280,7 @@ public class performancetargetboard extends Controller {
 
     @API(title = "查询业务员总指标", apiversion = R.ID2025103010195403.v1.class)
     public String queryperformancetarget_total() throws YosException {
-        long hrid= content.getLong("hrid");
+        //long hrid= content.getLong("hrid");
         long sa_saleareaid= content.getLong("sa_saleareaid");
         long year= content.getLong("year");
         JSONArray months = content.getJSONArray("months");
@@ -303,7 +304,7 @@ public class performancetargetboard extends Controller {
         }
         SQLFactory personnelsqlFactory = new SQLFactory(this, "人员-目标详情列表");
         personnelsqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
-        personnelsqlFactory.addParameter_SQL("where", " t.hrid="+hrid);
+        personnelsqlFactory.addParameter_SQL("where", " t.sa_saleareaid="+sa_saleareaid);
         personnelsqlFactory.addParameter("siteid", siteid);
         Rows salestargetrows = dbConnect.runSqlQuery(personnelsqlFactory.getSQL());
         BigDecimal rw_all=BigDecimal.ZERO;