wu 1 день назад
Родитель
Сommit
44a2ae5b94

+ 10 - 0
src/custom/restcontroller/R.java

@@ -7703,6 +7703,16 @@ public class R {
         public static class v1 {
         }
     }
+
+    public static class ID2025123014532102 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID2025123014533002 {
+        public static class v1 {
+        }
+    }
 }
 
 

+ 11 - 0
src/custom/restcontroller/webmanage/sale/salestarget2/SQL/看板医院统计目标.sql

@@ -0,0 +1,11 @@
+SELECT t5.itemclassname,
+       sum(ROUND((m1+m2+m3+m4+m5+m6+m7+m8+m9+m10+m11+m12) * price,2))  amount
+from sa_salestargetbill t1
+         INNER JOIN sa_salestarget t2 ON t2.sa_salestargetbillid = t1.sa_salestargetbillid
+         INNER JOIN sa_itemsaleclass t4 ON t4.itemid=t2.itemid
+         INNER JOIN plm_itemclass t5 ON t5.itemclassid=t4.itemclassid
+WHERE t1.year =$year$
+  and t1.`status` = '审核'
+  and t1.siteid =$siteid$
+  and t1.sa_customersid=$sa_customersid$
+GROUP BY t5.itemclassname

+ 7 - 0
src/custom/restcontroller/webmanage/sale/salestarget2/SQL/看板医院统计订单.sql

@@ -0,0 +1,7 @@
+SELECT t5.itemclassname, sum(t2.amount) amount, year(t1.checkdate) y
+from sa_order t1
+         INNER JOIN sa_orderitems t2 ON t2.sa_orderid = t1.sa_orderid and t2.siteid = t1.siteid
+         INNER JOIN sa_itemsaleclass t4 ON t4.itemid=t2.itemid
+         INNER JOIN plm_itemclass t5 ON t5.itemclassid=t4.itemclassid
+WHERE t1.siteid = $siteid$ and t1.`status` in ('审核', '关闭') and YEAR (t1.checkdate) in ($year$, $befyear$) and t1.sa_customersid=$sa_customersid$
+GROUP BY t5.itemclassname, year(t1.checkdate)

+ 13 - 0
src/custom/restcontroller/webmanage/sale/salestarget2/SQL/看板经销商统计目标.sql

@@ -0,0 +1,13 @@
+SELECT
+    t5.itemclassname,
+    sum(ROUND((m1+m2+m3+m4+m5+m6+m7+m8+m9+m10+m11+m12) * price,2))  amount
+from sa_salestargetbill t1
+         INNER JOIN sa_salestarget t2 ON t2.sa_salestargetbillid=t1.sa_salestargetbillid
+         INNER JOIN sa_agents_hospital t3 on t3.sa_hospitaldepid=t2.sa_hospitaldepid
+         INNER JOIN sa_itemsaleclass t4 ON t4.itemid=t2.itemid
+         INNER JOIN plm_itemclass t5 ON t5.itemclassid=t4.itemclassid
+WHERE t1.year = $year$
+  and t1.`status` = '审核'
+  and t1.siteid = $siteid$
+  and t3.sa_agentsid= $sa_agentsid$
+GROUP BY t5.itemclassname

+ 7 - 0
src/custom/restcontroller/webmanage/sale/salestarget2/SQL/看板经销商统计订单.sql

@@ -0,0 +1,7 @@
+SELECT t5.itemclassname, sum(t2.amount) amount, year(t1.checkdate) y
+from sa_order t1
+    INNER JOIN sa_orderitems t2 ON t2.sa_orderid = t1.sa_orderid and t2.siteid = t1.siteid
+    INNER JOIN sa_itemsaleclass t4 ON t4.itemid=t2.itemid
+    INNER JOIN plm_itemclass t5 ON t5.itemclassid=t4.itemclassid
+WHERE t1.siteid = $siteid$ and t1.`status` in ('审核', '关闭') and YEAR (t1.checkdate) in ($year$, $befyear$) and t1.sa_agentsid= $sa_agentsid$
+GROUP BY t5.itemclassname, year(t1.checkdate)

