【fix sonar】OSSFileController文件

This commit is contained in:
梁琦涛
2023-03-10 15:20:34 +08:00
parent 97603e4e85
commit 0c72e7e254
@@ -8,6 +8,7 @@ import com.jero.common.util.YouBianCodeUtil;
import com.jero.modules.system.entity.SysDepart;
import com.jero.modules.system.service.ISysDepartService;
import io.netty.util.internal.StringUtil;
import org.jetbrains.annotations.Nullable;
import java.util.List;
@@ -34,16 +35,7 @@ public class OrgCodeRule implements IFillRuleHandler {
// 定义旧编码字符串
String oldOrgCode = "";
String parentId = null;
if (formData != null && formData.size() > 0) {
Object obj = formData.get("parentId");
if (obj != null) parentId = obj.toString();
} else {
if (params != null) {
Object obj = params.get("parentId");
if (obj != null) parentId = obj.toString();
}
}
String parentId = getParentId(params, formData);
//如果是最高级,则查询出同级的org_code, 调用工具类生成编码并返回
if (StringUtil.isNullOrEmpty(parentId)) {
@@ -90,4 +82,23 @@ public class OrgCodeRule implements IFillRuleHandler {
strArray[1] = orgType;
return strArray;
}
@Nullable
private String getParentId(JSONObject params, JSONObject formData) {
String parentId = null;
if (formData != null && formData.size() > 0) {
Object obj = formData.get("parentId");
if (obj != null) {
parentId = obj.toString();
}
} else {
if (params != null) {
Object obj = params.get("parentId");
if (obj != null) {
parentId = obj.toString();
}
}
}
return parentId;
}
}