Commit 739cf430 by cjh

数据库字段暴露前端安全需求修改

parent 1f69863f
......@@ -73,7 +73,7 @@ public class NoUiPresentationUtil {
for (Map<String, Object> m : valueList) {
IModule module = moduleList.add();
for (Map.Entry<String, Object> entry : m.entrySet())
handleDatafield(context, (IDatafield<Object>) module.get(entry.getKey()), entry.getValue());
handleDatafield(context, (IDatafield<Object>) module.get(changeForELCS(entry.getKey())), entry.getValue());
}
}
}
......@@ -257,7 +257,7 @@ public class NoUiPresentationUtil {
IModule module = moduleList.get(index);
Collection<IDatafield> datafields = module.getDatafields();
for (IDatafield<Object> datafield : datafields) {
map.put(datafield.getName(), handle(datafield.getValue(), datafield));
map.put(changeForELCS(datafield.getName()), handle(datafield.getValue(), datafield));
}
list.add(map);
}
......@@ -349,4 +349,46 @@ public class NoUiPresentationUtil {
return sysmodBytes;
}
//偏移 头4 尾7
public static String changeForELCS(String str){
String btw_str = str.substring(1,str.length()-1);
String head = change(str.charAt(0),4);
String tail = change(str.charAt(str.length()-1),7);
return head + btw_str + tail;
}
//根据偏移量转换字符
public static String change(char ch,int offset){
int before = ch;
int after;
//a-z
if(ch >=97 && ch <= 122){
if(before+offset <= 122){
after = before+offset;
}else{
after = (before+offset)%122+96;
}
return String.valueOf((char)after);
}
//A-Z
if(ch >=65 && ch <= 90){
if(before+offset <= 90){
after = before+offset;
}else{
after = (before+offset)%90+64;
}
return String.valueOf((char)after);
}
//0-9
if(ch >=48 && ch <= 57){
if(before+offset <= 57){
after = before+offset;
}else{
after = (before+offset)%57+47;
}
return String.valueOf((char)after);
}
return String.valueOf(ch);
}
}
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