Browse Source

Merge branch 'master' of ssh://10.10.100.21/source/platform-bi-server

xiaoct 7 years ago
parent
commit
6da76713b4
27 changed files with 606 additions and 131 deletions
  1. 27 5
      src/main/java/com/controller/DashboardsController.java
  2. 2 0
      src/main/java/com/controller/DataConnectorController.java
  3. 25 8
      src/main/java/com/dao/ChartsConfigMapper.java
  4. 42 8
      src/main/java/com/dao/DashboardsMapper.java
  5. 22 0
      src/main/java/com/model/bo/ChartsColumnConfig.java
  6. 17 0
      src/main/java/com/model/po/ChartConfig.java
  7. 27 0
      src/main/java/com/model/po/ChartConfigList.java
  8. 33 0
      src/main/java/com/model/po/ChartsConfigToDash.java
  9. 18 0
      src/main/java/com/model/po/Dashboards.java
  10. 9 0
      src/main/java/com/model/vo/configVo/ChartConfigInfo.java
  11. 26 0
      src/main/java/com/model/vo/configVo/ChartsToDashInfo.java
  12. 18 0
      src/main/java/com/model/vo/configVo/DashboardsInfo.java
  13. 1 0
      src/main/java/com/model/vo/configVo/StrategysInfo.java
  14. 19 0
      src/main/java/com/model/vo/dataVo/ChartsDataInfo.java
  15. 31 0
      src/main/java/com/model/vo/dataVo/PopAndIndDataInfo.java
  16. 0 25
      src/main/java/com/model/vo/dataVo/PopulationDataInfo.java
  17. 1 1
      src/main/java/com/server/ChartsUtilService.java
  18. 59 10
      src/main/java/com/server/DashboardsService.java
  19. 148 0
      src/main/java/com/server/DashboardsToChartsUtilService.java
  20. 14 2
      src/main/java/com/server/ImplementSqlService.java
  21. 8 0
      src/main/java/com/server/ShowHistogramService.java
  22. 12 56
      src/main/java/com/server/ShowIndividualService.java
  23. 9 4
      src/main/java/com/server/ShowLineService.java
  24. 7 4
      src/main/java/com/server/ShowPieService.java
  25. 14 2
      src/main/java/com/server/ShowPopulationService.java
  26. 8 4
      src/main/java/com/server/ShowScatterService.java
  27. 9 2
      src/main/java/com/server/StrategysService.java

+ 27 - 5
src/main/java/com/controller/DashboardsController.java

@@ -1,20 +1,26 @@
 package com.controller;
 
 import com.model.pojo.RepEntity;
+import com.model.vo.configVo.ChangeOrderInfo;
+import com.model.vo.configVo.ChartsToDashInfo;
 import com.model.vo.configVo.DashboardsInfo;
 import com.server.DashboardsService;
+import com.server.DashboardsToChartsUtilService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestHeader;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.sql.SQLException;
 import java.util.List;
 
 @RestController
 public class DashboardsController {
     @Autowired
     DashboardsService dashboardsService;
+    @Autowired
+    DashboardsToChartsUtilService dashboardsToChartsUtilService;
 
     /*
     保存看板
@@ -22,7 +28,7 @@ public class DashboardsController {
     @CheckToken
     @RequestMapping("/inputDashboards")
     public RepEntity inputDashboards(@RequestHeader String token, @RequestBody DashboardsInfo body){
-        return dashboardsService.setDashboards(body);
+        return dashboardsService.setDashboards(token, body);
     }
 
     /*
@@ -31,7 +37,7 @@ public class DashboardsController {
     @CheckToken
     @RequestMapping("/updateDashboards")
     public RepEntity updateDashboards(@RequestHeader String token,@RequestBody DashboardsInfo body){
-        return dashboardsService.updateDashboards(body);
+        return dashboardsService.updateDashboards(token, body);
     }
 
     /*
@@ -40,7 +46,7 @@ public class DashboardsController {
     @CheckToken
     @RequestMapping("/delDashboards")
     public RepEntity delDashboards(@RequestHeader String token,@RequestBody List<Integer> body){
-        return dashboardsService.delDashboards(body);
+        return dashboardsService.delDashboards(token, body);
     }
 
     /*
@@ -49,7 +55,7 @@ public class DashboardsController {
     @CheckToken
     @RequestMapping("/getListDashboards")
     public RepEntity getListDashboards(@RequestHeader String token){
-        return dashboardsService.getListDashboards();
+        return dashboardsService.getListDashboards(token);
     }
 
     /*
@@ -58,6 +64,22 @@ public class DashboardsController {
     @CheckToken
     @RequestMapping("/getDashboards")
     public RepEntity getDashboards(@RequestHeader String token,@RequestBody int body){
-        return dashboardsService.getDashboards(body);
+        return dashboardsService.getDashboards(token, body);
+    }
+
+    /*
+    转交看板
+     */
+    @RequestMapping("/changeDashOrder")
+    public RepEntity changeDashOrder(@RequestHeader String token,@RequestBody ChangeOrderInfo body){
+        return dashboardsService.changeDashOrder(token, body);
+    }
+
+    /*
+    看板生成图表
+     */
+    @RequestMapping("/showChartsInDash")
+    public RepEntity showChartsInDash(@RequestHeader String token, @RequestBody ChartsToDashInfo body) throws SQLException {
+        return dashboardsToChartsUtilService.getChartsInDash(body, token);
     }
 }

+ 2 - 0
src/main/java/com/controller/DataConnectorController.java

@@ -8,6 +8,7 @@ import com.model.vo.configVo.DataConnectorInfo;
 import com.model.vo.configVo.GroupInfo;
 import com.server.DataConnectorService;
 import com.server.ImplementSqlService;
