Commit f3dd3589 by 陶光胜

自助指标解密

parent 6e322c63
package com.gic.cloud.data.hook.service.impl;
import cn.medubi.client.utils.LogPak;
import com.alibaba.fastjson.JSON;
import com.gic.cloud.data.hook.api.dto.*;
import com.gic.cloud.data.hook.api.dto.DataDesensiType;
import com.gic.cloud.data.hook.api.entity.*;
......@@ -45,10 +46,10 @@ public class FreeQueryServiceImpl implements IFreeQueryService {
public static final String SAVE_FOLDER = "/usr/local/data-hook-file";
/** 脱敏字段 */
public static final List<String> FILTERS_PHONE_ONLY = Arrays.asList("mobile", "phone", "enterprise_name");
public static final List<String> FILTERS_PHONE_ONLY = Arrays.asList("mobile", "phone", "enterprise_name", "phone_number");
/** 脱敏字段 */
public static final List<String> FILTERS_PHONE_AND_CARD = Arrays.asList("card_num", "mobile", "phone", "enterprise_name");
public static final List<String> FILTERS_PHONE_AND_CARD = Arrays.asList("card_num", "mobile", "phone", "enterprise_name", "phone_number");
/** 获取指定脱敏类型的过滤字段集合
* @param desensiType
......@@ -63,6 +64,7 @@ public class FreeQueryServiceImpl implements IFreeQueryService {
/** 是否为脱敏字段 */
public static boolean isFilterFields(Integer desensiType, String fieldName) {
List<String> fieldsFilter = getFieldsFilters(desensiType);
log.debug("isFilterFields:", JSON.toJSONString(fieldsFilter) + "-" + desensiType +"-"+ fieldName);
for (String filter : fieldsFilter) {
if (fieldName.contains(filter)) return true;
} // FOR OVER
......
......@@ -6,6 +6,7 @@ import com.gic.cloud.data.hook.api.entity.FlatQueryExecuteRequest;
import com.gic.cloud.data.hook.api.entity.GeneralResult;
import com.gic.cloud.data.hook.api.service.IFlatQueryResultService;
import com.gic.cloud.data.hook.api.service.IFreeQueryService;
import com.gic.enterprise.api.service.EnterpriseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -26,6 +27,8 @@ public class FreeQueryController {
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Autowired
private IFreeQueryService freeQueryService;
@Autowired
private EnterpriseService enterpriseService;
/** 获取所有的自定义查询表信息
* @param request
......@@ -127,7 +130,8 @@ public class FreeQueryController {
*/
@RequestMapping("/get-free-query-result")
public FreeQueryResult getFreeQueryResult(String sql, String enterpriseId, Integer queryDataType, Integer desensiType, HttpServletRequest request, HttpServletResponse response) {
return this.freeQueryService.getFreeQueryResult( "SELECT tmpTable.* FROM (" + sql + ") AS tmpTable LIMIT 1000", enterpriseId, queryDataType, desensiType);
Integer dataPermission = this.enterpriseService.getEnterpriseSettingByEnterpriseId(enterpriseId).getDataPermission();
return this.freeQueryService.getFreeQueryResult( "SELECT tmpTable.* FROM (" + sql + ") AS tmpTable LIMIT 1000", enterpriseId, queryDataType, dataPermission);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment