Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug修改和功能优化 #2420

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void excudeService() {

@Around("excudeService()")
public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
long time1=System.currentTimeMillis();
long time1=System.currentTimeMillis();
Object result = pjp.proceed();
long time2=System.currentTimeMillis();
log.debug("获取JSON数据 耗时:"+(time2-time1)+"ms");
Expand Down Expand Up @@ -103,12 +103,27 @@ private void parseDictText(Object result) {
String table = field.getAnnotation(Dict.class).dictTable();
String key = String.valueOf(item.get(field.getName()));

//翻译字典值对应的txt
String textValue = translateDictValue(code, text, table, key);
//update-begin--Author:zhangkaihang -- Date:20210407 ----for:增加以逗号为分隔符支持一对多字典------
String[] textArry = text.split(",");
for(int index=0;index<textArry.length;index++){
//翻译字典值对应的txt
String textValue = translateDictValue(code, textArry[index], table, key);

log.debug(" 字典Val : "+ textValue);
log.debug(" __翻译字典字段__ "+field.getName() + CommonConstant.DICT_TEXT_SUFFIX+": "+ textValue);
item.put(field.getName() + CommonConstant.DICT_TEXT_SUFFIX, textValue);
log.debug(" 字典Val : "+ textValue);
log.debug(" __翻译字典字段__ "+field.getName() + CommonConstant.DICT_TEXT_SUFFIX+": "+ textValue);
if (index > 0) {
item.put(field.getName() + CommonConstant.DICT_TEXT_SUFFIX + index, textValue);
}else
item.put(field.getName() + CommonConstant.DICT_TEXT_SUFFIX, textValue);
}

// //翻译字典值对应的txt
// String textValue = translateDictValue(code, text, table, key);
//
// log.debug(" 字典Val : "+ textValue);
// log.debug(" __翻译字典字段__ "+field.getName() + CommonConstant.DICT_TEXT_SUFFIX+": "+ textValue);
// item.put(field.getName() + CommonConstant.DICT_TEXT_SUFFIX, textValue);
//update-end--Author:zhangkaihang -- Date:20210407 ----for:增加以逗号为分隔符支持一对多字典------
}
//date类型默认转换string格式化日期
if (field.getType().getName().equals("java.util.Date")&&field.getAnnotation(JsonFormat.class)==null&&item.get(field.getName())!=null){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ public void saveRolePermission(String roleId, String permissionIds, String lastP
} catch (Exception e) {
ip = "127.0.0.1";
}
//update-begin--Author:zhangkaihang -- Date:20210407 ----for:解决ip地址超长无法insert到数据库报错“授权失败”------
String[] ipArray = ip.split(",");
if(ipArray.length>1){
ip = ipArray[0];
}
//update-end--Author:zhangkaihang -- Date:20210407 ----for:解决ip地址超长无法insert到数据库报错“授权失败”------
List<String> add = getDiff(lastPermissionIds,permissionIds);
if(add!=null && add.size()>0) {
List<SysRolePermission> list = new ArrayList<SysRolePermission>();
Expand All @@ -80,15 +86,15 @@ public void saveRolePermission(String roleId, String permissionIds, String lastP
}
this.saveBatch(list);
}

List<String> delete = getDiff(permissionIds,lastPermissionIds);
if(delete!=null && delete.size()>0) {
for (String permissionId : delete) {
this.remove(new QueryWrapper<SysRolePermission>().lambda().eq(SysRolePermission::getRoleId, roleId).eq(SysRolePermission::getPermissionId, permissionId));
}
}
}

/**
* 从diff中找出main中没有的元素
* @param main
Expand All @@ -102,7 +108,7 @@ private List<String> getDiff(String main,String diff){
if(oConvertUtils.isEmpty(main)) {
return Arrays.asList(diff.split(","));
}

String[] mainArr = main.split(",");
String[] diffArr = diff.split(",");
Map<String, Integer> map = new HashMap<>();
Expand Down