Sfoglia il codice sorgente

Merge branch 'develop' into develop-green

郭齐峰 2 anni fa
parent
commit
2189e7403b

BIN
lib/yos.core-2.4.11-sources.jar → lib/yos.core-2.4.12-sources.jar


BIN
lib/yos.core-2.4.11.jar → lib/yos.core-2.4.12.jar


+ 2 - 2
src/custom/restcontroller/sale/salestarget/SQL/企业-收款.sql

@@ -1,6 +1,6 @@
 with sa_salestarget as (
-   select point,year,sys_enterpriseid,sum(amount) amount from (SELECT 0+CAST(amount AS CHAR) amount, MONTH(billdate) point,YEAR(billdate) year,sys_enterpriseid FROM sa_cashbill
-    WHERE siteid =$siteid$ AND status in('审核') and ($where1$) and type=1 and YEAR (billdate)=$year$ and sys_enterpriseid in $sys_enterpriseid$) a
+   select point,year,sys_enterpriseid,sum(amount) amount from (SELECT 0+CAST(amount AS CHAR) amount, MONTH(period) point,YEAR(period) year,sys_enterpriseid FROM sa_cashbill
+    WHERE siteid =$siteid$ AND status in('审核') and ($where1$) and type=1 and YEAR (period)=$year$ and sys_enterpriseid in $sys_enterpriseid$) a
     GROUP BY point,year,sys_enterpriseid
     )
 SELECT DISTINCT m.year,

+ 4 - 13
src/custom/restcontroller/sale/salestarget/enterprise.java