+ 45 - 4
src/custom/restcontroller/webmanage/sale/salestarget2/salestargetstatistics.java

@@ -325,26 +325,53 @@ public class salestargetstatistics extends Controller {
         return getSucReturnObject().setData(arearows).toString();
     }
 
-    @API(title = "人员目标统计看板", apiversion = R.ID2025122915143202.v1.class)
-    public String peopleTargetPanel() throws YosException {
+    @API(title = "统计看板", apiversion = R.ID2025122915143202.v1.class)
+    public String peoplePanel() throws YosException {
         int year = content.getIntValue("year");
         int befyear = year - 1;
         Long userid = content.getLongValue("userid");
+        Long sa_customersid = content.getLongValue("sa_customersid");
+        Long sa_agentsid = content.getLongValue("sa_agentsid");
+        int type = content.getIntValue("type", 1);
 
         Rows itemclassrows = dbConnect.runSqlQuery("SELECT DISTINCT itemclassname from plm_itemclass WHERE siteid='" + siteid + "' ");
 
         SQLFactory sqlFactory = new SQLFactory(this, "看板人员统计订单");
+        if (type == 1) {
+            sqlFactory = new SQLFactory(this, "看板人员统计订单");
+            sqlFactory.addParameter("userid", userid);
+        }
+        if (type == 2) {
+            sqlFactory = new SQLFactory(this, "看板医院统计订单");
+            sqlFactory.addParameter("sa_customersid", sa_customersid);
+        }
+        if (type == 3) {
+            sqlFactory = new SQLFactory(this, "看板经销商统计订单");
+            sqlFactory.addParameter("sa_agentsid", sa_agentsid);
+        }
         sqlFactory.addParameter("siteid", siteid);
         sqlFactory.addParameter("year", year);
         sqlFactory.addParameter("befyear", befyear);
-        sqlFactory.addParameter("userid", userid);
+
         Rows rows = dbConnect.runSqlQuery(sqlFactory);
         RowsMap salesRowsMap = rows.toRowsMap("itemclassname");
 
         sqlFactory = new SQLFactory(this, "看板人员统计目标");
+        if (type == 1) {
+            sqlFactory = new SQLFactory(this, "看板人员统计目标");
+            sqlFactory.addParameter("userid", userid);
+        }
+        if (type == 2) {
+            sqlFactory = new SQLFactory(this, "看板医院统计目标");
+            sqlFactory.addParameter("sa_customersid", sa_customersid);
+        }
+        if (type == 3) {
+            sqlFactory = new SQLFactory(this, "看板经销商统计目标");
+            sqlFactory.addParameter("sa_agentsid", sa_agentsid);
+        }
         sqlFactory.addParameter("siteid", siteid);
         sqlFactory.addParameter("year", year);
-        sqlFactory.addParameter("userid", userid);
+
         Rows targetrows = dbConnect.runSqlQuery(sqlFactory);
         RowsMap targetRowsMap = targetrows.toRowsMap("itemclassname");
 
@@ -390,6 +417,20 @@ public class salestargetstatistics extends Controller {
         return getSucReturnObject().setData(itemclassrows).toString();
     }
 
+    @API(title = "医院统计看板", apiversion = R.ID2025123014532102.v1.class)
+    public String doctorPanel() throws YosException {
+
+
+        return getSucReturnObject().setData("").toString();
+    }
+
+    @API(title = "经销商统计看板", apiversion = R.ID2025123014533002.v1.class)
+    public String agentPanel() throws YosException {
+
+
+        return getSucReturnObject().setData("").toString();
+    }
+
 
     public void calculate(String key, Row arearow, Rows dataRows, ArrayList<String> dates) {
         BigDecimal saleamount = BigDecimal.ZERO;