Commit 87a150a7 by fudahua

字段限制

parent d0077ff7
package com.gic.cloud.data.hook.api.dto;
import java.io.Serializable;
public class FieldSizeQuery implements Serializable {
private int size;
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
}
package com.gic.cloud.data.hook.web; package com.gic.cloud.data.hook.web;
import com.alibaba.fastjson.JSONObject;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigService;
import com.gic.clerk.api.constant.ThirdProjectEnum; import com.gic.clerk.api.constant.ThirdProjectEnum;
import com.gic.clerk.api.dto.AuthorizedUser; import com.gic.clerk.api.dto.AuthorizedUser;
import com.gic.clerk.api.dto.PowerClerkDTO; import com.gic.clerk.api.dto.PowerClerkDTO;
...@@ -24,6 +27,7 @@ import org.slf4j.LoggerFactory; ...@@ -24,6 +27,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -43,6 +47,8 @@ public class FlatQueryController { ...@@ -43,6 +47,8 @@ public class FlatQueryController {
private static Logger logger= LoggerFactory.getLogger(FlatQueryController.class); private static Logger logger= LoggerFactory.getLogger(FlatQueryController.class);
private static final int FIELD_SIZE=100;
/** 脱敏字段 */ /** 脱敏字段 */
public static final List<String> FILTERS_PHONE_ONLY = Arrays.asList("mobile", "phone", "enterprise_name", "phone_number", "receive_phone_number", "use_phone_number", "friend_phone_num","from_phone_num"); public static final List<String> FILTERS_PHONE_ONLY = Arrays.asList("mobile", "phone", "enterprise_name", "phone_number", "receive_phone_number", "use_phone_number", "friend_phone_num","from_phone_num");
...@@ -207,6 +213,64 @@ public class FlatQueryController { ...@@ -207,6 +213,64 @@ public class FlatQueryController {
return result; return result;
} }
/** 获取自助查询下载量评估
* @param tableId
* @param request
* @param response
* @return
*/
@RequestMapping("/get-query-field-size")
public FieldSizeQuery getQueryFieldSize(String tableId, HttpServletRequest request, HttpServletResponse response) {
FieldSizeQuery result = new FieldSizeQuery();
if (StringUtils.isEmpty(tableId)) {
logger.info("参数缺失tableID");
result.setSize(FIELD_SIZE);
return result;
}
String enterpriseId = SessionContextUtils.getLoginUserEnterpriseId();
int fieldSize = getFieldSize(enterpriseId, tableId);
result.setSize(fieldSize);
return result;
}
private int getFieldSize(String enterpriseId,String tableId) {
Config appConfig = ConfigService.getAppConfig();
String fieldSizeConfig = appConfig.getProperty("field.size", "");
if (StringUtils.isEmpty(fieldSizeConfig)) {
logger.info("没有在apoll配置");
return FIELD_SIZE;
}
JSONObject config = JSONObject.parseObject(fieldSizeConfig);
JSONObject defaultConfig = config.getJSONObject("default");
JSONObject tableConfig = config.getJSONObject(tableId);
if (null == tableConfig && defaultConfig == null) {
return FIELD_SIZE;
}
Integer num=null;
if (tableConfig!=null){
num = tableConfig.getInteger(enterpriseId);
if (num != null) {
return num;
}
num = tableConfig.getInteger("common");
if (num != null) {
return num;
}
}
if (defaultConfig!=null) {
num = defaultConfig.getInteger(enterpriseId);
if (num != null) {
return num;
}
num = defaultConfig.getInteger("common");
if (num != null) {
return num;
}
}
return FIELD_SIZE;
}
/** 生成自助查询下载任务 /** 生成自助查询下载任务
* @param executeRequest * @param executeRequest
* @param request * @param request
......
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