Browse Source

Merge remote-tracking branch 'origin/feature-refactor' into feature-refactor

hy 6 years ago
parent
commit
6f214ad99d
28 changed files with 216 additions and 43 deletions
  1. 3 3
      bi-core/src/main/java/com/usoftchina/bi/core/base/BaseContextHolder.java
  2. 3 2
      bi-core/src/main/java/com/usoftchina/bi/core/base/RepCode.java
  3. 1 2
      bi-server/src/main/java/com/usoftchina/bi/server/controller/dashboard/DashboardMenuController.java
  4. 2 2
      bi-server/src/main/java/com/usoftchina/bi/server/controller/user/UserController.java
  5. 1 0
      bi-server/src/main/java/com/usoftchina/bi/server/controller/user/UserPowerController.java
  6. 4 6
      bi-server/src/main/java/com/usoftchina/bi/server/dao/chart/ChartsConfigMapper.java
  7. 7 7
      bi-server/src/main/java/com/usoftchina/bi/server/dao/chart/ShowChartsMapper.java
  8. 1 4
      bi-server/src/main/java/com/usoftchina/bi/server/dao/dashboard/DashboardsMapper.java
  9. 1 1
      bi-server/src/main/java/com/usoftchina/bi/server/dao/dataSource/DataConnectorMapper.java
  10. 25 2
      bi-server/src/main/java/com/usoftchina/bi/server/dao/user/UserMapper.java
  11. 8 0
      bi-server/src/main/java/com/usoftchina/bi/server/dao/user/UserPowerMapper.java
  12. 7 1
      bi-server/src/main/java/com/usoftchina/bi/server/service/chart/ChartsConfigService.java
  13. 23 6
      bi-server/src/main/java/com/usoftchina/bi/server/service/chart/ShowHistogramService.java
  14. 1 1
      bi-server/src/main/java/com/usoftchina/bi/server/service/chart/ShowLineService.java
  15. 4 0
      bi-server/src/main/java/com/usoftchina/bi/server/service/chart/TimeConverterUtil.java
  16. 2 1
      bi-server/src/main/java/com/usoftchina/bi/server/service/dashboard/DashBoardMenuService.java
  17. 3 0
      bi-server/src/main/java/com/usoftchina/bi/server/service/dataSource/DataConnectorService.java
  18. 50 0
      bi-server/src/main/java/com/usoftchina/bi/server/service/user/UserPowerService.java
  19. 66 1
      bi-server/src/main/java/com/usoftchina/bi/server/service/user/UserService.java
  20. 2 2
      bi-server/src/main/resources/application.properties
  21. 0 0
      bi-server/src/main/resources/static/index.47161842.css
  22. 0 0
      bi-server/src/main/resources/static/index.5ff87b47.js
  23. 0 0
      bi-server/src/main/resources/static/index.a34fe3fc.js
  24. 0 0
      bi-server/src/main/resources/static/index.f87723cc.css
  25. 2 2
      bi-server/src/main/resources/static/index.html
  26. BIN
      bi-server/src/main/resources/static/static/login-bg.492b0933.jpg
  27. BIN
      bi-server/src/main/resources/static/static/login-bg.69e45b47.png
  28. BIN
      bi-server/src/main/resources/static/static/login-header.cdb7f126.png

+ 3 - 3
bi-core/src/main/java/com/usoftchina/bi/core/base/BaseContextHolder.java

@@ -35,7 +35,7 @@ public class BaseContextHolder {
         return Integer.valueOf(String.valueOf(value));
     }
 
