chenw 6 лет назад
Родитель
Сommit
41be3867c0

+ 1 - 1
bi-server/src/main/java/com/usoftchina/bi/server/controller/chart/ShowChartsController.java

@@ -105,7 +105,7 @@ public class ShowChartsController {
     @CheckToken
     @PostMapping("/showIndicator")
     public RepEntity showIndicator(@RequestHeader String token,@RequestBody IndicatorConfigInfo indicatorConfigInfo) {
-        return showIndicatorService.showIndicator(indicatorConfigInfo, token);
+        return showIndicatorService.showIndicator(indicatorConfigInfo, token, null);
     }
 
     /*

+ 6 - 4
bi-server/src/main/java/com/usoftchina/bi/server/dao/dashboard/DashboardsMapper.java

@@ -18,9 +18,9 @@ public interface DashboardsMapper {
     插入
      */
     @Insert("insert into " +
-            "bi_dashboards(id, bd_name,bd_note,CONFIGURATION,create_by, filters, create_date, BD_THUMBNAIL,relation_columns, create_id, bd_code,bd_menuId)" +
+            "bi_dashboards(id, bd_name,bd_note,CONFIGURATION,create_by, filters, create_date, BD_THUMBNAIL,relation_columns, create_id, bd_code,bd_menuId,theme)" +
             "values(#{id,jdbcType=INTEGER}, #{bdName,jdbcType=VARCHAR},#{bdNote,jdbcType=VARCHAR},#{bdConfiguration,jdbcType=VARCHAR},#{createBy,jdbcType=VARCHAR}, #{filters,jdbcType=VARCHAR}, " +
-            "to_date(to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'),'YYYY-MM-DD hh24:mi:ss'), #{thumbnail,jdbcType=VARCHAR},#{relationColumns,jdbcType=VARCHAR}, #{createId,jdbcType=INTEGER}, #{bdCode,jdbcType=VARCHAR}, #{menuId, jdbcType=INTEGER})")
+            "to_date(to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'),'YYYY-MM-DD hh24:mi:ss'), #{thumbnail,jdbcType=VARCHAR},#{relationColumns,jdbcType=VARCHAR}, #{createId,jdbcType=INTEGER}, #{bdCode,jdbcType=VARCHAR}, #{menuId, jdbcType=INTEGER}, #{theme, jdbcType=VARCHAR})")
     @SelectKey(before=true,keyProperty="id",resultType=Integer.class,statement="SELECT BI_DASHBOARDS_SEQUENCE.nextval from dual",keyColumn = "id")
     void setDashboards(Dashboards dashboards);
 
