Sfoglia il codice sorgente

目标添加账户id字段(多选)

hu 1 anno fa
parent
commit
433e89877b

+ 46 - 16
src/custom/restcontroller/sale/salestarget/enterprise.java

@@ -90,11 +90,14 @@ public class enterprise extends Controller {
         String assessmentindicators="";
         //统计维度
         String statisticaldimension="";
+        //统计维度
+        String sa_accountclassids="";
         if(curryear!=0){
-            Rows rows =dbConnect.runSqlQuery("SELECT assessmentindicators,statisticaldimension FROM sa_salestargetbill WHERE `year` = " + curryear + " AND targettype ='企业目标' AND siteid = '" + siteid + "'");
+            Rows rows =dbConnect.runSqlQuery("SELECT assessmentindicators,statisticaldimension,sa_accountclassids FROM sa_salestargetbill WHERE `year` = " + curryear + " AND targettype ='企业目标' AND siteid = '" + siteid + "'");
             if(rows.isNotEmpty()){
                 assessmentindicators=rows.get(0).getString("assessmentindicators");
                 statisticaldimension=rows.get(0).getString("statisticaldimension");
+                sa_accountclassids=rows.get(0).getString("sa_accountclassids");
             }
         }
 
@@ -108,45 +111,72 @@ public class enterprise extends Controller {
         Rows actualRows = new Rows();
         //开票
         if (assessmentindicators.equals("开票")) {
+            String where1=" 1=1 ";
             sqlFactory = new SQLFactory(this, "企业-开票");
             if(statisticaldimension.equals("订单审核")){
-                sqlFactory.addParameter_SQL("where1", "t2.status='审核'");
+                where1=where1+" and t2.status='审核' ";
             }else{
-                sqlFactory.addParameter_SQL("where1", "t2.status='提交'");
+                where1=where1+" and t2.status='提交' ";
             }
+            if(StringUtils.isNotBlank(sa_accountclassids)){
+                if(isJSONArray(sa_accountclassids)){
+                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
+                    where1=where1+ " and t2.sa_accountclassid in"+jsonArrayResult;
+                    where1 = where1.replace("[", "(").replace("]", ")");
+                }
+            }
+            sqlFactory.addParameter_SQL("where1",where1);
         }
         //订单
         if (assessmentindicators.equals("订单")) {
+            String where1=" 1=1 ";
             sqlFactory = new SQLFactory(this, "企业-订单");
             if(statisticaldimension.equals("订单审核")){
-                sqlFactory.addParameter_SQL("where1", "t2.status='审核'");
+                where1=where1+" and t2.status='审核' ";
             }else{
-                sqlFactory.addParameter_SQL("where1", "t2.status='提交'");
+                where1=where1+" and t2.status='提交' ";
             }
-
-
+            if(StringUtils.isNotBlank(sa_accountclassids)){
+                if(isJSONArray(sa_accountclassids)){
+                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
+                    where1=where1+ " and t2.sa_accountclassid in"+jsonArrayResult;
+                    where1 = where1.replace("[", "(").replace("]", ")");
+                }
+            }
+            sqlFactory.addParameter_SQL("where1",where1);
         }
         //出货
         if (assessmentindicators.equals("出货")) {
+            String where1=" 1=1 ";
             sqlFactory = new SQLFactory(this, "企业-出货");
-            sqlFactory.addParameter_SQL("where1", "1=1");
+            if(StringUtils.isNotBlank(sa_accountclassids)){
+                if(isJSONArray(sa_accountclassids)){
+                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
+                    where1=where1+ " and t2.sa_accountclassid in"+jsonArrayResult;
+                    where1 = where1.replace("[", "(").replace("]", ")");
+                }
+            }
+            sqlFactory.addParameter_SQL("where1",where1);
         }
         //收款
         if (assessmentindicators.equals("收款")) {
+            String where1=" 1=1 ";
             sqlFactory = new SQLFactory(this, "企业-收款");
-            if(StringUtils.isBlank(statisticaldimension)){
-                sqlFactory.addParameter_SQL("where1", "1=1");
-            }else{
+            if(StringUtils.isNotBlank(statisticaldimension)){
                 if(isJSONArray(statisticaldimension)){
                     JSONArray jsonArrayResult = JSONArray.parseArray(statisticaldimension);
-                    String where1="class in"+jsonArrayResult+" or subclass in"+jsonArrayResult;
+                    where1=where1+" and (class in"+jsonArrayResult+" or subclass in"+jsonArrayResult+")";
+                    where1 = where1.replace("[", "(").replace("]", ")");
+                }
+            }
+            if(StringUtils.isNotBlank(sa_accountclassids)){
+                if(isJSONArray(sa_accountclassids)){
+                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
+                    where1=where1+ " and sa_accountclassid in"+jsonArrayResult;
                     where1 = where1.replace("[", "(").replace("]", ")");
-                    sqlFactory.addParameter_SQL("where1", where1);
-                }else{
-                    sqlFactory.addParameter_SQL("where1", "1=1");
                 }
-
             }
+            sqlFactory.addParameter_SQL("where1",where1);
     }
         sqlFactory.addParameter_in("sys_enterpriseid", rows.toArrayList("sys_enterpriseid",new ArrayList<Long>()));
         sqlFactory.addParameter("siteid", siteid);

+ 1 - 0
src/custom/restcontroller/webmanage/sale/salestarget/SQL/人员-目标详情.sql

@@ -5,6 +5,7 @@ SELECT t1.sa_salestargetbillid,
        t1.year,
        t1.assessmentindicators,
        t1.statisticaldimension,
+       t1.sa_accountclassids,
        t1.`status`,
        t1.changeby,
        t1.changedate,

+ 2 - 2
src/custom/restcontroller/webmanage/sale/salestarget/SQL/创建新年度.sql

@@ -1,4 +1,4 @@
 insert into sa_salestargetbill (siteid, sa_salestargetbillid, createby, createdate, changeuserid, changeby, changedate,
-                                targettype, year, status,sys_enterpriseid,tradefield,assessmentindicators,statisticaldimension)
+                                targettype, year, status,sys_enterpriseid,tradefield,assessmentindicators,statisticaldimension,sa_accountclassids)
 values ($siteid$, $sa_salestargetbillid$, $username$, CURRENT_TIME, $userid$, $username$, CURRENT_TIME, $targettype$, $year$,
-        '新建',$sys_enterpriseid$,$tradefield$,$assessmentindicators$,$statisticaldimension$);
+        '新建',$sys_enterpriseid$,$tradefield$,$assessmentindicators$,$statisticaldimension$,$sa_accountclassids$);

+ 1 - 0
src/custom/restcontroller/webmanage/sale/salestarget/SQL/年度目标列表.sql

@@ -4,6 +4,7 @@ SELECT t1.sa_salestargetbillid,
        t1.targettype,
        t1.assessmentindicators,
        t1.statisticaldimension,
+       t1.sa_accountclassids,
        t1.year,
        t1.`status`,
        (SELECT count(*) FROM sa_salestargethr WHERE sa_salestargetbillid = t1.sa_salestargetbillid) peoplecount

+ 16 - 9
src/custom/restcontroller/webmanage/sale/salestarget/enterprisetarget.java

@@ -40,6 +40,7 @@ public class enterprisetarget extends Controller {
         JSONArray agentsArray = content.getJSONArray("agents");
         String assessmentindicators=content.getString("assessmentindicators");
         String statisticaldimension=content.getStringValue("statisticaldimension");
+        String sa_accountclassids=content.getStringValue("sa_accountclassids");
         ArrayList<String> sqlList = new ArrayList<>();
         if (sa_salestargetbillid <= 0) {
             //查询创建年度是否存在
@@ -60,6 +61,7 @@ public class enterprisetarget extends Controller {
                 sqlFactory.addParameter("tradefield", "");
                 sqlFactory.addParameter("assessmentindicators", assessmentindicators);
                 sqlFactory.addParameter("statisticaldimension", statisticaldimension);
+                sqlFactory.addParameter("sa_accountclassids", sa_accountclassids);
 
                 sqlList.add(sqlFactory.getSQL());
             }
@@ -228,11 +230,13 @@ public class enterprisetarget extends Controller {
         String assessmentindicators="";
         //统计维度
         String statisticaldimension="";
+        String  sa_accountclassids="";
         if(curryear!=0){
-            Rows rows =dbConnect.runSqlQuery("SELECT assessmentindicators,statisticaldimension FROM sa_salestargetbill WHERE `year` = " + curryear + " AND targettype ='企业目标' AND siteid = '" + siteid + "'");
+            Rows rows =dbConnect.runSqlQuery("SELECT assessmentindicators,statisticaldimension,sa_accountclassids FROM sa_salestargetbill WHERE `year` = " + curryear + " AND targettype ='企业目标' AND siteid = '" + siteid + "'");
             if(rows.isNotEmpty()){
                 assessmentindicators=rows.get(0).getString("assessmentindicators");
                 statisticaldimension=rows.get(0).getString("statisticaldimension");
+                sa_accountclassids=rows.get(0).getString("sa_accountclassids");
             }
         }
 
@@ -259,19 +263,22 @@ public class enterprisetarget extends Controller {
         //收款
         if (assessmentindicators.equals("收款")) {
             sqlFactory = new SQLFactory(new enterprise(new JSONObject()), "企业-收款");
-            if(StringUtils.isBlank(statisticaldimension)){
-                sqlFactory.addParameter_SQL("where1", "1=1");
-            }else{
+            String where1=" 1=1 ";
+            if(StringUtils.isNotBlank(statisticaldimension)){
                 if(isJSONArray(statisticaldimension)){
                     JSONArray jsonArrayResult = JSONArray.parseArray(statisticaldimension);
-                    String where1="class in"+jsonArrayResult+" or subclass in"+jsonArrayResult;
+                    where1=where1+" and (class in"+jsonArrayResult+" or subclass in"+jsonArrayResult+")";
+                    where1 = where1.replace("[", "(").replace("]", ")");
+                }
+            }
+            if(StringUtils.isNotBlank(sa_accountclassids)){
+                if(isJSONArray(sa_accountclassids)){
+                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
+                    where1=where1+ " and sa_accountclassid in"+jsonArrayResult;
                     where1 = where1.replace("[", "(").replace("]", ")");
-                    sqlFactory.addParameter_SQL("where1", where1);
-                }else{
-                    sqlFactory.addParameter_SQL("where1", "1=1");
                 }
-
             }
+            sqlFactory.addParameter_SQL("where1",where1);
             sqlFactory.addParameter_in("sys_enterpriseid", rows.toArrayList("sys_enterpriseid",new ArrayList<Long>()));
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("year", curryear);

+ 46 - 0
src/custom/restcontroller/webmanage/sale/salestarget/personnel.java

@@ -36,6 +36,8 @@ public class personnel extends Controller {
         String assessmentindicators=content.getString("assessmentindicators");
         Long sa_salestargetbillid = content.getLong("sa_salestargetbillid");
         String statisticaldimension=content.getStringValue("statisticaldimension");
+        String sa_accountclassids=content.getStringValue("sa_accountclassids");
+
         JSONArray salesArray = content.getJSONArray("sales");
 
         ArrayList<String> sqlList = new ArrayList<>();
@@ -54,6 +56,8 @@ public class personnel extends Controller {
             sqlFactory.addParameter("year", year);
             sqlFactory.addParameter("assessmentindicators", assessmentindicators);
             sqlFactory.addParameter("statisticaldimension", statisticaldimension);
+            sqlFactory.addParameter("sa_accountclassids", sa_accountclassids);
+
             sqlFactory.addParameter("targettype", "人员目标");
             sqlFactory.addParameter("tradefield", "");
             sqlList.add(sqlFactory.getSQL());
@@ -206,6 +210,27 @@ public class personnel extends Controller {
         sqlFactory.addParameter_SQL("where", where);
         sqlFactory.addParameter("targettype", targettype);
         Rows rows = dbConnect.runSqlQuery(sqlFactory);
+        Rows accountclassrows = dbConnect.runSqlQuery("select sa_accountclassid,accountname from sa_accountclass where siteid='"+siteid+"'");
+        RowsMap accountclassrowsMap = accountclassrows.toRowsMap("sa_accountclassid");
+
+        for (Row row:rows) {
+            JSONArray jsonArray= new JSONArray();
+            if(isJSONArray(row.getString("statisticaldimension"))){
+                row.put("statisticaldimension",JSONArray.parseArray(row.getString("statisticaldimension")));
+            }
+            if(isJSONArray(row.getString("sa_accountclassids"))){
+                JSONArray sa_accountclassids =JSONArray.parseArray(row.getString("sa_accountclassids"));
+                for (Object object:sa_accountclassids) {
+                    Long sa_accountclassid = Long.valueOf(object.toString());
+                    if(accountclassrowsMap.containsKey(String.valueOf(sa_accountclassid))){
+                        if(accountclassrowsMap.get(String.valueOf(sa_accountclassid)).isNotEmpty()){
+                            jsonArray.add(accountclassrowsMap.get(String.valueOf(sa_accountclassid)).get(0));
+                        }
+                    }
+                }
+                row.put("sa_accountclassids",jsonArray);
+            }
+        }
 
 
         return getSucReturnObject().setData(rows).toString();
@@ -218,6 +243,27 @@ public class personnel extends Controller {
         sqlFactory.addParameter("siteid", siteid);
         sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
         Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
+        Rows accountclassrows = dbConnect.runSqlQuery("select sa_accountclassid,accountname from sa_accountclass where siteid='"+siteid+"'");
+        RowsMap accountclassrowsMap = accountclassrows.toRowsMap("sa_accountclassid");
+
+        for (Row row:rows) {
+            JSONArray jsonArray= new JSONArray();
+            if(isJSONArray(row.getString("statisticaldimension"))){
+                row.put("statisticaldimension",JSONArray.parseArray(row.getString("statisticaldimension")));
+            }
+            if(isJSONArray(row.getString("sa_accountclassids"))){
+                JSONArray sa_accountclassids =JSONArray.parseArray(row.getString("sa_accountclassids"));
+                for (Object object:sa_accountclassids) {
+                    Long sa_accountclassid = Long.valueOf(object.toString());
+                    if(accountclassrowsMap.containsKey(String.valueOf(sa_accountclassid))){
+                        if(accountclassrowsMap.get(String.valueOf(sa_accountclassid)).isNotEmpty()){
+                            jsonArray.add(accountclassrowsMap.get(String.valueOf(sa_accountclassid)).get(0));
+                        }
+                    }
+                }
+                row.put("sa_accountclassids",jsonArray);
+            }
+        }
         return getSucReturnObject().setData(rows.isNotEmpty() ? rows.get(0) : new Rows()).toString();
     }
 

+ 139 - 43
src/custom/restcontroller/webmanage/sale/salestarget/personnelstatistics.java

@@ -114,7 +114,7 @@ public class personnelstatistics extends Controller {
         Calendar cal = Calendar.getInstance();
         int year = cal.get(Calendar.YEAR);
 
-        Rows billRows = dbConnect.runSqlQuery("SELECT sa_salestargetbillid,assessmentindicators,statisticaldimension FROM sa_salestargetbill WHERE  year="+year+"  AND siteid ='" + siteid + "' and  targettype = '人员目标'");
+        Rows billRows = dbConnect.runSqlQuery("SELECT sa_salestargetbillid,assessmentindicators,statisticaldimension,sa_accountclassids FROM sa_salestargetbill WHERE  year="+year+"  AND siteid ='" + siteid + "' and  targettype = '人员目标'");
 
         SQLFactory hrsqlFactory = new SQLFactory(this, "业务员列表查询");
         hrsqlFactory.addParameter("siteid", siteid);
@@ -129,10 +129,13 @@ public class personnelstatistics extends Controller {
         String assessmentindicators="";
         //统计维度
         String statisticaldimension="";
+        //账户
+        String sa_accountclassids="";
         if (billRows.isNotEmpty()) {
             sa_salestargetbillid=billRows.get(0).getLong("sa_salestargetbillid");
             assessmentindicators=billRows.get(0).getString("assessmentindicators");
             statisticaldimension=billRows.get(0).getString("statisticaldimension");
+            sa_accountclassids=billRows.get(0).getString("sa_accountclassids");
         }
 
         /*
@@ -197,14 +200,23 @@ public class personnelstatistics extends Controller {
         Rows actualRows = new Rows();
         //开票
         if (assessmentindicators .equals("开票")) {
+            String where1 =" 1=1 ";
             sqlFactory = new SQLFactory(this, "人员目标统计-开票");
             sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
             sqlFactory.addParameter_SQL("where", where);
             if(statisticaldimension.equals("订单审核")){
-                sqlFactory.addParameter_SQL("where1", "t2.status='审核'");
+                where1=where1+" and t2.status='审核'";
             }else{
-                sqlFactory.addParameter_SQL("where1", "t2.status='提交'");
+                where1=where1+" and t2.status='提交'";
             }
+            if(StringUtils.isNotBlank(sa_accountclassids)){
+                if(isJSONArray(sa_accountclassids)){
+                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
+                    where1=where1+ " and t2.sa_accountclassid in"+jsonArrayResult;
+                    where1 = where1.replace("[", "(").replace("]", ")");
+                }
+            }
+            sqlFactory.addParameter_SQL("where1",where1);
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("year", year);
             actualRows = dbConnect.runSqlQuery(sqlFactory);
@@ -212,47 +224,66 @@ public class personnelstatistics extends Controller {
         }
         //订单
         if (assessmentindicators .equals("订单")) {
+            String where1 =" 1=1 ";
             sqlFactory = new SQLFactory(this, "人员目标统计-订单");
             sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
             sqlFactory.addParameter_SQL("where", where);
             if(statisticaldimension.equals("订单审核")){
-                sqlFactory.addParameter_SQL("where1", "t2.status='审核'");
+                where1=where1+" and t2.status='审核'";
             }else{
-                sqlFactory.addParameter_SQL("where1", "t2.status='提交'");
+                where1=where1+" and t2.status='提交'";
+            }
+            if(StringUtils.isNotBlank(sa_accountclassids)){
+                if(isJSONArray(sa_accountclassids)){
+                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
+                    where1=where1+ " and t2.sa_accountclassid in"+jsonArrayResult;
+                    where1 = where1.replace("[", "(").replace("]", ")");
+                }
             }
+            sqlFactory.addParameter_SQL("where1",where1);
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("year", year);
             actualRows = dbConnect.runSqlQuery(sqlFactory);
         }
         //出货
         if (assessmentindicators .equals("出货")) {
+            String where1 =" 1=1 ";
             sqlFactory = new SQLFactory(this, "人员目标统计-出货");
             sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
             sqlFactory.addParameter_SQL("where", where);
-            sqlFactory.addParameter_SQL("where1", "1=1");
-            sqlFactory.addParameter("statisticaldimension", statisticaldimension);
+            if(StringUtils.isNotBlank(sa_accountclassids)){
+                if(isJSONArray(sa_accountclassids)){
+                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
+                    where1=where1+ " and t2.sa_accountclassid in"+jsonArrayResult;
+                    where1 = where1.replace("[", "(").replace("]", ")");
+                }
+            }
+            sqlFactory.addParameter_SQL("where1",where1);
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("year", year);
             actualRows = dbConnect.runSqlQuery(sqlFactory);
         }
         //收款
         if (assessmentindicators .equals("收款")) {
+            String where1 =" 1=1 ";
             sqlFactory = new SQLFactory(this, "人员目标统计-收款");
             sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
             sqlFactory.addParameter_SQL("where", where);
-            if(StringUtils.isBlank(statisticaldimension)){
-                sqlFactory.addParameter_SQL("where1", "1=1");
-            }else{
+            if(StringUtils.isNotBlank(statisticaldimension)){
                 if(isJSONArray(statisticaldimension)){
                     JSONArray jsonArrayResult = JSONArray.parseArray(statisticaldimension);
-                    String where1="t1.class in"+jsonArrayResult+" or t1.subclass in"+jsonArrayResult;
+                     where1= where1+ " and (t1.class in"+jsonArrayResult+" or t1.subclass in"+jsonArrayResult+")";
+                     where1 = where1.replace("[", "(").replace("]", ")");
+                }
+            }
+            if(StringUtils.isNotBlank(sa_accountclassids)){
+                if(isJSONArray(sa_accountclassids)){
+                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
+                    where1=where1+ " and t1.sa_accountclassid in"+jsonArrayResult;
                     where1 = where1.replace("[", "(").replace("]", ")");
-                    sqlFactory.addParameter_SQL("where1", where1);
-                }else{
-                    sqlFactory.addParameter_SQL("where1", "1=1");
                 }
-
             }
+            sqlFactory.addParameter_SQL("where1",where1);
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("year", year);
             actualRows = dbConnect.runSqlQuery(sqlFactory);
@@ -313,7 +344,7 @@ public class personnelstatistics extends Controller {
         Calendar cal = Calendar.getInstance();
         int year = cal.get(Calendar.YEAR);
 
-        Rows billRows = dbConnect.runSqlQuery("SELECT sa_salestargetbillid,assessmentindicators,statisticaldimension FROM sa_salestargetbill WHERE  year="+year+"  AND siteid ='" + siteid + "' and  targettype = '人员目标'");
+        Rows billRows = dbConnect.runSqlQuery("SELECT sa_salestargetbillid,assessmentindicators,statisticaldimension,sa_accountclassids FROM sa_salestargetbill WHERE  year="+year+"  AND siteid ='" + siteid + "' and  targettype = '人员目标'");
 
         SQLFactory hrsqlFactory = new SQLFactory(this, "业务员列表查询");
         hrsqlFactory.addParameter("siteid", siteid);
@@ -333,10 +364,13 @@ public class personnelstatistics extends Controller {
         String assessmentindicators="";
         //统计维度
         String statisticaldimension="";
+        //账户
+        String sa_accountclassids="";
         if (billRows.isNotEmpty()) {
             sa_salestargetbillid=billRows.get(0).getLong("sa_salestargetbillid");
             assessmentindicators=billRows.get(0).getString("assessmentindicators");
             statisticaldimension=billRows.get(0).getString("statisticaldimension");
+            sa_accountclassids=billRows.get(0).getString("sa_accountclassids");
         }
 
         /*
@@ -401,14 +435,23 @@ public class personnelstatistics extends Controller {
         Rows actualRows = new Rows();
         //开票
         if (assessmentindicators .equals("开票")) {
+            String where1 =" 1=1 ";
             sqlFactory = new SQLFactory(this, "人员目标统计-开票");
             sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
             sqlFactory.addParameter_SQL("where", where);
             if(statisticaldimension.equals("订单审核")){
-                sqlFactory.addParameter_SQL("where1", "t2.status='审核'");
+                where1=where1+" and t2.status='审核'";
             }else{
-                sqlFactory.addParameter_SQL("where1", "t2.status='提交'");
+                where1=where1+" and t2.status='提交'";
+            }
+            if(StringUtils.isNotBlank(sa_accountclassids)){
+                if(isJSONArray(sa_accountclassids)){
+                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
+                    where1=where1+ " and t2.sa_accountclassid in"+jsonArrayResult;
+                    where1 = where1.replace("[", "(").replace("]", ")");
+                }
             }
+            sqlFactory.addParameter_SQL("where1",where1);
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("year", year);
             actualRows = dbConnect.runSqlQuery(sqlFactory);
@@ -416,46 +459,66 @@ public class personnelstatistics extends Controller {
         }
         //订单
         if (assessmentindicators .equals("订单")) {
+            String where1 =" 1=1 ";
             sqlFactory = new SQLFactory(this, "人员目标统计-订单");
             sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
             sqlFactory.addParameter_SQL("where", where);
             if(statisticaldimension.equals("订单审核")){
-                sqlFactory.addParameter_SQL("where1", "t2.status='审核'");
+                where1=where1+" and t2.status='审核'";
             }else{
-                sqlFactory.addParameter_SQL("where1", "t2.status='提交'");
+                where1=where1+" and t2.status='提交'";
             }
+            if(StringUtils.isNotBlank(sa_accountclassids)){
+                if(isJSONArray(sa_accountclassids)){
+                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
+                    where1=where1+ " and t2.sa_accountclassid in"+jsonArrayResult;
+                    where1 = where1.replace("[", "(").replace("]", ")");
+                }
+            }
+            sqlFactory.addParameter_SQL("where1",where1);
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("year", year);
             actualRows = dbConnect.runSqlQuery(sqlFactory);
         }
         //出货
         if (assessmentindicators .equals("出货")) {
+            String where1 =" 1=1 ";
             sqlFactory = new SQLFactory(this, "人员目标统计-出货");
             sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
             sqlFactory.addParameter_SQL("where", where);
-            sqlFactory.addParameter_SQL("where1", "1=1");
+            if(StringUtils.isNotBlank(sa_accountclassids)){
+                if(isJSONArray(sa_accountclassids)){
+                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
+                    where1=where1+ " and t2.sa_accountclassid in"+jsonArrayResult;
+                    where1 = where1.replace("[", "(").replace("]", ")");
+                }
+            }
+            sqlFactory.addParameter_SQL("where1",where1);
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("year", year);
             actualRows = dbConnect.runSqlQuery(sqlFactory);
         }
         //收款
         if (assessmentindicators .equals("收款")) {
+            String where1 =" 1=1 ";
             sqlFactory = new SQLFactory(this, "人员目标统计-收款");
             sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
             sqlFactory.addParameter_SQL("where", where);
-            if(StringUtils.isBlank(statisticaldimension)){
-                sqlFactory.addParameter_SQL("where1", "1=1");
-            }else{
+            if(StringUtils.isNotBlank(statisticaldimension)){
                 if(isJSONArray(statisticaldimension)){
                     JSONArray jsonArrayResult = JSONArray.parseArray(statisticaldimension);
-                    String where1="t1.class in"+jsonArrayResult+" or t1.subclass in"+jsonArrayResult;
+                    where1= where1+ " and (t1.class in"+jsonArrayResult+" or t1.subclass in"+jsonArrayResult+")";
+                    where1 = where1.replace("[", "(").replace("]", ")");
+                }
+            }
+            if(StringUtils.isNotBlank(sa_accountclassids)){
+                if(isJSONArray(sa_accountclassids)){
+                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
+                    where1=where1+ " and t1.sa_accountclassid in"+jsonArrayResult;
                     where1 = where1.replace("[", "(").replace("]", ")");
-                    sqlFactory.addParameter_SQL("where1", where1);
-                }else{
-                    sqlFactory.addParameter_SQL("where1", "1=1");
                 }
-
             }
+            sqlFactory.addParameter_SQL("where1",where1);
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("year", year);
             actualRows = dbConnect.runSqlQuery(sqlFactory);
@@ -509,16 +572,19 @@ public class personnelstatistics extends Controller {
     public String queryList() throws YosException {
         //年份
         Long sa_salestargetbillid = content.getLong("sa_salestargetbillid");
-        Rows billRows = dbConnect.runSqlQuery("SELECT assessmentindicators,year,statisticaldimension FROM sa_salestargetbill WHERE sa_salestargetbillid=" + sa_salestargetbillid + "  AND siteid ='" + siteid + "'");
+        Rows billRows = dbConnect.runSqlQuery("SELECT assessmentindicators,year,statisticaldimension,sa_accountclassids FROM sa_salestargetbill WHERE sa_salestargetbillid=" + sa_salestargetbillid + "  AND siteid ='" + siteid + "'");
 
         //考核指标类型
         String assessmentindicators = "";
         //统计维度
         String statisticaldimension="";
+        //账户
+        String sa_accountclassids="";
         long year = 2023;
         if (billRows.isNotEmpty()) {
             assessmentindicators=billRows.get(0).getString("assessmentindicators");
             statisticaldimension=billRows.get(0).getString("statisticaldimension");
+            sa_accountclassids=billRows.get(0).getString("sa_accountclassids");
             year=billRows.get(0).getLong("year");
         }
 
@@ -596,14 +662,23 @@ public class personnelstatistics extends Controller {
         Rows actualRows = new Rows();
         //开票
         if (assessmentindicators .equals("开票")) {
+            String where1 =" 1=1 ";
             sqlFactory = new SQLFactory(this, "人员目标统计-开票");
             sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
             sqlFactory.addParameter_SQL("where", where);
             if(statisticaldimension.equals("订单审核")){
-                sqlFactory.addParameter_SQL("where1", "t2.status='审核'");
+                where1=where1+" and t2.status='审核'";
             }else{
-                sqlFactory.addParameter_SQL("where1", "t2.status='提交'");
+                where1=where1+" and t2.status='提交'";
             }
+            if(StringUtils.isNotBlank(sa_accountclassids)){
+                if(isJSONArray(sa_accountclassids)){
+                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
+                    where1=where1+ " and t2.sa_accountclassid in"+jsonArrayResult;
+                    where1 = where1.replace("[", "(").replace("]", ")");
+                }
+            }
+            sqlFactory.addParameter_SQL("where1",where1);
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("year", year);
             actualRows = dbConnect.runSqlQuery(sqlFactory);
@@ -611,50 +686,71 @@ public class personnelstatistics extends Controller {
         }
         //订单
         if (assessmentindicators .equals("订单")) {
+            String where1 =" 1=1 ";
             sqlFactory = new SQLFactory(this, "人员目标统计-订单");
             sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
             sqlFactory.addParameter_SQL("where", where);
             if(statisticaldimension.equals("订单审核")){
-                sqlFactory.addParameter_SQL("where1", "t2.status='审核'");
+                where1=where1+" and t2.status='审核'";
             }else{
-                sqlFactory.addParameter_SQL("where1", "t2.status='提交'");
+                where1=where1+" and t2.status='提交'";
             }
+            if(StringUtils.isNotBlank(sa_accountclassids)){
+                if(isJSONArray(sa_accountclassids)){
+                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
+                    where1=where1+ " and t2.sa_accountclassid in"+jsonArrayResult;
+                    where1 = where1.replace("[", "(").replace("]", ")");
+                }
+            }
+            sqlFactory.addParameter_SQL("where1",where1);
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("year", year);
             actualRows = dbConnect.runSqlQuery(sqlFactory);
         }
         //出货
         if (assessmentindicators .equals("出货")) {
+            String where1 =" 1=1 ";
             sqlFactory = new SQLFactory(this, "人员目标统计-出货");
             sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
             sqlFactory.addParameter_SQL("where", where);
-            sqlFactory.addParameter_SQL("where1", "1=1");
+            if(StringUtils.isNotBlank(sa_accountclassids)){
+                if(isJSONArray(sa_accountclassids)){
+                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
+                    where1=where1+ " and t2.sa_accountclassid in"+jsonArrayResult;
+                    where1 = where1.replace("[", "(").replace("]", ")");
+                }
+            }
+            sqlFactory.addParameter_SQL("where1",where1);
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("year", year);
             actualRows = dbConnect.runSqlQuery(sqlFactory);
         }
         //收款
         if (assessmentindicators .equals("收款")) {
+            String where1 =" 1=1 ";
             sqlFactory = new SQLFactory(this, "人员目标统计-收款");
             sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
             sqlFactory.addParameter_SQL("where", where);
-            if(StringUtils.isBlank(statisticaldimension)){
-                sqlFactory.addParameter_SQL("where1", "1=1");
-            }else{
+            if(StringUtils.isNotBlank(statisticaldimension)){
                 if(isJSONArray(statisticaldimension)){
                     JSONArray jsonArrayResult = JSONArray.parseArray(statisticaldimension);
-                    String where1="t1.class in"+jsonArrayResult+" or t1.subclass in"+jsonArrayResult;
+                    where1= where1+ " and (t1.class in"+jsonArrayResult+" or t1.subclass in"+jsonArrayResult+")";
                     where1 = where1.replace("[", "(").replace("]", ")");
-                    sqlFactory.addParameter_SQL("where1", where1);
-                }else{
-                    sqlFactory.addParameter_SQL("where1", "1=1");
                 }
-
             }
+            if(StringUtils.isNotBlank(sa_accountclassids)){
+                if(isJSONArray(sa_accountclassids)){
+                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
+                    where1=where1+ " and t1.sa_accountclassid in"+jsonArrayResult;
+                    where1 = where1.replace("[", "(").replace("]", ")");
+                }
+            }
+            sqlFactory.addParameter_SQL("where1",where1);
             sqlFactory.addParameter("siteid", siteid);
             sqlFactory.addParameter("year", year);
             actualRows = dbConnect.runSqlQuery(sqlFactory);
         }
+
         if(!saleareas.isEmpty() && saleareas.size()==1){
             for (Row row :actualRows) {
                 if(row.getLong("parentid")==0){