-    public static void setUserId(int userId) {
+    public static synchronized void setUserId(int userId) {
         set("userId", userId);
     }
 
@@ -44,7 +44,7 @@ public class BaseContextHolder {
         return String.valueOf(value);
     }
 
-    public static void setUserName(String userName) {
+    public static synchronized void setUserName(String userName) {
         set("userName", userName);
     }
 
@@ -53,7 +53,7 @@ public class BaseContextHolder {
         return String.valueOf(value);
     }
 
-    public static void setRole(String role){
+    public static synchronized void setRole(String role){
         set("role", role);
     }
 }

+ 3 - 2
bi-core/src/main/java/com/usoftchina/bi/core/base/RepCode.java

@@ -24,8 +24,9 @@ public enum  RepCode {
     DashboardNonExistent(-510, "看板不存在"),
     DATACONNECTOR_USED_DATASOURCE(-511, "已有数据源使用了此连接,无法删除!"),
     CHARTS_USED_DATACONNECTOR(-512, "该数据源存在关联的图表,不允许删除!"),
-    DASHBOARD_USED_CHARTS(-513, "已有看板使用了此图表,无法删除!"),
-    MENU_USED_DASHBOARD(-514, "此目录下存在看板,无法删除!");
+    DASHBOARD_USED_CHARTS(-513, "该图表存在关联的报表,不允许删除!"),
+    MENU_USED_DASHBOARD(-514, "此目录下存在报表,无法删除!"),
+    USER_GROUP_EXISTS(-515, "用户组名称已存在!");
 
     private int code;
     private String msg;

+ 1 - 2
bi-server/src/main/java/com/usoftchina/bi/server/controller/dashboard/DashboardMenuController.java

@@ -36,8 +36,7 @@ public class DashboardMenuController {
     @Auth(user = "admin")
     @ApiOperation(value = "保存目录", notes = "保存看板目录", response = RepEntity.class)
     public RepEntity save(@RequestHeader String token, @RequestBody DashBoardMenuInfo dashBoardMenuInfo){
-        dashBoardMenuService.save(dashBoardMenuInfo);
-        return new RepEntity(RepCode.success);
+        return new RepEntity(RepCode.success, dashBoardMenuService.save(dashBoardMenuInfo));
     }
 
     @PostMapping("/update")

+ 2 - 2
bi-server/src/main/java/com/usoftchina/bi/server/controller/user/UserController.java

@@ -66,7 +66,7 @@ public class UserController {
      */
     @ApiOperation(value = "创建用户组", notes = "创建用户组", response = RepEntity.class)
     @Auth(user = "admin")
-    @Log(module = "用户", name = "#body.userGroupName", token = "#token")
+    @Log(module = "用户管理", name = "#body.userGroupName", token = "#token")
     @CheckToken
     @PostMapping("/createUserGroup")
     public RepEntity saveUserGroup(@RequestHeader String token, @RequestBody UserGroupInfo body){
@@ -78,7 +78,7 @@ public class UserController {
      */
     @ApiOperation(value = "更新用户组", notes = "更新用户组", response = RepEntity.class)
     @Auth(user = "admin")
-    @Log(module = "用户", name = "#body.userGroupName", token = "#token")
+    @Log(module = "用户管理", name = "#body.userGroupName", token = "#token")
     @CheckToken
     @PostMapping("/updateUserGroup")
     public RepEntity updateUserGroup(@RequestHeader String token, @RequestBody UserGroupInfo body){

+ 1 - 0
bi-server/src/main/java/com/usoftchina/bi/server/controller/user/UserPowerController.java

@@ -3,6 +3,7 @@ package com.usoftchina.bi.server.controller.user;
 import com.usoftchina.bi.core.base.RepCode;
 import com.usoftchina.bi.core.base.RepEntity;
 import com.usoftchina.bi.server.model.pojo.annotation.CheckToken;
+import com.usoftchina.bi.server.model.pojo.annotation.Log;
 import com.usoftchina.bi.server.model.vo.configVo.BatchUserPowerInfo;
 import com.usoftchina.bi.server.model.vo.configVo.UserPowerInfo;
 import com.usoftchina.bi.server.service.user.UserPowerService;

+ 4 - 6
bi-server/src/main/java/com/usoftchina/bi/server/dao/chart/ChartsConfigMapper.java

@@ -48,8 +48,9 @@ public interface ChartsConfigMapper {
     /*
     查看图表列表
      */
-    @Select("select id as chartId, chart_name as chartName, chart_type as chartType, create_by as createBy, create_date as createDate" +
-            ",bc_filters as filters, CHART_DESCRIBES as describes, bc_charts_group as chartsGroup, bc_charts_option as chartOption, demo from bi_charts")
+    @Select("select '1' as authority,case when bc.BD_DATA_ID not in(select id from bi_data_connectors) then '1' else '0' end dbStatus, 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.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, bc.demo, bds.BASES_NAME as dataConnectionName, bds.id as dataConnectionId "
+            + "from bi_charts bc left join bi_data_connectors bd on bc.bd_data_id=bd.id left join BI_DATABASES bds on bds.id = BD.DB_CONFIG")
     List<ChartConfigList> getListCharts();
 
     /*
@@ -107,9 +108,6 @@ public interface ChartsConfigMapper {
             "    ))")
     List<ChartConfigList> getListByUser(@Param("id") int id, TestPage testPage);
 
-    @Select("")
-    List<ChartConfigList> getListWithoutLimit(@Param("id") int id, TestPage testPage);
-
     /*
     通过Id查找表名
     */
@@ -261,7 +259,7 @@ public interface ChartsConfigMapper {
      * @param groupInfoList
      */
     @Update("<script>"
-            + "UPDATE BI_CHARTS_GROUP SET BC_FATHER_ID = -1 WHERE BC_FATHER_ID IN "
+            + "UPDATE BI_CHARTS_GROUP SET BC_FATHER_ID = -1 WHERE BC_ID IN "
             + "<foreach collection=\"list\" item=\"item\" index=\"index\" open=\"(\" close=\")\" separator=\",\">"
             +   "#{item.id, jdbcType=INTEGER}"
             + "</foreach>"

+ 7 - 7
bi-server/src/main/java/com/usoftchina/bi/server/dao/chart/ShowChartsMapper.java

@@ -34,10 +34,10 @@ public interface ShowChartsMapper {
                      @Param("xdata") String xdata, @Param("screen") String screen);
 
     //x轴数据 -> 优化后
-    @Select("select ${dataType}(${yAxisName}) from ${tableName} where 1=1 ${screen} GROUP BY ${xColumn}")
+    @Select("select ${dataType}(${yAxisName}) from ${tableName} where 1=1 ${screen} and ${xColumn} in (select * from (select DISTINCT ${xColumn} from ${tableName} ${screenToColumn}) where rownum <= #{num}) GROUP BY ${xColumn}")
     List<Double> getValues(@Param("yAxisName") String yAxisName, @Param("xColumn") String xColumn,
                     @Param("tableName") String tableName, @Param("dataType") String dataType,
-                    @Param("screen") String screen);
+                    @Param("screen") String screen, @Param("screenToColumn") String screenToColumn, @Param("num") int num);
 
     //x轴数据 -> 饼图优化后
     @Select("select ${dataType}(${yAxisName}) value, ${xColumn} name from ${tableName} where 1=1 ${screen} GROUP BY ${xColumn}")
@@ -98,7 +98,7 @@ public interface ShowChartsMapper {
                                  @Param("screen") String screen);
 
     //无分组时间类型值(柱状图)->优化后
-    @Select("select ${dataType}(${yAxisName}) from ${tableName} WHERE 1=1 ${screen} GROUP BY (to_char(${xAxisName},${timeType})) ORDER BY (to_char(${xAxisName},${timeType}))")
+    @Select("select ${dataType}(${yAxisName}) from ${tableName} WHERE 1=1 ${screen} GROUP BY (to_char(${xAxisName},${timeType})) ")
     List<Double> getHistogramTimeValue(@Param("dataType") String dataType, @Param("yAxisName") String yAxisName,
                                        @Param("tableName") String tableName, @Param("xAxisName") String xAxisName,
                                        @Param("timeType") String timeType, @Param("screen") String screen);
@@ -145,16 +145,16 @@ public interface ShowChartsMapper {
     );
 
     //查询时间类型分组的值->优化后(柱状图)
-    @Select("select ${dataType}(${yAxisName}) from ${tableName} where ${groupsColumn}=#{groupsIndex} GROUP BY TO_CHAR(${xColumn},${timeType}) GROUP BY TO_CHAR(${xColumn},${timeType})")
+    @Select("select ${dataType}(${yAxisName}) from ${tableName} where ${groupsColumn}=#{groupsIndex} GROUP BY TO_CHAR(${xColumn},${timeType}) ORDER BY TO_CHAR(${xColumn},${timeType})")
     List<Double> getHistogramTimeValueGroupValuesTime(@Param("dataType") String dataType, @Param("yAxisName") String yAxisName, @Param("tableName") String tableName,
                                                       @Param("groupsColumn") String groupsColumn, @Param("groupsIndex") String groupsIndex,
                                                       @Param("xColumn") String xColumn, @Param("timeType") String timeType);
 
     //查询时间类型分组的值->优化后
-    @Select("select ${dataType}(${yAxisName}) as \"value\",TO_CHAR(${xColumn},${timeType}) as \"date\",${groupsColumn} as \"group\" from ${tableName} where ${groupsColumn} IN (SELECT ${groupsColumn} FROM ${tableName} GROUP BY ${groupsColumn}) GROUP BY TO_CHAR(${xColumn},${timeType}),${groupsColumn} ")
+    @Select("select ${dataType}(${yAxisName}) as \"value\",TO_CHAR(${xColumn},${timeType}) as \"date\",${groupsColumn} as \"group\" from ${tableName} where ${groupsColumn} IN (SELECT ${groupsColumn} FROM ${tableName} GROUP BY ${groupsColumn}) ${screen} GROUP BY TO_CHAR(${xColumn},${timeType}),${groupsColumn} ")
     List<LineSeriesGroupMap> getGroupsValuesTime(@Param("dataType") String dataType, @Param("yAxisName") String yAxisName, @Param("tableName") String tableName,
                                                  @Param("groupsColumn") String groupsColumn, @Param("groupsIndex") String groupsIndex,
-                                                 @Param("xColumn") String xColumn, @Param("timeType") String timeType
+                                                 @Param("xColumn") String xColumn, @Param("timeType") String timeType, @Param("screen") String screen
     );
 
     //有分组时时间类型为空值
@@ -223,7 +223,7 @@ public interface ShowChartsMapper {
     /*
     总体分组的值
      */
-    @Select("select ${groupBy},${operation} from ${tableName} group by ${groupBy} order by ${groupByOne}")
+    @Select("select ${groupBy},${operation} from ${tableName} ${screen} group by ${groupBy} order by ${groupByOne}")
     List<LinkedHashMap<String, Object>> getGroupByValue(@Param("groupBy") String groupBy, @Param("operation") String operation, @Param("tableName") String tableName,
                                                         @Param("groupByOne") String groupByOne, @Param("screen") String screen);
 

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

@@ -133,10 +133,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 " +
-            " 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))" +
-            " or (BO_TYPE='1'))) and id = #{id}")
+            " from BI_DASHBOARDS where id = #{id}")
     @ResultMap("DashBoardsResultMap")
     Dashboards getDashboardsWithoutLimit(@Param("id") int id);
 

+ 1 - 1
bi-server/src/main/java/com/usoftchina/bi/server/dao/dataSource/DataConnectorMapper.java

@@ -215,7 +215,7 @@ public interface DataConnectorMapper {
             "<if test=\"dataName != null\"> DATA_NAME = #{dataName, jdbcType=VARCHAR}, </if>" +
             "<if test=\"userName != null\"> USER_NAME = #{userName, jdbcType=VARCHAR}, </if>" +
             "<if test=\"passWord != null\"> PASS_WORD = #{passWord, jdbcType=VARCHAR}, </if>" +
-            "<if test=\"note != null\"> NOTE = #{note, jdbcType=VARCHAR} </if>" +
+            "NOTE = #{note, jdbcType=VARCHAR}" +
             "where id = #{id, jdbcType=INTEGER}" +
             "</script>")
     void updatabases(Databases databases);

+ 25 - 2
bi-server/src/main/java/com/usoftchina/bi/server/dao/user/UserMapper.java

@@ -129,7 +129,7 @@ public interface UserMapper {
      */
     @Select("SELECT BU_ID as id, BU_NAME as name, BU_DEPARTMENT as department, BU_POST as post, BU_ROLE as role," +
             " USER_NAME as userName, PASS_WORD as passWord, BU_PHONE as phone, BU_CLASS as state " +
-            "FROM BI_USERS WHERE USER_NAME = #{userName}")
+            "FROM BI_USERS WHERE USER_NAME = #{userName} AND BU_CLASS <> '离职'")
     User getBIUserByName(@Param("userName") String userName);
 
     /**
@@ -139,7 +139,7 @@ public interface UserMapper {
      */
     @Select("SELECT BU_ID as id, BU_NAME as name, BU_DEPARTMENT as department, BU_POST as post, BU_ROLE as role," +
             " USER_NAME as userName, PASS_WORD as passWord, BU_PHONE as phone, BU_CLASS as state " +
-            "FROM BI_USERS WHERE BU_PHONE = #{mobile}")
+            "FROM BI_USERS WHERE BU_PHONE = #{mobile} AND BU_CLASS <> '离职'")
     User getBIUserByMobile(@Param("mobile") String mobile);
 
     /*
@@ -180,6 +180,14 @@ public interface UserMapper {
     @Update("update bi_users set user_token = #{token} where bu_id = #{id}")
     void updateToken(@Param("token") String token, @Param("id") int id);
 
+    /**
+     * 查询名称是否重复
+     * @param name
+     * @return
+     */
+    @Select("SELECT COUNT(*) FROM BI_USER_GROUPS WHERE BG_NAME = #{name,jdbcType=VARCHAR}")
+    int getGroupCountByGroupName(@Param("name")String name);
+
     /*
     创建用户组
      */
@@ -220,6 +228,13 @@ public interface UserMapper {
     @Delete("delete from bi_user_groups where bg_id = #{id}")
     void delUserGroup(Long id);
 
+    /**
+     * 删除用户组所拥有的权限
+     * @param id
+     */
+    @Delete("DELETE FROM BI_POWER_USERS WHERE BPU_USERGROUPID = #{id}")
+    void deletePowerByGroupId(Long id);
+
     /*
     添加用户到用户组
      */
@@ -234,6 +249,14 @@ public interface UserMapper {
     @Select("select count(*) from bi_user_rel_groups where br_user_id = #{userId} and br_user_group = #{userGroupId} ")
     int getUserCountInGroup(@Param("userId") int userId, @Param("userGroupId") int userGroupId);
 
+    /**
+     * 获取用户名
+     * @param ids
+     * @return
+     */
+    @Select("SELECT WM_CONCAT(BU_NAME) FROM BI_USERS WHERE BU_ID IN (${ids})")
+    String getUserByIds(String ids);
+
     /*
     查询用户组下的用户信息
      */

+ 8 - 0
bi-server/src/main/java/com/usoftchina/bi/server/dao/user/UserPowerMapper.java

@@ -84,4 +84,12 @@ public interface UserPowerMapper {
             + "</script>")
     void insertByUserId(@Param("array") String[] ids, @Param("userId") int id);
 
+    @Select("SELECT WM_CONCAT(BD_NAME) FROM BI_DASHBOARDS WHERE ID IN (${ids}) AND ID NOT IN (SELECT BPU_DASHBOARDID FROM BI_POWER_USERS WHERE BPU_USERGROUPID = #{id} AND BPU_DASHBOARDID IN (${ids}))")
+    String getDashboardsNameByUserGroup(@Param("ids") String ids, @Param("id") int id);
+
+    @Select("SELECT WM_CONCAT(BD_NAME) FROM BI_DASHBOARDS WHERE ID IN (${ids}) AND ID NOT IN (SELECT BPU_DASHBOARDID FROM BI_POWER_USERS WHERE BPU_USERID = #{id} AND BPU_DASHBOARDID IN (${ids}))")
+    String getDashboardsNameByUser(@Param("ids") String ids, @Param("id") int id);
+
+    @Select("SELECT WM_CONCAT(BD_NAME) FROM BI_DASHBOARDS WHERE ID IN (${ids})")
+    String getDashboardsByIds(@Param("ids") String ids);
 }

+ 7 - 1
bi-server/src/main/java/com/usoftchina/bi/server/service/chart/ChartsConfigService.java

@@ -205,7 +205,13 @@ public class ChartsConfigService {
      */
     public RepEntity getListCharts(String token, TestPage testPage){
         int id = BaseContextHolder.getUserId();
-        List<ChartConfigList> chartsList = chartsConfigMapper.getListByUser(id,testPage.enablePaging());
+        String role = BaseContextHolder.getRole();
+        List<ChartConfigList> chartsList = new ArrayList<>();
+        if (RoleConstant.SUPER_ADMIN.getRole().equals(role)) {
+            chartsList = chartsConfigMapper.getListCharts();
+        }else {
+            chartsList = chartsConfigMapper.getListByUser(id, testPage.enablePaging());
+        }
         PageInfo<ChartConfigList> pageInfo = new PageInfo<>(chartsList);
         return new RepEntity(RepCode.success, pageInfo);
     }

+ 23 - 6
bi-server/src/main/java/com/usoftchina/bi/server/service/chart/ShowHistogramService.java

@@ -138,10 +138,26 @@ public class ShowHistogramService {
             }
 
             //无分组时Y值
-            if ("time".equals(xColumnType)){        //如果是时间类型
-                value = timeConverterUtil.getHistogramTimeValue(yColumn, xColumn, tableName, yAxisType, xAxisType, xAxisData, screenToColumnS);
-            }else {
-                value = showChartsMapper.getValues(yColumn, xColumn, tableName, yAxisType, screenToColumnS);
+            Iterator itX = xAxisData.iterator();
+            while (itX.hasNext()){
+                String xdata = (String)itX.next();
+                double valueOne = 0;
+                String valueOnes = null;
+                if ("time".equals(xColumnType)){
+                    valueOnes = timeConverterUtil.getTimeValueConverter(yColumn, xColumn, tableName, yAxisType, xAxisType, xdata, screenToColumnS);
+                }else {
+                    if (xdata == null || "".equals(xdata)){
+                        valueOnes = showChartsMapper.getValuesIsNull(yColumn, xColumn, tableName, yAxisType, screenToColumnS);
+                    }else {
+                        valueOnes = showChartsMapper.getXValue(yColumn, xColumn, tableName, yAxisType, xdata, screenToColumnS);
+                    }
+                }
+                if (valueOnes == null || "".equals(valueOnes)){
+                    valueOne = 0;
+                }else {
+                    valueOne = Double.parseDouble(valueOnes);
+                }
+                value.add(valueOne);
             }
 
             series.setName(xColumn);
@@ -177,8 +193,8 @@ public class ShowHistogramService {
                             double groupsValueOne = 0;
                             String groupsValueOnes = null;
                             if ("time".equals(xColumnType)){
-                                groupsValue = timeConverterUtil.getHistogramGroupTime(yAxisType, yColumn, tableName, groupByName, xAxisType,
-                                        groupsName, xColumn, xAxisData, screenToColumnS);
+                                groupsValueOnes = timeConverterUtil.getGroupTimeConverter(yAxisType, yColumn, tableName, groupByName, xAxisType,
+                                        groupsName, xColumn, xAxisDataOne, screenToColumnS);
                             }else {
                                 String xColumnKey = "";
                                 if (xAxisDataOne == null || "".equals(xAxisDataOne)){
@@ -201,6 +217,7 @@ public class ShowHistogramService {
                             }else{
                                 groupsValueOne = Double.parseDouble(groupsValueOnes);
                             }
+
                             groupsValue.add(groupsValueOne);
                         }
                         ne.setValue(groupsValue);

+ 1 - 1
bi-server/src/main/java/com/usoftchina/bi/server/service/chart/ShowLineService.java

@@ -144,7 +144,7 @@ public class ShowLineService {
                 }
                 String groupsName = (String)itGroupsData.next();
 
-                List<LineSeriesGroupMap> lineSeriesGroupMapList = showChartsMapper.getGroupsValuesTime(yAxisType, yColumn, tableName, groupByName, groupsName, xColumn, "'YYYY-MM-DD'");
+                List<LineSeriesGroupMap> lineSeriesGroupMapList = showChartsMapper.getGroupsValuesTime(yAxisType, yColumn, tableName, groupByName, groupsName, xColumn, "'YYYY-MM-DD'",screenToColumnS);
                 Map<String, List<LineSeriesGroupMap>> lineSeriesGroupMap = CollectionUtils.groupBy(lineSeriesGroupMapList, LineSeriesGroupMap::getGroup);
                 Iterator<Map.Entry<String, List<LineSeriesGroupMap>>> it = lineSeriesGroupMap.entrySet().iterator();
                 List<LineSeriesMap> lineSeriesMapList = null;

+ 4 - 0
bi-server/src/main/java/com/usoftchina/bi/server/service/chart/TimeConverterUtil.java

@@ -4,6 +4,7 @@ import com.usoftchina.bi.server.dao.chart.ShowChartsMapper;
 import com.usoftchina.bi.server.model.bo.TimeReture;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
 
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -72,6 +73,9 @@ public class TimeConverterUtil {
             }else {
                 timeReture.setOverdose(true);
             }
+            if (StringUtils.isEmpty(screen)) {
+                screen = "where 1 = 1";
+            }
             value = showChartsMapper.getTimeYear(xColumnName, tableName, screen);
             timeReture.setValues(value);
         }else {

+ 2 - 1
bi-server/src/main/java/com/usoftchina/bi/server/service/dashboard/DashBoardMenuService.java

@@ -50,8 +50,9 @@ public class DashBoardMenuService {
         return dashboardMenuRespDTOList;
     }
 
-    public void save(DashBoardMenuInfo dashBoardMenuInfo){
+    public int save(DashBoardMenuInfo dashBoardMenuInfo){
         dashBoardMenuMapper.insert(dashBoardMenuInfo);
+        return dashBoardMenuInfo.getId();
     }
 
     public void update(DashBoardMenuInfo dashBoardMenuInfo){

+ 3 - 0
bi-server/src/main/java/com/usoftchina/bi/server/service/dataSource/DataConnectorService.java

@@ -139,6 +139,9 @@ public class DataConnectorService {
         while (isList.hasNext()) {
             DataConnectorList dataConnectorList = (DataConnectorList) isList.next();
             BaseConfig baseConfig = dataConnectorList.getDbConfig();
+            if (ObjectUtils.isEmpty(baseConfig)) {
+                continue;
+            }
             baseConfig.setPassWord("");
             dataConnectorList.setDbConfig(baseConfig);
             listConnectors.add(dataConnectorList);

+ 50 - 0
bi-server/src/main/java/com/usoftchina/bi/server/service/user/UserPowerService.java

@@ -1,10 +1,13 @@
 package com.usoftchina.bi.server.service.user;
 
 import com.usoftchina.bi.core.base.BaseContextHolder;
+import com.usoftchina.bi.server.dao.dashboard.DashboardsMapper;
+import com.usoftchina.bi.server.dao.user.UserMapper;
 import com.usoftchina.bi.server.dao.user.UserPowerMapper;
 import com.usoftchina.bi.server.model.vo.configVo.BatchUserPowerInfo;
 import com.usoftchina.bi.server.model.vo.configVo.UserPowerInfo;
 import com.usoftchina.bi.server.model.vo.dataVo.DashboardPowerDTO;
+import com.usoftchina.bi.server.service.common.MessageLogService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -19,6 +22,12 @@ public class UserPowerService {
 
     @Autowired
     private UserPowerMapper userPowerMapper;
+    @Autowired
+    private MessageLogService messageLogService;
+    @Autowired
+    private UserMapper userMapper;
+    @Autowired
+    private DashboardsMapper dashboardsMapper;
 
     /**
      * 新增用户(组)权限
@@ -26,6 +35,8 @@ public class UserPowerService {
      */
     public void save(UserPowerInfo userPowerInfo){
         userPowerMapper.insert(userPowerInfo);
+        String content = getLogContent(userPowerInfo, "新增");
+        messageLogService.save("权限管理", null, BaseContextHolder.getUserName(), content);
     }
 
     /**
@@ -43,6 +54,8 @@ public class UserPowerService {
      */
     public void delete(UserPowerInfo userPowerInfo){
         userPowerMapper.delete(userPowerInfo);
+        String content = getLogContent(userPowerInfo, "删除");
+        messageLogService.delete("权限管理", null, BaseContextHolder.getUserName(), content);
     }
 
     /**
@@ -52,20 +65,57 @@ public class UserPowerService {
     public void batchAdd(BatchUserPowerInfo batchUserPowerInfo) {
         String[] ids = batchUserPowerInfo.getDashboardIds().split(",");
         if (batchUserPowerInfo.getType() == 0) {
+            String dashboardsName = userPowerMapper.getDashboardsNameByUserGroup(batchUserPowerInfo.getDashboardIds(), batchUserPowerInfo.getBizId());
+            String name = userMapper.getUserGroup(batchUserPowerInfo.getBizId()).getUserGroupName();
+
             userPowerMapper.deleteByUserGroupId(batchUserPowerInfo.getDashboardIds(),batchUserPowerInfo.getBizId());
             userPowerMapper.insertByUserGroupId(ids, batchUserPowerInfo.getBizId());
+            messageLogService.save("权限管理", null, BaseContextHolder.getUserName(), "批量新增 " + name + "(用户组) 查看报表 " + dashboardsName + " 的权限");
         }else {
+            String dashboardsName = userPowerMapper.getDashboardsNameByUser(batchUserPowerInfo.getDashboardIds(), batchUserPowerInfo.getBizId());
+            String name = userMapper.getUserById(batchUserPowerInfo.getBizId()).getUserName();
+
             userPowerMapper.deleteByUserId(batchUserPowerInfo.getDashboardIds(), batchUserPowerInfo.getBizId());
             userPowerMapper.insertByUserId(ids, batchUserPowerInfo.getBizId());
+
+            messageLogService.save("权限管理", null, BaseContextHolder.getUserName(), "批量新增 " + name + "(用户) 查看报表 " + dashboardsName + " 的权限");
         }
     }
 
+    /**
+     * 批量删除权限
+     * @param batchUserPowerInfo
+     */
     public void batchDelete(BatchUserPowerInfo batchUserPowerInfo){
         if (batchUserPowerInfo.getType() == 0) {
+            String dashboardsName = userPowerMapper.getDashboardsByIds(batchUserPowerInfo.getDashboardIds());
+            String name = userMapper.getUserGroup(batchUserPowerInfo.getBizId()).getUserGroupName();
             userPowerMapper.deleteByUserGroupId(batchUserPowerInfo.getDashboardIds(),batchUserPowerInfo.getBizId());
+            messageLogService.delete("权限管理", null, BaseContextHolder.getUserName(), "批量删除 " + name + "(用户组) 查看报表 " + dashboardsName + " 的权限");
         }else {
+            String dashboardsName = userPowerMapper.getDashboardsByIds(batchUserPowerInfo.getDashboardIds());
+            String name = userMapper.getUserById(batchUserPowerInfo.getBizId()).getUserName();
             userPowerMapper.deleteByUserId(batchUserPowerInfo.getDashboardIds(), batchUserPowerInfo.getBizId());
+            messageLogService.delete("权限管理", null, BaseContextHolder.getUserName(), "批量删除 " + name + "(用户) 查看报表 " + dashboardsName + " 的权限");
+        }
+    }
+
+    /**
+     * 获取日志内容
+     * @param userPowerInfo
+     * @return
+     */
+    private String getLogContent(UserPowerInfo userPowerInfo, String operation){
+        String dashboardName = dashboardsMapper.getDashboardsWithoutLimit(userPowerInfo.getDashboardId()).getBdName();
+        StringBuilder sb = new StringBuilder();
+        if (userPowerInfo.getType() == 0) {
+            String name = userMapper.getUserGroup(userPowerInfo.getBizId()).getUserGroupName();
+            sb.append(operation + "用户组 " + name + "查看报表 " + dashboardName + "的权限");
+        }else {
+            String name = userMapper.getUserById(userPowerInfo.getBizId()).getUserName();
+            sb.append(operation + "用户 " + name + "查看报表 " + dashboardName + "的权限");
         }
+        return sb.toString();
     }
 
 }

+ 66 - 1
bi-server/src/main/java/com/usoftchina/bi/server/service/user/UserService.java

@@ -9,6 +9,7 @@ import com.usoftchina.bi.core.utils.EncryUtil;
 import com.usoftchina.bi.server.aspect.JwtTokenAspect;
 import com.usoftchina.bi.server.dao.user.UserMapper;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.usoftchina.bi.server.model.po.MessageLog;
 import com.usoftchina.bi.server.model.po.TokenData;
 import com.usoftchina.bi.server.model.po.User;
 import com.usoftchina.bi.server.model.po.UserGroup;
@@ -24,6 +25,7 @@ import org.springframework.util.StringUtils;
 import java.io.IOException;
 import java.util.Iterator;
 import java.util.List;
+import java.util.stream.Collectors;
 
 @Service
 public class UserService {
@@ -68,6 +70,11 @@ public class UserService {
             password = user.getPassWord();
 
             user = findUserFromUAS(userName, pws);
+            if ("离职".equals(user.getState())) {
+                //更新离职状态
+                userMapper.updateUser(user);
+                throw new MyException(RepCode.NoUser);
+            }
             user.setRole(role);
             int userId = userMapper.getUserId(user.getUserName());
             user.setId(userId);
@@ -158,6 +165,10 @@ public class UserService {
     创建用户组
      */
     public RepEntity createUserGroup(UserGroupInfo userGroupInfo){
+        int count = userMapper.getGroupCountByGroupName(userGroupInfo.getUserGroupName());
+        if (count > 0) {
+            throw new MyException(RepCode.USER_GROUP_EXISTS);
+        }
         UserGroup userGroup = new UserGroup();
         BeanUtils.copyProperties(userGroupInfo,userGroup);
         if (userGroup.getUserGroupNote() == null){
@@ -191,7 +202,9 @@ public class UserService {
     public RepEntity delUserGroup(Long id){
         UserGroup userGroup = userMapper.getUserGroup(id.intValue());
         userMapper.delUserGroup(id);
-        messageLogService.delete("用户组", userGroup.getUserGroupName(), BaseContextHolder.getUserName(), "删除用户组");
+        //删除用户组相关的权限
+        userMapper.deletePowerByGroupId(id);
+        messageLogService.delete("用户管理", userGroup.getUserGroupName(), BaseContextHolder.getUserName(), "删除用户组");
         return new RepEntity(RepCode.success);
     }
 
@@ -199,7 +212,9 @@ public class UserService {
     添加用户到用户组
      */
     public RepEntity setUserInto(UserGroupSetInfo userGroupSetInfo){
+        String username = BaseContextHolder.getUserName();
         int userGroupId = userGroupSetInfo.getUserGroupId();
+        String groupName = userMapper.getUserGroup(userGroupId).getUserGroupName();
         List<Integer> userList = userGroupSetInfo.getUserList();
         Iterator isList = userList.iterator();
         while (isList.hasNext()){
@@ -211,6 +226,8 @@ public class UserService {
                 userMapper.setUserInto(userId, userGroupId);
             }
         }
+        //记录LOG
+        userGroupLog(userList, username, groupName, "add");
         return new RepEntity(RepCode.success);
     }
 
@@ -228,11 +245,59 @@ public class UserService {
     public RepEntity delUserInGroup(UserGroupSetInfo userGroupSetInfo){
         List<Integer> list = userGroupSetInfo.getUserList();
         int userGroupId = userGroupSetInfo.getUserGroupId();
+        String username = BaseContextHolder.getUserName();
+        String groupName = userMapper.getUserGroup(userGroupId).getUserGroupName();
         Iterator isList = list.iterator();
         while (isList.hasNext()){
             int userId = (int) isList.next();
             userMapper.delUserInGroup(userId, userGroupId);
         }
+        //记录LOG
+        userGroupLog(list, username, groupName, "delete");
         return new RepEntity(RepCode.success);
     }
+
+    private void userGroupLog(List<Integer> userList, String username, String groupName, String type){
+        //记录LOG
+        List<String> userIdsList = userList.stream().map(x -> x + "").collect(Collectors.toList());
+        String userIds = String.join(",", userIdsList);
+        String userNames = userMapper.getUserByIds(userIds);
+        String[] userNameArray = userNames.split(",");
+        StringBuilder sb = new StringBuilder();
+        MessageLog messageLog = new MessageLog();
+        String content = "", result = "";
+        if (userNameArray.length > 10) {
+            for (int i = 0, len = userNameArray.length; i < len; i = i+10) {
+                for (int j = 0; j < 10; j++) {
+                    sb.append(userNameArray[i+j] + ",");
+                }
+                String names = sb.substring(0, sb.length() - 1);
+                if ("add".equals(type)) {
+                    content = "添加用户:" + names + " 到用户组" + groupName + "中";
+                    result = "添加成功";
+                }else if ("delete".equals(type)){
+                    content = "从用户组" + groupName + "删除用户:" + names;
+                    result = "删除成功";
+                }
+                messageLog = new MessageLog(username, content,result, null, "用户管理", null);
+                messageLogService.customizeLog(messageLog);
+                sb.delete(0, sb.length());
+            }
+
+        }else {
+            for (int i = 0, len = userNameArray.length; i < len; i++) {
+                sb.append(userNameArray[i] + ",");
+            }
+            String names = sb.substring(0, sb.length() - 1);
+            if ("add".equals(type)) {
+                content = "添加用户:" + names + " 到用户组" + groupName + "中";
+                result = "添加成功";
+            }else if ("delete".equals(type)){
+                content = "从用户组" + groupName + "删除用户:" + names;
+                result = "删除成功";
+            }
+            messageLog = new MessageLog(username, content,result, null, "用户管理", null);
+            messageLogService.customizeLog(messageLog);
+        }
+    }
 }

+ 2 - 2
bi-server/src/main/resources/application.properties

@@ -9,8 +9,8 @@ spring.datasource.url=jdbc:oracle:thin:@127.0.0.1:1521:orcl
 spring.datasource.username=UAS_BI
 spring.datasource.password=select!#%*(
 
-spring.jackson.date-format=yyyy-MM-dd
-spring.jackson.time-zone=GMT+8
+#spring.jackson.date-format=yyyy-MM-dd
+#spring.jackson.time-zone=GMT+8
 
 #线上环境
 #spring.datasource.url=jdbc:oracle:thin:@218.18.115.198:1523:orcl

File diff suppressed because it is too large
+ 0 - 0
bi-server/src/main/resources/static/index.47161842.css


File diff suppressed because it is too large
+ 0 - 0
bi-server/src/main/resources/static/index.5ff87b47.js


File diff suppressed because it is too large
+ 0 - 0
bi-server/src/main/resources/static/index.a34fe3fc.js


File diff suppressed because it is too large
+ 0 - 0
bi-server/src/main/resources/static/index.f87723cc.css


+ 2 - 2
bi-server/src/main/resources/static/index.html

@@ -4,8 +4,8 @@
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <title>BI 商业智能平台</title>
-<link rel="shortcut icon" href="favicon.png"><link href="index.f87723cc.css" rel="stylesheet"></head>
+<link rel="shortcut icon" href="favicon.png"><link href="index.47161842.css" rel="stylesheet"></head>
 <body>
   <div id="root"></div>
-<script type="text/javascript" src="index.a34fe3fc.js"></script></body>
+<script type="text/javascript" src="index.5ff87b47.js"></script></body>
 </html>

BIN
bi-server/src/main/resources/static/static/login-bg.492b0933.jpg


BIN
bi-server/src/main/resources/static/static/login-bg.69e45b47.png


BIN
bi-server/src/main/resources/static/static/login-header.cdb7f126.png


Some files were not shown because too many files changed in this diff