|
|
@ -17,6 +17,7 @@ import com.hxgk.lowcode.utils.HttpUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.http.protocol.HTTP; |
|
|
import org.apache.http.protocol.HTTP; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.apache.logging.log4j.LogManager; |
|
|
import org.apache.logging.log4j.LogManager; |
|
|
import org.apache.logging.log4j.Logger; |
|
|
import org.apache.logging.log4j.Logger; |
|
|
@ -25,6 +26,8 @@ import org.apache.logging.log4j.Logger; |
|
|
import java.io.IOException; |
|
|
import java.io.IOException; |
|
|
import java.lang.reflect.Array; |
|
|
import java.lang.reflect.Array; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
|
|
|
import java.util.regex.Matcher; |
|
|
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
|
@Service |
|
|
@Service |
|
|
public class CustomerFormServiceImpl implements CustomerFormService { |
|
|
public class CustomerFormServiceImpl implements CustomerFormService { |
|
|
@ -51,6 +54,9 @@ public class CustomerFormServiceImpl implements CustomerFormService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private CustomerFormViewService customerFormViewService; |
|
|
private CustomerFormViewService customerFormViewService; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${myProps.gainTableVersionFieldUrl}") |
|
|
|
|
|
private String gainTableVersionFieldUrl; |
|
|
|
|
|
|
|
|
private static final Logger logger = LogManager.getLogger(); |
|
|
private static final Logger logger = LogManager.getLogger(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -152,9 +158,17 @@ public class CustomerFormServiceImpl implements CustomerFormService { |
|
|
}else if(StringUtils.isNotEmpty(c.getPostpermit())){ |
|
|
}else if(StringUtils.isNotEmpty(c.getPostpermit())){ |
|
|
//按照可见角色判断权限
|
|
|
//按照可见角色判断权限
|
|
|
for (int i = 0; i < postpermitArr.length; i++) { |
|
|
for (int i = 0; i < postpermitArr.length; i++) { |
|
|
if(postpermitArr[i].equals(userDetail.getRoleId().toString())){ |
|
|
ArrayList<String> roleIdList = extractNumbers(userDetail.getRoleId()); |
|
|
|
|
|
int roleHitCount = 0; |
|
|
|
|
|
for(String roleId : roleIdList){ |
|
|
|
|
|
if(postpermitArr[i].equals(roleId)){ |
|
|
|
|
|
roleHitCount++; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if(roleHitCount>0){ |
|
|
customerFormList1.add(c); |
|
|
customerFormList1.add(c); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}else if(StringUtils.isNotEmpty(c.getPermit())){ |
|
|
}else if(StringUtils.isNotEmpty(c.getPermit())){ |
|
|
//按照授权范围(org)判断权限
|
|
|
//按照授权范围(org)判断权限
|
|
|
@ -188,7 +202,7 @@ public class CustomerFormServiceImpl implements CustomerFormService { |
|
|
String post = null; |
|
|
String post = null; |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
post = HttpUtils.send(url, param, HTTP.UTF_8, key, token); |
|
|
post = HttpUtils.send(gainTableVersionFieldUrl, param, HTTP.UTF_8, key, token); |
|
|
System.out.println("post:"+post.toString()); |
|
|
System.out.println("post:"+post.toString()); |
|
|
} catch (IOException e) { |
|
|
} catch (IOException e) { |
|
|
e.printStackTrace(); |
|
|
e.printStackTrace(); |
|
|
@ -410,7 +424,17 @@ public class CustomerFormServiceImpl implements CustomerFormService { |
|
|
}else if(StringUtils.isNotEmpty(c.getPostpermit())){ |
|
|
}else if(StringUtils.isNotEmpty(c.getPostpermit())){ |
|
|
//按照可见角色判断权限
|
|
|
//按照可见角色判断权限
|
|
|
for (int i = 0; i < postpermitArr.length; i++) { |
|
|
for (int i = 0; i < postpermitArr.length; i++) { |
|
|
if(postpermitArr[i].equals(userDetail.getRoleId().toString())){ |
|
|
/*if(postpermitArr[i].equals(userDetail.getRoleId().toString())){ |
|
|
|
|
|
customerFormList1.add(c); |
|
|
|
|
|
}*/ |
|
|
|
|
|
ArrayList<String> roleIdList = extractNumbers(userDetail.getRoleId()); |
|
|
|
|
|
int roleHitCount = 0; |
|
|
|
|
|
for(String roleId : roleIdList){ |
|
|
|
|
|
if(postpermitArr[i].equals(roleId)){ |
|
|
|
|
|
roleHitCount++; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if(roleHitCount>0){ |
|
|
customerFormList1.add(c); |
|
|
customerFormList1.add(c); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -527,8 +551,8 @@ public class CustomerFormServiceImpl implements CustomerFormService { |
|
|
String onlyToShowTableId = ""; |
|
|
String onlyToShowTableId = ""; |
|
|
|
|
|
|
|
|
//上线修改
|
|
|
//上线修改
|
|
|
String url = "http://172.20.2.87:7777/customer_form/gainTableVersionField";//本地+内网
|
|
|
//String url = "http://172.20.2.87:7777/customer_form/gainTableVersionField";//本地+内网
|
|
|
//String url = "http://36.133.126.182:39250/customer_form/gainTableVersionField";//外网
|
|
|
String url = "http://36.133.126.182:39250/customer_form/gainTableVersionField";//外网
|
|
|
if(cfid.contains("zibiaoid-")){ |
|
|
if(cfid.contains("zibiaoid-")){ |
|
|
onlyToShowTableId = cfid.split("zibiaoid-")[1]; |
|
|
onlyToShowTableId = cfid.split("zibiaoid-")[1]; |
|
|
cfid = cfid.split(":")[0];//当选择某个主表的子表时,连主表数据一并返回。
|
|
|
cfid = cfid.split(":")[0];//当选择某个主表的子表时,连主表数据一并返回。
|
|
|
@ -543,7 +567,7 @@ public class CustomerFormServiceImpl implements CustomerFormService { |
|
|
System.out.println("userKey:"+userKey); |
|
|
System.out.println("userKey:"+userKey); |
|
|
System.out.println("token:"+token);*/ |
|
|
System.out.println("token:"+token);*/ |
|
|
try { |
|
|
try { |
|
|
post = HttpUtils.send(url, param, HTTP.UTF_8, userKey, token); |
|
|
post = HttpUtils.send(gainTableVersionFieldUrl, param, HTTP.UTF_8, userKey, token); |
|
|
System.out.println("post:"+post.toString()); |
|
|
System.out.println("post:"+post.toString()); |
|
|
} catch (IOException e) { |
|
|
} catch (IOException e) { |
|
|
e.printStackTrace(); |
|
|
e.printStackTrace(); |
|
|
@ -2339,6 +2363,16 @@ public class CustomerFormServiceImpl implements CustomerFormService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
public static ArrayList<String> extractNumbers(String input) { |
|
|
|
|
|
ArrayList<String> numbers = new ArrayList<>(); |
|
|
|
|
|
Pattern pattern = Pattern.compile("\\d+"); // 匹配连续数字
|
|
|
|
|
|
Matcher matcher = pattern.matcher(input); |
|
|
|
|
|
|
|
|
|
|
|
while (matcher.find()) { |
|
|
|
|
|
numbers.add(matcher.group()); // 直接提取数字字符串
|
|
|
|
|
|
} |
|
|
|
|
|
return numbers; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Boolean queryHideRoleCondition(String key, String token, String targetOrgOrPerson, String condition, String currentUser) { |
|
|
public Boolean queryHideRoleCondition(String key, String token, String targetOrgOrPerson, String condition, String currentUser) { |
|
|
@ -2350,7 +2384,19 @@ public class CustomerFormServiceImpl implements CustomerFormService { |
|
|
|
|
|
|
|
|
String[] targetOrgOrPersonArr = targetOrgOrPerson.split(":"); |
|
|
String[] targetOrgOrPersonArr = targetOrgOrPerson.split(":"); |
|
|
String targetRoleId = targetOrgOrPersonArr[2]; |
|
|
String targetRoleId = targetOrgOrPersonArr[2]; |
|
|
if(userDetail.getRoleId().toString().equals(targetRoleId)){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ArrayList<String> roleIdList = extractNumbers(userDetail.getRoleId()); |
|
|
|
|
|
int roleHitCount = 0; |
|
|
|
|
|
for(String roleId : roleIdList){ |
|
|
|
|
|
if(targetRoleId.equals(roleId)){ |
|
|
|
|
|
roleHitCount++; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(roleHitCount>0){ |
|
|
return true; |
|
|
return true; |
|
|
}else{ |
|
|
}else{ |
|
|
return false; |
|
|
return false; |
|
|
|