Browse Source

Merge branch 'develop-green' into develop

hu 1 năm trước cách đây
mục cha
commit
f9486da2f5

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

@@ -5153,150 +5153,187 @@ public class R {
         public static class v1 {
         }
     }
+
     public static class ID20230720143503 {
         public static class v1 {
         }
     }
+
     public static class ID20230720143603 {
         public static class v1 {
         }
     }
+
     public static class ID20230720152503 {
         public static class v1 {
         }
     }
+
     public static class ID20230721104302 {
         public static class v1 {
         }
     }
+
     public static class ID20230721110502 {
         public static class v1 {
         }
     }
+
     public static class ID20230728133003 {
         public static class v1 {
         }
     }
+
     public static class ID20230728143503 {
         public static class v1 {
         }
     }
+
     public static class ID20230729103203 {
         public static class v1 {
         }
     }
+
     public static class ID20230726111403 {
         public static class v1 {
         }
     }
+
     public static class ID20230729142603 {
         public static class v1 {
         }
     }
+
     public static class ID20230729165303 {
         public static class v1 {
         }
     }
+
     public static class ID20230802093703 {
         public static class v1 {
         }
     }
+
     public static class ID20230802100103 {
         public static class v1 {
         }
     }
+
     public static class ID20230802103303 {
         public static class v1 {
         }
     }
+
     public static class ID20230802111003 {
         public static class v1 {
         }
     }
+
     public static class ID20230803140903 {
         public static class v1 {
         }
     }
+
     public static class ID20230803143703 {
         public static class v1 {
         }
     }
+
     public static class ID20230803165003 {
         public static class v1 {
         }
     }
+
     public static class ID20230815151203 {
         public static class v1 {
         }
     }
+
     public static class ID20230818135003 {
         public static class v1 {
         }
     }
+
     public static class ID20230826091303 {
         public static class v1 {
         }
     }
+
     public static class ID20230829161203 {
         public static class v1 {
         }
     }
+
     public static class ID20230706103703 {
         public static class v1 {
         }
     }
+
     public static class ID20230913154803 {
         public static class v1 {
         }
     }
+
     public static class ID20230918155003 {
         public static class v1 {
         }
     }
+
     public static class ID20230918155103 {
         public static class v1 {
         }
     }
+
     public static class ID20230920134403 {
         public static class v1 {
         }
     }
+
     public static class ID20230927135803 {
         public static class v1 {
         }
     }
+
     public static class ID20231007101703 {
         public static class v1 {
         }
     }
+
     public static class ID20231007101803 {
         public static class v1 {
         }
     }
+
     public static class ID20231018093803 {
         public static class v1 {
         }
     }
+
     public static class ID20231018103203 {
         public static class v1 {
         }
     }
+
     public static class ID20231018103303 {
         public static class v1 {
         }
     }
+
     public static class ID20231018142103 {
         public static class v1 {
         }
     }
+
     public static class ID20231018162103 {
         public static class v1 {
         }
     }
+
     public static class ID20231020111203 {
         public static class v1 {
         }
     }