+import com.util.BasesSource.TargetDataSource;
 import com.util.RoleInterceptor.Auth;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -100,6 +101,7 @@ public class DataConnectorController {
     /*
     执行数据源配置
     */
+    @TargetDataSource
     @CheckToken
     @RequestMapping("/implementSql")
     @Auth(user = "admin")

+ 25 - 8
src/main/java/com/dao/ChartsConfigMapper.java

@@ -1,8 +1,10 @@
 package com.dao;
 
+import com.model.bo.ChartsColumnConfig;
 import com.model.bo.ColumnConfigAndSql;
 import com.model.po.ChartConfig;
 import com.model.po.ChartConfigList;
+import com.model.po.ChartsConfigToDash;
 import com.model.vo.configVo.GroupInfo;
 import org.apache.ibatis.annotations.*;
 import org.springframework.stereotype.Repository;
@@ -15,9 +17,9 @@ import java.util.Map;
 public interface ChartsConfigMapper {
 
     @Insert("insert into bi_charts(id,CHART_NAME,CHART_TYPE,BD_DATA_ID,CHART_CONFIG,GROUP_BY,ACCESS_AUTHORITY,UPDATE_AUTHORITY,BC_CHARTS_GROUP,CHART_DESCRIBES,BC_CHART_STYLE," +
-            "create_by,create_date, bc_charts_option, create_Id) " +
+            "create_by,create_date, bc_charts_option, create_Id, BC_FETCHCONFIG) " +
             "VALUES (#{chartId},#{chartName},#{chartType}, #{dataId}, #{chartConfig}, #{groupBy}, #{accessAuthority}, #{updateAuthority}, #{chartsGroup}," +
-            "#{describes},#{style}, #{createBy},to_date(to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'),'YYYY-MM-DD hh24:mi:ss'),  #{chartOption}, #{createId})" )
+            "#{describes},#{style}, #{createBy},to_date(to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'),'YYYY-MM-DD hh24:mi:ss'),  #{chartOption}, #{createId}, #{fetchConfig})" )
 //    @Options(useGeneratedKeys=false, keyProperty = "chartId",keyColumn = "id")
     @SelectKey(before=true,keyProperty="chartId",resultType=Integer.class,statement="SELECT charts_squence.nextval from dual",keyColumn = "id")
     void insertCharts(ChartConfig chartConfig);
@@ -32,10 +34,11 @@ public interface ChartsConfigMapper {
             "</script>")
     void deleteCharts(List<Integer> idList);
 
-    @Select("select id as chartId, chart_name as chartName, chart_type as chartType, create_by as createBy, create_date as createDate, bc_charts_group as chartsGroup" +
-            ",bc_filters as filters, BD_DATA_ID as dataId, bc_table_name as tableName, CHART_CONFIG as chartConfig, GROUP_BY as groupBy, bc_charts_option as chartOption, " +
-            "ACCESS_AUTHORITY as accessAuthority, UPDATE_AUTHORITY as updateAuthority, CHART_DESCRIBES as describes, BC_CHART_STYLE as style, BC_FILTERS as filters " +
-            ",create_id as createId from bi_charts where id = #{id}")
+    @Select("select bc.id as chartId, chart_name as chartName, chart_type as chartType, bc.create_by as createBy, bc.create_date as createDate, bc_charts_group as chartsGroup" +
+            "            ,bc.bc_filters as filters, bc.BD_DATA_ID as dataId, bc_table_name as tableName, CHART_CONFIG as chartConfig, bc.GROUP_BY as groupBy, bc_charts_option as chartOption, " +
+            "            bc.ACCESS_AUTHORITY as accessAuthority, UPDATE_AUTHORITY as updateAuthority, CHART_DESCRIBES as describes, BC_CHART_STYLE as style, BC_FILTERS as filters " +
+            "            ,bc.create_id as createId, bd.DATA_NAME as dataName from bi_charts bc left join BI_DATA_CONNECTORS bd on bc.BD_DATA_ID = bd.id" +
+            "             where bc.id = #{id}")
     ChartConfig getOneChart(int id);
 
     /*
@@ -88,8 +91,9 @@ public interface ChartsConfigMapper {
             "            or bo2.bo_type = '1' and bo2.bo_ob_id = bc.CREATE_ID" +
             "        )" +
             "    ) = 0 then '0'" +
-            "    else null end authority, id as chartId, chart_name as chartName, chart_type as chartType, bc.create_by as createBy, bc.create_date as createDate" +
-            "            ,bc_filters as filters, CHART_DESCRIBES as describes, bc_charts_group as chartsGroup, bc_charts_option as chartOption, create_id as createId from bi_charts bc where create_id = #{id} or ( create_id !=#{id} and id in (" +
+            "    else null end authority, bc.id as chartId, bc.chart_name as chartName, bc.chart_type as chartType, bc.create_by as createBy, bc.create_date as createDate, BC_FILTERS as filters" +
+            "    ,bc.bc_filters as filters, bc.CHART_DESCRIBES as describes, bc.bc_charts_group as chartsGroup, bc.bc_charts_option as chartOption ,bc.bd_data_id as dataId,bd.data_name as dataName, bc.create_id as createId  " +
+            "     from bi_charts bc left join bi_data_connectors bd on bc.bd_data_id=bd.id where (bc.create_id = #{id} or bc.id in (" +
             "      select bc_chart_id from bi_chart_strategys where BC_ID in (" +
             "        select BO_ST_ID from BI_CHART_OBJECT where (BO_TYPE='1' and BO_OB_ID = #{id})" +
             "        or (" +
@@ -141,6 +145,7 @@ public interface ChartsConfigMapper {
             "<if test=\"style != null\"> , BC_CHART_STYLE = #{style} </if>" +
             "<if test=\"chartsGroup !=null\">, BC_CHARTS_GROUP = #{chartsGroup}</if>"+
             "<if test=\"chartOption !=null\">, bc_charts_option = #{chartOption}</if>"+
+            "<if test=\"fetchConfig !=null\">, BC_FETCHCONFIG = #{fetchConfig}</if>"+
             "<if test=\"updateDate != null\"> , UPDATE_DATE = to_date(#{updateDate},'YYYY-MM-DD hh24:mi:ss') </if>" +
             "where id = #{chartId}" +
             "</script>")
@@ -270,4 +275,16 @@ public interface ChartsConfigMapper {
     @Select("${sql}")
     List<Map<String, Object>> getChartsData(@Param("sql") String sql);
 
+    /*
+    通过图表ID获取图表配置
+     */
+    @Select("select id, chart_type as chartType, BC_FETCHCONFIG as fetchConfig from bi_charts where id = #{id}")
+    ChartsConfigToDash getChartConfigToDash(int id);
+
+    /*
+    通过图表ID查询图表列配置和style
+     */
+    @Select("select chart_config as chartConfig, BC_CHART_STYLE as chartStyle from bi_charts where id = #{id}")
+    ChartsColumnConfig getChartsColumn(int id);
+
 }

+ 42 - 8
src/main/java/com/dao/DashboardsMapper.java

