瀏覽代碼

伊宁项目更改相关 统一app增加登录接口 增加子系统 apply端 URL通配规则

1037015548@qq.com 1 年之前
父節點
當前提交
8cdafe2e58

+ 23 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java

@@ -3,6 +3,7 @@ package com.ruoyi.web.controller.system;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.exception.user.*;
@@ -207,11 +208,33 @@ public class SysLoginController extends BaseController
                         Dangan dangan = danganService.selectDanganById(relate.getDanganId());
                         if (!ObjectUtils.isEmpty(dangan)) {
                             dangan.setDanganLoginName(relate.getDanganLoginName());
+                            dangan.setUrlRules(relate.getUrlRules());
                             danganList.add(dangan);
                         }
                     }
                 }
                 List<Dangan> danganListApp = danganList.stream().filter(r -> r.getApplyType()!=-1).collect(Collectors.toList());
+                //URL版通配规则, 将url组装后后修改了返回给前端
+                for (Dangan danganObj : danganListApp){
+                    if(!StringUtils.isEmpty(danganObj.getUrlRules())) {
+                        //应用类型为H5时处理, app暂不处理
+                        if (danganObj.getApplyType() == 1) {
+                            JSONArray array = JSONArray.parseArray(danganObj.getUrlRules());//规则
+                            String hUrl = danganObj.gethUrl();
+                            int i = 0;
+                            for (Object obj : array) {
+                                JSONObject joItem = JSONObject.parseObject(obj.toString());
+                                if (i == 0) {
+                                    hUrl += "?" + joItem.getString("key") + "=" + joItem.getString("value");
+                                } else {
+                                    hUrl += "&" + joItem.getString("key") + "=" + joItem.getString("value");
+                                }
+                                i++;
+                            }
+                            danganObj.sethUrl(hUrl);
+                        }
+                    }
+                }
                 JSONObject jsonObject = new JSONObject();
                 jsonObject.put("userInfo",user);
                 jsonObject.put("danganList",danganListApp);

+ 6 - 1
ruoyi-admin/src/main/resources/templates/system/userRelate/add.html

@@ -44,7 +44,12 @@
                 </div>
             </div>
 
-
+            <div class="form-group">
+                <label class="col-sm-3 control-label">url通配规则(JSON [{key:"...",value:".."}]):</label>
+                <div class="col-sm-8">
+                    <input id="urlRules" name="urlRules" class="form-control" type="text" />
+                </div>
+            </div>
 
 
         </form>

+ 6 - 0
ruoyi-admin/src/main/resources/templates/system/userRelate/edit.html

@@ -25,6 +25,12 @@
                     <input name="danganLoginName" class="form-control" th:field="*{danganLoginName}"></input>
                 </div>
             </div>
+            <div class="form-group">
+                <label class="col-sm-3 control-label">url通配规则(JSON [{key:"...",value:".."}]):</label>
+                <div class="col-sm-8">
+                    <input id="urlRules" name="urlRules" th:field="*{urlRules}" class="form-control" type="text" />
+                </div>
+            </div>
         </form>
     </div>
     <th:block th:include="include :: footer" />

+ 12 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/Dangan.java

@@ -1,5 +1,6 @@
 package com.ruoyi.system.domain;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
 import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -180,6 +181,17 @@ public class Dangan extends BaseEntity
     //TODO 查询用组装字段, 数据库结构无关
     private String danganLoginName;
 
+    @JsonIgnore
+    private String urlRules;
+
+    public String getUrlRules() {
+        return urlRules;
+    }
+
+    public void setUrlRules(String urlRules) {
+        this.urlRules = urlRules;
+    }
+
     public String getApplyIconColor() {
         return applyIconColor;
     }

+ 10 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/UserRelate.java

@@ -73,10 +73,20 @@ public class UserRelate extends BaseEntity
 
     private Dangan dangan;
 
+    //url通配规则(JSON [{key:"...",value:".."}])
+    private String urlRules;
 
     //TODO mainLhk.html 前端渲染用字段
     private String className;
 
+    public String getUrlRules() {
+        return urlRules;
+    }
+
+    public void setUrlRules(String urlRules) {
+        this.urlRules = urlRules;
+    }
+
     public String getClassName() {
         return className;
     }

+ 6 - 1
ruoyi-system/src/main/resources/mapper/system/UserRelateMapper.xml

@@ -26,6 +26,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="danganUrl"    column="dangan_url"    />
         <result property="danganStatus"    column="dangan_status"    />
 
+        <result property="urlRules"    column="url_rules"    />
+
     </resultMap>
 
     <sql id="selectUserRelateVo">
@@ -36,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
          ur.dangan_id, d.dangan_name, ur.dangan_login_name,
          d.status  as dangan_status  ,
          ur.status,
-         ur.relate_time, ur.create_by, ur.create_time, ur.update_by, ur.update_time, ur.remark
+         ur.relate_time, ur.create_by, ur.create_time, ur.update_by, ur.update_time, ur.remark,ur.url_rules
         from sys_user_relate ur
         left join sys_user u on u.user_id=ur.user_id
         left join sys_dangan d on d.dangan_id = ur.dangan_id
@@ -86,6 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="remark != null">remark,</if>
+            <if test="urlRules != null">url_rules</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="userId != null">#{userId},</if>
@@ -101,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="remark != null">#{remark},</if>
+            <if test="urlRules != null">#{urlRules}</if>
          </trim>
     </insert>
 
@@ -120,6 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
             <if test="remark != null">remark = #{remark},</if>
+            <if test="urlRules != null">url_rules = #{urlRules}</if>
         </trim>
         where relate_id = #{relateId}
     </update>