+
     public static class ID20231020111303 {
         public static class v1 {
         }
@@ -5322,90 +5359,112 @@ public class R {
         public static class v1 {
         }
     }
+
     public static class ID20231024110003 {
         public static class v1 {
         }
     }
+
     public static class ID20231025144003 {
         public static class v1 {
         }
     }
+
     public static class ID20231025144103 {
         public static class v1 {
         }
     }
+
     public static class ID20231025160203 {
         public static class v1 {
         }
     }
+
     public static class ID20231030091403 {
         public static class v1 {
         }
     }
+
     public static class ID20231030093503 {
         public static class v1 {
         }
     }
+
     public static class ID20231103100503 {
         public static class v1 {
         }
     }
+
     public static class ID20231115095103 {
         public static class v1 {
         }
     }
+
     public static class ID20231201144302 {
         public static class v1 {
         }
     }
+
     public static class ID20231201145402 {
         public static class v1 {
         }
     }
+
     public static class ID20231201145502 {
         public static class v1 {
         }
     }
+
     public static class ID20231201153702 {
         public static class v1 {
         }
     }
+
     public static class ID20230706094703 {
         public static class v1 {
         }
     }
+
     public static class ID20231205134103 {
         public static class v1 {
         }
     }
+
     public static class ID20231208133902 {
         public static class v1 {
         }
     }
+
     public static class ID20231208134002 {
         public static class v1 {
         }
     }
+
     public static class ID20231208134102 {
         public static class v1 {
         }
     }
+
     public static class ID20231208134202 {
         public static class v1 {
         }
     }
+
     public static class ID20231211141802 {
         public static class v1 {
         }
     }
+
     public static class ID20231212110202 {
         public static class v1 {
         }
     }
+
     public static class ID20231212111202 {
         public static class v1 {
         }
     }
+
     public static class ID2023121221131702 {
         public static class v1 {
         }
@@ -5420,6 +5479,7 @@ public class R {
         public static class v1 {
         }
     }
+
     public static class ID20231121145103 {
         public static class v1 {
         }
@@ -5434,14 +5494,41 @@ public class R {
         public static class v1 {
         }
     }
+
     public static class ID20240123163302 {
         public static class v1 {
         }
     }
+
     public static class ID2024020201095102 {
         public static class v1 {
         }
     }
+
+    public static class ID20240407094804 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID20240407094904 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID20240407095004 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID20240407095104 {
+        public static class v1 {
+        }
+    }
+
+    public static class ID20240407095204 {
+        public static class v1 {
+        }
+    }
     public static class ID20231108160203 {
         public static class v1 {
         }

+ 5 - 4
src/custom/restcontroller/webmanage/sale/dispatch/SQL/商品发货数量汇总.sql

@@ -1,6 +1,7 @@
 SELECT  t3.itemno,
-        SUM(t1.qty-ifnull(t1.outwarehouseqty,0)) qty
+        ifnull(t1.batchno,'') batchno,
+    SUM(t1.qty-ifnull(t1.outwarehouseqty,0)) qty
 FROM sa_dispatch_items t1
-         inner join sa_dispatch t2 on t1.siteid = t2.siteid and t1.sa_dispatchid = t2.sa_dispatchid
-         left join plm_item t3 on t1.siteid = t3.siteid and t1.itemid = t3.itemid
-WHERE t2.STATUS in ('审核','复核') and t1.siteid=$siteid$ and t3.itemno in $itemno$ group by t3.itemno
+    inner join sa_dispatch t2 on t1.siteid = t2.siteid and t1.sa_dispatchid = t2.sa_dispatchid
+    left join plm_item t3 on t1.siteid = t3.siteid and t1.itemid = t3.itemid
+WHERE t2.STATUS in ('审核','复核') and t1.siteid=$siteid$ and t3.itemno in $itemno$ group by t3.itemno,ifnull(t1.batchno,'')

+ 18 - 6
src/custom/restcontroller/webmanage/sale/dispatch/dispatch.java

@@ -721,7 +721,7 @@ public class dispatch extends Controller {
 
         Rows rowscurrentDispatchDetail = dbConnect.runSqlQuery("select sum(t1.qty) qty,t1.sa_orderitemsid,t1.siteid,t2.itemno from sa_dispatch_items t1 left join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid  where t1.sa_dispatchid=" + sa_dispatchid + " group by t1.sa_orderitemsid,t1.siteid,t2.itemno");
 
-        Rows rowsDispatchDetailGroupByItem = dbConnect.runSqlQuery("select sum(t1.qty) qty,t2.itemno from sa_dispatch_items t1 inner join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid  where t1.sa_dispatchid=" + sa_dispatchid + " group by t2.itemno");
+        Rows rowsDispatchDetailGroupByItem = dbConnect.runSqlQuery("select sum(t1.qty) qty,t2.itemno,ifnull(t1.batchno,'') batchno,0 invbalqty from sa_dispatch_items t1 inner join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid  where t1.sa_dispatchid=" + sa_dispatchid + " group by t2.itemno,ifnull(t1.batchno,'')");
         RowsMap rowsMapDispatchDetailGroupByItem = rowsDispatchDetailGroupByItem.toRowsMap("itemno");
 
         if (siteid.equalsIgnoreCase("lsa") && Parameter.get(siteid, "dispatchinstock").equals("1")) {
@@ -777,7 +777,7 @@ public class dispatch extends Controller {
             if (!erpDocking.getUrl().isEmpty()) {
                 JSONArray jsonArray = erpDocking.getErpIcinvbalRows(200000, 1, rowsDispatchDetail.toJsonArray("itemno"));
 
-                Rows rowsDispatchDetailBatchno = dbConnect.runSqlQuery("select t2.itemno,t1.batchno from sa_dispatch_items t1 inner join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid  where t1.batchno!='' and t1.sa_dispatchid=" + sa_dispatchid);
+                Rows rowsDispatchDetailBatchno = dbConnect.runSqlQuery("select t2.itemno,t1.batchno from sa_dispatch_items t1 inner join plm_item t2 on t1.itemid=t2.itemid and t1.siteid=t2.siteid  where ifnull(t1.batchno,'')!='' and t1.sa_dispatchid=" + sa_dispatchid);
 
                 for(Row row :rowsDispatchDetailBatchno){
                     JSONArray jsonArray1 =new JSONArray();
@@ -786,10 +786,20 @@ public class dispatch extends Controller {
                     if(jsonArrayBatch.isEmpty()){
                         return getErrReturnObject().setErrMsg(row.getString("itemno")+"批号有误,请重新选择!!")
                                 .toString();
+                    }else{
+                        if (rowsMapDispatchDetailGroupByItem.containsKey(row.getString("itemno"))) {
+                            if (rowsMapDispatchDetailGroupByItem.get(row.getString("itemno")).isNotEmpty()) {
+                                for(Row row1 : rowsMapDispatchDetailGroupByItem.get(row.getString("itemno"))){
+                                    if(row1.getString("batchno").equals(row.getString("batchno"))){
+                                        row1.put("invbalqty", ((JSONObject)jsonArrayBatch.get(0)).getBigDecimalValue("fqty"));
+                                    }
+                                }
+                            }
+                        }
                     }
 
 
-               }
+                }
 
                 SQLFactory sqlFactory1 = new SQLFactory(this, "商品发货数量汇总");
                 sqlFactory1.addParameter("siteid", siteid);
@@ -801,9 +811,11 @@ public class dispatch extends Controller {
                     JSONObject jsonObject = (JSONObject) obj;
                     if (rowsMapDispatchDetailGroupByItem.containsKey(jsonObject.getString("fitemno"))) {
                         if (rowsMapDispatchDetailGroupByItem.get(jsonObject.getString("fitemno")).isNotEmpty()) {
-                            rowsMapDispatchDetailGroupByItem.get(jsonObject.getString("fitemno")).get(0).put("invbalqty", jsonObject.getBigDecimalValue("fqty"));
-                        } else {
-                            rowsMapDispatchDetailGroupByItem.get(jsonObject.getString("fitemno")).get(0).put("invbalqty", 0);
+                            for(Row row : rowsMapDispatchDetailGroupByItem.get(jsonObject.getString("fitemno"))){
+                                if(StringUtils.isBlank(row.getString("batchno"))){
+                                    row.put("invbalqty", jsonObject.getBigDecimalValue("fqty"));
+                                }
+                            }
                         }
                     }
                 }

+ 59 - 5
src/custom/restcontroller/webmanage/sale/dispatch/dispatchItems.java

@@ -286,6 +286,39 @@ public class dispatchItems extends Controller {
         sqlFactory1.addParameter_in("itemno", rows.toArrayList("itemno", new ArrayList<>()));
         Rows sumQtyRows = dbConnect.runSqlQuery(sqlFactory1);
         RowsMap sumQtyRowsMap = sumQtyRows.toRowsMap("itemno");
+        if(!siteid.equalsIgnoreCase("lsa")){
+            for(Row row : rows){
+                if(StringUtils.isNotBlank(row.getString("batchno"))){
+                    JSONArray jsonArray1 =new JSONArray();
+                    jsonArray1.add(row.getString("itemno"));
+                    JSONArray jsonArrayBatch = erpDocking.getErpIcinvbalBatchRowsforbatchno(20000, 1, jsonArray1,row.getString("batchno"));
+                    if(!jsonArrayBatch.isEmpty()){
+                        if(sumQtyRowsMap.containsKey(row.getString("itemno"))){
+                            RowsMap rowsMapByBatchno = sumQtyRowsMap.get(row.getString("itemno")).toRowsMap("batchno");
+                            if(rowsMapByBatchno.containsKey(row.getString("batchno"))){
+                                for(Row row1 :sumQtyRowsMap.get(row.getString("itemno"))){
+                                    if(row.getString("batchno").equals(row1.getString("batchno"))){
+                                        row.put("delinvbalqty", ((JSONObject)jsonArrayBatch.get(0)).getBigDecimalValue("fqty").subtract(row1.getBigDecimal("qty")));
+                                        row.put("invbalqty", ((JSONObject)jsonArrayBatch.get(0)).getBigDecimalValue("fqty"));
+                                    }
+                                }
+                            }else{
+                                row.put("delinvbalqty", ((JSONObject)jsonArrayBatch.get(0)).getBigDecimalValue("fqty"));
+                                row.put("invbalqty", ((JSONObject)jsonArrayBatch.get(0)).getBigDecimalValue("fqty"));
+                            }
+
+                        }else{
+                            row.put("delinvbalqty", ((JSONObject)jsonArrayBatch.get(0)).getBigDecimalValue("fqty"));
+                            row.put("invbalqty", ((JSONObject)jsonArrayBatch.get(0)).getBigDecimalValue("fqty"));
+                        }
+                    }else{
+                        row.put("delinvbalqty", row.getBigDecimal("qty").negate());
+                        row.put("invbalqty", 0);
+                    }
+                }
+            }
+        }
+
 
         if (!jsonArray.isEmpty()) {
             for (Object obj : jsonArray) {
@@ -295,23 +328,44 @@ public class dispatchItems extends Controller {
                     if (rowsMap.get(jsonObject.getString("fitemno")).isNotEmpty()) {
                         if (sumQtyRowsMap.containsKey(jsonObject.getString("fitemno"))) {
                             if(siteid.equalsIgnoreCase("lsa")){
-                                rowsMap.get(jsonObject.getString("fitemno")).get(0).put("delinvbalqty", jsonObject.getBigDecimalValue("FQty").subtract(sumQtyRowsMap.get(jsonObject.getString("fitemno")).get(0).getBigDecimal("qty")));
+                                for(Row row :rowsMap.get(jsonObject.getString("fitemno"))){
+                                    row.put("delinvbalqty", jsonObject.getBigDecimalValue("FQty").subtract(row.getBigDecimal("qty")));
+                                }
+                                //rowsMap.get(jsonObject.getString("fitemno")).get(0).put("delinvbalqty", jsonObject.getBigDecimalValue("FQty").subtract(sumQtyRowsMap.get(jsonObject.getString("fitemno")).get(0).getBigDecimal("qty")));
                             }else{
-                                rowsMap.get(jsonObject.getString("fitemno")).get(0).put("delinvbalqty", jsonObject.getBigDecimalValue("fqty").subtract(sumQtyRowsMap.get(jsonObject.getString("fitemno")).get(0).getBigDecimal("qty")));
+                                for(Row row :rowsMap.get(jsonObject.getString("fitemno"))){
+                                    if(StringUtils.isBlank(row.getString("batchno"))){
+                                        row.put("delinvbalqty", jsonObject.getBigDecimalValue("fqty").subtract(row.getBigDecimal("qty")));
+                                    }
+                                }
+                                //rowsMap.get(jsonObject.getString("fitemno")).get(0).put("delinvbalqty", jsonObject.getBigDecimalValue("fqty").subtract(sumQtyRowsMap.get(jsonObject.getString("fitemno")).get(0).getBigDecimal("qty")));
                             }
 
                         } else {
                             if(siteid.equalsIgnoreCase("lsa")){
-                                rowsMap.get(jsonObject.getString("fitemno")).get(0).put("delinvbalqty", jsonObject.getBigDecimalValue("FQty"));
+                                for(Row row :rowsMap.get(jsonObject.getString("fitemno"))){
+                                    row.put("delinvbalqty", jsonObject.getBigDecimalValue("FQty"));
+                                }
+                                //rowsMap.get(jsonObject.getString("fitemno")).get(0).put("delinvbalqty", jsonObject.getBigDecimalValue("FQty"));
                             }else{
-                                rowsMap.get(jsonObject.getString("fitemno")).get(0).put("delinvbalqty", jsonObject.getBigDecimalValue("fqty"));
+                                for(Row row :rowsMap.get(jsonObject.getString("fitemno"))){
+                                    if(StringUtils.isBlank(row.getString("batchno"))){
+                                        row.put("delinvbalqty", jsonObject.getBigDecimalValue("fqty"));
+                                    }
+                                }
+                                //rowsMap.get(jsonObject.getString("fitemno")).get(0).put("delinvbalqty", jsonObject.getBigDecimalValue("fqty"));
                             }
 
                         }
                         if(siteid.equalsIgnoreCase("lsa")){
                             rowsMap.get(jsonObject.getString("fitemno")).get(0).put("invbalqty", jsonObject.getBigDecimalValue("FQty"));
                         }else{
-                            rowsMap.get(jsonObject.getString("fitemno")).get(0).put("invbalqty", jsonObject.getBigDecimalValue("fqty"));
+                            for(Row row :rowsMap.get(jsonObject.getString("fitemno"))){
+                                if(StringUtils.isBlank(row.getString("batchno"))){
+                                    row.put("invbalqty", jsonObject.getBigDecimalValue("fqty"));
+                                }
+                            }
+                            //rowsMap.get(jsonObject.getString("fitemno")).get(0).put("invbalqty", jsonObject.getBigDecimalValue("fqty"));
                         }
 
                     }

+ 6 - 2
src/custom/restcontroller/webmanage/sale/invbal/invbal.java

@@ -543,8 +543,12 @@ public class invbal extends Controller {
             }
         }
         for (Row row : rows) {
-            for (int i=0;i<12;i++) {
-                row.replace("month_0"+(i+1), row.get(getLast12Months().get(i)));
+            for (int i = 0; i < 12; i++) {
+                if (i < 9) {
+                    row.replace("month_0" + (i + 1), row.get(getLast12Months().get(i)));
+                } else {
+                    row.replace("month_" + (i + 1), row.get(getLast12Months().get(i)));
+                }
             }
         }
 //        if (isExport) {

+ 121 - 0
src/custom/restcontroller/webmanage/sale/reporttype/ReportType.java

@@ -0,0 +1,121 @@
+package restcontroller.webmanage.sale.reporttype;
+
+import beans.datacontrllog.DataContrlLog;
+import beans.user.User;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import common.Controller;
+import common.YosException;
+import common.annotation.API;
+import common.data.InsertSQL;
+import common.data.QuerySQL;
+import common.data.Rows;
+import common.data.SQLFactory;
+import restcontroller.R;
+
+import java.util.ArrayList;
+
+@API(title = "报表分类")
+public class ReportType extends Controller {
+    /**
+     * 构造函数
+     *
+     * @param content
+     */
+    public ReportType(JSONObject content) throws YosException {
+        super(content);
+    }
+
+
+    @API(title = "授权报表中心应用的报表查询", apiversion = R.ID20240407094904.v1.class)
+    public String queryReport() throws YosException {
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_report", "sys_reportid");
+        querySQL.setTableAlias("t1");
+        querySQL.addJoinTable(JOINTYPE.left, "jimu_report", "t2", "t1.jimu_report_id = t2.id");
+        querySQL.addJoinTable(JOINTYPE.left, "sys_reporttype", "t3", "t1.sys_reportid = t3.sys_reportid and t3.siteid='" + siteid + "'");
+        querySQL.setWhere("t1.systemappid=" + 163 + " and (ifnull(t1.siteid,'')='' or t1.siteid = '" + siteid + "')");
+        querySQL.addQueryFields("name", "if(t1.reporttype = '积木报表', t2.name, t1.name)");
+        querySQL.addQueryFields("type", "group_concat(t3.type separator ',')");
+        querySQL.addGroupBy("t1.sys_reportid", "t1.name", "t2.name");
+        querySQL.setWhere("((t1.reporttype = '积木报表' and t2.id is not null) or (t1.reporttype != '积木报表'))");
+        querySQL.setPage(pageSize, pageNumber);
+        Rows query = querySQL.query();
+        return getSucReturnObject().setData(query).toString();
+
+    }
+
+    @API(title = "设置报表分类", apiversion = R.ID20240407095004.v1.class)
+    public String updateReportType() throws YosException {
+        Long sys_reportid = content.getLong("sys_reportid");
+        JSONArray types = content.getJSONArray("types");
+
+        ArrayList<String> sqlList = new ArrayList<>();
+
+        long[] sys_reporttypes = createTableID("sys_reporttype", types.size());
+        int i = 0;
+        if (dbConnect.runSqlQuery("select 1 from sys_reporttype where siteid='" + siteid + "' and sys_reportid=" + sys_reportid).isNotEmpty()) {
+            sqlList.add("delete from sys_reporttype where siteid='" + siteid + "' and sys_reportid=" + sys_reportid);
+        }
+        for (Object o : types) {
+            InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sys_reporttype");
+            insertSQL.setSiteid(siteid);
+            insertSQL.setValue("type", o);
+            insertSQL.setValue("sys_reporttypeid", sys_reporttypes[i]);
+            insertSQL.setValue("sys_reportid", sys_reportid);
+            sqlList.add(insertSQL.getSQL());
+            i++;
+        }
+        sqlList.add(DataContrlLog.createLog(this, "sys_report", sys_reportid, "编辑", "设置分类" + types).getSQL());
+        dbConnect.runSqlUpdate(sqlList);
+        return getSucReturnObject().toString();
+    }
+
+    @API(title = "查询报表已授权分类", apiversion = R.ID20240407095104.v1.class)
+    public String queryReportType() throws YosException {
+        Long sys_reportid = content.getLong("sys_reportid");
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_reporttype", "sys_reporttypeid", "type", "sys_reportid");
+        querySQL.setTableAlias("t1");
+        querySQL.setSiteid(siteid);
+        querySQL.setWhere("sys_reportid", sys_reportid);
+        querySQL.setPage(pageSize, pageNumber);
+        Rows query = querySQL.query();
+        return getSucReturnObject().setData(query).toString();
+    }
+
+    @API(title = "报表已授权分类删除", apiversion = R.ID20240407095204.v1.class)
+    public String deleteReportType() throws YosException {
+        Long sys_reportid = content.getLong("sys_reportid");
+        JSONArray sys_reporttypeids = content.getJSONArray("sys_reporttypeids");
+        ArrayList<String> sqlList = new ArrayList<>();
+        if (!sys_reporttypeids.isEmpty()) {
+            String replace = sys_reporttypeids.toString().replace("[", "(").replace("]", ")");
+            Rows rows = dbConnect.runSqlQuery("select type from sys_reporttype where sys_reporttypeid in " + replace);
+            sqlList.add("delete from sys_reporttype where siteid='" + siteid + "' and sys_reporttypeid in " + replace);
+            sqlList.add(DataContrlLog.createLog(this, "sys_report", sys_reportid, "删除", "删除分类" + rows.toArrayList("type")).getSQL());
+            dbConnect.runSqlUpdate(sqlList);
+        }
+        return getSucReturnObject().toString();
+    }
+
+    @API(title = "已授权报表分类查询", apiversion = R.ID20240407094804.v1.class)
+    public String queryType() throws YosException {
+        if (userInfo.isSiteAdministrator() || userInfo.isSysAdministrator()) {
+            Rows rows = dbConnect.runSqlQuery("select distinct type from sys_reporttype where siteid = '" + siteid + "'");
+            return getSucReturnObject().setData(rows).toString();
+        }
+        Rows userroleRows = dbConnect.runSqlQuery("select roleid from sys_userrole where siteid='" + siteid + "' and userid=" + userid);
+        if (userroleRows.isNotEmpty()) {
+            String roleids = userroleRows.toArrayList("roleid").toString().replace("[", "(").replace("]", ")");
+            QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_reporttype", "type");
+            querySQL.setTableAlias("t1");
+            querySQL.setSiteid(siteid);
+            querySQL.setWhere("exists(select 1 from sys_rolereportauth t2 where t1.siteid=t2.siteid and t1.sys_reportid=t2.sys_reportid and t2.roleid in" + roleids + ")");
+            querySQL.addGroupBy("type");
+            querySQL.setPage(pageSize, pageNumber);
+            Rows query = querySQL.query();
+            return getSucReturnObject().setData(query).toString();
+        }
+        return getSucReturnObject().setData(new Rows()).toString();
+    }
+
+}

+ 10 - 0
src/custom/restcontroller/webmanage/sale/reporttype/SQL/授权报表中心应用的报表查询.sql

@@ -0,0 +1,10 @@
+select t1.sys_reportid,
+       if(t1.reporttype = '积木报表', t2.name, t1.name) name,
+       group_concat(t3.type separator ',')              type
+from sys_report t1
+         left join jimu_report t2 on t1.jimu_report_id = t2.id
+         left join sys_reporttype t3 on t1.sys_reportid = t3.sys_reportid and t3.siteid = $siteid$
+where t1.systemappid = 163
+  and (ifnull(t1.siteid, '') = '' or t1.siteid = $siteid$)
+  and ((t1.reporttype = '积木报表' and t2.id is not null) or (t1.reporttype != '积木报表'))
+group by t1.sys_reportid, t1.name, t2.name