@@ -15,8 +15,9 @@ public interface DashboardsMapper {
     插入
      */
     @Insert("insert into " +
-            "bi_dashboards(id, bd_name,bd_note,CONFIGURATION,create_by,create_date, BD_THUMBNAIL)" +
-            "values(#{id}, #{bdName},#{bdNote},#{bdConfiguration},#{createBy},to_date(to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'),'YYYY-MM-DD hh24:mi:ss'), #{thumbnail})")
+            "bi_dashboards(id, bd_name,bd_note,CONFIGURATION,create_by,create_date, BD_THUMBNAIL,relation_columns, create_id)" +
+            "values(#{id}, #{bdName},#{bdNote},#{bdConfiguration},#{createBy}," +
+            "to_date(to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'),'YYYY-MM-DD hh24:mi:ss'), #{thumbnail},#{relationColumns}, #{createId})")
     @SelectKey(before=true,keyProperty="id",resultType=Integer.class,statement="SELECT bi_dashboards_squence.nextval from dual",keyColumn = "id")
     void setDashboards(Dashboards dashboards);
 
@@ -28,8 +29,8 @@ public interface DashboardsMapper {
             "BD_NAME = #{bdName}" +
             "<if test=\"bdNote != null\"> , BD_NOTE = #{bdNote} </if>" +
             "<if test=\"bdConfiguration != null\"> , CONFIGURATION = #{bdConfiguration} </if>" +
-            "<if test=\"createBy != null\"> , CREATE_BY = #{createBy} </if>" +
             "<if test=\"thumbnail != null\"> , BD_THUMBNAIL = #{thumbnail} </if>" +
+            "<if test=\"relationColumns != null\">, relation_columns = #{relationColumns} </if>"+
             " ,UPDATE_DATE = to_date(to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'),'YYYY-MM-DD hh24:mi:ss') " +
             "where id = #{id}" +
             "</script>")
@@ -51,13 +52,46 @@ public interface DashboardsMapper {
     /*
     查询看板列表
      */
-    @Select("select id, bd_note as bdNote, bd_name as bdName, CONFIGURATION as bdConfiguration, CREATE_BY as createBy, CREATE_DATE as createDate, BD_THUMBNAIL as thumbnail from BI_DASHBOARDS")
-    List<Dashboards> getListDashboards();
+    @Select("select id, bd_note as bdNote, bd_name as bdName, CONFIGURATION as bdConfiguration, CREATE_BY as createBy, create_id as createId, CREATE_DATE as createDate, BD_THUMBNAIL as thumbnail " +
+            "from BI_DASHBOARDS where id in " +
+            " (select bo_da_id from bi_DASHBOARDS_object " +
+            "where (bo_type = '0' and bo_ob_id in (select br_user_group from bi_user_rel_groups where br_user_id= #{userId})) " +
+            " or (BO_TYPE='1' and bo_ob_id = #{userId} )) or create_id = #{userId}")
+    List<Dashboards> getListDashboards(int userId);
 
     /*
     查询看板
      */
-    @Select("select id, bd_note as bdNote, bd_name as bdName, CONFIGURATION as bdConfiguration, CREATE_BY as createBy, CREATE_DATE as createDate, BD_THUMBNAIL as thumbnail " +
-            "from BI_DASHBOARDS  where id = #{id}")
-    Dashboards getDashboards(int id);
+    @Select("select id, bd_note as bdNote, bd_name as bdName, CONFIGURATION as bdConfiguration, CREATE_BY as createBy, create_id as createId, CREATE_DATE as createDate, BD_THUMBNAIL as thumbnail, relation_columns as relationColumns" +
+            " from BI_DASHBOARDS where (id in " +
+            " (select bo_da_id from bi_DASHBOARDS_object " +
+            " where (bo_type = '0' and bo_ob_id in (select br_user_group from bi_user_rel_groups where br_user_id= #{userId}))" +
+            " or (BO_TYPE='1' and bo_ob_id = #{userId} )) or create_id = #{userId}) and id = #{id}")
+    Dashboards getDashboards(@Param("userId") int userId, @Param("id") int id);
+
+    /*
+    看板移交
+     */
+    @Update("update BI_DASHBOARDS set create_by = #{createBy}, create_id = #{createId} where id = #{id}")
+    void changeDashOrder(@Param("createBy") String createBy, @Param("createId") int createId, @Param("id") int id);
+
+    /*
+    添加看板对象
+     */
+    @Insert("insert into bi_dashboards_object(bo_id, bo_da_id, bo_type, bo_ob_id) values" +
+            "(#{id}, #{daId}, #{objectType}, #{obId})")
+    @SelectKey(before=true,keyProperty="id",resultType=int.class,statement="SELECT bi_dashboards_object_squence.nextval from dual",keyColumn = "bo_id")
+    void addObject(@Param("daId") int daId, @Param("objectType") String objectType, @Param("obId") int obId);
+
+    /*
+   删除对象
+    */
+    @Delete("delete from bi_dashboards_object where bo_da_id = #{daId}")
+    void delObject(int daId);
+
+    /*
+    获取看板拥有人ID
+     */
+    @Select("select create_id from bi_dashboards where id = #{id}")
+    int getCreateIdById(int id);
 }

+ 22 - 0
src/main/java/com/model/bo/ChartsColumnConfig.java

@@ -0,0 +1,22 @@
+package com.model.bo;
+
+public class ChartsColumnConfig {
+    private String chartConfig;
+    private String chartStyle;
+
+    public String getChartConfig() {
+        return chartConfig;
+    }
+
+    public void setChartConfig(String chartConfig) {
+        this.chartConfig = chartConfig;
+    }
+
+    public String getChartStyle() {
+        return chartStyle;
+    }
+
+    public void setChartStyle(String chartStyle) {
+        this.chartStyle = chartStyle;
+    }
+}

+ 17 - 0
src/main/java/com/model/po/ChartConfig.java

