Browse Source

1.优化上线流程

2.关联表单支持人员多权限
master
liwenxuan 8 months ago
parent
commit
dfc72f9cf1
  1. 17
      src/main/java/com/hxgk/lowcode/model/entity/UserDetail.java
  2. 60
      src/main/java/com/hxgk/lowcode/service/impl/CustomerFormServiceImpl.java
  3. 7
      src/main/java/com/hxgk/lowcode/service/impl/QrCodeServiceImpl.java
  4. 4
      src/main/java/com/hxgk/lowcode/service/impl/UserServiceImpl.java
  5. 4
      src/main/resources/application-dev.yml
  6. 4
      src/main/resources/application-prod.yml

17
src/main/java/com/hxgk/lowcode/model/entity/UserDetail.java

@ -18,7 +18,7 @@ public class UserDetail {
//行政组织 //行政组织
private Long adminorg; private Long adminorg;
//role权限 //role权限
private Integer roleId; private String roleId;
//主部门 //主部门
private Long maindeparment; private Long maindeparment;
@ -67,14 +67,6 @@ public class UserDetail {
return adminorg; return adminorg;
} }
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public void setAdminorg(Long adminorg) { public void setAdminorg(Long adminorg) {
this.adminorg = adminorg; this.adminorg = adminorg;
} }
@ -87,6 +79,13 @@ public class UserDetail {
this.maindeparment = maindeparment; this.maindeparment = maindeparment;
} }
public String getRoleId() {
return roleId;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
@Override @Override
public String toString() { public String toString() {

60
src/main/java/com/hxgk/lowcode/service/impl/CustomerFormServiceImpl.java

@ -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;

7
src/main/java/com/hxgk/lowcode/service/impl/QrCodeServiceImpl.java

@ -10,6 +10,7 @@ import com.hxgk.lowcode.service.UserService;
import com.hxgk.lowcode.utils.QRCodeUtil; import com.hxgk.lowcode.utils.QRCodeUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
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 java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@ -25,6 +26,8 @@ public class QrCodeServiceImpl implements QrCodeService {
FieldRecordMapper fieldRecordMapper; FieldRecordMapper fieldRecordMapper;
@Autowired @Autowired
UserService userService; UserService userService;
@Value("${myProps.qrcodePrefix}")
private String qrcodePrefix;
@Override @Override
public String generateQrCodeByCfid(String cfid) { public String generateQrCodeByCfid(String cfid) {
@ -47,7 +50,7 @@ public class QrCodeServiceImpl implements QrCodeService {
String prefixLocal = "http://localhost:9998/#/form_table/taskListPage?"; String prefixLocal = "http://localhost:9998/#/form_table/taskListPage?";
String prefixout = "https://wab.hxgk.group/#/form_table/taskListPage?"; String prefixout = "https://wab.hxgk.group/#/form_table/taskListPage?";
//上线修改 //上线修改
qrCodeStr = prefixLocal+"id="+c.getCfid()+"&key="+c.getGroupid()+"&formid="+c.getId()+"&formKey="+c.getSignCode()+"&title="+c.getName()+"&state="+c.getStates(); qrCodeStr = qrcodePrefix+"id="+c.getCfid()+"&key="+c.getGroupid()+"&formid="+c.getId()+"&formKey="+c.getSignCode()+"&title="+c.getName()+"&state="+c.getStates();
Map<String,String> appAndGroupNameMap = customerFormViewService.getAppNameAndGroupNameByCfid(cfid); Map<String,String> appAndGroupNameMap = customerFormViewService.getAppNameAndGroupNameByCfid(cfid);
String groupName = appAndGroupNameMap.get("groupName"); String groupName = appAndGroupNameMap.get("groupName");
String appName = appAndGroupNameMap.get("appName"); String appName = appAndGroupNameMap.get("appName");
@ -83,7 +86,7 @@ public class QrCodeServiceImpl implements QrCodeService {
String prefixLocal = "http://localhost:9998/#/form_table/taskListPage?"; String prefixLocal = "http://localhost:9998/#/form_table/taskListPage?";
String prefixout = "https://wab.hxgk.group/#/form_table/taskListPage?"; String prefixout = "https://wab.hxgk.group/#/form_table/taskListPage?";
//上线修改 //上线修改
basicQrCodeStr = prefixLocal+"id="+c.getCfid()+"&key="+c.getGroupid()+"&formid="+c.getId()+"&formKey="+c.getSignCode()+"&title="+c.getName()+"&state="+c.getStates(); basicQrCodeStr = qrcodePrefix+"id="+c.getCfid()+"&key="+c.getGroupid()+"&formid="+c.getId()+"&formKey="+c.getSignCode()+"&title="+c.getName()+"&state="+c.getStates();
//查询要展示在表格中的信息 //查询要展示在表格中的信息
ArrayList<String> qrCodeShowFields = new ArrayList<>(); ArrayList<String> qrCodeShowFields = new ArrayList<>();
Object qrCodePrintStyle = settings.get("qrCodePrintStyle"); Object qrCodePrintStyle = settings.get("qrCodePrintStyle");

4
src/main/java/com/hxgk/lowcode/service/impl/UserServiceImpl.java

@ -82,8 +82,8 @@ public class UserServiceImpl implements UserService {
} }
//role //role
if (StringUtils.isNotEmpty(entry.getKey()) && entry.getKey().equals("role")) { if (StringUtils.isNotEmpty(entry.getKey()) && entry.getKey().equals("role")) {
Integer l = Integer.parseInt(entry.getValue()); //Integer l = Integer.parseInt(entry.getValue());
userDetail.setRoleId(l); userDetail.setRoleId(entry.getValue());
} }
if (StringUtils.isNotEmpty(entry.getKey()) && entry.getKey().equals("adminorg")) { if (StringUtils.isNotEmpty(entry.getKey()) && entry.getKey().equals("adminorg")) {
long adminorg = Long.parseLong(entry.getValue()); long adminorg = Long.parseLong(entry.getValue());

4
src/main/resources/application-dev.yml

@ -86,3 +86,7 @@ redisPool:
host: 127.0.0.1 host: 127.0.0.1
dbs: 5,14,15 dbs: 5,14,15
password: password:
myProps:
qrcodePrefix: http://localhost:9998/#/form_table/taskListPage?
gainTableVersionFieldUrl: http://172.20.2.87:7777/customer_form/gainTableVersionField

4
src/main/resources/application-prod.yml

@ -85,3 +85,7 @@ redisPool:
host: 127.0.0.1 host: 127.0.0.1
dbs: 5,14,15 dbs: 5,14,15
password: password:
myProps:
qrcodePrefix: https://wab.hxgk.group/#/form_table/taskListPage?
gainTableVersionFieldUrl: http://36.133.126.182:39250/customer_form/gainTableVersionField

Loading…
Cancel
Save