|
@@ -7,6 +7,7 @@ import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
import com.ruoyi.common.utils.ShiroUtils;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
import com.ruoyi.system.domain.Dangan;
|
|
|
import com.ruoyi.system.domain.UserRelate;
|
|
@@ -19,8 +20,13 @@ import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileInputStream;
|
|
|
+import java.io.FileNotFoundException;
|
|
|
+import java.io.InputStream;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Properties;
|
|
|
|
|
|
/**
|
|
|
* 子系统用户账号关联Controller
|
|
@@ -90,6 +96,23 @@ public class UserRelateController extends BaseController
|
|
|
return prefix + "/add";
|
|
|
}
|
|
|
|
|
|
+ public InputStream getConfigStream(String configFileName) {
|
|
|
+ InputStream inputStream = null;
|
|
|
+ try {
|
|
|
+ File configFile = new File(configFileName);
|
|
|
+ inputStream = new FileInputStream(configFile);
|
|
|
+ if (inputStream == null) {
|
|
|
+ // 尝试从 JAR 文件类目录加载
|
|
|
+ inputStream = getClass().getClassLoader().getResourceAsStream(configFileName);
|
|
|
+ }
|
|
|
+ } catch (FileNotFoundException e) {
|
|
|
+ // 处理异常,例如打印日志或退出程序
|
|
|
+ try {
|
|
|
+ inputStream = getClass().getClassLoader().getResourceAsStream(configFileName);
|
|
|
+ }catch(Exception ex){}
|
|
|
+ }
|
|
|
+ return inputStream;
|
|
|
+ }
|
|
|
/**
|
|
|
* 新增保存子系统用户账号关联
|
|
|
*/
|
|
@@ -99,6 +122,18 @@ public class UserRelateController extends BaseController
|
|
|
@ResponseBody
|
|
|
public AjaxResult addSave(UserRelate userRelate)
|
|
|
{
|
|
|
+ try {
|
|
|
+ InputStream inputStream = getConfigStream("application.yml");
|
|
|
+ Properties properties = new Properties();
|
|
|
+ properties.load(inputStream);
|
|
|
+ String urlRules = properties.getProperty("user_ralte_url_rules[" + userRelate.getDanganId() + "]");
|
|
|
+ if(!StringUtils.isEmpty(urlRules)){
|
|
|
+ userRelate.setUrlRules(urlRules);
|
|
|
+ }
|
|
|
+ }catch(Exception e){
|
|
|
+ logger.error("addSaveRelate:"+e.getLocalizedMessage());
|
|
|
+ }
|
|
|
+
|
|
|
userRelate.setCreateBy(ShiroUtils.getLoginName());
|
|
|
return toAjax(userRelateService.insertUserRelate(userRelate));
|
|
|
}
|