@@ -21,7 +21,24 @@ public class ChartConfig {
     private String createDate; //数据类型
     private String updateDate; //数据类型
     private String chartOption;      //列表缩略图数据
+    private String dataName;
+    private String fetchConfig;
 
+    public String getFetchConfig() {
+        return fetchConfig;
+    }
+
+    public void setFetchConfig(String fetchConfig) {
+        this.fetchConfig = fetchConfig;
+    }
+
+    public String getDataName() {
+        return dataName;
+    }
+
+    public void setDataName(String dataName) {
+        this.dataName = dataName;
+    }
 
     public int getCreateId() {
         return createId;

+ 27 - 0
src/main/java/com/model/po/ChartConfigList.java

@@ -11,6 +11,33 @@ public class ChartConfigList {
     private String chartOption;
     private String authority;
     private int createId;
+    private int dataId;
+    private String dataName;
+    private String filters;
+
+    public String getFilters() {
+        return filters;
+    }
+
+    public void setFilters(String filters) {
+        this.filters = filters;
+    }
+
+    public int getDataId() {
+        return dataId;
+    }
+
+    public void setDataId(int dataId) {
+        this.dataId = dataId;
+    }
+
+    public String getDataName() {
+        return dataName;
+    }
+
+    public void setDataName(String dataName) {
+        this.dataName = dataName;
+    }
 
     public int getCreateId() {
         return createId;

+ 33 - 0
src/main/java/com/model/po/ChartsConfigToDash.java

@@ -0,0 +1,33 @@
+package com.model.po;
+
+public class ChartsConfigToDash {
+    private int chartId;
+    private String fetchConfig;
+    private String chartType;
+
+    public String getChartType() {
+        return chartType;
+    }
+
+    public void setChartType(String chartType) {
+        this.chartType = chartType;
+    }
+
+    public int getChartId() {
+        return chartId;
+    }
+
+    public void setChartId(int chartId) {
+        this.chartId = chartId;
+    }
+
+    public String getFetchConfig() {
+        return fetchConfig;
+    }
+
+    public void setFetchConfig(String fetchConfig) {
+        this.fetchConfig = fetchConfig;
+    }
+}
+
+

+ 18 - 0
src/main/java/com/model/po/Dashboards.java

@@ -10,9 +10,27 @@ public class Dashboards {
     private String bdConfiguration;
     private String thumbnail;
     private String createBy;
+    private int createId;
+    private String relationColumns;
     private String createDate;
     private String updateDate;
 
+    public String getRelationColumns() {
+        return relationColumns;
+    }
+
+    public void setRelationColumns(String relationColumns) {
+        this.relationColumns = relationColumns;
+    }
+
+    public int getCreateId() {
+        return createId;
+    }
+
+    public void setCreateId(int createId) {
+        this.createId = createId;
+    }
+
     public String getThumbnail() {
         return thumbnail;
     }

+ 9 - 0
src/main/java/com/model/vo/configVo/ChartConfigInfo.java

@@ -23,6 +23,15 @@ public class ChartConfigInfo {
     private String style;                //样式
     private String filters;          //筛选
     private String chartOption;      //列表缩略图数据
+    private String fetchConfig;         //保存请求数据信息
+
+    public String getFetchConfig() {
+        return fetchConfig;
+    }
+
+    public void setFetchConfig(String fetchConfig) {
+        this.fetchConfig = fetchConfig;
+    }
 
     public int getCreateId() {
         return createId;

+ 26 - 0
src/main/java/com/model/vo/configVo/ChartsToDashInfo.java

@@ -0,0 +1,26 @@
+package com.model.vo.configVo;
+
+import com.model.bo.Screen;
+
+import java.util.List;
+
+public class ChartsToDashInfo {
+    private int dashCreateId;
+    private List<Screen> filters;
+
+    public int getDashCreateId() {
+        return dashCreateId;
+    }
+
+    public void setDashCreateId(int dashCreateId) {
+        this.dashCreateId = dashCreateId;
+    }
+
+    public List<Screen> getFilters() {
+        return filters;
+    }
+
+    public void setFilters(List<Screen> filters) {
+        this.filters = filters;
+    }
+}

+ 18 - 0
src/main/java/com/model/vo/configVo/DashboardsInfo.java

@@ -7,6 +7,24 @@ public class DashboardsInfo {
     private String bdConfiguration;
     private String thumbnail;
     private String createBy;
+    private int createId;
+    private String relationColumns;
+
+    public String getRelationColumns() {
+        return relationColumns;
+    }
+
+    public void setRelationColumns(String relationColumns) {
+        this.relationColumns = relationColumns;
+    }
+
+    public int getCreateId() {
+        return createId;
+    }
+
+    public void setCreateId(int createId) {
+        this.createId = createId;
+    }
 
     public String getThumbnail() {
         return thumbnail;

+ 1 - 0
src/main/java/com/model/vo/configVo/StrategysInfo.java

@@ -13,6 +13,7 @@ public class StrategysInfo {
     private String isOpen;
     private String createBy;
 
+
     public String getType() {
         return type;
     }

+ 19 - 0
src/main/java/com/model/vo/dataVo/ChartsDataInfo.java

@@ -5,6 +5,24 @@ import java.util.List;
 public class ChartsDataInfo<T> {
     private List<String> xAxis;
     private List<T> serieses;
+    private String chartsConfig;
+    private String chartsStyle;
+
+    public String getChartsConfig() {
+        return chartsConfig;
+    }
+
+    public void setChartsConfig(String chartsConfig) {
+        this.chartsConfig = chartsConfig;
+    }
+
+    public String getChartsStyle() {
+        return chartsStyle;
+    }
+
+    public void setChartsStyle(String chartsStyle) {
+        this.chartsStyle = chartsStyle;
+    }
 
     public List<String> getxAxis() {
         return xAxis;
@@ -22,6 +40,7 @@ public class ChartsDataInfo<T> {
         this.serieses = serieses;
     }
 
+
     @Override
     public String toString() {
         return "ChartsDataInfo{" +

+ 31 - 0
src/main/java/com/model/vo/dataVo/PopAndIndDataInfo.java

@@ -0,0 +1,31 @@
+package com.model.vo.dataVo;
+
+public class PopAndIndDataInfo<T> {
+    private String chartsConfig;
+    private String chartsStyle;
+    private T valueList;
+
+    public String getChartsConfig() {
+        return chartsConfig;
+    }
+
+    public void setChartsConfig(String chartsConfig) {
+        this.chartsConfig = chartsConfig;
+    }
+
+    public String getChartsStyle() {
+        return chartsStyle;
+    }
+
+    public void setChartsStyle(String chartsStyle) {
+        this.chartsStyle = chartsStyle;
+    }
+
+    public T getValueList() {
+        return valueList;
+    }
+
+    public void setValueList(T valueList) {
+        this.valueList = valueList;
+    }
+}

+ 0 - 25
src/main/java/com/model/vo/dataVo/PopulationDataInfo.java

@@ -1,25 +0,0 @@
-package com.model.vo.dataVo;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-
-public class PopulationDataInfo {
-    private List<String> columnHead;
-    private List<LinkedHashMap<String, Object>> valueList;
-
-    public List<String> getColumnHead() {
-        return columnHead;
-    }
-
-    public void setColumnHead(List<String> columnHead) {
-        this.columnHead = columnHead;
-    }
-
-    public List<LinkedHashMap<String, Object>> getValueList() {
-        return valueList;
-    }
-
-    public void setValueList(List<LinkedHashMap<String, Object>> valueList) {
-        this.valueList = valueList;
-    }
-}

+ 1 - 1
src/main/java/com/server/ChartsUtilService.java

@@ -67,7 +67,7 @@ public class ChartsUtilService {
             }else {
                 baseCreateId = createBId;
             }
-            if (baseCreateId == userId && createBId != -1){
+            if (baseCreateId == userId ){
                 System.out.println("等于吗");
                 return "(" + tableName +")";
             }else {

+ 59 - 10
src/main/java/com/server/DashboardsService.java

@@ -1,17 +1,22 @@
 package com.server;
 
 import com.dao.DashboardsMapper;
+import com.dao.UserMapper;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.model.po.Dashboards;
 import com.model.pojo.RepCode;
 import com.model.pojo.RepEntity;
+import com.model.vo.configVo.ChangeOrderInfo;
 import com.model.vo.configVo.DashboardsInfo;
+import com.util.GetTokenData;
 import com.util.TimeUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 @Service
 public class DashboardsService {
@@ -21,16 +26,22 @@ public class DashboardsService {
     DashboardsMapper dashboardsMapper;
     @Autowired
     ObjectMapper objectMapper;
+    @Autowired
+    GetTokenData getTokenData;
+    @Autowired
+    UserMapper userMapper;
 
     /*
     保存看板
      */
-    public RepEntity setDashboards(DashboardsInfo dashboardsInfo){
+    public RepEntity setDashboards(String token, DashboardsInfo dashboardsInfo){
+        Map<String, String> stringMap = getTokenData.getTokenData(token);
+        int userId = Integer.parseInt(stringMap.get("id"));
+        String name = stringMap.get("name");
         Dashboards dashboards = new Dashboards();
         BeanUtils.copyProperties(dashboardsInfo,dashboards);
-
-//        dashboards.setCreateDate(timeUtil.SystemTime());
-
+        dashboards.setCreateBy(name);
+        dashboards.setCreateId(userId);
         dashboardsMapper.setDashboards(dashboards);
         int id = dashboards.getId();
         return new RepEntity(RepCode.success, id);
@@ -39,9 +50,18 @@ public class DashboardsService {
     /*
     更新看板
      */
-    public RepEntity updateDashboards(DashboardsInfo dashboardsInfo) {
+    public RepEntity updateDashboards(String token, DashboardsInfo dashboardsInfo) {
+        Map<String, String> stringMap = getTokenData.getTokenData(token);
+        int userId = Integer.parseInt(stringMap.get("id"));
+        String name = stringMap.get("name");
+        int createId = dashboardsMapper.getCreateIdById(dashboardsInfo.getId());
+        if (userId != createId){
+            return new RepEntity(RepCode.NoAuthority);
+        }
         Dashboards dashboards = new Dashboards();
         BeanUtils.copyProperties(dashboardsInfo, dashboards);
+        dashboards.setCreateBy(name);
+        dashboards.setCreateId(userId);
 
         dashboardsMapper.updateDashboards(dashboards);
         return new RepEntity(RepCode.success);
@@ -50,7 +70,17 @@ public class DashboardsService {
     /*
     删除看板
      */
-    public RepEntity delDashboards(List<Integer> idList){
+    public RepEntity delDashboards(String token, List<Integer> idList){
+        Map<String, String> stringMap = getTokenData.getTokenData(token);
+        int userId = Integer.parseInt(stringMap.get("id"));
+        Iterator isList = idList.iterator();
+        while (isList.hasNext()){
+            int id = (int) isList.next();
+            int createId = dashboardsMapper.getCreateIdById(id);
+            if (userId != createId){
+                return new RepEntity(RepCode.NoAuthority);
+            }
+        }
         dashboardsMapper.delDashboards(idList);
         return new RepEntity(RepCode.success);
     }
@@ -58,14 +88,33 @@ public class DashboardsService {
     /*
     查看看板
      */
-    public RepEntity getListDashboards(){
-        return new RepEntity(RepCode.success, dashboardsMapper.getListDashboards());
+    public RepEntity getListDashboards(String token){
+        Map<String, String> stringMap = getTokenData.getTokenData(token);
+        int id = Integer.parseInt(stringMap.get("id"));
+        return new RepEntity(RepCode.success, dashboardsMapper.getListDashboards(id));
     }
 
     /*
     查看单个看板
      */
-    public RepEntity getDashboards(int id){
-        return new RepEntity(RepCode.success, dashboardsMapper.getDashboards(id));
+    public RepEntity getDashboards(String token, int id){
+        Map<String, String> stringMap = getTokenData.getTokenData(token);
+        int userId = Integer.parseInt(stringMap.get("id"));
+        return new RepEntity(RepCode.success, dashboardsMapper.getDashboards(userId, id));
+    }
+
+    /*
+    转交看板
+     */
+    public RepEntity changeDashOrder(String token, ChangeOrderInfo changeOrderInfo){
+        Map<String, String> stringMap = getTokenData.getTokenData(token);
+        int userId = Integer.parseInt(stringMap.get("id"));
+        int createId = dashboardsMapper.getCreateIdById(changeOrderInfo.getId());
+        if (userId != createId){
+            return new RepEntity(RepCode.NoAuthority);
+        }
+        String name = userMapper.getName(changeOrderInfo.getUserId());
+        dashboardsMapper.changeDashOrder(name, changeOrderInfo.getUserId(), changeOrderInfo.getId());
+        return new RepEntity(RepCode.success);
     }
 }

+ 148 - 0
src/main/java/com/server/DashboardsToChartsUtilService.java

@@ -0,0 +1,148 @@
+package com.server;
+
+import com.dao.ChartsConfigMapper;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.model.bo.Screen;
+import com.model.po.ChartsConfigToDash;
+import com.model.pojo.RepCode;
+import com.model.pojo.RepEntity;
+import com.model.vo.configVo.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.sql.SQLException;
+import java.util.List;
+
+/*
+看板中调用生成图表
+ */
+@Service
+public class DashboardsToChartsUtilService {
+    @Autowired
+    ChartsConfigMapper chartsConfigMapper;
+    @Autowired
+    ObjectMapper objectMapper;
+    @Autowired
+    ShowHistogramService showHistogramService;
+    @Autowired
+    ShowIndividualService showIndividualService;
+    @Autowired
+    ShowLineService showLineService;
+    @Autowired
+    ShowPieService showPieService;
+    @Autowired
+    ShowPopulationService showPopulationService;
+    @Autowired
+    ShowScatterService showScatterService;
+
+    public RepEntity getChartsInDash(ChartsToDashInfo chartsToDashInfo, String token) throws SQLException {
+        int chartId = chartsToDashInfo.getDashCreateId();
+        ChartsConfigToDash chartsConfigToDash = chartsConfigMapper.getChartConfigToDash(chartId);
+        String chartType = chartsConfigToDash.getChartType();
+        String fetchConfig = chartsConfigToDash.getFetchConfig();
+        List<Screen> filters = chartsToDashInfo.getFilters();
+        if ("Pie".equals(chartType)){
+            return getPie(fetchConfig, token, filters);
+
+        }else if ("Histogram".equals(chartType)){
+            return getHistogram(fetchConfig, token, filters);
+
+        }else if ("Line".equals(chartType)){
+            return getLine(fetchConfig, token, filters);
+
+        }else if ("population".equals(chartType)){
+            return getPopulation(fetchConfig, token, filters);
+
+        }else if ("individual".equals(chartType)){
+            getIndividual(fetchConfig, token, filters);
+
+        }else if("scatter".equals(chartType)){
+            return getScatter(fetchConfig, token, filters);
+        }
+        return new RepEntity(RepCode.success);
+    }
+
+    public RepEntity getHistogram(String fetchConfig, String token, List<Screen> filters){
+        HistogramConfigInfo histogramConfigInfo = new HistogramConfigInfo();
+        try {
+            histogramConfigInfo = objectMapper.readValue(fetchConfig,HistogramConfigInfo.class);
+            List<Screen> list = histogramConfigInfo.getFilters();
+            list.addAll(filters);
+            histogramConfigInfo.setFilters(list);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return showHistogramService.showHistogram(histogramConfigInfo, token);
+    }
+
+    public RepEntity getScatter(String fetchConfig, String token, List<Screen> filters){
+            ScatterConfigInfo scatterConfigInfo = new ScatterConfigInfo();
+            try {
+                System.out.println(fetchConfig);
+                scatterConfigInfo = objectMapper.readValue(fetchConfig,ScatterConfigInfo.class);
+                List<Screen> list = scatterConfigInfo.getFilters();
+                list.addAll(filters);
+                scatterConfigInfo.setFilters(list);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            return showScatterService.showScatter(scatterConfigInfo, token);
+    }
+
+    public RepEntity getLine(String fetchConfig, String token, List<Screen> filters){
+        LineConfigInfo lineConfigInfo = new LineConfigInfo();
+        try {
+            System.out.println(fetchConfig);
+            lineConfigInfo = objectMapper.readValue(fetchConfig,LineConfigInfo.class);
+            List<Screen> list = lineConfigInfo.getFilters();
+            list.addAll(filters);
+            lineConfigInfo.setFilters(list);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return showLineService.showLine(lineConfigInfo, token);
+    }
+
+    public RepEntity getPopulation(String fetchConfig, String token, List<Screen> filters) throws SQLException {
+        PopulationInfo populationInfo = new PopulationInfo();
+        try {
+            System.out.println(fetchConfig);
+            populationInfo = objectMapper.readValue(fetchConfig,PopulationInfo.class);
+            List<Screen> list = populationInfo.getFilters();
+            list.addAll(filters);
+            populationInfo.setFilters(list);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return showPopulationService.showPopulation(populationInfo, token);
+    }
+
+    public RepEntity getIndividual(String fetchConfig, String token, List<Screen> filters) throws SQLException {
+        IndividualConfigInfo individualConfigInfo = new IndividualConfigInfo();
+        try {
+            System.out.println(fetchConfig);
+            individualConfigInfo = objectMapper.readValue(fetchConfig,IndividualConfigInfo.class);
+            List<Screen> list = individualConfigInfo.getFilters();
+            list.addAll(filters);
+            individualConfigInfo.setFilters(list);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return showIndividualService.showIndividual(individualConfigInfo, token);
+    }
+
+    public RepEntity getPie(String fetchConfig, String token, List<Screen> filters){
+        PieConfigInfo pieConfigInfo = new PieConfigInfo();
+        try {
+            System.out.println(fetchConfig);
+            pieConfigInfo = objectMapper.readValue(fetchConfig,PieConfigInfo.class);
+            List<Screen> list = pieConfigInfo.getFilters();
+            list.addAll(filters);
+            pieConfigInfo.setFilters(list);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return showPieService.showPie(pieConfigInfo, token);
+    }
+
+}

+ 14 - 2
src/main/java/com/server/ImplementSqlService.java

@@ -33,12 +33,23 @@ public class ImplementSqlService {
             return new RepEntity(RepCode.ChartsNameNull);
         }
 
-        List<LinkedHashMap<String, Object>> columnData = dataColumnMapper.getColumn(sqlStr.toUpperCase());
+        System.out.println("查询"+ new Date());
+        List<LinkedHashMap<String, Object>> columnData = dataColumnMapper.getColumn(sqlStr);
+        System.out.println("查询结束"+ new Date());
         LinkedHashMap<String, String> tarValue = getColumnType(columnData);
 
+        LinkedHashMap<String, Object> columnDataKey = new LinkedHashMap<>();
         //取列名
         List<ColumnTypeInfo> isList = new ArrayList<>();
-        LinkedHashMap<String, Object> columnDataKey = columnData.get(0);
+        try{
+            System.out.println("取列名:" + new Date());
+            columnDataKey = columnData.get(0);
+            System.out.println("取列名结束" + new Date());
+        }catch (IndexOutOfBoundsException e){
+            return new RepEntity(RepCode.Null);
+        }
+
+        System.out.println("类型:"+new Date());
         Iterator<String> iter = columnDataKey.keySet().iterator();
         while (iter.hasNext()){
             String key = iter.next();
@@ -48,6 +59,7 @@ public class ImplementSqlService {
             columnTypeInfo.setColumnType(vaul);
             isList.add(columnTypeInfo);
         }
+        System.out.println("类型结束:"+new Date());
 
         return new RepEntity(RepCode.success,isList);
     }

+ 8 - 0
src/main/java/com/server/ShowHistogramService.java

@@ -3,6 +3,7 @@ package com.server;
 import com.dao.ChartsConfigMapper;
 import com.dao.ShowChartsMapper;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.model.bo.ChartsColumnConfig;
 import com.model.bo.Screen;
 import com.model.bo.ScreenStr;
 import com.model.bo.Series;
@@ -50,6 +51,13 @@ public class ShowHistogramService {
 
         //取表名
         int id = histogramConfigInfo.getId();
+        //获取列配置
+        ChartsColumnConfig chartsColumn = chartsConfigMapper.getChartsColumn(id);
+        String style = chartsColumn.getChartStyle();
+        String config = chartsColumn.getChartConfig();
+        chartsDataInfo.setChartsConfig(config);
+        chartsDataInfo.setChartsStyle(style);
+
         String tableName = chartsUtilService.getSqlStr(token, id);
         if ("".equals(tableName)){
             return new RepEntity(RepCode.NoAuthority);

+ 12 - 56
src/main/java/com/server/ShowIndividualService.java

@@ -2,11 +2,13 @@ package com.server;
 
 import com.dao.ChartsConfigMapper;
 import com.dao.ShowChartsMapper;
+import com.model.bo.ChartsColumnConfig;
 import com.model.bo.Screen;
 import com.model.bo.ScreenStr;
 import com.model.pojo.RepCode;
 import com.model.pojo.RepEntity;
 import com.model.vo.configVo.IndividualConfigInfo;
+import com.model.vo.dataVo.PopAndIndDataInfo;
 import com.util.BasesSource.DynamicDataSourceContextHolder;
 import com.util.ScreenUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -36,10 +38,18 @@ public class ShowIndividualService {
         if (individualConfigInfo == null || "".equals(individualConfigInfo)){
             return new RepEntity(RepCode.Null);
         }
+        PopAndIndDataInfo popAndIndDataInfo = new PopAndIndDataInfo();
 
         List<LinkedHashMap<String, Object>> targetValue = new ArrayList<>();
         //取表名
         int id = individualConfigInfo.getId();
+        //获取列配置
+        ChartsColumnConfig chartsColumn = chartsConfigMapper.getChartsColumn(id);
+        String style = chartsColumn.getChartStyle();
+        String config = chartsColumn.getChartConfig();
+        popAndIndDataInfo.setChartsConfig(config);
+        popAndIndDataInfo.setChartsStyle(style);
+
         String tableName = chartsUtilService.getSqlStr(token, id);
         if ("".equals(tableName)){
             return new RepEntity(RepCode.NoAuthority);
@@ -87,6 +97,7 @@ public class ShowIndividualService {
         String tableListName = this.getString(columnListName);
 
         targetValue = showChartsMapper.getOtherData(tableListName, tableName, columnName, sort, line, screenStr);
+        popAndIndDataInfo.setValueList(targetValue);
     }catch (Exception e){
         e.printStackTrace();
         System.out.println("异常");
@@ -94,63 +105,8 @@ public class ShowIndividualService {
     }finally {
         DynamicDataSourceContextHolder.clearDataSourceType();
     }
-//
-//        if ("STDDEV".equals(operation) || "stddev".equals(operation)){
-//            operation = "STDDEV";
-//            columnDev = showChartsMapper.getColumnDev(tableName, columnName, operation);  //标准差
-//            operation = "AVG";
-//            columnAvg = showChartsMapper.getColumnDev(tableName, columnName, operation);  //平均值
-//
-//        }else {
-//            columnDev = null;
-//            columnAvg = null;
-//        }
-//        List<TargetData> targetDataList = showChartsMapper.getTargetData(keyName, columnName, tableName, sort, line);
-//        List<Integer> idList = new ArrayList<>();
-//        List<Double> dataList = new ArrayList<>();
-//        Iterator isDataList = targetDataList.iterator();
-//        while (isDataList.hasNext()){
-//            TargetData targetData = (TargetData) isDataList.next();
-//            idList.add(targetData.getId());
-//            //算出目标列的值
-//            if (columnDev == null || "".equals(columnDev)){
-//                dataList.add(targetData.getData());
-//            }else {
-//                dataList.add((targetData.getData()-columnAvg)/columnDev);
-//            }
-//        }
-//
-//
-//
-//
-//        List<List<Object>> columnAllData = new ArrayList<>();//全部结果
-//
-//        Iterator isIdList = idList.iterator();
-//
-//        while (isIdList.hasNext()){
-//            int ids = (int) isIdList.next();
-//            List<Object> columnDataList = new ArrayList<>();//其他类一行结果集
-//            Iterator isColumnName = columnListName.iterator();
-//            while (isColumnName.hasNext()){
-//                String columnOtherName = (String) isColumnName.next();
-//                Object data = new Object();
-//                data = showChartsMapper.getOtherData(columnOtherName, ids, tableName, keyName);
-//                columnDataList.add(data);
-//                System.out.println("单个:"+columnDataList);
-//            }
-//            columnAllData.add(columnDataList);
-//            System.out.println("全部:"+columnAllData);
-//            System.out.println();
-//        }
-//
-//        System.out.println("------------------------------------------------------------------------------------------------------"+columnAllData);
-//
-//        TableDataInfo tableDataInfo = new TableDataInfo();
-//        tableDataInfo.setTargetData(dataList);
-//        tableDataInfo.setColumnData(columnAllData);
-
 
-        return new RepEntity(RepCode.success, targetValue);
+        return new RepEntity(RepCode.success, popAndIndDataInfo);
     }
 
 

+ 9 - 4
src/main/java/com/server/ShowLineService.java

@@ -2,10 +2,7 @@ package com.server;
 
 import com.dao.ChartsConfigMapper;
 import com.dao.ShowChartsMapper;
-import com.model.bo.LineSeries;
-import com.model.bo.LineSeriesMap;
-import com.model.bo.Screen;
-import com.model.bo.ScreenStr;
+import com.model.bo.*;
 import com.model.pojo.RepCode;
 import com.model.pojo.RepEntity;
 import com.model.vo.configVo.LineConfigInfo;
@@ -46,6 +43,14 @@ public class ShowLineService {
             return new RepEntity(RepCode.Null);
         }
         int id = lineConfigInfo.getId();
+        //获取列配置
+        ChartsColumnConfig chartsColumn = chartsConfigMapper.getChartsColumn(id);
+        String style = chartsColumn.getChartStyle();
+        String config = chartsColumn.getChartConfig();
+        chartsDataInfo.setChartsConfig(config);
+        chartsDataInfo.setChartsStyle(style);
+
+
         String tableName = chartsUtilService.getSqlStr(token, id);
         if ("".equals(tableName)){
             return new RepEntity(RepCode.NoAuthority);

+ 7 - 4
src/main/java/com/server/ShowPieService.java

@@ -2,10 +2,7 @@ package com.server;
 
 import com.dao.ChartsConfigMapper;
 import com.dao.ShowChartsMapper;
-import com.model.bo.PieSeries;
-import com.model.bo.PieSeriesMap;
-import com.model.bo.Screen;
-import com.model.bo.ScreenStr;
+import com.model.bo.*;
 import com.model.pojo.RepCode;
 import com.model.pojo.RepEntity;
 import com.model.vo.configVo.PieConfigInfo;
@@ -46,6 +43,12 @@ public class ShowPieService {
             return new RepEntity(RepCode.Null);
         }
         int id = pieConfigInfo.getId();
+        //获取列配置
+        ChartsColumnConfig chartsColumn = chartsConfigMapper.getChartsColumn(id);
+        String style = chartsColumn.getChartStyle();
+        String config = chartsColumn.getChartConfig();
+        chartsDataInfo.setChartsConfig(config);
+        chartsDataInfo.setChartsStyle(style);
         String tableName = chartsUtilService.getSqlStr(token, id);
         if ("".equals(tableName)){
             return new RepEntity(RepCode.NoAuthority);

+ 14 - 2
src/main/java/com/server/ShowPopulationService.java

@@ -2,11 +2,13 @@ package com.server;
 
 import com.dao.ChartsConfigMapper;
 import com.dao.ShowChartsMapper;
+import com.model.bo.ChartsColumnConfig;
 import com.model.bo.Screen;
 import com.model.bo.ScreenStr;
 import com.model.pojo.RepCode;
 import com.model.pojo.RepEntity;
 import com.model.vo.configVo.PopulationInfo;
+import com.model.vo.dataVo.PopAndIndDataInfo;
 import com.util.BasesSource.DynamicDataSourceContextHolder;
 import com.util.ScreenUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -32,8 +34,16 @@ public class ShowPopulationService {
         if (populationInfo == null || "".equals(populationInfo)){
             return new RepEntity(RepCode.Null);
         }
+        PopAndIndDataInfo popAndIndDataInfo = new PopAndIndDataInfo();
         //取表名
         int id = populationInfo.getId();
+        //获取列配置
+        ChartsColumnConfig chartsColumn = chartsConfigMapper.getChartsColumn(id);
+        String style = chartsColumn.getChartStyle();
+        String config = chartsColumn.getChartConfig();
+        popAndIndDataInfo.setChartsConfig(config);
+        popAndIndDataInfo.setChartsStyle(style);
+
         String tableName = chartsUtilService.getSqlStr(token, id);
         if ("".equals(tableName)){
             return new RepEntity(RepCode.NoAuthority);
@@ -97,7 +107,8 @@ public class ShowPopulationService {
                 }
                 targetData.put(operator, value);
             }
-            return new RepEntity(RepCode.success, targetData);
+            popAndIndDataInfo.setValueList(targetData);
+            return new RepEntity(RepCode.success, popAndIndDataInfo);
             //有分组
         }else {
             String listOne = groupByList.get(0);
@@ -157,7 +168,8 @@ public class ShowPopulationService {
             valueList = showChartsMapper.getGroupByValue(groupBy, opr, tableName, listOne, screenStr);
             valueList.addAll(valueListTh);
             System.out.println("valueList:"+ valueList);
-            return new RepEntity(RepCode.success, valueList);
+            popAndIndDataInfo.setValueList(valueList);
+            return new RepEntity(RepCode.success, popAndIndDataInfo);
         }
         }catch (Exception e){
             e.printStackTrace();

+ 8 - 4
src/main/java/com/server/ShowScatterService.java

@@ -2,10 +2,7 @@ package com.server;
 
 import com.dao.ChartsConfigMapper;
 import com.dao.ShowChartsMapper;
-import com.model.bo.LineSeries;
-import com.model.bo.LineSeriesMap;
-import com.model.bo.Screen;
-import com.model.bo.ScreenStr;
+import com.model.bo.*;
 import com.model.pojo.RepCode;
 import com.model.pojo.RepEntity;
 import com.model.vo.configVo.ScatterConfigInfo;
@@ -46,6 +43,13 @@ public class ShowScatterService {
             return new RepEntity(RepCode.Null);
         }
         int id = scatterConfigInfo.getId();
+        //获取列配置
+        ChartsColumnConfig chartsColumn = chartsConfigMapper.getChartsColumn(id);
+        String style = chartsColumn.getChartStyle();
+        String config = chartsColumn.getChartConfig();
+        chartsDataInfo.setChartsConfig(config);
+        chartsDataInfo.setChartsStyle(style);
+
         String tableName = chartsUtilService.getSqlStr(token, id);
         if ("".equals(tableName)){
             return new RepEntity(RepCode.NoAuthority);

+ 9 - 2
src/main/java/com/server/StrategysService.java

@@ -1,5 +1,6 @@
 package com.server;
 
+import com.dao.DashboardsMapper;
 import com.dao.StrategysBdMapper;
 import com.dao.StrategysChartMapper;
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -28,6 +29,8 @@ public class StrategysService {
     StrategysChartMapper strategysChartMapper;
     @Autowired
     ObjectMapper objectMapper;
+    @Autowired
+    DashboardsMapper dashboardsMapper;
     /*
    保存数据源策略
     */
@@ -145,8 +148,10 @@ public class StrategysService {
         int stId = objectInfo.getStId();
         if ("base".equals(type)){
             strategysBdMapper.delObject(stId);
-        }else {
+        }else if ("chart".equals(type)){
             strategysChartMapper.delObject(stId);
+        }else {
+            dashboardsMapper.delObject(stId);
         }
         List objs = objectInfo.getObj();
         Iterator isObj = objs.iterator();
@@ -157,8 +162,10 @@ public class StrategysService {
             System.out.println("obId:" + obId);
             if ("base".equals(type)) {
                 strategysBdMapper.addObject(stId, obType, obId);
-            } else {
+            } else if ("chart".equals(type)){
                 strategysChartMapper.addObject(stId, obType, obId);
+            }else {
+                dashboardsMapper.addObject(stId, obType, obId);
             }
         }
         return new RepEntity(RepCode.success);