@@ -172,25 +172,16 @@ public class enterprise extends Controller {
             String where1=" 1=1 ";
             sqlFactory = new SQLFactory(this, "企业-收款");
             if(StringUtils.isNotBlank(statisticaldimension)){
-                if(isJSONArray(statisticaldimension)){
-                    JSONArray jsonArrayResult = JSONArray.parseArray(statisticaldimension);
-                    if(!jsonArrayResult.isEmpty()){
-                        where1=where1+" and (class in"+jsonArrayResult+" or subclass in"+jsonArrayResult+")";
+                if(isJSONObject(statisticaldimension)){
+                    JSONObject jsonObjectResult = JSONObject.parseObject(statisticaldimension);
+                    if(!jsonObjectResult.isEmpty()){
+                        where1= where1+ " and (class in"+ jsonObjectResult.get("type")+" or subclass in"+ jsonObjectResult.get("mx")+")";
                         where1 = where1.replace("[", "(").replace("]", ")");
                     }
 
                 }
             }
-            if(StringUtils.isNotBlank(sa_accountclassids)){
-                if(isJSONArray(sa_accountclassids)){
-                    JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
-                    if(!jsonArrayResult.isEmpty()){
-                        where1=where1+ " and sa_accountclassid in"+jsonArrayResult;
-                        where1 = where1.replace("[", "(").replace("]", ")");
-                    }
 
-                }
-            }
             sqlFactory.addParameter_SQL("where1",where1);
     }
         sqlFactory.addParameter_in("sys_enterpriseid", rows.toArrayList("sys_enterpriseid",new ArrayList<Long>()));

+ 1 - 0
src/custom/restcontroller/webmanage/sale/itemclass/itemclass.java

@@ -333,6 +333,7 @@ public class itemclass extends Controller {
 				sqlFactory.addParameter("sa_brandid", row.getString("sa_brandid"));
 
 				sqlFactory.addParameter_SQL("where", where);
+				sqlFactory.addParameter_SQL("where2", " 1=1 ");
 				String sql = sqlFactory.getSQL();
 				Rows allrows = dbConnect.runSqlQuery(sql);
 				/*

+ 21 - 5
src/custom/restcontroller/webmanage/sale/order/OrderImport.java

@@ -246,16 +246,18 @@ public class OrderImport extends Controller {
                     sqlFactoryupload.addParameter("rowno", getRowNo(sa_orderid));
                     sqlFactoryupload.addParameter("itemid", row.getLong("itemid"));
                     sqlFactoryupload.addParameter("remarks", row.getString("remarks"));
-                    sqlFactoryupload.addParameter("customproperties",  row.getString("customproperties"));
+
                     sqlFactoryupload.addParameter("sa_promotion_itemsid", 0);
                     // 商品信息
                     Row itemRow = getItemRow(row.getLong("itemid"));
                     if(itemRow.getBoolean("iscustomsize")){
-                        sqlFactoryupload.addParameter("length", row.getLong("length"));
-                        sqlFactoryupload.addParameter("width",  row.getLong("width"));
+                        sqlFactoryupload.addParameter("length", row.getDouble("length"));
+                        sqlFactoryupload.addParameter("width",  row.getDouble("width"));
+                        sqlFactoryupload.addParameter("customproperties",  row.getString("customproperties"));
                     }else{
-                        sqlFactoryupload.addParameter("length", itemRow.getLong("length"));
-                        sqlFactoryupload.addParameter("width",  itemRow.getLong("width"));
+                        sqlFactoryupload.addParameter("length", itemRow.getDouble("length"));
+                        sqlFactoryupload.addParameter("width",  itemRow.getDouble("width"));
+                        sqlFactoryupload.addParameter("customproperties",  "");
                     }
 
 
@@ -317,6 +319,20 @@ public class OrderImport extends Controller {
                 dbConnect.runSqlUpdate(sqllist);
                 // 重新排序
                 updateRowNo(sa_orderid);
+
+                new OrderItems(content).updateAccountclassinfos(sa_orderid);
+                new OrderItemsHelper(this).executeDataFunction(sa_orderid);
+                //生成摘要
+                SQLFactory   sqlFactory = new SQLFactory(this, "查询定制费用统计");
+                sqlFactory.addParameter("sa_orderid", sa_orderid);
+                Rows tempRows = dbConnect.runSqlQuery(sqlFactory);
+                if (tempRows.isNotEmpty()) {
+                    String remarks = StringUtils.join(tempRows.toArray("remarks"), ";");
+                    dbConnect.runSqlUpdate("UPDATE sa_order set abstract ='" + remarks + "' WHERE sa_orderid='" + sa_orderid + "'");
+
+                } else {
+                    dbConnect.runSqlUpdate("UPDATE sa_order set abstract ='' WHERE sa_orderid='" + sa_orderid + "'");
+                }
             }
             if (iserr) {
                 ExcelFactory excelFactory = new ExcelFactory("sa_ordererr");

+ 1 - 0
src/custom/restcontroller/webmanage/sale/order/OrderItems.java

@@ -414,6 +414,7 @@ public class OrderItems extends Controller {
         JSONArray sa_orderitemsids = content.getJSONArray("sa_orderitemsids");
         SQLFactory sqlFactory = new SQLFactory(this, "订单商品明细_删除");
         sqlFactory.addParameter("siteid", siteid);
+        sqlFactory.addParameter("sa_orderid", sa_orderid);
         sqlFactory.addParameter_in("sa_orderitemsid", sa_orderitemsids.toArray());
         String sql = sqlFactory.getSQL();
         dbConnect.runSqlUpdate(sql);

+ 1 - 1
src/custom/restcontroller/webmanage/sale/order/SQL/订单商品明细_删除.sql

@@ -1,3 +1,3 @@
 delete
 from sa_orderitems
-WHERE sa_orderitemsid in $sa_orderitemsid$ and  siteid = $siteid$
+WHERE sa_orderitemsid in $sa_orderitemsid$ and  siteid = $siteid$ and sa_orderid=$sa_orderid$

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

@@ -152,4 +152,4 @@ from (
 								 left join sa_salearea t6 on t5.parentid = t6.sa_saleareaid and t5.siteid = t6.siteid
          group by  t6.sa_saleareaid,  t6.areafullname, t6.areaname) t
 where  ifnull(t.areaname,'')!='' and $where$
-order by areafullname, case when t.type = '区域' then 0 else 1 end
+order by  case when t.type = '区域汇总' then 0 else 1 end

+ 35 - 35
src/custom/restcontroller/webmanage/sale/salestarget/SQL/人员目标统计-出货.sql

@@ -62,23 +62,23 @@ from (
 								t2.parentid,
                 t2.areafullname,
                 1       level,
-                ROUND(y1a/10000,2) y1a,
-                ROUND(s1a/10000,2) s1a,
-                ROUND(s2a/10000,2) s2a,
-                ROUND(s3a/10000,2) s3a,
-                ROUND(s4a/10000,2) s4a,
-                ROUND(m1a/10000,2) m1a,
-                ROUND(m2a/10000,2) m2a,
-                ROUND(m3a/10000,2) m3a,
-                ROUND(m4a/10000,2) m4a,
-                ROUND(m5a/10000,2) m5a,
-                ROUND(m6a/10000,2) m6a,
-                ROUND(m7a/10000,2) m7a,
-                ROUND(m8a/10000,2) m8a,
-                ROUND(m9a/10000,2) m9a,
-                ROUND(m10a/10000,2) m10a,
-                ROUND(m11a/10000,2) m11a,
-                ROUND(m12a/10000,2) m12a
+                 CAST(ROUND(y1a,2) AS DECIMAL(16,2)) y1a,
+                 CAST(ROUND(s1a,2) AS DECIMAL(16,2))  s1a,
+                 CAST(ROUND(s2a,2) AS DECIMAL(16,2)) s2a,
+                 CAST(ROUND(s3a,2) AS DECIMAL(16,2))  s3a,
+                 CAST(ROUND(s4a,2) AS DECIMAL(16,2))  s4a,
+                 CAST(ROUND(m1a,2) AS DECIMAL(16,2))  m1a,
+                 CAST(ROUND(m2a,2) AS DECIMAL(16,2))  m2a,
+                 CAST(ROUND(m3a,2) AS DECIMAL(16,2))  m3a,
+                 CAST(ROUND(m4a,2) AS DECIMAL(16,2))   m4a,
+                 CAST(ROUND(m5a,2) AS DECIMAL(16,2))  m5a,
+                 CAST(ROUND(m6a,2) AS DECIMAL(16,2))   m6a,
+                 CAST(ROUND(m7a,2) AS DECIMAL(16,2))   m7a,
+                 CAST(ROUND(m8a,2) AS DECIMAL(16,2))  m8a,
+                 CAST(ROUND(m9a,2) AS DECIMAL(16,2))  m9a,
+                 CAST(ROUND(m10a,2) AS DECIMAL(16,2))  m10a,
+                 CAST(ROUND(m11a,2) AS DECIMAL(16,2))  m11a,
+                 CAST(ROUND(m12a,2) AS DECIMAL(16,2))  m12a
          from hrtarget t1
                   INNER JOIN sa_salearea t2 ON t2.sa_saleareaid = t1.sa_saleareaid
 			  union all
@@ -88,26 +88,26 @@ from (
 								t6.parentid,
                 t6.areafullname,
                 0        level,
-                ROUND(sum(y1a)/10000,2) y1a,
-                ROUND(sum(s1a)/10000,2) s1a,
-                ROUND(sum(s2a)/10000,2) s2a,
-                ROUND(sum(s3a)/10000,2) s3a,
-                ROUND(sum(s4a)/10000,2) s4a,
-                ROUND(sum(m1a)/10000,2) m1a,
-                ROUND(sum(m2a)/10000,2) m2a,
-                ROUND(sum(m3a)/10000,2) m3a,
-                ROUND(sum(m4a)/10000,2) m4a,
-                ROUND(sum(m5a)/10000,2) m5a,
-                ROUND(sum(m6a)/10000,2) m6a,
-                ROUND(sum(m7a)/10000,2) m7a,
-                ROUND(sum(m8a)/10000,2) m8a,
-                ROUND(sum(m9a)/10000,2) m9a,
-                ROUND(sum(m10a)/10000,2) m10a,
-                ROUND(sum(m11a)/10000,2) m11a,
-                ROUND(sum(m12a)/10000,2) m12a
+                CAST(ROUND(sum(y1a),2)  AS DECIMAL(16,2)) y1a,
+                CAST(ROUND(sum(s1a),2)  AS DECIMAL(16,2)) s1a,
+                CAST(ROUND(sum(s2a),2)  AS DECIMAL(16,2)) s2a,
+                CAST(ROUND(sum(s3a),2)  AS DECIMAL(16,2)) s3a,
+                CAST(ROUND(sum(s4a),2)  AS DECIMAL(16,2)) s4a,
+                CAST(ROUND(sum(m1a),2)  AS DECIMAL(16,2)) m1a,
+                CAST(ROUND(sum(m2a),2)  AS DECIMAL(16,2)) m2a,
+                CAST(ROUND(sum(m3a),2) AS DECIMAL(16,2)) m3a,
+                CAST(ROUND(sum(m4a),2)  AS DECIMAL(16,2)) m4a,
+                CAST(ROUND(sum(m5a),2)  AS DECIMAL(16,2)) m5a,
+                CAST(ROUND(sum(m6a),2)  AS DECIMAL(16,2)) m6a,
+                CAST(ROUND(sum(m7a),2)  AS DECIMAL(16,2)) m7a,
+                CAST(ROUND(sum(m8a),2)  AS DECIMAL(16,2)) m8a,
+                CAST(ROUND(sum(m9a),2)  AS DECIMAL(16,2)) m9a,
+                CAST(ROUND(sum(m10a),2)  AS DECIMAL(16,2)) m10a,
+                CAST(ROUND(sum(m11a),2)  AS DECIMAL(16,2)) m11a,
+                CAST(ROUND(sum(m12a),2)  AS DECIMAL(16,2)) m12a
          from hrtarget t1
                 left join sa_salearea t5 on t1.sa_saleareaid = t5.sa_saleareaid
 								 left join sa_salearea t6 on t5.parentid = t6.sa_saleareaid and t5.siteid = t6.siteid
          group by  t6.sa_saleareaid,  t6.areafullname, t6.areaname) t
 where $where$
-order by areafullname, case when t.type = '区域' then 0 else 1 end
+order by  case when t.type = '区域汇总' then 0 else 1 end

+ 1 - 1
src/custom/restcontroller/webmanage/sale/salestarget/SQL/人员目标统计-开票.sql

@@ -99,4 +99,4 @@ from (
 								 left join sa_salearea t6 on t5.parentid = t6.sa_saleareaid and t5.siteid = t6.siteid
          group by  t6.sa_saleareaid,  t6.areafullname, t6.areaname) t
 where  $where$
-order by areafullname, case when t.type = '区域' then 0 else 1 end
+order by  case when t.type = '区域汇总' then 0 else 1 end

+ 37 - 37
src/custom/restcontroller/webmanage/sale/salestarget/SQL/人员目标统计-收款.sql

@@ -1,10 +1,10 @@
 with sa_salestarget as
          (
- select 0+CAST(sum(amount) AS CHAR) amount,point,sa_saleareaid,type from (SELECT t1.amount, MONTH (t1.createdate) point,ifnull(t4.sa_saleareaid,0) sa_saleareaid,'月' type
+ select 0+CAST(sum(amount) AS CHAR) amount,point,sa_saleareaid,type from (SELECT t1.amount, MONTH (t1.period) point,ifnull(t4.sa_saleareaid,0) sa_saleareaid,'月' type
 FROM sa_cashbill t1
 		left join sys_enterprise_tradefield t3 on t1.sys_enterpriseid=t3.sys_enterpriseid and t1.siteid=t3.siteid
 		left join sa_salearea t4 on t4.sa_saleareaid=t3.sa_saleareaid and t4.siteid=t3.siteid
-WHERE YEAR (t1.createdate)=$year$ AND t1.siteid=$siteid$ AND t1.status in('审核') and t1.type=1 and ($where1$)) a
+WHERE YEAR (t1.period)=$year$ AND t1.siteid=$siteid$ AND t1.status in('审核') and t1.type=1 and ($where1$)) a
 GROUP BY point,sa_saleareaid,type
     )
         , hrtarget as (
@@ -53,23 +53,23 @@ from (
 								t2.parentid,
                 t2.areafullname,
                 1       level,
-                ROUND(y1a/10000,2) y1a,
-                ROUND(s1a/10000,2) s1a,
-                ROUND(s2a/10000,2) s2a,
-                ROUND(s3a/10000,2) s3a,
-                ROUND(s4a/10000,2) s4a,
-                ROUND(m1a/10000,2) m1a,
-                ROUND(m2a/10000,2) m2a,
-                ROUND(m3a/10000,2) m3a,
-                ROUND(m4a/10000,2) m4a,
-                ROUND(m5a/10000,2) m5a,
-                ROUND(m6a/10000,2) m6a,
-                ROUND(m7a/10000,2) m7a,
-                ROUND(m8a/10000,2) m8a,
-                ROUND(m9a/10000,2) m9a,
-                ROUND(m10a/10000,2) m10a,
-                ROUND(m11a/10000,2) m11a,
-                ROUND(m12a/10000,2) m12a
+                CAST(ROUND(y1a,2) AS DECIMAL(16,2)) y1a,
+                CAST(ROUND(s1a,2) AS DECIMAL(16,2))  s1a,
+                CAST(ROUND(s2a,2) AS DECIMAL(16,2)) s2a,
+                CAST(ROUND(s3a,2) AS DECIMAL(16,2))  s3a,
+                CAST(ROUND(s4a,2) AS DECIMAL(16,2))  s4a,
+                CAST(ROUND(m1a,2) AS DECIMAL(16,2))  m1a,
+                CAST(ROUND(m2a,2) AS DECIMAL(16,2))  m2a,
+                CAST(ROUND(m3a,2) AS DECIMAL(16,2))  m3a,
+                CAST(ROUND(m4a,2) AS DECIMAL(16,2))   m4a,
+                CAST(ROUND(m5a,2) AS DECIMAL(16,2))  m5a,
+                CAST(ROUND(m6a,2) AS DECIMAL(16,2))   m6a,
+                CAST(ROUND(m7a,2) AS DECIMAL(16,2))   m7a,
+                CAST(ROUND(m8a,2) AS DECIMAL(16,2))  m8a,
+                CAST(ROUND(m9a,2) AS DECIMAL(16,2))  m9a,
+                CAST(ROUND(m10a,2) AS DECIMAL(16,2))  m10a,
+                CAST(ROUND(m11a,2) AS DECIMAL(16,2))  m11a,
+                CAST(ROUND(m12a,2) AS DECIMAL(16,2))  m12a
          from hrtarget t1
                   INNER JOIN sa_salearea t2 ON t2.sa_saleareaid = t1.sa_saleareaid
 			  union all
@@ -79,26 +79,26 @@ from (
 								t6.parentid,
                 t6.areafullname,
                 0        level,
-                ROUND(sum(y1a)/10000,2) y1a,
-                ROUND(sum(s1a)/10000,2) s1a,
-                ROUND(sum(s2a)/10000,2) s2a,
-                ROUND(sum(s3a)/10000,2) s3a,
-                ROUND(sum(s4a)/10000,2) s4a,
-                ROUND(sum(m1a)/10000,2) m1a,
-                ROUND(sum(m2a)/10000,2) m2a,
-                ROUND(sum(m3a)/10000,2) m3a,
-                ROUND(sum(m4a)/10000,2) m4a,
-                ROUND(sum(m5a)/10000,2) m5a,
-                ROUND(sum(m6a)/10000,2) m6a,
-                ROUND(sum(m7a)/10000,2) m7a,
-                ROUND(sum(m8a)/10000,2) m8a,
-                ROUND(sum(m9a)/10000,2) m9a,
-                ROUND(sum(m10a)/10000,2) m10a,
-                ROUND(sum(m11a)/10000,2) m11a,
-                ROUND(sum(m12a)/10000,2) m12a
+                CAST(ROUND(sum(y1a),2)  AS DECIMAL(16,2)) y1a,
+                CAST(ROUND(sum(s1a),2)  AS DECIMAL(16,2)) s1a,
+                CAST(ROUND(sum(s2a),2)  AS DECIMAL(16,2)) s2a,
+                CAST(ROUND(sum(s3a),2)  AS DECIMAL(16,2)) s3a,
+                CAST(ROUND(sum(s4a),2)  AS DECIMAL(16,2)) s4a,
+                CAST(ROUND(sum(m1a),2)  AS DECIMAL(16,2)) m1a,
+                CAST(ROUND(sum(m2a),2)  AS DECIMAL(16,2)) m2a,
+                CAST(ROUND(sum(m3a),2) AS DECIMAL(16,2)) m3a,
+                CAST(ROUND(sum(m4a),2)  AS DECIMAL(16,2)) m4a,
+                CAST(ROUND(sum(m5a),2)  AS DECIMAL(16,2)) m5a,
+                CAST(ROUND(sum(m6a),2)  AS DECIMAL(16,2)) m6a,
+                CAST(ROUND(sum(m7a),2)  AS DECIMAL(16,2)) m7a,
+                CAST(ROUND(sum(m8a),2)  AS DECIMAL(16,2)) m8a,
+                CAST(ROUND(sum(m9a),2)  AS DECIMAL(16,2)) m9a,
+                CAST(ROUND(sum(m10a),2)  AS DECIMAL(16,2)) m10a,
+                CAST(ROUND(sum(m11a),2)  AS DECIMAL(16,2)) m11a,
+                CAST(ROUND(sum(m12a),2)  AS DECIMAL(16,2)) m12a
          from hrtarget t1
                 left join sa_salearea t5 on t1.sa_saleareaid = t5.sa_saleareaid
 								 left join sa_salearea t6 on t5.parentid = t6.sa_saleareaid and t5.siteid = t6.siteid
          group by  t6.sa_saleareaid,  t6.areafullname, t6.areaname) t
 where $where$
-order by areafullname, case when t.type = '区域' then 0 else 1 end
+order by  case when t.type = '区域汇总' then 0 else 1 end

+ 35 - 35
src/custom/restcontroller/webmanage/sale/salestarget/SQL/人员目标统计-订单.sql

@@ -51,23 +51,23 @@ from (
 								t2.parentid,
                 t2.areafullname,
                 1       level,
-                ROUND(y1a/10000,2) y1a,
-                ROUND(s1a/10000,2) s1a,
-                ROUND(s2a/10000,2) s2a,
-                ROUND(s3a/10000,2) s3a,
-                ROUND(s4a/10000,2) s4a,
-                ROUND(m1a/10000,2) m1a,
-                ROUND(m2a/10000,2) m2a,
-                ROUND(m3a/10000,2) m3a,
-                ROUND(m4a/10000,2) m4a,
-                ROUND(m5a/10000,2) m5a,
-                ROUND(m6a/10000,2) m6a,
-                ROUND(m7a/10000,2) m7a,
-                ROUND(m8a/10000,2) m8a,
-                ROUND(m9a/10000,2) m9a,
-                ROUND(m10a/10000,2) m10a,
-                ROUND(m11a/10000,2) m11a,
-                ROUND(m12a/10000,2) m12a
+                CAST(ROUND(y1a,2) AS DECIMAL(16,2)) y1a,
+                CAST(ROUND(s1a,2) AS DECIMAL(16,2))  s1a,
+                CAST(ROUND(s2a,2) AS DECIMAL(16,2)) s2a,
+                CAST(ROUND(s3a,2) AS DECIMAL(16,2))  s3a,
+                CAST(ROUND(s4a,2) AS DECIMAL(16,2))  s4a,
+                CAST(ROUND(m1a,2) AS DECIMAL(16,2))  m1a,
+                CAST(ROUND(m2a,2) AS DECIMAL(16,2))  m2a,
+                CAST(ROUND(m3a,2) AS DECIMAL(16,2))  m3a,
+                CAST(ROUND(m4a,2) AS DECIMAL(16,2))   m4a,
+                CAST(ROUND(m5a,2) AS DECIMAL(16,2))  m5a,
+                CAST(ROUND(m6a,2) AS DECIMAL(16,2))   m6a,
+                CAST(ROUND(m7a,2) AS DECIMAL(16,2))   m7a,
+                CAST(ROUND(m8a,2) AS DECIMAL(16,2))  m8a,
+                CAST(ROUND(m9a,2) AS DECIMAL(16,2))  m9a,
+                CAST(ROUND(m10a,2) AS DECIMAL(16,2))  m10a,
+                CAST(ROUND(m11a,2) AS DECIMAL(16,2))  m11a,
+                CAST(ROUND(m12a,2) AS DECIMAL(16,2))  m12a
          from hrtarget t1
                   INNER JOIN sa_salearea t2 ON t2.sa_saleareaid = t1.sa_saleareaid
 			  union all
@@ -77,26 +77,26 @@ from (
 								t6.parentid,
                 t6.areafullname,
                 0        level,
-                ROUND(sum(y1a)/10000,2) y1a,
-                ROUND(sum(s1a)/10000,2) s1a,
-                ROUND(sum(s2a)/10000,2) s2a,
-                ROUND(sum(s3a)/10000,2) s3a,
-                ROUND(sum(s4a)/10000,2) s4a,
-                ROUND(sum(m1a)/10000,2) m1a,
-                ROUND(sum(m2a)/10000,2) m2a,
-                ROUND(sum(m3a)/10000,2) m3a,
-                ROUND(sum(m4a)/10000,2) m4a,
-                ROUND(sum(m5a)/10000,2) m5a,
-                ROUND(sum(m6a)/10000,2) m6a,
-                ROUND(sum(m7a)/10000,2) m7a,
-                ROUND(sum(m8a)/10000,2) m8a,
-                ROUND(sum(m9a)/10000,2) m9a,
-                ROUND(sum(m10a)/10000,2) m10a,
-                ROUND(sum(m11a)/10000,2) m11a,
-                ROUND(sum(m12a)/10000,2) m12a
+                CAST(ROUND(sum(y1a),2)  AS DECIMAL(16,2)) y1a,
+                CAST(ROUND(sum(s1a),2)  AS DECIMAL(16,2)) s1a,
+                CAST(ROUND(sum(s2a),2)  AS DECIMAL(16,2)) s2a,
+                CAST(ROUND(sum(s3a),2)  AS DECIMAL(16,2)) s3a,
+                CAST(ROUND(sum(s4a),2)  AS DECIMAL(16,2)) s4a,
+                CAST(ROUND(sum(m1a),2)  AS DECIMAL(16,2)) m1a,
+                CAST(ROUND(sum(m2a),2)  AS DECIMAL(16,2)) m2a,
+                CAST(ROUND(sum(m3a),2) AS DECIMAL(16,2)) m3a,
+                CAST(ROUND(sum(m4a),2)  AS DECIMAL(16,2)) m4a,
+                CAST(ROUND(sum(m5a),2)  AS DECIMAL(16,2)) m5a,
+                CAST(ROUND(sum(m6a),2)  AS DECIMAL(16,2)) m6a,
+                CAST(ROUND(sum(m7a),2)  AS DECIMAL(16,2)) m7a,
+                CAST(ROUND(sum(m8a),2)  AS DECIMAL(16,2)) m8a,
+                CAST(ROUND(sum(m9a),2)  AS DECIMAL(16,2)) m9a,
+                CAST(ROUND(sum(m10a),2)  AS DECIMAL(16,2)) m10a,
+                CAST(ROUND(sum(m11a),2)  AS DECIMAL(16,2)) m11a,
+                CAST(ROUND(sum(m12a),2)  AS DECIMAL(16,2)) m12a
          from hrtarget t1
                 left join sa_salearea t5 on t1.sa_saleareaid = t5.sa_saleareaid
 								 left join sa_salearea t6 on t5.parentid = t6.sa_saleareaid and t5.siteid = t6.siteid
          group by  t6.sa_saleareaid,  t6.areafullname, t6.areaname) t
 where  $where$
-order by areafullname, case when t.type = '区域' then 0 else 1 end
+order by  case when t.type = '区域汇总' then 0 else 1 end

+ 12 - 0
src/custom/restcontroller/webmanage/sale/salestarget/SQL/更新新年度.sql

@@ -0,0 +1,12 @@
+UPDATE sa_salestargetbill
+SET
+    assessmentindicators = $assessmentindicators$,
+    sa_accountclassids=$sa_accountclassids$,
+    statisticaldimension=$statisticaldimension$,
+    changeuserid=$userid$,
+    changeby=$username$
+WHERE sa_salestargetbillid = $sa_salestargetbillid$ and siteid=$siteid$
+
+
+
+

+ 14 - 4
src/custom/restcontroller/webmanage/sale/salestarget/enterprisetarget.java

@@ -65,6 +65,16 @@ public class enterprisetarget extends Controller {
 
                 sqlList.add(sqlFactory.getSQL());
             }
+        }else{
+            SQLFactory sqlFactory = new SQLFactory(this, "更新新年度");
+            sqlFactory.addParameter("siteid", siteid);
+            sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
+            sqlFactory.addParameter("username", username);
+            sqlFactory.addParameter("userid", userid);
+            sqlFactory.addParameter("assessmentindicators", assessmentindicators);
+            sqlFactory.addParameter("statisticaldimension", statisticaldimension);
+            sqlFactory.addParameter("sa_accountclassids", sa_accountclassids);
+            sqlList.add(sqlFactory.getSQL());
         }
 
 
@@ -265,10 +275,10 @@ public class enterprisetarget extends Controller {
             sqlFactory = new SQLFactory(new enterprise(new JSONObject()), "企业-收款");
             String where1=" 1=1 ";
             if(StringUtils.isNotBlank(statisticaldimension)){
-                if(isJSONArray(statisticaldimension)){
-                    JSONArray jsonArrayResult = JSONArray.parseArray(statisticaldimension);
-                    if(!jsonArrayResult.isEmpty()){
-                        where1=where1+" and (class in"+jsonArrayResult+" or subclass in"+jsonArrayResult+")";
+                if(isJSONObject(statisticaldimension)){
+                    JSONObject jsonObjectResult = JSONObject.parseObject(statisticaldimension);
+                    if(!jsonObjectResult.isEmpty()){
+                        where1= where1+ " and (class in"+ jsonObjectResult.get("type")+" or subclass in"+ jsonObjectResult.get("mx")+")";
                         where1 = where1.replace("[", "(").replace("]", ")");
                     }
 

+ 17 - 1
src/custom/restcontroller/webmanage/sale/salestarget/personnel.java

@@ -73,6 +73,16 @@ public class personnel extends Controller {
             String sql = saleareahrsqlFactory.getSQL();
             Rows saleareahrrows = dbConnect.runSqlQuery(sql);
             salesArray=saleareahrrows.toJsonArray();
+        }else{
+            SQLFactory sqlFactory = new SQLFactory(this, "更新新年度");
+            sqlFactory.addParameter("siteid", siteid);
+            sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
+            sqlFactory.addParameter("username", username);
+            sqlFactory.addParameter("userid", userid);
+            sqlFactory.addParameter("assessmentindicators", assessmentindicators);
+            sqlFactory.addParameter("statisticaldimension", statisticaldimension);
+            sqlFactory.addParameter("sa_accountclassids", sa_accountclassids);
+            sqlList.add(sqlFactory.getSQL());
         }
 
 
@@ -220,6 +230,9 @@ public class personnel extends Controller {
             if(isJSONArray(row.getString("statisticaldimension"))){
                 row.put("statisticaldimension",JSONArray.parseArray(row.getString("statisticaldimension")));
             }
+            if(isJSONObject(row.getString("statisticaldimension"))){
+                row.put("statisticaldimension",JSONObject.parseObject(row.getString("statisticaldimension")));
+            }
             if(isJSONArray(row.getString("sa_accountclassids"))){
                 JSONArray sa_accountclassids =JSONArray.parseArray(row.getString("sa_accountclassids"));
                 for (Object object:sa_accountclassids) {
@@ -253,6 +266,9 @@ public class personnel extends Controller {
             if(isJSONArray(row.getString("statisticaldimension"))){
                 row.put("statisticaldimension",JSONArray.parseArray(row.getString("statisticaldimension")));
             }
+            if(isJSONObject(row.getString("statisticaldimension"))){
+                row.put("statisticaldimension",JSONObject.parseObject(row.getString("statisticaldimension")));
+            }
             if(isJSONArray(row.getString("sa_accountclassids"))){
                 JSONArray sa_accountclassids =JSONArray.parseArray(row.getString("sa_accountclassids"));
                 for (Object object:sa_accountclassids) {
@@ -346,7 +362,7 @@ public class personnel extends Controller {
         sqlFactory.addParameter("siteid", siteid);
         String sql = sqlFactory.getSQL();
         Rows rows = dbConnect.runSqlQuery(sql);
-        Rows saleareas = dbConnect.runSqlQuery("select * from sa_salearea where parentid=0");
+        Rows saleareas = dbConnect.runSqlQuery("select * from sa_salearea where parentid=0 and siteid='"+siteid+"'");
         Long sa_saleareaid=0l;
         if(!saleareas.isEmpty() && saleareas.size()==1){
             sa_saleareaid=saleareas.get(0).getLong("sa_saleareaid");

+ 17 - 15
src/custom/restcontroller/webmanage/sale/salestarget/personnelstatistics.java

@@ -164,7 +164,7 @@ public class personnelstatistics extends Controller {
         String sql = sqlFactory.getSQL();
         Rows rows = dbConnect.runSqlQuery(sql);
 
-        Rows saleareas = dbConnect.runSqlQuery("select * from sa_salearea where parentid=0");
+        Rows saleareas = dbConnect.runSqlQuery("select * from sa_salearea where parentid=0 and siteid='"+siteid+"'");
         Long sa_saleareaidtop=0l;
         if(!saleareas.isEmpty() && saleareas.size()==1){
             sa_saleareaidtop=saleareas.get(0).getLong("sa_saleareaid");
@@ -293,10 +293,10 @@ public class personnelstatistics extends Controller {
             sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
             sqlFactory.addParameter_SQL("where", where);
             if(StringUtils.isNotBlank(statisticaldimension)){
-                if(isJSONArray(statisticaldimension)){
-                    JSONArray jsonArrayResult = JSONArray.parseArray(statisticaldimension);
-                    if(!jsonArrayResult.isEmpty()){
-                        where1= where1+ " and (t1.class in"+jsonArrayResult+" or t1.subclass in"+jsonArrayResult+")";
+                if(isJSONObject(statisticaldimension)){
+                    JSONObject jsonObjectResult = JSONObject.parseObject(statisticaldimension);
+                    if(!jsonObjectResult.isEmpty()){
+                        where1= where1+ " and (t1.class in"+ jsonObjectResult.get("type")+" or t1.subclass in"+ jsonObjectResult.get("mx")+")";
                         where1 = where1.replace("[", "(").replace("]", ")");
                     }
 
@@ -414,7 +414,7 @@ public class personnelstatistics extends Controller {
         String sql = sqlFactory.getSQL();
         Rows rows = dbConnect.runSqlQuery(sql);
 
-        Rows saleareas = dbConnect.runSqlQuery("select * from sa_salearea where parentid=0");
+        Rows saleareas = dbConnect.runSqlQuery("select * from sa_salearea where parentid=0 and siteid='"+siteid+"'");
         Long sa_saleareaidtop=0l;
         if(!saleareas.isEmpty() && saleareas.size()==1){
             sa_saleareaidtop=saleareas.get(0).getLong("sa_saleareaid");
@@ -543,15 +543,16 @@ public class personnelstatistics extends Controller {
             sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
             sqlFactory.addParameter_SQL("where", where);
             if(StringUtils.isNotBlank(statisticaldimension)){
-                if(isJSONArray(statisticaldimension)){
-                    JSONArray jsonArrayResult = JSONArray.parseArray(statisticaldimension);
-                    if(!jsonArrayResult.isEmpty()){
-                        where1= where1+ " and (t1.class in"+jsonArrayResult+" or t1.subclass in"+jsonArrayResult+")";
+                if(isJSONObject(statisticaldimension)){
+                    JSONObject jsonObjectResult = JSONObject.parseObject(statisticaldimension);
+                    if(!jsonObjectResult.isEmpty()){
+                        where1= where1+ " and (t1.class in"+ jsonObjectResult.get("type")+" or t1.subclass in"+ jsonObjectResult.get("mx")+")";
                         where1 = where1.replace("[", "(").replace("]", ")");
                     }
 
                 }
             }
+
             if(StringUtils.isNotBlank(sa_accountclassids)){
                 if(isJSONArray(sa_accountclassids)){
                     JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);
@@ -656,7 +657,7 @@ public class personnelstatistics extends Controller {
         String sql = sqlFactory.getSQL();
         Rows rows = dbConnect.runSqlQuery(sql);
 
-        Rows saleareas = dbConnect.runSqlQuery("select * from sa_salearea where parentid=0");
+        Rows saleareas = dbConnect.runSqlQuery("select * from sa_salearea where parentid=0 and siteid='"+siteid+"'");
         Long sa_saleareaidtop=0l;
         if(!saleareas.isEmpty() && saleareas.size()==1){
             sa_saleareaidtop=saleareas.get(0).getLong("sa_saleareaid");
@@ -784,15 +785,16 @@ public class personnelstatistics extends Controller {
             sqlFactory.addParameter("sa_salestargetbillid", sa_salestargetbillid);
             sqlFactory.addParameter_SQL("where", where);
             if(StringUtils.isNotBlank(statisticaldimension)){
-                if(isJSONArray(statisticaldimension)){
-                    JSONArray jsonArrayResult = JSONArray.parseArray(statisticaldimension);
-                    if(!jsonArrayResult.isEmpty()){
-                        where1= where1+ " and (t1.class in"+jsonArrayResult+" or t1.subclass in"+jsonArrayResult+")";
+                if(isJSONObject(statisticaldimension)){
+                    JSONObject jsonObjectResult = JSONObject.parseObject(statisticaldimension);
+                    if(!jsonObjectResult.isEmpty()){
+                        where1= where1+ " and (t1.class in"+ jsonObjectResult.get("type")+" or t1.subclass in"+ jsonObjectResult.get("mx")+")";
                         where1 = where1.replace("[", "(").replace("]", ")");
                     }
 
                 }
             }
+
             if(StringUtils.isNotBlank(sa_accountclassids)){
                 if(isJSONArray(sa_accountclassids)){
                     JSONArray jsonArrayResult = JSONArray.parseArray(sa_accountclassids);