@@ -55,6 +55,7 @@ public interface DashboardsMapper {
             "<if test=\"thumbnail != null\"> , BD_THUMBNAIL = #{thumbnail} </if>" +
             "<if test=\"relationColumns != null\">, relation_columns = #{relationColumns} </if>"+
             "<if test=\"filters != null\">, filters = #{filters} </if>"+
+            "<if test=\"theme != null\">, filters = #{theme} </if>"+
             "<if test=\"bdCode != null\">, BD_CODE = #{bdCode} </if>"+
             " ,UPDATE_DATE = to_date(to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'),'YYYY-MM-DD hh24:mi:ss') " +
             "where id = #{id}" +
@@ -105,7 +106,7 @@ public interface DashboardsMapper {
     /*
     查询看板
      */
-    @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, filters, demo, bd_code,bd_menuId " +
+    @Select("select id, bd_note as bdNote,theme, 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, filters, demo, bd_code,bd_menuId " +
             " 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}))" +
@@ -125,6 +126,7 @@ public interface DashboardsMapper {
             @Result(column = "demo", property = "demo", jdbcType = JdbcType.BOOLEAN),
             @Result(column = "id", property = "chartIds", one = @One(select = "getChartIdsById")),
             @Result(column = "bd_code", property = "bdCode", jdbcType = JdbcType.VARCHAR),
+            @Result(column = "theme", property = "theme", jdbcType = JdbcType.VARCHAR),
             @Result(column = "bd_menuId", property = "menuId", jdbcType = JdbcType.VARCHAR)
     })
     Dashboards getDashboards(@Param("userId") int userId, @Param("id") int id);
@@ -132,7 +134,7 @@ public interface DashboardsMapper {
     /*
    查询看板
     */
-    @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, filters, demo, bd_code,bd_menuId " +
+    @Select("select id, bd_note as bdNote,theme, 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, filters, demo, bd_code,bd_menuId " +
             " from BI_DASHBOARDS where id = #{id}")
     @ResultMap("DashBoardsResultMap")
     Dashboards getDashboardsWithoutLimit(@Param("id") int id);

+ 9 - 0
bi-server/src/main/java/com/usoftchina/bi/server/model/po/Dashboards.java

@@ -20,9 +20,18 @@ public class Dashboards {
     private String filters;
     private String chartIds;
     private String bdCode;
+    private String theme;
     private boolean demo;
     private int menuId;
 
+    public String getTheme() {
+        return theme;
+    }
+
+    public void setTheme(String theme) {
+        this.theme = theme;
+    }
+
     public int getMenuId() {
         return menuId;
     }

+ 9 - 0
bi-server/src/main/java/com/usoftchina/bi/server/model/vo/configVo/DashboardsInfo.java

@@ -12,8 +12,17 @@ public class DashboardsInfo {
     private String filters;
     private String chartIds;
     private String bdCode;
+    private String theme;
     private int menuId;
 
+    public String getTheme() {
+        return theme;
+    }
+
+    public void setTheme(String theme) {
+        this.theme = theme;
+    }
+
     public int getMenuId() {
         return menuId;
     }

+ 10 - 2
bi-server/src/main/java/com/usoftchina/bi/server/service/chart/ShowIndicatorService.java

@@ -2,10 +2,12 @@ package com.usoftchina.bi.server.service.chart;
 
 import com.usoftchina.bi.core.base.RepCode;
 import com.usoftchina.bi.core.base.RepEntity;
+import com.usoftchina.bi.server.dao.chart.ChartsConfigMapper;
 import com.usoftchina.bi.server.dao.chart.ShowChartsMapper;
 import com.usoftchina.bi.server.model.bo.Screen;
 import com.usoftchina.bi.server.model.bo.ScreenStr;
 import com.usoftchina.bi.server.model.vo.configVo.IndicatorConfigInfo;
+import com.usoftchina.bi.server.model.vo.dataVo.ChartsDataInfo;
 import com.usoftchina.bi.server.utils.ScreenUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -29,6 +31,8 @@ public class ShowIndicatorService {
     @Autowired
     private ShowChartsMapper showChartsMapper;
     @Autowired
+    private ChartsConfigMapper chartsConfigMapper;
+    @Autowired
     private ScreenUtil screenUtil;
 
     /**
@@ -37,7 +41,8 @@ public class ShowIndicatorService {
      * @param token
      * @return
      */
-    public RepEntity<?> showIndicator(IndicatorConfigInfo indicatorConfigInfo, String token) {
+    public RepEntity<ChartsDataInfo> showIndicator(IndicatorConfigInfo indicatorConfigInfo, String token, String styleConfig) {
+        ChartsDataInfo chartsDataInfo = new ChartsDataInfo();
         Assert.notNull(indicatorConfigInfo, "请求参数不正确");
         List<Screen> filters = indicatorConfigInfo.getFilters();
         String fields = "", otherFields = "";
@@ -60,7 +65,10 @@ public class ShowIndicatorService {
             condition += "," + String.join(",", indicatorConfigInfo.getOtherColumn());
         }
         List<Map<String, Object>> indicatorSeriesMapList = showChartsMapper.getIndicatorValue(fields, tableName, condition, sort, indicatorConfigInfo.getRule());
-        return new RepEntity<>(RepCode.success, indicatorSeriesMapList);
+        chartsDataInfo.setChartsColumnConfig(chartsConfigMapper.getChartsColumn(indicatorConfigInfo.getId()));
+        chartsDataInfo.setSerieses(indicatorSeriesMapList);
+        chartsDataInfo.setStyleConfig(styleConfig);
+        return new RepEntity<>(RepCode.success, chartsDataInfo);
     }
 
     /**

+ 3 - 3
bi-server/src/main/java/com/usoftchina/bi/server/service/dashboard/DashboardsToChartsUtilService.java

@@ -90,7 +90,7 @@ public class DashboardsToChartsUtilService {
         }else if("scatter".equals(chartType)){
             return getScatter(fetchConfig, token, filters, chartId, styleConfig);
         }else if ("indicator".equalsIgnoreCase(chartType)) {
-            return getIndicator(fetchConfig, token, filters);
+            return getIndicator(fetchConfig, token, filters, styleConfig);
         }
         return new RepEntity(RepCode.success);
     }
@@ -166,7 +166,7 @@ public class DashboardsToChartsUtilService {
         return showPieService.showPie(pieConfigInfo, token, chartId, styleConfig);
     }
 
-    private RepEntity getIndicator(String fetchConfig, String token, List<Screen> filters){
+    private RepEntity getIndicator(String fetchConfig, String token, List<Screen> filters, String styleConfig){
         IndicatorConfigInfo indicatorConfigInfo = new IndicatorConfigInfo();
         try {
             indicatorConfigInfo = objectMapper.readValue(fetchConfig,IndicatorConfigInfo.class);
@@ -174,7 +174,7 @@ public class DashboardsToChartsUtilService {
         } catch (Exception e) {
             e.printStackTrace();
         }
-        return showIndicatorService.showIndicator(indicatorConfigInfo, token);
+        return showIndicatorService.showIndicator(indicatorConfigInfo, token, styleConfig);
     }
 
 }