JiangPengLi 2 miesięcy temu
rodzic
commit
11835833ee

+ 16 - 2
projects-service/src/main/java/com/rtrh/projects/modules/projects/mapper/SubInfoMapper.xml

@@ -219,7 +219,14 @@
                 and s.sub_name like CONCAT('%', #{vo.subName}, '%')
             </if>
             <if test="vo.statusRed!=null and vo.statusRed!=''">
-                and s.status_red = #{vo.statusRed}
+                <choose>
+                    <when test='vo.statusRed == "0"'>
+                        and (s.status_red is null or s.status_red = '0')
+                    </when>
+                    <otherwise>
+                        and s.status_red = #{vo.statusRed}
+                    </otherwise>
+                </choose>
             </if>
             <if test="vo.cbStatus!=null and vo.cbStatus!=''">
                 and s.cb_status = #{vo.cbStatus}
@@ -324,7 +331,14 @@
                 and sub_name like CONCAT('%', #{vo.subName}, '%')
             </if>
             <if test="vo.statusRed!=null and vo.statusRed!=''">
-                and s.status_red = #{vo.statusRed}
+                <choose>
+                    <when test='vo.statusRed == "0"'>
+                        and (s.status_red is null or s.status_red = '0')
+                    </when>
+                    <otherwise>
+                        and s.status_red = #{vo.statusRed}
+                    </otherwise>
+                </choose>
             </if>
             <if test="vo.cbStatus!=null and vo.cbStatus!=''">
                 and cb_status = #{vo.cbStatus}

+ 1 - 4
projects-service/src/main/java/com/rtrh/projects/modules/projects/po/SubInfoGxj.java

@@ -183,10 +183,7 @@ public class SubInfoGxj extends TableBaseColomn implements Serializable {
         return amtTotal == null ? BigDecimal.ZERO : amtTotal;
     }
     public String getStatusRed(){
-        if (statusRed == null) {
-            return RedLightEnum.GREEN.getCode();
-        }
-        return RedLightEnum.getNameByCode(statusRed);
+        return statusRed == null ? RedLightEnum.GREEN.getCode() : statusRed;
     }
     public String getStatusRedName() {
         if (statusRed == null || reason == null) {

+ 14 - 1
projects-service/src/main/java/com/rtrh/projects/modules/system/po/SecUser.java

@@ -18,7 +18,7 @@ import javax.persistence.Transient;
 @SuppressWarnings("serial")
 @Data
 public class SecUser implements Serializable {
-
+	private static final long serialVersionUID = 4816882895152246253L;
 	/**
 	 * id,与帐号id相同
 	 */
@@ -119,6 +119,15 @@ public class SecUser implements Serializable {
 	 * 是否能查看所有市区县项目
 	 */
 	private String statusSubject;
+
+
+	/**
+	 * 是否能查看所有行业项目
+	 */
+	private String statusIndustry;
+
+
+
 	/**
 	 * 是否可编辑
 	 */
@@ -152,4 +161,8 @@ public class SecUser implements Serializable {
 	@Transient
 	private String  oldPassword;
 
+	//当前角色代码
+	@Transient
+	private String  roleCode;
+
 }

+ 9 - 1
projects-service/src/main/java/com/rtrh/projects/modules/system/service/impl/PersonInfoServiceImpl.java

@@ -4,10 +4,13 @@ import java.text.MessageFormat;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
+import java.util.ResourceBundle;
 
 import javax.transaction.Transactional;
 
+import com.alibaba.fastjson.JSON;
 import com.rtrh.projects.modules.account.dao.CommUserDao;
+import com.rtrh.projects.util.HttpClientUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -262,7 +265,12 @@ public class PersonInfoServiceImpl implements PersonInfoService {
 
 	@Override
 	public SecUser findPersonInfoById(String id) {
-		return personInfoDao.findById(id);
+		// return personInfoDao.findById(id);
+		ResourceBundle resourceBundle = ResourceBundle.getBundle("config");
+		String inUrl = resourceBundle.getString("app.fgw.in.url");
+		Object o = HttpClientUtil.sendGetRequest(inUrl + "/outApi/remote/findPersonInfoById?id=" + id, null);
+		SecUser secUser = JSON.parseObject(JSON.toJSONString(o), SecUser.class);
+		return secUser;
 	}
 
 	@Override

+ 125 - 0
projects-service/src/main/java/com/rtrh/projects/util/HttpClientUtil.java

@@ -0,0 +1,125 @@
+package com.rtrh.projects.util;
+
+import com.alibaba.fastjson.JSON;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+// import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.rtrh.core.vo.Message;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.util.Map;
+
+@Slf4j
+public class HttpClientUtil {
+
+    /**
+     * 发送 GET 请求
+     *
+     * @param url    请求地址
+     * @param params 请求参数(键值对形式)
+     * @return 响应结果字符串
+     */
+    public static Object sendGetRequest(String url, Map<String, String> params) {
+        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
+            // 拼接参数到 URL
+            StringBuilder sb = new StringBuilder(url);
+            if (params != null && !params.isEmpty()) {
+                sb.append("?");
+                for (Map.Entry<String, String> entry : params.entrySet()) {
+                    sb.append(entry.getKey())
+                            .append("=")
+                            .append(URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.toString()))
+                            .append("&");
+                }
+                sb.deleteCharAt(sb.length() - 1); // 移除最后一个 &
+            }
+
+            // 创建 GET 请求
+            HttpGet request = new HttpGet(sb.toString());
+
+            // 发送请求并获取响应
+            try (CloseableHttpResponse response = httpClient.execute(request)) {
+                HttpEntity entity = response.getEntity();
+                if (entity != null) {
+                    String responseBody = EntityUtils.toString(entity, StandardCharsets.UTF_8);
+                    return JSON.parseObject(responseBody, Message.class).getData();
+                }
+            }catch (Exception e){
+                log.error(e.getMessage());
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+
+    /**
+     * 发送 POST 请求
+     *
+     * @param url       请求地址
+     * @param jsonBody  JSON 格式的请求体
+     * @param headers   请求头(键值对形式)
+     * @return 响应结果字符串
+     */
+    public static Object sendPostRequest(String url, Object jsonBody, Map<String, String> headers) {
+        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
+            // 创建 POST 请求
+            HttpPost request = new HttpPost(url);
+
+            // 设置请求头
+            if (headers != null) {
+                for (Map.Entry<String, String> entry : headers.entrySet()) {
+                    request.addHeader(entry.getKey(), entry.getValue());
+                }
+            }
+
+            ObjectMapper objectMapper = new ObjectMapper();
+            // 注册Java 8日期时间模块
+            // objectMapper.registerModule(new JavaTimeModule());
+            // 禁用时间戳格式,默认改为ISO-8601格式
+            // objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
+            // 自定义日期格式为数据库兼容格式
+            // objectMapper.setDateFormat(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
+            String jsonBodyStr = objectMapper.writeValueAsString(jsonBody);
+
+            // 设置请求体
+            if (!jsonBodyStr.isEmpty()) {
+                StringEntity entity = new StringEntity(jsonBodyStr, StandardCharsets.UTF_8);
+                entity.setContentType("application/json");
+                request.setEntity(entity);
+            }
+
+            // 发送请求并获取响应
+            try (CloseableHttpResponse response = httpClient.execute(request)) {
+                HttpEntity entity = response.getEntity();
+                if (entity != null) {
+                    String responseBody = EntityUtils.toString(entity, StandardCharsets.UTF_8);
+                    if (!responseBody.isEmpty()){
+                        return JSON.parseObject(responseBody, Message.class).getData();
+                    }
+                }
+            }catch (Exception e) {
+                e.printStackTrace();
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    public static Object sendPostRequest(String url, Object jsonBody) {
+        return sendPostRequest(url, jsonBody, null);
+    }
+}

+ 3 - 2
projects/src/main/java/com/team/security/ShiroDbRealm.java

@@ -76,7 +76,7 @@ public class ShiroDbRealm extends AuthorizingRealm implements Serializable {
 
 	private TeamAuthenticationInfo login(UserToken token) {
 
-		CommUser commUser = commUserService.findCommUserByLoginname(token.getUsername());
+		CommUser commUser = commUserService.findCommUserByFgwLoginName(token.getUsername());
 		if(null == commUser){
 			throw new UnknownAccountException(token.getUsername());
 		}
@@ -88,8 +88,9 @@ public class ShiroDbRealm extends AuthorizingRealm implements Serializable {
 			throw new LockedAccountException(token.getUsername());
 		}
 		
+		// SecUser personInfo = personInfoService.findPersonInfoById(commUser.getId());
 		SecUser personInfo = personInfoService.findPersonInfoById(commUser.getId());
-		
+
 		Locale locale = Locale.getDefault();
 		if (RquestInfoHandler.getRquestInfo() != null) {
 			locale = RquestInfoHandler.getRquestInfo().getLocale();

+ 5 - 3
projects/src/main/webapp/vmodules/subject/subInfo/tz/light.jsp

@@ -107,9 +107,11 @@
                 </div>
             </div>
             <div class="layui-form-item" style="margin-top: 30px;">
-                <label class="layui-form-label "></label>
-                <div class="layui-input-block">
-                    <button type="button" class="layui-btn-submit" lay-submit lay-filter="submit">保存</button>
+                <div class="layui-inline">
+                    <label class="layui-form-label" style="width: 100px"></label>
+                    <div class="layui-input-block">
+                        <button type="button" class="layui-btn-submit" lay-submit lay-filter="submit">保存</button>
+                    </div>
                 </div>
             </div>
         </div>